ia64/linux-2.6.18-xen.hg

changeset 9:fac1f3836a60

Imported patch net-csum.patch from xen-unstable.hg 15200:bd3d6b4c52ec
author Ian Campbell <ian.campbell@xensource.com>
date Mon Jun 04 10:05:23 2007 +0100 (2007-06-04)
parents aa96379da741
children 69a9c3af24fc
files net/ipv4/netfilter/ip_nat_proto_tcp.c net/ipv4/netfilter/ip_nat_proto_udp.c net/ipv4/xfrm4_output.c
line diff
     1.1 --- a/net/ipv4/netfilter/ip_nat_proto_tcp.c	Mon Jun 04 10:05:23 2007 +0100
     1.2 +++ b/net/ipv4/netfilter/ip_nat_proto_tcp.c	Mon Jun 04 10:05:23 2007 +0100
     1.3 @@ -129,7 +129,12 @@ tcp_manip_pkt(struct sk_buff **pskb,
     1.4  	if (hdrsize < sizeof(*hdr))
     1.5  		return 1;
     1.6  
     1.7 -	hdr->check = ip_nat_cheat_check(~oldip, newip,
     1.8 +#ifdef CONFIG_XEN
     1.9 +	if ((*pskb)->proto_csum_blank)
    1.10 +		hdr->check = ip_nat_cheat_check(oldip, ~newip, hdr->check);
    1.11 +	else
    1.12 +#endif
    1.13 +		hdr->check = ip_nat_cheat_check(~oldip, newip,
    1.14  					ip_nat_cheat_check(oldport ^ 0xFFFF,
    1.15  							   newport,
    1.16  							   hdr->check));
     2.1 --- a/net/ipv4/netfilter/ip_nat_proto_udp.c	Mon Jun 04 10:05:23 2007 +0100
     2.2 +++ b/net/ipv4/netfilter/ip_nat_proto_udp.c	Mon Jun 04 10:05:23 2007 +0100
     2.3 @@ -113,11 +113,17 @@ udp_manip_pkt(struct sk_buff **pskb,
     2.4  		newport = tuple->dst.u.udp.port;
     2.5  		portptr = &hdr->dest;
     2.6  	}
     2.7 -	if (hdr->check) /* 0 is a special case meaning no checksum */
     2.8 -		hdr->check = ip_nat_cheat_check(~oldip, newip,
     2.9 +	if (hdr->check) { /* 0 is a special case meaning no checksum */
    2.10 +#ifdef CONFIG_XEN
    2.11 +		if ((*pskb)->proto_csum_blank)
    2.12 +			hdr->check = ip_nat_cheat_check(oldip, ~newip, hdr->check);
    2.13 +		else
    2.14 +#endif
    2.15 +			hdr->check = ip_nat_cheat_check(~oldip, newip,
    2.16  					ip_nat_cheat_check(*portptr ^ 0xFFFF,
    2.17  							   newport,
    2.18  							   hdr->check));
    2.19 +	}
    2.20  	*portptr = newport;
    2.21  	return 1;
    2.22  }
     3.1 --- a/net/ipv4/xfrm4_output.c	Mon Jun 04 10:05:23 2007 +0100
     3.2 +++ b/net/ipv4/xfrm4_output.c	Mon Jun 04 10:05:23 2007 +0100
     3.3 @@ -18,6 +18,8 @@
     3.4  #include <net/xfrm.h>
     3.5  #include <net/icmp.h>
     3.6  
     3.7 +extern int skb_checksum_setup(struct sk_buff *skb);
     3.8 +
     3.9  static int xfrm4_tunnel_check_size(struct sk_buff *skb)
    3.10  {
    3.11  	int mtu, ret = 0;
    3.12 @@ -48,6 +50,10 @@ static int xfrm4_output_one(struct sk_bu
    3.13  	struct xfrm_state *x = dst->xfrm;
    3.14  	int err;
    3.15  	
    3.16 +	err = skb_checksum_setup(skb);
    3.17 +	if (err)
    3.18 +		goto error_nolock;
    3.19 +
    3.20  	if (skb->ip_summed == CHECKSUM_HW) {
    3.21  		err = skb_checksum_help(skb, 0);
    3.22  		if (err)