]> xenbits.xensource.com Git - legacy/linux-2.6.18-xen.git/commitdiff
Imported patch net-csum.patch from xen-unstable.hg 15200:bd3d6b4c52ec
authorIan Campbell <ian.campbell@xensource.com>
Mon, 4 Jun 2007 09:05:23 +0000 (10:05 +0100)
committerIan Campbell <ian.campbell@xensource.com>
Mon, 4 Jun 2007 09:05:23 +0000 (10:05 +0100)
net/ipv4/netfilter/ip_nat_proto_tcp.c
net/ipv4/netfilter/ip_nat_proto_udp.c
net/ipv4/xfrm4_output.c

index a3d14079eba6ebe2f835f14c5cf291441f481a8f..35d1d90c968a43b6e15fba1fdff8aa3c856a6f83 100644 (file)
@@ -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));
index ec6053fdc867db4ae033e2e831f8c50a95e3c577..e8eaf6a37f29ea677d2d2650abbee38315a5e7bc 100644 (file)
@@ -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;
 }
index d16f863cf687645198a6299cab9b718c7c25af97..dda359f0d3b535a9c6184f8bafa5c7c24dc6f4d1 100644 (file)
@@ -18,6 +18,8 @@
 #include <net/xfrm.h>
 #include <net/icmp.h>
 
+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)