Netdev List
 help / color / mirror / Atom feed
From: David Ahern <dsahern@kernel.org>
To: Yuyang Huang <sigefriedhyy@gmail.com>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH iproute2-next] ipmaddr: use RTM_GETMULTICAST to list multicast addresses
Date: Wed, 15 Jul 2026 09:02:59 -0600	[thread overview]
Message-ID: <01009484-2a68-4b44-b742-bee13bbb08b2@kernel.org> (raw)
In-Reply-To: <20260711030733.48567-1-sigefriedhyy@gmail.com>

On 7/10/26 9:07 PM, Yuyang Huang wrote:
> +static int accept_maddr(struct nlmsghdr *n, void *arg)
> +{
> +	struct maddr_dump_ctx *ctx = arg;
> +	struct ifaddrmsg *ifm = NLMSG_DATA(n);
> +	int len = n->nlmsg_len - NLMSG_LENGTH(sizeof(*ifm));
> +	struct rtattr *tb[IFA_MAX + 1];
> +	struct ma_info *ma;
> +
> +	if (n->nlmsg_type != RTM_GETMULTICAST &&
> +	    n->nlmsg_type != RTM_NEWMULTICAST)
> +		return 0;

From claude (and I agree with the finding)

> +static int accept_maddr(struct nlmsghdr *n, void *arg)
> +{
> ...
> +     if (n->nlmsg_type != RTM_GETMULTICAST &&
> +         n->nlmsg_type != RTM_NEWMULTICAST)
> +             return 0;

The kernel replies to a RTM_GETMULTICAST dump request with
RTM_NEWMULTICAST messages — it never sends RTM_GETMULTICAST in a
response.  Including RTM_GETMULTICAST in the guard is dead code and is
confusing; it inverts the usual convention used everywhere else in
iproute2 (e.g. ipaddress.c always checks RTM_NEW* / RTM_DEL*, never
RTM_GET*).

Should be:

        if (n->nlmsg_type != RTM_NEWMULTICAST)
                return 0;



      reply	other threads:[~2026-07-15 15:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-11  3:07 [PATCH iproute2-next] ipmaddr: use RTM_GETMULTICAST to list multicast addresses Yuyang Huang
2026-07-15 15:02 ` David Ahern [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=01009484-2a68-4b44-b742-bee13bbb08b2@kernel.org \
    --to=dsahern@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sigefriedhyy@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox