Skip to contentSkip to conversation

ipv6: ipv6_find_hdr restore prev functionality

PATCH In review Hans Schillstrom 2 participants 2 messages Feb 27, 2014

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipv6: ipv6_find_hdr restore prev functionality

The commit 9195bb8e381d81d5a315f911904cdf0cfcc919b8 ("ipv6: improve ipv6_find_hdr() to skip empty routing headers") broke ipv6_find_hdr().

When a target is specified like IPPROTO_ICMPV6 ipv6_find_hdr() returns -ENOENT when it's found, not the header as expected.

A part of IPVS is broken and possible also nft_exthdr_eval(). When target is -1 which it is most cases, it works.

This patch exits the do while loop if the specific header is found so the nexthdr could be returned as expected.

---
 net/ipv6/exthdrs_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv6/exthdrs_core.c +1 -1
index 140748d..8af3eb5 100644
@@ -212,7 +212,7 @@ int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset,
 		found = (nexthdr == target);
 
 		if ((!ipv6_ext_hdr(nexthdr)) || nexthdr == NEXTHDR_NONE) {
-			if (target < 0)
+			if (target < 0 || found)
 				break;
 			return -ENOENT;
 		}
Signature · 1 line
1.7.11.7
maintainer
#1 lore raw

From: Hans Schillstrom <[email protected]>
Date: Thu, 27 Feb 2014 12:57:58 +0100

Quoted 9 lines

The commit 9195bb8e381d81d5a315f911904cdf0cfcc919b8 ("ipv6: improve ipv6_find_hdr() to skip empty routing headers") broke ipv6_find_hdr().

When a target is specified like IPPROTO_ICMPV6 ipv6_find_hdr() returns -ENOENT when it's found, not the header as expected.

A part of IPVS is broken and possible also nft_exthdr_eval(). When target is -1 which it is most cases, it works.

Quoted 6 lines

This patch exits the do while loop if the specific header is found so the nexthdr could be returned as expected.

Looks good, applied and queued up for -stable, thanks!