Skip to contentSkip to conversation

src: Fix test for IPv6 header

PATCH Applied Duncan Roe 2 participants 3 messages Nov 24, 2019 – Dec 7, 2019 netfilter

lore
Share & tools
lore

Duncan Roe

author
#0 lore raw

PATCH 1/1 src: Fix test for IPv6 header

Updated:

src/extra/ipv6.c: Only test the first 4 bits of the putative IPv6 header to be
6, since all the other bits are up for grabs. (I have seen nonzero Flow Control on the local interface and RFC2474 & RFC3168 document Traffic Class use).

---
 src/extra/ipv6.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/extra/ipv6.c +1 -1
index af307d6..f685b3b 100644
@@ -45,7 +45,7 @@ struct ip6_hdr *nfq_ip6_get_hdr(struct pkt_buff *pktb)
 	ip6h = (struct ip6_hdr *)pktb->network_header;
 
 	/* Not IPv6 packet. */
-	if (ip6h->ip6_flow != 0x60)
+	if ((*(uint8_t *)ip6h & 0xf0) != 0x60)
 		return NULL;
 
 	return ip6h;
Signature · 1 line
2.14.5
author
#1 lore raw

Hi Pablo,

Quoted 26 lines · Duncan Roe

Updated:

src/extra/ipv6.c: Only test the first 4 bits of the putative IPv6 header to be
6, since all the other bits are up for grabs. (I have seen nonzero Flow Control on the local interface and RFC2474 & RFC3168 document Traffic Class use).

---
 src/extra/ipv6.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/extra/ipv6.c +1 -2
index af307d6..f685b3b 100644
@@ -45,7 +45,7 @@ struct ip6_hdr *nfq_ip6_get_hdr(struct pkt_buff *pktb)
 	ip6h = (struct ip6_hdr *)pktb->network_header;
 
 	/* Not IPv6 packet. */
-	if (ip6h->ip6_flow != 0x60)
+	if ((*(uint8_t *)ip6h & 0xf0) != 0x60)
 		return NULL;
 
 	return ip6h;
--
Quoted 2 lines

2.14.5

This patch is uncontroversial surely?

Cheers ... Duncan.