[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d284a03b-baf8-339f-05bb-c42c3a2fb3f8@gmail.com>
Date: Thu, 2 Dec 2021 09:38:36 -0700
From: David Ahern <dsahern@...il.com>
To: Andrew Lunn <andrew@...n.ch>
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 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?
Powered by blists - more mailing lists