summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2011-01-21 21:29:50 +0100
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2011-01-21 21:29:50 +0100
commitc3ad618ce8e52a484d9cea024a4cd5d7cade444f (patch)
tree2fa4aff6943bd15491fe8bdd37885d77a0069eb6
parent133dacf17131daa138f22b7ac38f3b94de203681 (diff)
Fixed broken ICMP and ICMPv6 handling
I mistyped the bitwise operator and the network-order conversion was missing too. Sigh, sendip cannot generate proper packets to check ICMP and ICMPv6 in the testsuite. :-(
-rw-r--r--kernel/ip_set_getport.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/kernel/ip_set_getport.c b/kernel/ip_set_getport.c
index 968c570..76737bb 100644
--- a/kernel/ip_set_getport.c
+++ b/kernel/ip_set_getport.c
@@ -47,25 +47,26 @@ get_port(const struct sk_buff *skb, int protocol, unsigned int protooff,
break;
}
case IPPROTO_ICMP: {
- struct icmphdr _icmph;
+ struct icmphdr _ich;
const struct icmphdr *ic;
- ic = skb_header_pointer(skb, protooff, sizeof(_icmph), &_icmph);
+ ic = skb_header_pointer(skb, protooff, sizeof(_ich), &_ich);
if (ic == NULL)
return false;
- *port = (__force __be16)((ic->type << 8) & ic->code);
+ *port = (__force __be16)htons((ic->type << 8) | ic->code);
break;
}
case IPPROTO_ICMPV6: {
- struct icmp6hdr _icmph;
+ struct icmp6hdr _ich;
const struct icmp6hdr *ic;
- ic = skb_header_pointer(skb, protooff, sizeof(_icmph), &_icmph);
+ ic = skb_header_pointer(skb, protooff, sizeof(_ich), &_ich);
if (ic == NULL)
return false;
- *port = (__force __be16)((ic->icmp6_type << 8) & ic->icmp6_code);
+ *port = (__force __be16)
+ htons((ic->icmp6_type << 8) | ic->icmp6_code);
break;
}
default: