Skip to content

Commit

Permalink
ipv6: ipv6_find_hdr restore prev functionality
Browse files Browse the repository at this point in the history
The commit 9195bb8 ("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.

Reported-by: Art -kwaak- van Breemen <ard@telegraafnet.nl>
Signed-off-by: Hans Schillstrom <hans@schillstrom.com>
CC:Ansis Atteka <aatteka@nicira.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Hans Schillstrom authored and David S. Miller committed Feb 27, 2014
1 parent feff9ab commit accfe0e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/ipv6/exthdrs_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit accfe0e

Please sign in to comment.