summaryrefslogtreecommitdiff
blob: f52f99b55345be86c5cec7a7b68ffc58faf22ded (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
Subject: xen3 TCP/UDP checksumming
From: http://xenbits.xensource.com/xen-3.1-testing.hg (tip 15042)
Acked-by: jbeulich@novell.com

This is only a guess, based on suggestions from Keir Fraser.

---
 net/ipv4/netfilter/nf_nat_proto_tcp.c |    3 +++
 net/ipv4/netfilter/nf_nat_proto_udp.c |    4 ++++
 net/ipv4/xfrm4_output.c               |    4 ++++
 3 files changed, 11 insertions(+)

--- a/net/ipv4/netfilter/nf_nat_proto_tcp.c	2007-08-27 12:09:26.000000000 -0400
+++ b/net/ipv4/netfilter/nf_nat_proto_tcp.c	2007-08-27 14:01:24.000000000 -0400
@@ -132,6 +132,9 @@ tcp_manip_pkt(struct sk_buff **pskb,
 	if (hdrsize < sizeof(*hdr))
 		return 1;
 
+	if (skb_checksum_setup(*pskb))
+		return 0;
+
 	nf_proto_csum_replace4(&hdr->check, *pskb, oldip, newip, 1);
 	nf_proto_csum_replace2(&hdr->check, *pskb, oldport, newport, 0);
 	return 1;
--- a/net/ipv4/netfilter/nf_nat_proto_udp.c	2007-08-27 12:09:26.000000000 -0400
+++ b/net/ipv4/netfilter/nf_nat_proto_udp.c	2007-08-27 14:01:24.000000000 -0400
@@ -116,6 +116,10 @@ udp_manip_pkt(struct sk_buff **pskb,
 		newport = tuple->dst.u.udp.port;
 		portptr = &hdr->dest;
 	}
+
+	if (skb_checksum_setup(*pskb))
+		return 0;
+
 	if (hdr->check || (*pskb)->ip_summed == CHECKSUM_PARTIAL) {
 		nf_proto_csum_replace4(&hdr->check, *pskb, oldip, newip, 1);
 		nf_proto_csum_replace2(&hdr->check, *pskb, *portptr, newport,
--- a/net/ipv4/xfrm4_output.c	2007-08-27 12:09:26.000000000 -0400
+++ b/net/ipv4/xfrm4_output.c	2007-08-27 14:01:24.000000000 -0400
@@ -47,6 +47,10 @@ static int xfrm4_output_one(struct sk_bu
 	struct xfrm_state *x = dst->xfrm;
 	int err;
 
+	err = skb_checksum_setup(skb);
+	if (err)
+		goto error_nolock;
+
 	if (skb->ip_summed == CHECKSUM_PARTIAL) {
 		err = skb_checksum_help(skb);
 		if (err)