jbaublitz / neli

Rust type safe netlink library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RtBuffer encoded with invalid length

kloenk opened this issue · comments

Version of neli
v0.6 & main

Does the documentation specify that neil's behavior is correct?
no, the kernel errors out with netlink: 'linux::netlink:': attribute type 29 has an invalid length. and Wireshark with <MISSING>

Does there appear to be a mistake in the netlink documentation based on the kernel code?
No

Describe the bug
RtAttributes are encoded with invalid length. Having one attribute with type u32 reports length of 4, which is only the attribute header and the length. Correct value would be 8

To Reproduce
Steps to reproduce the behavior:

  1. Request Getlink with Ifla::ExtMask
  2. See dmesg

Expected behavior
Kernel should be able to parse the length.

Setting the initial length to 4 Fixes the problem. This makes me think, that length of the header is forgotten to be computed at creation time.

Given that Rtattr::set_payload increments the rta_len I don't see any gain, only the possibility of errors in making the length an option accessible to the user as input to the new function.