lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Thu, 2 Dec 2021 20:11:58 +0100
From:   Andrew Lunn <andrew@...n.ch>
To:     David Ahern <dsahern@...il.com>
Cc:     David Miller <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
        David Ahern <dsahern@...nel.org>,
        Willem de Bruijn <willemb@...gle.com>,
        James Prestwood <prestwoj@...il.com>,
        Justin Iurman <justin.iurman@...ege.be>,
        Praveen Chaudhary <praveen5582@...il.com>,
        "Jason A . Donenfeld" <Jason@...c4.com>,
        Eric Dumazet <edumazet@...gle.com>,
        netdev <netdev@...r.kernel.org>
Subject: Re: [patch RFC net-next v2 2/3] icmp: ICMPV6: Examine invoking
 packet for Segment Route Headers.

On Thu, Dec 02, 2021 at 09:38:36AM -0700, David Ahern wrote:
> On 12/1/21 1:25 PM, Andrew Lunn wrote:
> > diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
> > index a7c31ab67c5d..dd1fe8a822e3 100644
> > --- a/net/ipv6/icmp.c
> > +++ b/net/ipv6/icmp.c
> > @@ -818,9 +819,40 @@ static void icmpv6_echo_reply(struct sk_buff *skb)
> >  	local_bh_enable();
> >  }
> >  
> > +/* Determine if the invoking packet contains a segment routing header.
> > + * If it does, extract the true destination address, which is in the
> > + * first segment address
> > + */
> > +static void icmpv6_notify_srh(struct sk_buff *skb, struct inet6_skb_parm *opt)
> > +{
> > +	__u16 network_header = skb->network_header;
> > +	struct ipv6_sr_hdr *srh;
> > +
> > +	/* Update network header to point to the invoking packet
> > +	 * inside the ICMP packet, so we can use the seg6_get_srh()
> > +	 * helper.
> > +	 */
> > +	skb_reset_network_header(skb);
> > +
> > +	srh = seg6_get_srh(skb, 0);
> > +	if (!srh)
> > +		goto out;
> > +
> > +	if (srh->type != IPV6_SRCRT_TYPE_4)
> > +		goto out;
> > +
> > +	opt->flags |= IP6SKB_SEG6;
> > +	opt->srhoff = (unsigned char *)srh - skb->data;
> > +
> > +out:
> > +	/* Restore the network header back to the ICMP packet */
> > +	skb->network_header = network_header;
> > +}
> > +
> 
> since this is SR specific, why not put it in seg6.c?

Hi David

I can move it.

I was thinking it is only every going to be called from one location,
so having it here the compiler will inline it.

And it is also very specific to ICMP.  If you are not thinking ICMP,
you might not actually understand what it is doing.

    Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ