Thread (13 messages) 13 messages, 2 authors, 15d ago

Re: [PATCH net-next 2/4] tools: ynl: reject zero-length attributes instead of looping forever

From: Jakub Kicinski <kuba@kernel.org>
Date: 2026-09-11 02:25:10
Also in: lkml

On Tue, 08 Sep 2026 19:45:08 -0400 Taylor Bates wrote:
The BRIDGE_VLANDB_GOPTS_MCAST_ROUTER_PORTS payload the kernel then sends:

  34 00 02 00   MDBA_ROUTER, len 52
  30 00 01 00   MDBA_ROUTER_PORT, len 48
  08 00 00 00   bare ifindex 8, written by nla_put_nohdr()
  08 00 01 00   MDBA_ROUTER_PATTR_TIMER, len 8
  00 00 00 00   timer value, 0 for a permanent router
Sounds like the family outputs garbage and should not be supported.
         while offset < len(msg):
             attr = NlAttr(msg, offset)
+            if attr.full_len < 4:
+                raise YnlException(
+                    f'Malformed attribute at offset {offset}: '
+                    f'length {attr.payload_len} is shorter than the header')
             offset += attr.full_len
             self.attrs.append(attr)
Not sure i follow you logic. If anything I'd have written:

	if len(msg) - offset < 4:
		raise ...short, not overly verbose msg")

? But again, if the kernel is not outputting valid attrs that's not
YNL's problem. 
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help