direct-io.hg

changeset 7384:26862e5458eb

Fix NAT for domU checksum offload.

Signed-off-by: Jon Mason <jdmason@us.ibm.com>
author kaf24@firebug.cl.cam.ac.uk
date Sat Oct 15 08:33:19 2005 +0100 (2005-10-15)
parents 5487b11faafa
children 27d7c7f226f4
files patches/linux-2.6.12/net-csum.patch
line diff
     1.1 --- a/patches/linux-2.6.12/net-csum.patch	Sat Oct 15 07:43:08 2005 +0100
     1.2 +++ b/patches/linux-2.6.12/net-csum.patch	Sat Oct 15 08:33:19 2005 +0100
     1.3 @@ -9,3 +9,48 @@ diff -ur linux-2.6.11/net/ipv4/netfilter
     1.4   	    && csum_tcpudp_magic(iph->saddr, iph->daddr, udplen, IPPROTO_UDP,
     1.5   			         skb->ip_summed == CHECKSUM_HW ? skb->csum
     1.6   			      	 : skb_checksum(skb, iph->ihl*4, udplen, 0))) {
     1.7 +
     1.8 +--- ../xen-unstable.hg/linux-2.6.12-xen0/net/ipv4/netfilter/ip_nat_proto_udp.c	2005-06-17 14:48:29.000000000 -0500
     1.9 ++++ linux-2.6-xen-sparse/net/ipv4/netfilter/ip_nat_proto_udp.c	2005-10-14 15:17:53.000000000 -0500
    1.10 +@@ -112,11 +112,19 @@ udp_manip_pkt(struct sk_buff **pskb,
    1.11 + 		newport = tuple->dst.u.udp.port;
    1.12 + 		portptr = &hdr->dest;
    1.13 + 	}
    1.14 +-	if (hdr->check) /* 0 is a special case meaning no checksum */
    1.15 +-		hdr->check = ip_nat_cheat_check(~oldip, newip,
    1.16 ++	
    1.17 ++	if (hdr->check) { /* 0 is a special case meaning no checksum */
    1.18 ++		if ((*pskb)->proto_csum_blank) {
    1.19 ++			hdr->check = ip_nat_cheat_check(oldip, ~newip, 
    1.20 ++					ip_nat_cheat_check(*portptr ^ 0xFFFF, 
    1.21 ++						newport, hdr->check));
    1.22 ++		} else {
    1.23 ++			hdr->check = ip_nat_cheat_check(~oldip, newip,
    1.24 + 					ip_nat_cheat_check(*portptr ^ 0xFFFF,
    1.25 + 							   newport,
    1.26 + 							   hdr->check));
    1.27 ++		}
    1.28 ++	}
    1.29 + 	*portptr = newport;
    1.30 + 	return 1;
    1.31 + }
    1.32 +--- ../xen-unstable.hg/linux-2.6.12-xen0/net/ipv4/netfilter/ip_nat_proto_tcp.c	2005-06-17 14:48:29.000000000 -0500
    1.33 ++++ linux-2.6-xen-sparse/net/ipv4/netfilter/ip_nat_proto_tcp.c	2005-10-14 16:41:20.000000000 -0500
    1.34 +@@ -127,10 +127,16 @@ tcp_manip_pkt(struct sk_buff **pskb,
    1.35 + 	if (hdrsize < sizeof(*hdr))
    1.36 + 		return 1;
    1.37 + 
    1.38 +-	hdr->check = ip_nat_cheat_check(~oldip, newip,
    1.39 ++	if ((*pskb)->proto_csum_blank) {
    1.40 ++		hdr->check = ip_nat_cheat_check(oldip, ~newip,
    1.41 ++				ip_nat_cheat_check(oldport ^ 0xFFFF,
    1.42 ++					newport, hdr->check));
    1.43 ++	} else { 
    1.44 ++		hdr->check = ip_nat_cheat_check(~oldip, newip,
    1.45 + 					ip_nat_cheat_check(oldport ^ 0xFFFF,
    1.46 + 							   newport,
    1.47 + 							   hdr->check));
    1.48 ++	}
    1.49 + 	return 1;
    1.50 + }
    1.51 +