From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jon Mason Subject: Re: [PATCH] Fix NAT for domU checksum offload Date: Fri, 14 Oct 2005 18:49:52 -0500 Message-ID: <20051014234951.GE11252@us.ibm.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Ian Pratt Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org I added the patch to the already existing "net-csum.patch", as it seemed to be the right fit. Signed-off-by: Jon Mason # HG changeset patch # User root@pentium4 # Node ID db72430136444d143a9ad0849922621e9ad7c9aa # Parent f9b300fab36e2a7fef2160ca2e6ab0db1f1b3280 Fix NAT for domU checksum offload diff -r f9b300fab36e -r db7243013644 patches/linux-2.6.12/net-csum.patch --- a/patches/linux-2.6.12/net-csum.patch Fri Oct 14 17:27:25 2005 +++ b/patches/linux-2.6.12/net-csum.patch Fri Oct 14 23:42:24 2005 @@ -9,3 +9,48 @@ && csum_tcpudp_magic(iph->saddr, iph->daddr, udplen, IPPROTO_UDP, skb->ip_summed == CHECKSUM_HW ? skb->csum : skb_checksum(skb, iph->ihl*4, udplen, 0))) { + +--- ../xen-unstable.hg/linux-2.6.12-xen0/net/ipv4/netfilter/ip_nat_proto_udp.c 2005-06-17 14:48:29.000000000 -0500 ++++ linux-2.6-xen-sparse/net/ipv4/netfilter/ip_nat_proto_udp.c 2005-10-14 15:17:53.000000000 -0500 +@@ -112,11 +112,19 @@ 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 */ ++ if ((*pskb)->proto_csum_blank) { ++ hdr->check = ip_nat_cheat_check(oldip, ~newip, ++ ip_nat_cheat_check(*portptr ^ 0xFFFF, ++ newport, hdr->check)); ++ } else { ++ hdr->check = ip_nat_cheat_check(~oldip, newip, + ip_nat_cheat_check(*portptr ^ 0xFFFF, + newport, + hdr->check)); ++ } ++ } + *portptr = newport; + return 1; + } +--- ../xen-unstable.hg/linux-2.6.12-xen0/net/ipv4/netfilter/ip_nat_proto_tcp.c 2005-06-17 14:48:29.000000000 -0500 ++++ linux-2.6-xen-sparse/net/ipv4/netfilter/ip_nat_proto_tcp.c 2005-10-14 16:41:20.000000000 -0500 +@@ -127,10 +127,16 @@ tcp_manip_pkt(struct sk_buff **pskb, + if (hdrsize < sizeof(*hdr)) + return 1; + +- hdr->check = ip_nat_cheat_check(~oldip, newip, ++ if ((*pskb)->proto_csum_blank) { ++ hdr->check = ip_nat_cheat_check(oldip, ~newip, ++ ip_nat_cheat_check(oldport ^ 0xFFFF, ++ newport, hdr->check)); ++ } else { ++ hdr->check = ip_nat_cheat_check(~oldip, newip, + ip_nat_cheat_check(oldport ^ 0xFFFF, + newport, + hdr->check)); ++ } + return 1; + } +