SIGN IN SIGN UP

fix: zero the genlmsghdr reserved field in Genlmsg

The kernel struct is defined as follows:

	struct genlmsghdr {
                __u8    cmd;
                __u8    version;
                __u16   reserved;
        };

Genlmsg declared only Command and Version (2 bytes), but SizeofGenlmsg
is 4 and Serialize() unsafe-casts the struct to [4]byte. The extra two
bytes contained arbitrary contents read from adjacent memory and emitted
as the genlmsghdr reserved field.

The kernel's genl_header_check() conditionally rejects a non-zero
reserved field with EINVAL ("genlmsghdr.reserved field is not 0") which
surfaced when adding new netdev commands.

Add an explicit Reserved uint16 field so the struct is genuinely 4 bytes
and serializes the reserved word as zero.

Signed-off-by: Aaron Campbell <aaron@monkey.org>
A
Aaron Campbell committed
9c2aece9c6131be48577127c8ea7138eb8a6792e
Parent: 1d39b13
Committed by Alessandro Boch <aboch@cisco.com> on 6/10/2026, 5:57:38 PM