summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2025-09-15 14:40:30 +0200
committerFlorian Westphal <fw@strlen.de>2025-09-15 20:17:42 +0200
commit54dea548d796653534645c6e3c8577eaf7d77411 (patch)
tree50f662e9399bf3472382fb3a2a058bba5ad06966
parent03da98bcd284d55212bc79e91dfb63da0ef7b937 (diff)
examples: genl: fix wrong attribute sizeHEADmaster
This example no longer works on more recent kernels: genl-family-get error: Invalid argument dmesg says: netlink: 'genl-family-get': attribute type 1 has an invalid length. Fix this and also zero out the reserved field in the genl header, while not validated yet for dumps this could change. Reported-by: Divyanshu Rathore <Divyanshu.Rathore@bmwtechworks.in> Signed-off-by: Florian Westphal <fw@strlen.de>
-rw-r--r--examples/genl/genl-family-get.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/examples/genl/genl-family-get.c b/examples/genl/genl-family-get.c
index ba8de12..0c20067 100644
--- a/examples/genl/genl-family-get.c
+++ b/examples/genl/genl-family-get.c
@@ -199,8 +199,9 @@ int main(int argc, char *argv[])
genl = mnl_nlmsg_put_extra_header(nlh, sizeof(struct genlmsghdr));
genl->cmd = CTRL_CMD_GETFAMILY;
genl->version = 1;
+ genl->reserved = 0;
- mnl_attr_put_u32(nlh, CTRL_ATTR_FAMILY_ID, GENL_ID_CTRL);
+ mnl_attr_put_u16(nlh, CTRL_ATTR_FAMILY_ID, GENL_ID_CTRL);
if (argc >= 2)
mnl_attr_put_strz(nlh, CTRL_ATTR_FAMILY_NAME, argv[1]);
else