netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@nvidia.com>
To: Willem de Bruijn <willemdebruijn.kernel@gmail.com>, rbonica@juniper.net
Cc: netdev@vger.kernel.org, davem@davemloft.net, kuba@kernel.org,
	pabeni@redhat.com, edumazet@google.com, horms@kernel.org,
	dsahern@kernel.org, petrm@nvidia.com, willemb@google.com,
	daniel@iogearbox.net, fw@strlen.de, ishaangandhi@gmail.com,
	tom@herbertland.com
Subject: Re: [PATCH net-next 1/3] ipv4: icmp: Add RFC 5837 support
Date: Thu, 23 Oct 2025 11:35:57 +0300	[thread overview]
Message-ID: <aPno7Zt2Fu1DapvM@shredder> (raw)
In-Reply-To: <willemdebruijn.kernel.2e842c8c31670@gmail.com>

On Wed, Oct 22, 2025 at 06:00:28PM -0400, Willem de Bruijn wrote:
> Ido Schimmel wrote:
> > +static __be32 icmp_ext_iio_addr4_find(const struct net_device *dev)
> > +{
> > +	struct in_device *in_dev;
> > +	struct in_ifaddr *ifa;
> > +
> > +	in_dev = __in_dev_get_rcu(dev);
> > +	if (!in_dev)
> > +		return 0;
> > +
> > +	/* It is unclear from RFC 5837 which IP address should be chosen, but
> > +	 * it makes sense to choose a global unicast address.
> 
> Is it possible for no such address to exist, and in that case should
> one of the backup options be considered?

It is possible for no such address to exist, but I believe this
extension is mainly going to be used in unnumbered networks where router
interfaces do not have IPv4 addresses assigned to them. At least that is
the use case I'm interested in supporting. So, while we can try to fall
back to backup options, I think that in the common case they are not
going to exist.

Ron, do you have any opinion on this? I read RFC 5837 again and could
not find any hints about which IP address to choose. I suspect because
the IP address is the least interesting sub-object.

> 
> > +	 */
> > +	in_dev_for_each_ifa_rcu(ifa, in_dev) {
> > +		if (READ_ONCE(ifa->ifa_flags) & IFA_F_SECONDARY)
> > +			continue;
> > +		if (ifa->ifa_scope != RT_SCOPE_UNIVERSE ||
> > +		    ipv4_is_multicast(ifa->ifa_address))
> > +			continue;
> > +		return ifa->ifa_address;
> > +	}
> > +
> > +	return 0;
> > +}
> > +
> > +static void icmp_ext_iio_iif_append(struct net *net, struct sk_buff *skb,
> > +				    int iif)
> > +{
> > +	struct icmp_ext_iio_name_subobj *name_subobj;
> > +	struct icmp_extobj_hdr *objh;
> > +	struct net_device *dev;
> > +	__be32 data;
> > +
> > +	if (!iif)
> > +		return;
> > +
> 
> Might be good to add a comment that field order is prescribed by the RFC.

Good idea. Will add. Looking at the traceroute code, I expect the
selftest to fail if someone changes this order, but it's good to be
explicit about it.

  reply	other threads:[~2025-10-23  8:36 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-22  6:53 [PATCH net-next 0/3] icmp: Add RFC 5837 support Ido Schimmel
2025-10-22  6:53 ` [PATCH net-next 1/3] ipv4: " Ido Schimmel
2025-10-22 22:00   ` Willem de Bruijn
2025-10-23  8:35     ` Ido Schimmel [this message]
2025-10-22  6:53 ` [PATCH net-next 2/3] ipv6: " Ido Schimmel
2025-10-22  6:53 ` [PATCH net-next 3/3] selftests: traceroute: Add ICMP extensions tests Ido Schimmel
2025-10-22 22:12   ` Willem de Bruijn
2025-10-23  9:09     ` Ido Schimmel
2025-10-23 15:39     ` Ido Schimmel
2025-10-23 21:25       ` Willem de Bruijn
2025-10-22 13:26 ` [PATCH net-next 0/3] icmp: Add RFC 5837 support Jakub Kicinski
2025-10-22 13:58   ` Ido Schimmel
2025-10-22 15:10     ` Jakub Kicinski
2025-10-22 15:35       ` Ido Schimmel
2025-10-23  0:38         ` Jakub Kicinski
2025-10-24  1:48           ` Jakub Kicinski
2025-10-24 14:50             ` Ido Schimmel
2025-10-24 15:04               ` Jakub Kicinski
2025-10-22 17:29 ` David Ahern
2025-10-23 11:19   ` Ido Schimmel
2025-10-23 13:39   ` Willem de Bruijn

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=aPno7Zt2Fu1DapvM@shredder \
    --to=idosch@nvidia.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=fw@strlen.de \
    --cc=horms@kernel.org \
    --cc=ishaangandhi@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=petrm@nvidia.com \
    --cc=rbonica@juniper.net \
    --cc=tom@herbertland.com \
    --cc=willemb@google.com \
    --cc=willemdebruijn.kernel@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;
as well as URLs for NNTP newsgroup(s).