Skip to contentSkip to conversation

Patch "ipv6: re-enable fragment header matching in ipv6_find_hdr" has been added to the 4.4-stable tree

PATCH [email protected] 1 participant 1 message Apr 16, 2016

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

ipv6: re-enable fragment header matching in ipv6_find_hdr

to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
ipv6-re-enable-fragment-header-matching-in-ipv6_find_hdr.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From foo@baz Sat Apr 16 10:02:53 PDT 2016

From: Florian Westphal <[email protected]>
Date: Tue, 1 Mar 2016 16:15:16 +0100
Subject: ipv6: re-enable fragment header matching in ipv6_find_hdr

From: Florian Westphal <[email protected]>

[ Upstream commit 5d150a985520bbe3cb2aa1ceef24a7e32f20c15f ]

When ipv6_find_hdr is used to find a fragment header (caller specifies target NEXTHDR_FRAGMENT) we erronously return -ENOENT for all fragments with nonzero offset.

Before commit 9195bb8e381d, when target was specified, we did not enter the exthdr walk loop as nexthdr == target so this used to work.

Now we do (so we can skip empty route headers). When we then stumble upon a frag with nonzero frag_off we must return -ENOENT ("header not found") only if the caller did not specifically request NEXTHDR_FRAGMENT.

This allows nfables exthdr expression to match ipv6 fragments, e.g. via

nft add rule ip6 filter input frag frag-off gt 0

Fixes 9195bb8e381d ("ipv6: improve ipv6_find_hdr() to skip empty routing headers")
---
 net/ipv6/exthdrs_core.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
net/ipv6/exthdrs_core.c +5 -1
@@ -257,7 +257,11 @@ int ipv6_find_hdr(const struct sk_buff *
 						*fragoff = _frag_off;
 					return hp->nexthdr;
 				}
-				return -ENOENT;
+				if (!found)
+					return -ENOENT;
+				if (fragoff)
+					*fragoff = _frag_off;
+				break;
 			}
 			hdrlen = 8;
 		} else if (nexthdr == NEXTHDR_AUTH) {

Patches currently in stable-queue which might be from [email protected] are

queue-4.4/ipv6-re-enable-fragment-header-matching-in-ipv6_find_hdr.patch