netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tom Herbert <tom@herbertland.com>
To: <davem@davemloft.net>, <netdev@vger.kernel.org>
Cc: <kernel-team@fb.com>
Subject: [PATCH v2 next-next 08/12] ipv6: Fix nexthdr for reinjection
Date: Fri, 6 May 2016 13:04:52 -0700	[thread overview]
Message-ID: <1462565096-4076043-9-git-send-email-tom@herbertland.com> (raw)
In-Reply-To: <1462565096-4076043-1-git-send-email-tom@herbertland.com>

In ip6_input_finish the protocol handle returns a value greater than
zero the packet needs to be resubmitted using the returned protocol.
The returned protocol is being ignored and each time through resubmit
nexthdr is taken from an offest in the packet. This patch fixes that
so that nexthdr is taken from return value of the protocol handler.

Signed-off-by: Tom Herbert <tom@herbertland.com>
---
 net/ipv6/ip6_input.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
index 6ed5601..2a0258a 100644
--- a/net/ipv6/ip6_input.c
+++ b/net/ipv6/ip6_input.c
@@ -222,13 +222,14 @@ static int ip6_input_finish(struct net *net, struct sock *sk, struct sk_buff *sk
 	 */
 
 	rcu_read_lock();
-resubmit:
+
 	idev = ip6_dst_idev(skb_dst(skb));
 	if (!pskb_pull(skb, skb_transport_offset(skb)))
 		goto discard;
 	nhoff = IP6CB(skb)->nhoff;
 	nexthdr = skb_network_header(skb)[nhoff];
 
+resubmit:
 	raw = raw6_local_deliver(skb, nexthdr);
 	ipprot = rcu_dereference(inet6_protos[nexthdr]);
 	if (ipprot) {
@@ -256,10 +257,12 @@ resubmit:
 			goto discard;
 
 		ret = ipprot->handler(skb);
-		if (ret > 0)
+		if (ret > 0) {
+			nexthdr = ret;
 			goto resubmit;
-		else if (ret == 0)
+		} else if (ret == 0) {
 			__IP6_INC_STATS(net, idev, IPSTATS_MIB_INDELIVERS);
+		}
 	} else {
 		if (!raw) {
 			if (xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb)) {
-- 
2.8.0.rc2

  parent reply	other threads:[~2016-05-06 20:05 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-06 20:04 [PATCH v2 next-next 00/12] ipv6: Enable GUEoIPv6 and more fixes for v6 tunneling Tom Herbert
2016-05-06 20:04 ` [PATCH v2 next-next 01/12] gso: Remove arbitrary checks for unsupported GSO Tom Herbert
2016-05-06 20:04 ` [PATCH v2 next-next 02/12] net: define gso types for IPx over IPv4 and IPv6 Tom Herbert
2016-05-06 20:34   ` Alexander Duyck
2016-05-06 20:43     ` Tom Herbert
2016-05-06 20:54       ` Alexander Duyck
2016-05-06 20:04 ` [PATCH v2 next-next 03/12] gre6: Fix flag translations Tom Herbert
2016-05-06 20:04 ` [PATCH v2 next-next 04/12] udp: Don't set skb->encapsulation with RCO Tom Herbert
2016-05-06 20:23   ` Alexander Duyck
2016-05-06 20:04 ` [PATCH v2 next-next 05/12] fou: Call setup_udp_tunnel_sock Tom Herbert
2016-05-06 20:04 ` [PATCH v2 next-next 06/12] fou: Split out {fou,gue}_build_header Tom Herbert
2016-05-06 20:04 ` [PATCH v2 next-next 07/12] fou: Add encap ops for IPv6 tunnels Tom Herbert
2016-05-06 20:04 ` Tom Herbert [this message]
2016-05-06 20:04 ` [PATCH v2 next-next 09/12] ipv6: Change "final" protocol processing for encapsulation Tom Herbert
2016-05-06 20:04 ` [PATCH v2 next-next 10/12] fou: Support IPv6 in fou Tom Herbert
2016-05-06 20:04 ` [PATCH v2 next-next 11/12] ip6_tun: Add infrastructure for doing encapsulation Tom Herbert
2016-05-06 20:04 ` [PATCH v2 next-next 12/12] ip6_gre: Add support for fou/gue encapsulation Tom Herbert

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=1462565096-4076043-9-git-send-email-tom@herbertland.com \
    --to=tom@herbertland.com \
    --cc=davem@davemloft.net \
    --cc=kernel-team@fb.com \
    --cc=netdev@vger.kernel.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).