aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/loopback.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2007-04-10 23:50:43 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 01:24:59 -0400
commitd56f90a7c96da5187f0cdf07ee7434fe6aa78bbc (patch)
tree3b9073cecfbb3b6a1e25ab2b5dd2a22a43aef238 /drivers/net/loopback.c
parentbbe735e4247dba32568a305553b010081c8dea99 (diff)
[SK_BUFF]: Introduce skb_network_header()
For the places where we need a pointer to the network header, it is still legal to touch skb->nh.raw directly if just adding to, subtracting from or setting it to another layer header. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/loopback.c')
-rw-r--r--drivers/net/loopback.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
index af476d2a513d..9265c27b13b2 100644
--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -76,7 +76,8 @@ static DEFINE_PER_CPU(struct pcpu_lstats, pcpu_lstats);
76static void emulate_large_send_offload(struct sk_buff *skb) 76static void emulate_large_send_offload(struct sk_buff *skb)
77{ 77{
78 struct iphdr *iph = skb->nh.iph; 78 struct iphdr *iph = skb->nh.iph;
79 struct tcphdr *th = (struct tcphdr*)(skb->nh.raw + (iph->ihl * 4)); 79 struct tcphdr *th = (struct tcphdr *)(skb_network_header(skb) +
80 (iph->ihl * 4));
80 unsigned int doffset = (iph->ihl + th->doff) * 4; 81 unsigned int doffset = (iph->ihl + th->doff) * 4;
81 unsigned int mtu = skb_shinfo(skb)->gso_size + doffset; 82 unsigned int mtu = skb_shinfo(skb)->gso_size + doffset;
82 unsigned int offset = 0; 83 unsigned int offset = 0;
@@ -93,7 +94,7 @@ static void emulate_large_send_offload(struct sk_buff *skb)
93 skb_set_mac_header(nskb, -ETH_HLEN); 94 skb_set_mac_header(nskb, -ETH_HLEN);
94 skb_reset_network_header(nskb); 95 skb_reset_network_header(nskb);
95 iph = nskb->nh.iph; 96 iph = nskb->nh.iph;
96 memcpy(nskb->data, skb->nh.raw, doffset); 97 memcpy(nskb->data, skb_network_header(skb), doffset);
97 if (skb_copy_bits(skb, 98 if (skb_copy_bits(skb,
98 doffset + offset, 99 doffset + offset,
99 nskb->data + doffset, 100 nskb->data + doffset,
@@ -108,7 +109,7 @@ static void emulate_large_send_offload(struct sk_buff *skb)
108 memcpy(nskb->cb, skb->cb, sizeof(skb->cb)); 109 memcpy(nskb->cb, skb->cb, sizeof(skb->cb));
109 nskb->pkt_type = skb->pkt_type; 110 nskb->pkt_type = skb->pkt_type;
110 111
111 th = (struct tcphdr*)(nskb->nh.raw + iph->ihl*4); 112 th = (struct tcphdr *)(skb_network_header(nskb) + iph->ihl * 4);
112 iph->tot_len = htons(frag_size + doffset); 113 iph->tot_len = htons(frag_size + doffset);
113 iph->id = htons(id); 114 iph->id = htons(id);
114 iph->check = 0; 115 iph->check = 0;