]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
gro: Fix COMPLETE checksum handling
authorHerbert Xu <herbert@gondor.apana.org.au>
Mon, 27 Apr 2009 12:44:45 +0000 (05:44 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 27 Apr 2009 12:44:45 +0000 (05:44 -0700)
On a brand new GRO skb, we cannot call ip_hdr since the header
may lie in the non-linear area.  This patch adds the helper
skb_gro_network_header to handle this.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/netdevice.h
net/ipv4/tcp_ipv4.c
net/ipv6/tcp_ipv6.c

index c9ef41916071be17a96cbdc9b87e39cb6983f0bc..fe20d171acf102aba5271c341788afad6913ee00 100644 (file)
@@ -1142,6 +1142,13 @@ static inline void *skb_gro_mac_header(struct sk_buff *skb)
               skb_shinfo(skb)->frags[0].page_offset;
 }
 
+static inline void *skb_gro_network_header(struct sk_buff *skb)
+{
+       return skb_headlen(skb) ? skb_network_header(skb) :
+              page_address(skb_shinfo(skb)->frags[0].page) +
+              skb_shinfo(skb)->frags[0].page_offset + skb_network_offset(skb);
+}
+
 static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev,
                                  unsigned short type,
                                  const void *daddr, const void *saddr,
index 5d427f86b4142115cbc6c02222b8bbd0b34f9506..bda74e8aed7e188047e77d8d3fb07b644509cce7 100644 (file)
@@ -2343,7 +2343,7 @@ void tcp4_proc_exit(void)
 
 struct sk_buff **tcp4_gro_receive(struct sk_buff **head, struct sk_buff *skb)
 {
-       struct iphdr *iph = ip_hdr(skb);
+       struct iphdr *iph = skb_gro_network_header(skb);
 
        switch (skb->ip_summed) {
        case CHECKSUM_COMPLETE:
index 4b5aa1854260642ec15fcb6124607dfba10f21b1..d9dd94b6bf669975b77763760c1ce3890d50e0ea 100644 (file)
@@ -943,7 +943,7 @@ static int tcp_v6_gso_send_check(struct sk_buff *skb)
 
 struct sk_buff **tcp6_gro_receive(struct sk_buff **head, struct sk_buff *skb)
 {
-       struct ipv6hdr *iph = ipv6_hdr(skb);
+       struct ipv6hdr *iph = skb_gro_network_header(skb);
 
        switch (skb->ip_summed) {
        case CHECKSUM_COMPLETE: