All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jon Mason <jdmason@us.ibm.com>
To: Ian Pratt <m+Ian.Pratt@cl.cam.ac.uk>
Cc: xen-devel@lists.xensource.com
Subject: Re: [PATCH] Fix NAT for domU checksum offload
Date: Fri, 14 Oct 2005 18:49:52 -0500	[thread overview]
Message-ID: <20051014234951.GE11252@us.ibm.com> (raw)
In-Reply-To: <A95E2296287EAD4EB592B5DEEFCE0E9D32E3C9@liverpoolst.ad.cl.cam.ac.uk>

I added the patch to the already existing "net-csum.patch", as it seemed
to be the right fit.

Signed-off-by: Jon Mason <jdmason@us.ibm.com>

# 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;
+ }
+ 

  parent reply	other threads:[~2005-10-14 23:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-14 23:09 [PATCH] Fix NAT for domU checksum offload Ian Pratt
2005-10-14 23:16 ` Jon Mason
2005-10-14 23:49 ` Jon Mason [this message]
2005-10-15  7:24   ` Keir Fraser
  -- strict thread matches above, loose matches on Subject: below --
2005-10-15  9:31 Ian Pratt
2005-10-14 22:32 Jon Mason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20051014234951.GE11252@us.ibm.com \
    --to=jdmason@us.ibm.com \
    --cc=m+Ian.Pratt@cl.cam.ac.uk \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.