Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 152098 Details for
Bug 223258
Xen guest name resolution fails
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Fix Xen checksum with 2.6.19 and beyond
p (text/plain), 26.98 KB, created by
Herbert Xu
on 2007-04-10 05:45:01 UTC
(
hide
)
Description:
Fix Xen checksum with 2.6.19 and beyond
Filename:
MIME Type:
Creator:
Herbert Xu
Created:
2007-04-10 05:45:01 UTC
Size:
26.98 KB
patch
obsolete
>diff -ur linux-2.6.20.noarch/drivers/xen/core/skbuff.c linux-2.6.20.i686/drivers/xen/core/skbuff.c >--- linux-2.6.20.noarch/drivers/xen/core/skbuff.c 2007-04-03 15:26:15.000000000 +1000 >+++ linux-2.6.20.i686/drivers/xen/core/skbuff.c 2007-04-03 22:23:05.000000000 +1000 >@@ -9,6 +9,10 @@ > #include <linux/etherdevice.h> > #include <linux/skbuff.h> > #include <linux/init.h> >+#include <linux/if_ether.h> >+#include <linux/tcp.h> >+#include <linux/udp.h> >+#include <net/ip.h> > #include <asm/io.h> > #include <asm/page.h> > #include <asm/hypervisor.h> >@@ -78,6 +82,38 @@ > return skb; > } > >+int skb_checksum_setup(struct sk_buff *skb) >+{ >+ if (skb->protocol != htons(ETH_P_IP)) >+ goto out; >+ skb->h.raw = (unsigned char *)skb->nh.iph + 4*skb->nh.iph->ihl; >+ skb->csum_start = skb->h.raw - skb->head; >+ if (skb->h.raw >= skb->tail) >+ goto out; >+ switch (skb->nh.iph->protocol) { >+ case IPPROTO_TCP: >+ skb->csum_offset = offsetof(struct tcphdr, check); >+ break; >+ case IPPROTO_UDP: >+ skb->csum_offset = offsetof(struct udphdr, check); >+ break; >+ default: >+ if (net_ratelimit()) >+ printk(KERN_ERR "Attempting to checksum a non-" >+ "TCP/UDP packet, dropping a protocol" >+ " %d packet", skb->nh.iph->protocol); >+ goto out; >+ } >+ if ((skb->h.raw + skb->csum_offset + 2) > skb->tail) >+ goto out; >+ skb->ip_summed = CHECKSUM_PARTIAL; >+ >+ return 0; >+out: >+ return -EPROTO; >+} >+EXPORT_SYMBOL(skb_checksum_setup); >+ > static void skbuff_ctor(void *buf, struct kmem_cache *cachep, unsigned long unused) > { > int order = 0; >diff -ur linux-2.6.20.noarch/drivers/xen/netback/loopback.c linux-2.6.20.i686/drivers/xen/netback/loopback.c >--- linux-2.6.20.noarch/drivers/xen/netback/loopback.c 2007-04-03 15:26:15.000000000 +1000 >+++ linux-2.6.20.i686/drivers/xen/netback/loopback.c 2007-03-30 21:01:02.000000000 +1000 >@@ -149,16 +149,6 @@ > np->stats.rx_bytes += skb->len; > np->stats.rx_packets++; > >- if (skb->ip_summed == CHECKSUM_PARTIAL) { >- /* Defer checksum calculation. */ >- skb->proto_csum_blank = 1; >- /* Must be a local packet: assert its integrity. */ >- skb->proto_data_valid = 1; >- } >- >- skb->ip_summed = skb->proto_data_valid ? >- CHECKSUM_UNNECESSARY : CHECKSUM_NONE; >- > skb->pkt_type = PACKET_HOST; /* overridden by eth_type_trans() */ > skb->protocol = eth_type_trans(skb, dev); > skb->dev = dev; >diff -ur linux-2.6.20.noarch/drivers/xen/netback/netback.c linux-2.6.20.i686/drivers/xen/netback/netback.c >--- linux-2.6.20.noarch/drivers/xen/netback/netback.c 2007-04-03 15:26:15.000000000 +1000 >+++ linux-2.6.20.i686/drivers/xen/netback/netback.c 2007-03-31 21:07:48.000000000 +1000 >@@ -293,7 +293,6 @@ > /* Copy only the header fields we use in this driver. */ > nskb->dev = skb->dev; > nskb->ip_summed = skb->ip_summed; >- nskb->proto_data_valid = skb->proto_data_valid; > dev_kfree_skb(skb); > skb = nskb; > } >@@ -666,9 +665,11 @@ > id = meta[npo.meta_cons].id; > flags = nr_frags ? NETRXF_more_data : 0; > >- if (skb->ip_summed == CHECKSUM_PARTIAL) /* local packet? */ >+ if (skb->ip_summed == CHECKSUM_PARTIAL) >+ /* local packet? */ > flags |= NETRXF_csum_blank | NETRXF_data_validated; >- else if (skb->proto_data_valid) /* remote but checksummed? */ >+ else if (skb->ip_summed == CHECKSUM_UNNECESSARY) >+ /* remote but checksummed? */ > flags |= NETRXF_data_validated; > > if (meta[npo.meta_cons].copy) >@@ -1303,23 +1304,19 @@ > netif_idx_release(pending_idx); > } > >- /* >- * Old frontends do not assert data_validated but we >- * can infer it from csum_blank so test both flags. >- */ >- if (txp->flags & (NETTXF_data_validated|NETTXF_csum_blank)) { >- skb->ip_summed = CHECKSUM_UNNECESSARY; >- skb->proto_data_valid = 1; >- } else { >- skb->ip_summed = CHECKSUM_NONE; >- skb->proto_data_valid = 0; >- } >- skb->proto_csum_blank = !!(txp->flags & NETTXF_csum_blank); >- > netbk_fill_frags(skb); > > skb->dev = netif->dev; > skb->protocol = eth_type_trans(skb, skb->dev); >+ skb->nh.raw = skb->data; >+ >+ if (txp->flags & NETTXF_csum_blank) { >+ if (skb_checksum_setup(skb)) { >+ kfree_skb(skb); >+ continue; >+ } >+ } else if (txp->flags & NETTXF_data_validated) >+ skb->ip_summed = CHECKSUM_UNNECESSARY; > > netif->stats.rx_bytes += skb->len; > netif->stats.rx_packets++; >diff -ur linux-2.6.20.noarch/drivers/xen/netfront/netfront.c linux-2.6.20.i686/drivers/xen/netfront/netfront.c >--- linux-2.6.20.noarch/drivers/xen/netfront/netfront.c 2007-04-03 15:26:15.000000000 +1000 >+++ linux-2.6.20.i686/drivers/xen/netfront/netfront.c 2007-03-31 21:07:43.000000000 +1000 >@@ -925,12 +925,12 @@ > tx->flags = 0; > extra = NULL; > >- if (skb->ip_summed == CHECKSUM_PARTIAL) /* local packet? */ >+ if (skb->ip_summed == CHECKSUM_PARTIAL) >+ /* local packet? */ > tx->flags |= NETTXF_csum_blank | NETTXF_data_validated; >-#ifdef CONFIG_XEN >- if (skb->proto_data_valid) /* remote but checksummed? */ >+ else if (skb->ip_summed == CHECKSUM_UNNECESSARY) >+ /* remote but checksummed? */ > tx->flags |= NETTXF_data_validated; >-#endif > > #ifdef HAVE_TSO > if (skb_is_gso(skb)) { >@@ -1351,20 +1351,10 @@ > skb->truesize += skb->data_len - (RX_COPY_THRESHOLD - len); > skb->len += skb->data_len; > >- /* >- * Old backends do not assert data_validated but we >- * can infer it from csum_blank so test both flags. >- */ >- if (rx->flags & (NETRXF_data_validated|NETRXF_csum_blank)) >+ if (rx->flags & NETRXF_csum_blank) >+ skb->ip_summed = CHECKSUM_PARTIAL; >+ else if (rx->flags & NETRXF_data_validated) > skb->ip_summed = CHECKSUM_UNNECESSARY; >- else >- skb->ip_summed = CHECKSUM_NONE; >-#ifdef CONFIG_XEN >- skb->proto_data_valid = (skb->ip_summed != CHECKSUM_NONE); >- skb->proto_csum_blank = !!(rx->flags & NETRXF_csum_blank); >-#endif >- np->stats.rx_packets++; >- np->stats.rx_bytes += skb->len; > > __skb_queue_tail(&rxq, skb); > >@@ -1404,6 +1394,19 @@ > > /* Ethernet work: Delayed to here as it peeks the header. */ > skb->protocol = eth_type_trans(skb, dev); >+ skb->nh.raw = skb->data; >+ >+ if (skb->ip_summed == CHECKSUM_PARTIAL) { >+ if (skb_checksum_setup(skb)) { >+ work_done--; >+ kfree_skb(skb); >+ np->stats.rx_errors++; >+ continue; >+ } >+ } >+ >+ np->stats.rx_packets++; >+ np->stats.rx_bytes += skb->len; > > /* Pass it up. */ > netif_receive_skb(skb); >diff -ur linux-2.6.20.noarch/include/linux/skbuff.h linux-2.6.20.i686/include/linux/skbuff.h >--- linux-2.6.20.noarch/include/linux/skbuff.h 2007-04-03 15:26:15.000000000 +1000 >+++ linux-2.6.20.i686/include/linux/skbuff.h 2007-04-03 17:20:11.000000000 +1000 >@@ -31,10 +31,11 @@ > #define HAVE_ALLOC_SKB /* For the drivers to know */ > #define HAVE_ALIGNABLE_SKB /* Ditto 8) */ > >+/* Don't change this without changing skb_csum_unnecessary! */ > #define CHECKSUM_NONE 0 >-#define CHECKSUM_PARTIAL 1 >-#define CHECKSUM_UNNECESSARY 2 >-#define CHECKSUM_COMPLETE 3 >+#define CHECKSUM_UNNECESSARY 1 >+#define CHECKSUM_COMPLETE 2 >+#define CHECKSUM_PARTIAL 3 > > #define SKB_DATA_ALIGN(X) (((X) + (SMP_CACHE_BYTES - 1)) & \ > ~(SMP_CACHE_BYTES - 1)) >@@ -198,12 +199,12 @@ > * @len: Length of actual data > * @data_len: Data length > * @mac_len: Length of link layer header >- * @csum: Checksum >+ * @csum: Checksum (must include start/offset pair) >+ * @csum_start: Offset from skb->head where checksumming should start >+ * @csum_offset: Offset from csum_start where checksum should be stored > * @local_df: allow local fragmentation > * @cloned: Head may be cloned (check refcnt to be sure) > * @nohdr: Payload reference only, must not modify header >- * @proto_data_valid: Protocol data validated since arriving at localhost >- * @proto_csum_blank: Protocol csum must be added before leaving localhost > * @pkt_type: Packet class > * @fclone: skbuff clone status > * @ip_summed: Driver fed us an IP checksum >@@ -276,7 +277,10 @@ > mac_len; > union { > __wsum csum; >- __u32 csum_offset; >+ struct { >+ __u16 csum_start; >+ __u16 csum_offset; >+ }; > }; > __u32 priority; > __u8 local_df:1, >@@ -286,13 +290,7 @@ > nfctinfo:3; > __u8 pkt_type:3, > fclone:2, >-#ifndef CONFIG_XEN > ipvs_property:1; >-#else >- ipvs_property:1, >- proto_data_valid:1, >- proto_csum_blank:1; >-#endif > __be16 protocol; > > void (*destructor)(struct sk_buff *skb); >@@ -1345,6 +1343,8 @@ > > extern struct sk_buff *skb_segment(struct sk_buff *skb, int features); > >+extern int skb_checksum_setup(struct sk_buff *skb); >+ > static inline void *skb_header_pointer(const struct sk_buff *skb, int offset, > int len, void *buffer) > { >@@ -1392,6 +1392,11 @@ > skb->tstamp.off_usec = stamp->tv_usec; > } > >+static inline int skb_csum_unnecessary(const struct sk_buff *skb) >+{ >+ return skb->ip_summed & CHECKSUM_UNNECESSARY; >+} >+ > extern void __net_timestamp(struct sk_buff *skb); > > extern __sum16 __skb_checksum_complete(struct sk_buff *skb); >@@ -1414,8 +1419,8 @@ > */ > static inline unsigned int skb_checksum_complete(struct sk_buff *skb) > { >- return skb->ip_summed != CHECKSUM_UNNECESSARY && >- __skb_checksum_complete(skb); >+ return skb_csum_unnecessary(skb) ? >+ 0 : __skb_checksum_complete(skb); > } > > #ifdef CONFIG_NETFILTER >@@ -1494,5 +1499,12 @@ > return skb_shinfo(skb)->gso_size; > } > >+static inline void skb_forward_csum(struct sk_buff *skb) >+{ >+ /* Unfortunately we don't support this one. Any brave souls? */ >+ if (skb->ip_summed == CHECKSUM_COMPLETE) >+ skb->ip_summed = CHECKSUM_NONE; >+} >+ > #endif /* __KERNEL__ */ > #endif /* _LINUX_SKBUFF_H */ >diff -ur linux-2.6.20.noarch/include/net/tcp.h linux-2.6.20.i686/include/net/tcp.h >--- linux-2.6.20.noarch/include/net/tcp.h 2007-03-30 13:39:07.000000000 +1000 >+++ linux-2.6.20.i686/include/net/tcp.h 2007-04-03 17:20:11.000000000 +1000 >@@ -816,7 +816,7 @@ > > static inline int tcp_checksum_complete(struct sk_buff *skb) > { >- return skb->ip_summed != CHECKSUM_UNNECESSARY && >+ return !skb_csum_unnecessary(skb) && > __tcp_checksum_complete(skb); > } > >diff -ur linux-2.6.20.noarch/include/net/udp.h linux-2.6.20.i686/include/net/udp.h >--- linux-2.6.20.noarch/include/net/udp.h 2007-03-30 13:39:07.000000000 +1000 >+++ linux-2.6.20.i686/include/net/udp.h 2007-04-03 17:20:11.000000000 +1000 >@@ -80,7 +80,7 @@ > > static inline int udp_lib_checksum_complete(struct sk_buff *skb) > { >- return skb->ip_summed != CHECKSUM_UNNECESSARY && >+ return !skb_csum_unnecessary(skb) && > __udp_lib_checksum_complete(skb); > } > >diff -ur linux-2.6.20.noarch/Makefile linux-2.6.20.i686/Makefile >--- linux-2.6.20.noarch/Makefile 2007-03-30 16:08:48.000000000 +1000 >+++ linux-2.6.20.i686/Makefile 2007-03-30 21:08:37.000000000 +1000 >@@ -1,7 +1,7 @@ > VERSION = 2 > PATCHLEVEL = 6 > SUBLEVEL = 20 >-EXTRAVERSION = -prep >+EXTRAVERSION = -1.2938.fc6xen > NAME = Homicidal Dwarf Hamster > > # *DOCUMENTATION* >diff -ur linux-2.6.20.noarch/net/bridge/br_forward.c linux-2.6.20.i686/net/bridge/br_forward.c >--- linux-2.6.20.noarch/net/bridge/br_forward.c 2007-04-03 15:26:15.000000000 +1000 >+++ linux-2.6.20.i686/net/bridge/br_forward.c 2007-03-30 21:01:02.000000000 +1000 >@@ -71,7 +71,7 @@ > > indev = skb->dev; > skb->dev = to->dev; >- skb->ip_summed = CHECKSUM_NONE; >+ skb_forward_csum(skb); > > NF_HOOK(PF_BRIDGE, NF_BR_FORWARD, skb, indev, skb->dev, > br_forward_finish); >diff -ur linux-2.6.20.noarch/net/core/dev.c linux-2.6.20.i686/net/core/dev.c >--- linux-2.6.20.noarch/net/core/dev.c 2007-04-03 15:26:15.000000000 +1000 >+++ linux-2.6.20.i686/net/core/dev.c 2007-04-03 15:53:05.000000000 +1000 >@@ -117,12 +117,6 @@ > #include <linux/err.h> > #include <linux/ctype.h> > >-#ifdef CONFIG_XEN >-#include <net/ip.h> >-#include <linux/tcp.h> >-#include <linux/udp.h> >-#endif >- > /* > * The list of packet types we will receive (as opposed to discard) > * and the routines to invoke. >@@ -1176,7 +1170,7 @@ > int skb_checksum_help(struct sk_buff *skb) > { > __wsum csum; >- int ret = 0, offset = skb->h.raw - skb->data; >+ int ret = 0, offset; > > if (skb->ip_summed == CHECKSUM_COMPLETE) > goto out_set_summed; >@@ -1192,14 +1186,16 @@ > goto out; > } > >+ offset = skb->csum_start - (skb->data - skb->head); > BUG_ON(offset > (int)skb->len); > csum = skb_checksum(skb, offset, skb->len-offset, 0); > >- offset = skb->tail - skb->h.raw; >+ offset = (skb->tail - skb->data) - offset; > BUG_ON(offset <= 0); > BUG_ON(skb->csum_offset + 2 > offset); > >- *(__sum16*)(skb->h.raw + skb->csum_offset) = csum_fold(csum); >+ *(__sum16 *)(skb->head + skb->csum_start + skb->csum_offset) = >+ csum_fold(csum); > > out_set_summed: > skb->ip_summed = CHECKSUM_NONE; >@@ -1398,43 +1394,6 @@ > } \ > } > >-#ifdef CONFIG_XEN >-inline int skb_checksum_setup(struct sk_buff *skb) >-{ >- if (skb->proto_csum_blank) { >- if (skb->protocol != htons(ETH_P_IP)) >- goto out; >- skb->h.raw = (unsigned char *)skb->nh.iph + 4*skb->nh.iph->ihl; >- if (skb->h.raw >= skb->tail) >- goto out; >- switch (skb->nh.iph->protocol) { >- case IPPROTO_TCP: >- skb->csum = offsetof(struct tcphdr, check); >- break; >- case IPPROTO_UDP: >- skb->csum = offsetof(struct udphdr, check); >- break; >- default: >- if (net_ratelimit()) >- printk(KERN_ERR "Attempting to checksum a non-" >- "TCP/UDP packet, dropping a protocol" >- " %d packet", skb->nh.iph->protocol); >- goto out; >- } >- if ((skb->h.raw + skb->csum + 2) > skb->tail) >- goto out; >- skb->ip_summed = CHECKSUM_PARTIAL; >- skb->proto_csum_blank = 0; >- } >- return 0; >-out: >- return -EPROTO; >-} >-#else >-inline int skb_checksum_setup(struct sk_buff *skb) { return 0; } >-#endif >- >- > /** > * dev_queue_xmit - transmit a buffer > * @skb: buffer to transmit >@@ -1467,12 +1426,6 @@ > struct Qdisc *q; > int rc = -ENOMEM; > >- /* If a checksum-deferred packet is forwarded to a device that needs a >- * checksum, correct the pointers and force checksumming. >- */ >- if (skb_checksum_setup(skb)) >- goto out_kfree_skb; >- > /* GSO will handle the following emulations directly. */ > if (netif_needs_gso(dev, skb)) > goto gso; >@@ -1494,12 +1447,15 @@ > /* If packet is not checksummed and device does not support > * checksumming for this protocol, complete checksumming here. > */ >- if (skb->ip_summed == CHECKSUM_PARTIAL && >- (!(dev->features & NETIF_F_GEN_CSUM) && >- (!(dev->features & NETIF_F_IP_CSUM) || >- skb->protocol != htons(ETH_P_IP)))) >- if (skb_checksum_help(skb)) >- goto out_kfree_skb; >+ if (skb->ip_summed == CHECKSUM_PARTIAL) { >+ skb->h.raw = skb->head + skb->csum_start; >+ >+ if (!(dev->features & NETIF_F_GEN_CSUM) && >+ (!(dev->features & NETIF_F_IP_CSUM) || >+ skb->protocol != htons(ETH_P_IP))) >+ if (skb_checksum_help(skb)) >+ goto out_kfree_skb; >+ } > > gso: > spin_lock_prefetch(&dev->queue_lock); >@@ -1848,19 +1804,6 @@ > } > #endif > >-#ifdef CONFIG_XEN >- switch (skb->ip_summed) { >- case CHECKSUM_UNNECESSARY: >- skb->proto_data_valid = 1; >- break; >- case CHECKSUM_PARTIAL: >- /* XXX Implement me. */ >- default: >- skb->proto_data_valid = 0; >- break; >- } >-#endif >- > list_for_each_entry_rcu(ptype, &ptype_all, list) { > if (!ptype->dev || ptype->dev == skb->dev) { > if (pt_prev) >@@ -3625,7 +3568,6 @@ > EXPORT_SYMBOL(net_enable_timestamp); > EXPORT_SYMBOL(net_disable_timestamp); > EXPORT_SYMBOL(dev_get_flags); >-EXPORT_SYMBOL(skb_checksum_setup); > > #if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) > EXPORT_SYMBOL(br_handle_frame_hook); >diff -ur linux-2.6.20.noarch/net/core/netpoll.c linux-2.6.20.i686/net/core/netpoll.c >--- linux-2.6.20.noarch/net/core/netpoll.c 2007-03-30 13:39:09.000000000 +1000 >+++ linux-2.6.20.i686/net/core/netpoll.c 2007-04-03 17:20:11.000000000 +1000 >@@ -86,7 +86,7 @@ > { > __wsum psum; > >- if (uh->check == 0 || skb->ip_summed == CHECKSUM_UNNECESSARY) >+ if (uh->check == 0 || skb_csum_unnecessary(skb)) > return 0; > > psum = csum_tcpudp_nofold(saddr, daddr, ulen, IPPROTO_UDP, 0); >diff -ur linux-2.6.20.noarch/net/core/skbuff.c linux-2.6.20.i686/net/core/skbuff.c >--- linux-2.6.20.noarch/net/core/skbuff.c 2007-04-03 15:26:15.000000000 +1000 >+++ linux-2.6.20.i686/net/core/skbuff.c 2007-04-03 15:52:33.000000000 +1000 >@@ -484,10 +484,6 @@ > C(local_df); > n->cloned = 1; > n->nohdr = 0; >-#ifdef CONFIG_XEN >- C(proto_data_valid); >- C(proto_csum_blank); >-#endif > C(pkt_type); > C(ip_summed); > C(priority); >@@ -1423,7 +1419,7 @@ > long csstart; > > if (skb->ip_summed == CHECKSUM_PARTIAL) >- csstart = skb->h.raw - skb->data; >+ csstart = skb->csum_start - (skb->data - skb->head); > else > csstart = skb_headlen(skb); > >diff -ur linux-2.6.20.noarch/net/ipv4/ip_forward.c linux-2.6.20.i686/net/ipv4/ip_forward.c >--- linux-2.6.20.noarch/net/ipv4/ip_forward.c 2007-04-03 15:26:15.000000000 +1000 >+++ linux-2.6.20.i686/net/ipv4/ip_forward.c 2007-03-30 21:01:02.000000000 +1000 >@@ -68,7 +68,7 @@ > if (skb->pkt_type != PACKET_HOST) > goto drop; > >- skb->ip_summed = CHECKSUM_NONE; >+ skb_forward_csum(skb); > > /* > * According to the RFC, we must first decrease the TTL field. If >diff -ur linux-2.6.20.noarch/net/ipv4/ipvs/ip_vs_core.c linux-2.6.20.i686/net/ipv4/ipvs/ip_vs_core.c >--- linux-2.6.20.noarch/net/ipv4/ipvs/ip_vs_core.c 2007-03-30 13:39:10.000000000 +1000 >+++ linux-2.6.20.i686/net/ipv4/ipvs/ip_vs_core.c 2007-04-03 17:20:11.000000000 +1000 >@@ -680,8 +680,7 @@ > } > > /* Ensure the checksum is correct */ >- if (skb->ip_summed != CHECKSUM_UNNECESSARY && >- ip_vs_checksum_complete(skb, ihl)) { >+ if (!skb_csum_unnecessary(skb) && ip_vs_checksum_complete(skb, ihl)) { > /* Failed checksum! */ > IP_VS_DBG(1, "Forward ICMP: failed checksum from %d.%d.%d.%d!\n", > NIPQUAD(iph->saddr)); >@@ -921,8 +920,7 @@ > verdict = NF_DROP; > > /* Ensure the checksum is correct */ >- if (skb->ip_summed != CHECKSUM_UNNECESSARY && >- ip_vs_checksum_complete(skb, ihl)) { >+ if (!skb_csum_unnecessary(skb) && ip_vs_checksum_complete(skb, ihl)) { > /* Failed checksum! */ > IP_VS_DBG(1, "Incoming ICMP: failed checksum from %d.%d.%d.%d!\n", > NIPQUAD(iph->saddr)); >diff -ur linux-2.6.20.noarch/net/ipv4/netfilter/ip_nat_proto_tcp.c linux-2.6.20.i686/net/ipv4/netfilter/ip_nat_proto_tcp.c >--- linux-2.6.20.noarch/net/ipv4/netfilter/ip_nat_proto_tcp.c 2007-04-03 15:26:15.000000000 +1000 >+++ linux-2.6.20.i686/net/ipv4/netfilter/ip_nat_proto_tcp.c 2007-03-30 21:01:02.000000000 +1000 >@@ -129,15 +129,8 @@ > if (hdrsize < sizeof(*hdr)) > return 1; > >-#ifdef CONFIG_XEN >- if ((*pskb)->proto_csum_blank) >- nf_csum_replace4(&hdr->check, oldip, newip); >- else >-#endif >- { > nf_proto_csum_replace4(&hdr->check, *pskb, oldip, newip, 1); > nf_proto_csum_replace2(&hdr->check, *pskb, oldport, newport, 0); >- } > return 1; > } > >diff -ur linux-2.6.20.noarch/net/ipv4/netfilter/ip_nat_proto_udp.c linux-2.6.20.i686/net/ipv4/netfilter/ip_nat_proto_udp.c >--- linux-2.6.20.noarch/net/ipv4/netfilter/ip_nat_proto_udp.c 2007-04-03 15:26:15.000000000 +1000 >+++ linux-2.6.20.i686/net/ipv4/netfilter/ip_nat_proto_udp.c 2007-03-30 21:01:02.000000000 +1000 >@@ -115,16 +115,8 @@ > } > > if (hdr->check || (*pskb)->ip_summed == CHECKSUM_PARTIAL) { >-#ifdef CONFIG_XEN >- if ((*pskb)->proto_csum_blank) >- nf_csum_replace4(&hdr->check, oldip, newip); >- else >-#endif >- { > nf_proto_csum_replace4(&hdr->check, *pskb, oldip, newip, 1); > nf_proto_csum_replace2(&hdr->check, *pskb, *portptr, newport, 0); >- } >- > if (!hdr->check) > hdr->check = CSUM_MANGLED_0; > } >diff -ur linux-2.6.20.noarch/net/ipv4/tcp_input.c linux-2.6.20.i686/net/ipv4/tcp_input.c >--- linux-2.6.20.noarch/net/ipv4/tcp_input.c 2007-03-30 13:39:10.000000000 +1000 >+++ linux-2.6.20.i686/net/ipv4/tcp_input.c 2007-04-03 17:20:11.000000000 +1000 >@@ -3775,7 +3775,7 @@ > int err; > > local_bh_enable(); >- if (skb->ip_summed==CHECKSUM_UNNECESSARY) >+ if (skb_csum_unnecessary(skb)) > err = skb_copy_datagram_iovec(skb, hlen, tp->ucopy.iov, chunk); > else > err = skb_copy_and_csum_datagram_iovec(skb, hlen, >@@ -3807,7 +3807,7 @@ > > static inline int tcp_checksum_complete_user(struct sock *sk, struct sk_buff *skb) > { >- return skb->ip_summed != CHECKSUM_UNNECESSARY && >+ return !skb_csum_unnecessary(skb) && > __tcp_checksum_complete_user(sk, skb); > } > >@@ -3825,7 +3825,7 @@ > if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list) > tp->ucopy.dma_chan = get_softnet_dma(); > >- if (tp->ucopy.dma_chan && skb->ip_summed == CHECKSUM_UNNECESSARY) { >+ if (tp->ucopy.dma_chan && skb_csum_unnecessary(skb)) { > > dma_cookie = dma_skb_copy_datagram_iovec(tp->ucopy.dma_chan, > skb, hlen, tp->ucopy.iov, chunk, tp->ucopy.pinned_list); >diff -ur linux-2.6.20.noarch/net/ipv4/tcp_ipv4.c linux-2.6.20.i686/net/ipv4/tcp_ipv4.c >--- linux-2.6.20.noarch/net/ipv4/tcp_ipv4.c 2007-03-30 13:39:10.000000000 +1000 >+++ linux-2.6.20.i686/net/ipv4/tcp_ipv4.c 2007-04-03 17:20:11.000000000 +1000 >@@ -504,6 +504,7 @@ > if (skb->ip_summed == CHECKSUM_PARTIAL) { > th->check = ~tcp_v4_check(th, len, > inet->saddr, inet->daddr, 0); >+ skb->csum_start = skb->h.raw - skb->head; > skb->csum_offset = offsetof(struct tcphdr, check); > } else { > th->check = tcp_v4_check(th, len, inet->saddr, inet->daddr, >@@ -1634,8 +1635,7 @@ > * Packet length and doff are validated by header prediction, > * provided case of th->doff==0 is eliminated. > * So, we defer the checks. */ >- if ((skb->ip_summed != CHECKSUM_UNNECESSARY && >- tcp_v4_checksum_init(skb))) >+ if (!skb_csum_unnecessary(skb) && tcp_v4_checksum_init(skb)) > goto bad_packet; > > th = skb->h.th; >diff -ur linux-2.6.20.noarch/net/ipv4/udp.c linux-2.6.20.i686/net/ipv4/udp.c >--- linux-2.6.20.noarch/net/ipv4/udp.c 2007-03-30 16:08:32.000000000 +1000 >+++ linux-2.6.20.i686/net/ipv4/udp.c 2007-04-03 17:37:38.000000000 +1000 >@@ -425,6 +425,7 @@ > /* > * Only one fragment on the socket. > */ >+ skb->csum_start = skb->h.raw - skb->head; > skb->csum_offset = offsetof(struct udphdr, check); > uh->check = ~csum_tcpudp_magic(src, dst, len, IPPROTO_UDP, 0); > } else { >@@ -838,7 +839,7 @@ > * (re-)compute it if message is truncated. > * UDP-Lite: always needs to checksum, no HW support. > */ >- copy_only = (skb->ip_summed==CHECKSUM_UNNECESSARY); >+ copy_only = skb_csum_unnecessary(skb); > > if (is_udplite || (!copy_only && msg->msg_flags&MSG_TRUNC)) { > if (__udp_lib_checksum_complete(skb)) >@@ -1094,7 +1095,7 @@ > } > } > >- if (sk->sk_filter && skb->ip_summed != CHECKSUM_UNNECESSARY) { >+ if (sk->sk_filter && !skb_csum_unnecessary(skb)) { > if (__udp_lib_checksum_complete(skb)) > goto drop; > skb->ip_summed = CHECKSUM_UNNECESSARY; >@@ -1174,7 +1175,7 @@ > skb->len, IPPROTO_UDP, skb->csum )) > skb->ip_summed = CHECKSUM_UNNECESSARY; > } >- if (skb->ip_summed != CHECKSUM_UNNECESSARY) >+ if (!skb_csum_unnecessary(skb)) > skb->csum = csum_tcpudp_nofold(skb->nh.iph->saddr, > skb->nh.iph->daddr, > skb->len, IPPROTO_UDP, 0); >diff -ur linux-2.6.20.noarch/net/ipv4/xfrm4_output.c linux-2.6.20.i686/net/ipv4/xfrm4_output.c >--- linux-2.6.20.noarch/net/ipv4/xfrm4_output.c 2007-04-03 15:26:15.000000000 +1000 >+++ linux-2.6.20.i686/net/ipv4/xfrm4_output.c 2007-03-30 21:01:02.000000000 +1000 >@@ -18,8 +18,6 @@ > #include <net/xfrm.h> > #include <net/icmp.h> > >-extern int skb_checksum_setup(struct sk_buff *skb); >- > static int xfrm4_tunnel_check_size(struct sk_buff *skb) > { > int mtu, ret = 0; >@@ -49,10 +47,6 @@ > struct dst_entry *dst = skb->dst; > 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); >diff -ur linux-2.6.20.noarch/net/ipv6/ip6_output.c linux-2.6.20.i686/net/ipv6/ip6_output.c >--- linux-2.6.20.noarch/net/ipv6/ip6_output.c 2007-04-03 15:26:15.000000000 +1000 >+++ linux-2.6.20.i686/net/ipv6/ip6_output.c 2007-03-30 21:01:03.000000000 +1000 >@@ -372,7 +372,7 @@ > goto drop; > } > >- skb->ip_summed = CHECKSUM_NONE; >+ skb_forward_csum(skb); > > /* > * We DO NOT make any processing on >diff -ur linux-2.6.20.noarch/net/ipv6/raw.c linux-2.6.20.i686/net/ipv6/raw.c >--- linux-2.6.20.noarch/net/ipv6/raw.c 2007-03-30 13:39:11.000000000 +1000 >+++ linux-2.6.20.i686/net/ipv6/raw.c 2007-04-03 17:20:11.000000000 +1000 >@@ -369,7 +369,7 @@ > skb->len, inet->num, skb->csum)) > skb->ip_summed = CHECKSUM_UNNECESSARY; > } >- if (skb->ip_summed != CHECKSUM_UNNECESSARY) >+ if (!skb_csum_unnecessary(skb)) > skb->csum = ~csum_unfold(csum_ipv6_magic(&skb->nh.ipv6h->saddr, > &skb->nh.ipv6h->daddr, > skb->len, inet->num, 0)); >@@ -421,7 +421,7 @@ > msg->msg_flags |= MSG_TRUNC; > } > >- if (skb->ip_summed==CHECKSUM_UNNECESSARY) { >+ if (skb_csum_unnecessary(skb)) { > err = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied); > } else if (msg->msg_flags&MSG_TRUNC) { > if (__skb_checksum_complete(skb)) >diff -ur linux-2.6.20.noarch/net/ipv6/tcp_ipv6.c linux-2.6.20.i686/net/ipv6/tcp_ipv6.c >--- linux-2.6.20.noarch/net/ipv6/tcp_ipv6.c 2007-03-30 16:08:32.000000000 +1000 >+++ linux-2.6.20.i686/net/ipv6/tcp_ipv6.c 2007-04-03 17:20:11.000000000 +1000 >@@ -948,6 +948,7 @@ > > if (skb->ip_summed == CHECKSUM_PARTIAL) { > th->check = ~csum_ipv6_magic(&np->saddr, &np->daddr, len, IPPROTO_TCP, 0); >+ skb->csum_start = skb->h.raw - skb->head; > skb->csum_offset = offsetof(struct tcphdr, check); > } else { > th->check = csum_ipv6_magic(&np->saddr, &np->daddr, len, IPPROTO_TCP, >@@ -970,6 +971,7 @@ > th->check = 0; > th->check = ~csum_ipv6_magic(&ipv6h->saddr, &ipv6h->daddr, skb->len, > IPPROTO_TCP, 0); >+ skb->csum_start = skb->h.raw - skb->head; > skb->csum_offset = offsetof(struct tcphdr, check); > skb->ip_summed = CHECKSUM_PARTIAL; > return 0; >@@ -1704,8 +1706,7 @@ > if (!pskb_may_pull(skb, th->doff*4)) > goto discard_it; > >- if ((skb->ip_summed != CHECKSUM_UNNECESSARY && >- tcp_v6_checksum_init(skb))) >+ if (!skb_csum_unnecessary(skb) && tcp_v6_checksum_init(skb)) > goto bad_packet; > > th = skb->h.th; >diff -ur linux-2.6.20.noarch/net/ipv6/udp.c linux-2.6.20.i686/net/ipv6/udp.c >--- linux-2.6.20.noarch/net/ipv6/udp.c 2007-03-30 13:39:11.000000000 +1000 >+++ linux-2.6.20.i686/net/ipv6/udp.c 2007-04-03 17:20:11.000000000 +1000 >@@ -144,7 +144,7 @@ > /* > * Decide whether to checksum and/or copy data. > */ >- copy_only = (skb->ip_summed==CHECKSUM_UNNECESSARY); >+ copy_only = skb_csum_unnecessary(skb); > > if (is_udplite || (!copy_only && msg->msg_flags&MSG_TRUNC)) { > if (__udp_lib_checksum_complete(skb)) >@@ -382,7 +382,7 @@ > skb->len, IPPROTO_UDP, skb->csum )) > skb->ip_summed = CHECKSUM_UNNECESSARY; > >- if (skb->ip_summed != CHECKSUM_UNNECESSARY) >+ if (!skb_csum_unnecessary(skb)) > skb->csum = ~csum_unfold(csum_ipv6_magic(&skb->nh.ipv6h->saddr, > &skb->nh.ipv6h->daddr, > skb->len, IPPROTO_UDP, >diff -ur linux-2.6.20.noarch/net/sctp/input.c linux-2.6.20.i686/net/sctp/input.c >--- linux-2.6.20.noarch/net/sctp/input.c 2007-03-30 13:39:11.000000000 +1000 >+++ linux-2.6.20.i686/net/sctp/input.c 2007-04-03 17:20:11.000000000 +1000 >@@ -144,8 +144,7 @@ > __skb_pull(skb, skb->h.raw - skb->data); > if (skb->len < sizeof(struct sctphdr)) > goto discard_it; >- if ((skb->ip_summed != CHECKSUM_UNNECESSARY) && >- (sctp_rcv_checksum(skb) < 0)) >+ if (!skb_csum_unnecessary(skb) && sctp_rcv_checksum(skb) < 0) > goto discard_it; > > skb_pull(skb, sizeof(struct sctphdr)); >diff -ur linux-2.6.20.noarch/net/sunrpc/socklib.c linux-2.6.20.i686/net/sunrpc/socklib.c >--- linux-2.6.20.noarch/net/sunrpc/socklib.c 2007-03-30 13:39:12.000000000 +1000 >+++ linux-2.6.20.i686/net/sunrpc/socklib.c 2007-04-03 17:20:11.000000000 +1000 >@@ -154,7 +154,7 @@ > desc.offset = sizeof(struct udphdr); > desc.count = skb->len - desc.offset; > >- if (skb->ip_summed == CHECKSUM_UNNECESSARY) >+ if (skb_csum_unnecessary(skb)) > goto no_checksum; > > desc.csum = csum_partial(skb->data, desc.offset, skb->csum);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 223258
:
150551
|
150639
| 152098