From: Ian Campbell Date: Mon, 4 Jun 2007 09:05:23 +0000 (+0100) Subject: Imported patch net-csum.patch from xen-unstable.hg 15200:bd3d6b4c52ec X-Git-Tag: xen-3.2.0~246 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=2c0b888c1f0c4aeb0c21a8c5c04d18b73af64195;p=legacy%2Flinux-2.6.18-xen.git Imported patch net-csum.patch from xen-unstable.hg 15200:bd3d6b4c52ec --- diff --git a/net/ipv4/netfilter/ip_nat_proto_tcp.c b/net/ipv4/netfilter/ip_nat_proto_tcp.c index a3d14079..35d1d90c 100644 --- a/net/ipv4/netfilter/ip_nat_proto_tcp.c +++ b/net/ipv4/netfilter/ip_nat_proto_tcp.c @@ -129,7 +129,12 @@ tcp_manip_pkt(struct sk_buff **pskb, if (hdrsize < sizeof(*hdr)) return 1; - hdr->check = ip_nat_cheat_check(~oldip, newip, +#ifdef CONFIG_XEN + if ((*pskb)->proto_csum_blank) + hdr->check = ip_nat_cheat_check(oldip, ~newip, hdr->check); + else +#endif + hdr->check = ip_nat_cheat_check(~oldip, newip, ip_nat_cheat_check(oldport ^ 0xFFFF, newport, hdr->check)); diff --git a/net/ipv4/netfilter/ip_nat_proto_udp.c b/net/ipv4/netfilter/ip_nat_proto_udp.c index ec6053fd..e8eaf6a3 100644 --- a/net/ipv4/netfilter/ip_nat_proto_udp.c +++ b/net/ipv4/netfilter/ip_nat_proto_udp.c @@ -113,11 +113,17 @@ udp_manip_pkt(struct sk_buff **pskb, newport = tuple->dst.u.udp.port; portptr = &hdr->dest; } - if (hdr->check) /* 0 is a special case meaning no checksum */ - hdr->check = ip_nat_cheat_check(~oldip, newip, + if (hdr->check) { /* 0 is a special case meaning no checksum */ +#ifdef CONFIG_XEN + if ((*pskb)->proto_csum_blank) + hdr->check = ip_nat_cheat_check(oldip, ~newip, hdr->check); + else +#endif + hdr->check = ip_nat_cheat_check(~oldip, newip, ip_nat_cheat_check(*portptr ^ 0xFFFF, newport, hdr->check)); + } *portptr = newport; return 1; } diff --git a/net/ipv4/xfrm4_output.c b/net/ipv4/xfrm4_output.c index d16f863c..dda359f0 100644 --- a/net/ipv4/xfrm4_output.c +++ b/net/ipv4/xfrm4_output.c @@ -18,6 +18,8 @@ #include #include +extern int skb_checksum_setup(struct sk_buff *skb); + static int xfrm4_tunnel_check_size(struct sk_buff *skb) { int mtu, ret = 0; @@ -48,6 +50,10 @@ static int xfrm4_output_one(struct sk_buff *skb) struct xfrm_state *x = dst->xfrm; int err; + err = skb_checksum_setup(skb); + if (err) + goto error_nolock; + if (skb->ip_summed == CHECKSUM_HW) { err = skb_checksum_help(skb, 0); if (err)