Commit 5f6de72e authored by Marcel Sebek's avatar Marcel Sebek Committed by David S. Miller

[NETFILTER]: ip6t_LOG and packets with hop-by-hop options.

Packet with IPPROTO_HOPOPTS extended header isn't logged properly by
ip6t_LOG.c. It only prints PROTO=0 and nothing more, because
IPPROTO_HOPOPTS=0 and in this file 0 is used to indicate last header.
This patch fix it by using IPPROTO_NONE to indicate last header.
Signed-off-by: default avatarMarcel Sebek <sebek64@post.cz>
Signed-off-by: default avatarHarald Welte <laforge@netfilter.org>
Signed-off-by: default avatarDavid S. Miller <davem@redhat.com>
parent e1b7f396
...@@ -48,10 +48,10 @@ static spinlock_t log_lock = SPIN_LOCK_UNLOCKED; ...@@ -48,10 +48,10 @@ static spinlock_t log_lock = SPIN_LOCK_UNLOCKED;
/* takes in current header and pointer to the header */ /* takes in current header and pointer to the header */
/* if another header exists, sets hdrptr to the next header /* if another header exists, sets hdrptr to the next header
and returns the new header value, else returns 0 */ and returns the new header value, else returns IPPROTO_NONE */
static u_int8_t ip6_nexthdr(u_int8_t currenthdr, u_int8_t **hdrptr) static u_int8_t ip6_nexthdr(u_int8_t currenthdr, u_int8_t **hdrptr)
{ {
u_int8_t hdrlen, nexthdr = 0; u_int8_t hdrlen, nexthdr = IPPROTO_NONE;
switch(currenthdr){ switch(currenthdr){
case IPPROTO_AH: case IPPROTO_AH:
...@@ -77,7 +77,6 @@ static u_int8_t ip6_nexthdr(u_int8_t currenthdr, u_int8_t **hdrptr) ...@@ -77,7 +77,6 @@ static u_int8_t ip6_nexthdr(u_int8_t currenthdr, u_int8_t **hdrptr)
break; break;
} }
return nexthdr; return nexthdr;
} }
/* One level of recursion won't kill us */ /* One level of recursion won't kill us */
...@@ -101,7 +100,7 @@ static void dump_packet(const struct ip6t_log_info *info, ...@@ -101,7 +100,7 @@ static void dump_packet(const struct ip6t_log_info *info,
fragment = 0; fragment = 0;
hdrptr = (u_int8_t *)(ipv6h + 1); hdrptr = (u_int8_t *)(ipv6h + 1);
while (currenthdr) { while (currenthdr != IPPROTO_NONE) {
if ((currenthdr == IPPROTO_TCP) || if ((currenthdr == IPPROTO_TCP) ||
(currenthdr == IPPROTO_UDP) || (currenthdr == IPPROTO_UDP) ||
(currenthdr == IPPROTO_ICMPV6)) (currenthdr == IPPROTO_ICMPV6))
...@@ -264,7 +263,7 @@ static void dump_packet(const struct ip6t_log_info *info, ...@@ -264,7 +263,7 @@ static void dump_packet(const struct ip6t_log_info *info,
} }
break; break;
} }
/* Max length: 10 "PROTO 255 " */ /* Max length: 10 "PROTO=255 " */
default: default:
printk("PROTO=%u ", currenthdr); printk("PROTO=%u ", currenthdr);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment