From: David Ahern <dsahern@gmail.com>
To: Suprit Japagal <suprit.japagal@gmail.com>,
davem@davemloft.net, yoshfuji@linux-ipv6.org, dsahern@kernel.org,
David Lebrun <david.lebrun@uclouvain.be>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH] NET: SRv6: seg6_local: Fixed SRH processing when segments left is 0
Date: Sun, 31 Jan 2021 10:33:14 -0700 [thread overview]
Message-ID: <5ac9c562-6bd6-1ab5-3504-b83dc58c15cc@gmail.com> (raw)
In-Reply-To: <20210131130840.32384-1-suprit.japagal@gmail.com>
[ cc David Lebrun, author of the original code ]
On 1/31/21 6:08 AM, Suprit Japagal wrote:
> From: "Suprit.Japagal" <suprit.japagal@gmail.com>
>
> According to the standard IETF RFC 8754, section 4.3.1.1
> (https://tools.ietf.org/html/rfc8754#section-4.3.1.1)
> When the segments left in SRH equals to 0, proceed to process the
> next header in the packet, whose type is identified by the
> Next header field of the routing header.
>
> Signed-off-by: Suprit.Japagal <suprit.japagal@gmail.com>
> ---
> net/ipv6/seg6_local.c | 54 +++++++++++++++++++++++++++++++++++++++++++++------
> 1 file changed, 48 insertions(+), 6 deletions(-)
>
> diff --git a/net/ipv6/seg6_local.c b/net/ipv6/seg6_local.c
> index b07f7c1..b17f9dc 100644
> --- a/net/ipv6/seg6_local.c
> +++ b/net/ipv6/seg6_local.c
> @@ -273,11 +273,25 @@ static int input_action_end(struct sk_buff *skb, struct seg6_local_lwt *slwt)
> {
> struct ipv6_sr_hdr *srh;
>
> - srh = get_and_validate_srh(skb);
> + srh = get_srh(skb);
> if (!srh)
> goto drop;
>
> - advance_nextseg(srh, &ipv6_hdr(skb)->daddr);
> +#ifdef CONFIG_IPV6_SEG6_HMAC
> + if (srh->segments_left > 0)
> + if (!seg6_hmac_validate_skb(skb))
> + goto drop;
> +#endif
> +
> + if (srh->segments_left == 0) {
> + if (!decap_and_validate(skb, srh->nexthdr))
> + goto drop;
> +
> + if (!pskb_may_pull(skb, sizeof(struct ipv6hdr)))
> + goto drop;
> + } else {
> + advance_nextseg(srh, &ipv6_hdr(skb)->daddr);
> + }
>
> seg6_lookup_nexthop(skb, NULL, 0);
>
> @@ -293,11 +307,25 @@ static int input_action_end_x(struct sk_buff *skb, struct seg6_local_lwt *slwt)
> {
> struct ipv6_sr_hdr *srh;
>
> - srh = get_and_validate_srh(skb);
> + srh = get_srh(skb);
> if (!srh)
> goto drop;
>
> - advance_nextseg(srh, &ipv6_hdr(skb)->daddr);
> +#ifdef CONFIG_IPV6_SEG6_HMAC
> + if (srh->segments_left > 0)
> + if (!seg6_hmac_validate_skb(skb))
> + goto drop;
> +#endif
> +
> + if (srh->segments_left == 0) {
> + if (!decap_and_validate(skb, srh->nexthdr))
> + goto drop;
> +
> + if (!pskb_may_pull(skb, sizeof(struct ipv6hdr)))
> + goto drop;
> + } else {
> + advance_nextseg(srh, &ipv6_hdr(skb)->daddr);
> + }
>
> seg6_lookup_nexthop(skb, &slwt->nh6, 0);
>
> @@ -312,11 +340,25 @@ static int input_action_end_t(struct sk_buff *skb, struct seg6_local_lwt *slwt)
> {
> struct ipv6_sr_hdr *srh;
>
> - srh = get_and_validate_srh(skb);
> + srh = get_srh(skb);
> if (!srh)
> goto drop;
>
> - advance_nextseg(srh, &ipv6_hdr(skb)->daddr);
> +#ifdef CONFIG_IPV6_SEG6_HMAC
> + if (srh->segments_left > 0)
> + if (!seg6_hmac_validate_skb(skb))
> + goto drop;
> +#endif
> +
> + if (srh->segments_left == 0) {
> + if (!decap_and_validate(skb, srh->nexthdr))
> + goto drop;
> +
> + if (!pskb_may_pull(skb, sizeof(struct ipv6hdr)))
> + goto drop;
> + } else {
> + advance_nextseg(srh, &ipv6_hdr(skb)->daddr);
> + }
>
> seg6_lookup_nexthop(skb, NULL, slwt->table);
>
>
next parent reply other threads:[~2021-01-31 20:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20210131130840.32384-1-suprit.japagal@gmail.com>
2021-01-31 17:33 ` David Ahern [this message]
2021-02-02 9:52 ` [PATCH] NET: SRv6: seg6_local: Fixed SRH processing when segments left is 0 Ahmed Abdelsalam
[not found] ` <CAGTyo2N5KzFmDgjkqHGZAcO4ZdQ54iKDD6wCYDHemZHFGfP57A@mail.gmail.com>
2021-02-03 8:50 ` Ahmed Abdelsalam
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=5ac9c562-6bd6-1ab5-3504-b83dc58c15cc@gmail.com \
--to=dsahern@gmail.com \
--cc=davem@davemloft.net \
--cc=david.lebrun@uclouvain.be \
--cc=dsahern@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=suprit.japagal@gmail.com \
--cc=yoshfuji@linux-ipv6.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 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).