From 254fc3e3aec5a7768fac60acaf82732297a28dbf Mon Sep 17 00:00:00 2001 From: Victorien Date: Thu, 5 Jul 2018 11:18:09 +0200 Subject: [PATCH] Fixed header type when there are multiple array to encode TCA_EMATCH_TREE_LIST is using type as an index value for nested elements. Since we can not override this value from upper classes, I increment the type value without warranty it would work for other classes that use this code. --- pyroute2/netlink/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pyroute2/netlink/__init__.py b/pyroute2/netlink/__init__.py index 5f9d3d82c..c7ec2869c 100644 --- a/pyroute2/netlink/__init__.py +++ b/pyroute2/netlink/__init__.py @@ -1007,12 +1007,15 @@ def encode(self): # handle the array case if self._nla_array: + header_type = 1 for value in self.getvalue(): cell = type(self)(data=self.data, offset=offset, parent=self) cell._nla_array = False - cell['header']['type'] = 1 + cell['header']['type'] = header_type + header_type += 1 + if cell.cell_header is not None: cell.header = cell.cell_header cell.setvalue(value)