From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Florian Westphal <fw@strlen.de>
Cc: netfilter-devel <netfilter-devel@vger.kernel.org>,
Sudha.Ranganathan@bmwtechworks.in,
Divyanshu Rathore <Divyanshu.Rathore@bmwtechworks.in>
Subject: Re: [PATCH libmnl] examples: genl: fix wrong attribute size
Date: Mon, 15 Sep 2025 23:18:06 +0200 [thread overview]
Message-ID: <aMiCjv-IDEQdCv_P@calendula> (raw)
In-Reply-To: <20250915124049.331477-1-fw@strlen.de>
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
>
>
prev parent reply other threads:[~2025-09-15 21:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aMiCjv-IDEQdCv_P@calendula \
--to=pablo@netfilter.org \
--cc=Divyanshu.Rathore@bmwtechworks.in \
--cc=Sudha.Ranganathan@bmwtechworks.in \
--cc=fw@strlen.de \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.