diff options
author | Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp> | 2006-02-15 18:25:18 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-02-15 18:25:18 -0500 |
commit | 7c6de05884b9fcc7ef621e2ab198ba93d85f46aa (patch) | |
tree | 0ed6f6709aa703691be1292d2cb1a60ab338bdec /net/netfilter | |
parent | 763ecff1879b3877f57f20fc9e79599aef59359f (diff) |
[NETFILTER]: nf_conntrack: Fix TCP/UDP HW checksum handling for IPv6 packet
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>
Diffstat (limited to 'net/netfilter')
-rw-r--r-- | net/netfilter/nf_conntrack_proto_tcp.c | 4 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_proto_udp.c | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c index df99138c3b3..6492ed66fb3 100644 --- a/net/netfilter/nf_conntrack_proto_tcp.c +++ b/net/netfilter/nf_conntrack_proto_tcp.c | |||
@@ -864,7 +864,9 @@ static int csum6(const struct sk_buff *skb, unsigned int dataoff) | |||
864 | { | 864 | { |
865 | return csum_ipv6_magic(&skb->nh.ipv6h->saddr, &skb->nh.ipv6h->daddr, | 865 | return csum_ipv6_magic(&skb->nh.ipv6h->saddr, &skb->nh.ipv6h->daddr, |
866 | skb->len - dataoff, IPPROTO_TCP, | 866 | skb->len - dataoff, IPPROTO_TCP, |
867 | skb->ip_summed == CHECKSUM_HW ? skb->csum | 867 | skb->ip_summed == CHECKSUM_HW |
868 | ? csum_sub(skb->csum, | ||
869 | skb_checksum(skb, 0, dataoff, 0)) | ||
868 | : skb_checksum(skb, dataoff, skb->len - dataoff, | 870 | : skb_checksum(skb, dataoff, skb->len - dataoff, |
869 | 0)); | 871 | 0)); |
870 | } | 872 | } |
diff --git a/net/netfilter/nf_conntrack_proto_udp.c b/net/netfilter/nf_conntrack_proto_udp.c index 4264dd079a1..831d206344e 100644 --- a/net/netfilter/nf_conntrack_proto_udp.c +++ b/net/netfilter/nf_conntrack_proto_udp.c | |||
@@ -161,7 +161,9 @@ static int csum6(const struct sk_buff *skb, unsigned int dataoff) | |||
161 | { | 161 | { |
162 | return csum_ipv6_magic(&skb->nh.ipv6h->saddr, &skb->nh.ipv6h->daddr, | 162 | return csum_ipv6_magic(&skb->nh.ipv6h->saddr, &skb->nh.ipv6h->daddr, |
163 | skb->len - dataoff, IPPROTO_UDP, | 163 | skb->len - dataoff, IPPROTO_UDP, |
164 | skb->ip_summed == CHECKSUM_HW ? skb->csum | 164 | skb->ip_summed == CHECKSUM_HW |
165 | ? csum_sub(skb->csum, | ||
166 | skb_checksum(skb, 0, dataoff, 0)) | ||
165 | : skb_checksum(skb, dataoff, skb->len - dataoff, | 167 | : skb_checksum(skb, dataoff, skb->len - dataoff, |
166 | 0)); | 168 | 0)); |
167 | } | 169 | } |