[NETFILTER]: nf_conntrack: Fix TCP/UDP HW checksum handling for IPv6 packet
authorYasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp>
Wed, 15 Feb 2006 23:25:18 +0000 (15:25 -0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 15 Feb 2006 23:25:18 +0000 (15:25 -0800)
If skb->ip_summed is CHECKSUM_HW here, skb->csum includes checksum
of actual IPv6 header and extension headers. Then such excess
checksum must be subtruct when nf_conntrack calculates TCP/UDP checksum
with pseudo IPv6 header. Spotted by Ben Skeggs.

Signed-off-by: Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/netfilter/nf_conntrack_proto_tcp.c
net/netfilter/nf_conntrack_proto_udp.c

index df99138c3b3b6bfcd1176b7ae3633eb0b7c396cc..6492ed66fb3c6cb033d9db835cc0eac006ce8fa3 100644 (file)
@@ -864,7 +864,9 @@ static int csum6(const struct sk_buff *skb, unsigned int dataoff)
 {
        return csum_ipv6_magic(&skb->nh.ipv6h->saddr, &skb->nh.ipv6h->daddr,
                               skb->len - dataoff, IPPROTO_TCP,
-                              skb->ip_summed == CHECKSUM_HW ? skb->csum
+                              skb->ip_summed == CHECKSUM_HW
+                              ? csum_sub(skb->csum,
+                                         skb_checksum(skb, 0, dataoff, 0))
                               : skb_checksum(skb, dataoff, skb->len - dataoff,
                                              0));
 }
index 4264dd079a16522c6673f279b91c6a8635f54a9e..831d206344e0176bf3987fc9d613cd8913dd4621 100644 (file)
@@ -161,7 +161,9 @@ static int csum6(const struct sk_buff *skb, unsigned int dataoff)
 {
        return csum_ipv6_magic(&skb->nh.ipv6h->saddr, &skb->nh.ipv6h->daddr,
                               skb->len - dataoff, IPPROTO_UDP,
-                              skb->ip_summed == CHECKSUM_HW ? skb->csum
+                              skb->ip_summed == CHECKSUM_HW
+                              ? csum_sub(skb->csum,
+                                         skb_checksum(skb, 0, dataoff, 0))
                               : skb_checksum(skb, dataoff, skb->len - dataoff,
                                              0));
 }