From: Tom Herbert <tom@herbertland.com>
To: <davem@davemloft.net>, <netdev@vger.kernel.org>
Cc: <kernel-team@fb.com>
Subject: [PATCH v7 net-next 03/16] ipv6: Fix nexthdr for reinjection
Date: Wed, 18 May 2016 09:06:11 -0700 [thread overview]
Message-ID: <1463587584-2315623-4-git-send-email-tom@herbertland.com> (raw)
In-Reply-To: <1463587584-2315623-1-git-send-email-tom@herbertland.com>
In ip6_input_finish the nexthdr protocol is retrieved from the
next header offset that is returned in the cb of the skb.
This method does not work for UDP encapsulation that may not
even have a concept of a nexthdr field (e.g. FOU).
This patch checks for a final protocol (INET6_PROTO_FINAL) when a
protocol handler returns > 0. If the protocol is not final then
resubmission is performed on nhoff value. If the protocol is final
then the nexthdr is taken to be the return value.
Signed-off-by: Tom Herbert <tom@herbertland.com>
---
net/ipv6/ip6_input.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
index f185cbc..d35dff2 100644
--- a/net/ipv6/ip6_input.c
+++ b/net/ipv6/ip6_input.c
@@ -236,6 +236,7 @@ resubmit:
nhoff = IP6CB(skb)->nhoff;
nexthdr = skb_network_header(skb)[nhoff];
+resubmit_final:
raw = raw6_local_deliver(skb, nexthdr);
ipprot = rcu_dereference(inet6_protos[nexthdr]);
if (ipprot) {
@@ -263,10 +264,21 @@ resubmit:
goto discard;
ret = ipprot->handler(skb);
- if (ret > 0)
- goto resubmit;
- else if (ret == 0)
+ if (ret > 0) {
+ if (ipprot->flags & INET6_PROTO_FINAL) {
+ /* Not an extension header, most likely UDP
+ * encapsulation. Use return value as nexthdr
+ * protocol not nhoff (which presumably is
+ * not set by handler).
+ */
+ nexthdr = ret;
+ goto resubmit_final;
+ } else {
+ goto resubmit;
+ }
+ } 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
next prev parent reply other threads:[~2016-05-18 16:06 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-18 16:06 [PATCH v7 net-next 00/16] ipv6: Enable GUEoIPv6 and more fixes for v6 tunneling Tom Herbert
2016-05-18 16:06 ` [PATCH v7 net-next 01/16] gso: Remove arbitrary checks for unsupported GSO Tom Herbert
2016-05-21 1:02 ` Hannes Frederic Sowa
2016-05-21 3:56 ` Alexander Duyck
2016-05-22 7:44 ` Michael S. Tsirkin
2016-05-22 12:33 ` Hannes Frederic Sowa
2016-05-22 7:44 ` Michael S. Tsirkin
2016-05-18 16:06 ` [PATCH v7 net-next 02/16] net: define gso types for IPx over IPv4 and IPv6 Tom Herbert
2016-05-18 22:03 ` Jeff Kirsher
2016-05-18 16:06 ` Tom Herbert [this message]
2016-05-18 16:06 ` [PATCH v7 net-next 04/16] ipv6: Change "final" protocol processing for encapsulation Tom Herbert
2016-05-18 16:06 ` [PATCH v7 net-next 05/16] net: Cleanup encap items in ip_tunnels.h Tom Herbert
2016-05-18 16:06 ` [PATCH v7 net-next 06/16] fou: Call setup_udp_tunnel_sock Tom Herbert
2016-05-18 16:06 ` [PATCH v7 net-next 07/16] fou: Split out {fou,gue}_build_header Tom Herbert
2016-05-18 16:06 ` [PATCH v7 net-next 08/16] fou: Support IPv6 in fou Tom Herbert
2016-05-18 16:06 ` [PATCH v7 net-next 09/16] ip6_tun: Add infrastructure for doing encapsulation Tom Herbert
2016-05-18 16:06 ` [PATCH v7 net-next 10/16] fou: Add encap ops for IPv6 tunnels Tom Herbert
2016-05-18 16:06 ` [PATCH v7 net-next 11/16] ip6_gre: Add support for fou/gue encapsulation Tom Herbert
2016-05-18 16:06 ` [PATCH v7 net-next 12/16] ip6_tunnel: " Tom Herbert
2016-05-18 16:06 ` [PATCH v7 net-next 13/16] ipv6: Set features for IPv6 tunnels Tom Herbert
2016-05-18 16:06 ` [PATCH v7 net-next 14/16] ip6ip6: Support for GSO/GRO Tom Herbert
2016-05-18 16:06 ` [PATCH v7 net-next 15/16] ip4ip6: " Tom Herbert
2016-05-18 16:06 ` [PATCH v7 net-next 16/16] ipv6: Don't reset inner headers in ip6_tnl_xmit Tom Herbert
2016-05-18 17:32 ` [PATCH v7 net-next 00/16] ipv6: Enable GUEoIPv6 and more fixes for v6 tunneling Alexander Duyck
2016-05-18 17:40 ` Tom Herbert
2016-05-20 22:03 ` David Miller
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=1463587584-2315623-4-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).