Skip to contentSkip to conversation

netfilter: fix: support ipv6header match on packets ending with NEXTHDR_NONE

PATCH Applied Christoph Paasch 2 participants 2 messages Apr 28, 2009 – May 5, 2009

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

PATCH 1/1 netfilter: fix: support ipv6header match on packets ending with NEXTHDR_NONE

As packets ending with NEXTHDR_NONE don't have a last extension header, the check for the length needs to be after the check for NEXTHDR_NONE.

---
 net/ipv6/netfilter/ip6t_ipv6header.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
net/ipv6/netfilter/ip6t_ipv6header.c +3 -3
index 14e6724..91490ad 100644
@@ -50,14 +50,14 @@ ipv6header_mt6(const struct sk_buff *skb, const struct xt_match_param *par)
 		struct ipv6_opt_hdr _hdr;
 		int hdrlen;
 
-		/* Is there enough space for the next ext header? */
-		if (len < (int)sizeof(struct ipv6_opt_hdr))
-			return false;
 		/* No more exthdr -> evaluate */
 		if (nexthdr == NEXTHDR_NONE) {
 			temp |= MASK_NONE;
 			break;
 		}
+		/* Is there enough space for the next ext header? */
+		if (len < (int)sizeof(struct ipv6_opt_hdr))
+			return false;
 		/* ESP -> evaluate */
 		if (nexthdr == NEXTHDR_ESP) {
 			temp |= MASK_ESP;
Signature · 1 line
1.6.0.4
#1 lore raw
Quoted 2 lines · Christoph Paasch

As packets ending with NEXTHDR_NONE don't have a last extension header, the check for the length needs to be after the check for NEXTHDR_NONE.

Applied, thanks Christoph.