* genl-family-get test fails with "Invalid Argument" on kernel 6.8
@ 2025-09-15 7:34 Divyanshu Rathore
2025-09-15 12:40 ` [PATCH libmnl] examples: genl: fix wrong attribute size Florian Westphal
0 siblings, 1 reply; 3+ messages in thread
From: Divyanshu Rathore @ 2025-09-15 7:34 UTC (permalink / raw)
To: netfilter-devel@vger.kernel.org; +Cc: Sudha Ranganathan
Dear Team,
As part of our system testing for the libmnl component version 1.0.5, we are using the genl-family-get.c test file from the upstream repository:
libmnl/tree/examples/genl/genl-family-get.c
In our test setup, we execute this binary without any arguments. We have observed that the test behaves differently depending on the kernel version:
On systems running kernel 5.15, the binary executes successfully.
On systems running kernel 6.8, it consistently fails with the following error: "Invalid Argument"
We added debug logs and got the below output:
Test failing due to:
AssertionError: Regex didn't match: 'name=' not found in '[DBG] main: program start\n[DBG] main: building request: nlmsg_type=16, nlmsg_flags=0x5, nlmsg_seq=1756046191\n[DBG] main: dumping all families\n[DBG] main: opened netlink socket\n[DBG] main: socket bound, portid=9125\n[DBG] main: sent request to kernel\n[DBG] main: received 48 bytes from kernel\n[DBG] main: mnl_cb_run returned -1\n[DBG] main: program finished'
We ensured that the same libmnl version 1.0.5 is used across all systems, and we verified this issue on multiple hardware platforms. We also added debug prints and verified that the failure occurs in the call to mnl_socket_sendto().
From our investigation, We checked in multiple hardwares and added debug prints, from that it is concluded that, the kernel version upgrade is causing the issue
Can you please check this issue and provide the fix for it.
Let us know if additional details are needed.
Best Regards,
Divyanshu Rathore
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH libmnl] examples: genl: fix wrong attribute size
2025-09-15 7:34 genl-family-get test fails with "Invalid Argument" on kernel 6.8 Divyanshu Rathore
@ 2025-09-15 12:40 ` Florian Westphal
2025-09-15 21:18 ` Pablo Neira Ayuso
0 siblings, 1 reply; 3+ messages in thread
From: Florian Westphal @ 2025-09-15 12:40 UTC (permalink / raw)
To: netfilter-devel; +Cc: Sudha.Ranganathan, Florian Westphal, Divyanshu Rathore
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>
---
I will push this out later today.
examples/genl/genl-family-get.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/examples/genl/genl-family-get.c b/examples/genl/genl-family-get.c
index ba8de122094c..0c2006755e30 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
--
2.51.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH libmnl] examples: genl: fix wrong attribute size
2025-09-15 12:40 ` [PATCH libmnl] examples: genl: fix wrong attribute size Florian Westphal
@ 2025-09-15 21:18 ` Pablo Neira Ayuso
0 siblings, 0 replies; 3+ messages in thread
From: Pablo Neira Ayuso @ 2025-09-15 21:18 UTC (permalink / raw)
To: Florian Westphal; +Cc: netfilter-devel, Sudha.Ranganathan, Divyanshu Rathore
On Mon, Sep 15, 2025 at 02:40:30PM +0200, Florian Westphal wrote:
> 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>
Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
> ---
> I will push this out later today.
>
> examples/genl/genl-family-get.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/examples/genl/genl-family-get.c b/examples/genl/genl-family-get.c
> index ba8de122094c..0c2006755e30 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
> --
> 2.51.0
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-09-15 21:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-15 7:34 genl-family-get test fails with "Invalid Argument" on kernel 6.8 Divyanshu Rathore
2025-09-15 12:40 ` [PATCH libmnl] examples: genl: fix wrong attribute size Florian Westphal
2025-09-15 21:18 ` Pablo Neira Ayuso
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox