summaryrefslogtreecommitdiffstats
path: root/tools/net
diff options
context:
space:
mode:
authorDonald Hunter <donald.hunter@gmail.com>2024-03-07 00:10:41 +0100
committerJakub Kicinski <kuba@kernel.org>2024-03-08 05:28:22 +0100
commitcecbc52c46e235bd651f7b3ebbf481764846a2d9 (patch)
treed528ac8a9a2c7162c2b597b6a8ec54c637a927c7 /tools/net
parentMerge branch 'isdn-constify-struct-class-usage' (diff)
downloadlinux-cecbc52c46e235bd651f7b3ebbf481764846a2d9.tar.xz
linux-cecbc52c46e235bd651f7b3ebbf481764846a2d9.zip
tools/net/ynl: Fix extack decoding for netlink-raw
Extack decoding was using a hard-coded msg header size of 20 but netlink-raw has a header size of 16. Use a protocol specific msghdr_size() when decoding the attr offssets. Signed-off-by: Donald Hunter <donald.hunter@gmail.com> Link: https://lore.kernel.org/r/20240306231046.97158-2-donald.hunter@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'tools/net')
-rw-r--r--tools/net/ynl/lib/ynl.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/net/ynl/lib/ynl.py b/tools/net/ynl/lib/ynl.py
index 239e22b7a85f..b810a478a304 100644
--- a/tools/net/ynl/lib/ynl.py
+++ b/tools/net/ynl/lib/ynl.py
@@ -353,6 +353,9 @@ class NetlinkProtocol:
raise Exception(f'Multicast group "{mcast_name}" not present in the spec')
return mcast_groups[mcast_name].value
+ def msghdr_size(self):
+ return 16
+
class GenlProtocol(NetlinkProtocol):
def __init__(self, family_name):
@@ -378,6 +381,8 @@ class GenlProtocol(NetlinkProtocol):
raise Exception(f'Multicast group "{mcast_name}" not present in the family')
return self.genl_family['mcast'][mcast_name]
+ def msghdr_size(self):
+ return super().msghdr_size() + 4
class SpaceAttrs:
@@ -721,7 +726,7 @@ class YnlFamily(SpecFamily):
return
msg = self.nlproto.decode(self, NlMsg(request, 0, op.attr_set))
- offset = 20 + self._struct_size(op.fixed_header)
+ offset = self.nlproto.msghdr_size() + self._struct_size(op.fixed_header)
path = self._decode_extack_path(msg.raw_attrs, op.attr_set, offset,
extack['bad-attr-offs'])
if path: