aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
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 /net/core
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 'net/core')
-rw-r--r--net/core/dev.c9
-rw-r--r--net/core/filter.c2
2 files changed, 6 insertions, 5 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index 1b0758254ba0..54ffe9db9b02 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1068,8 +1068,8 @@ static void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev)
1068 */ 1068 */
1069 skb_reset_mac_header(skb2); 1069 skb_reset_mac_header(skb2);
1070 1070
1071 if (skb2->nh.raw < skb2->data || 1071 if (skb_network_header(skb2) < skb2->data ||
1072 skb2->nh.raw > skb2->tail) { 1072 skb_network_header(skb2) > skb2->tail) {
1073 if (net_ratelimit()) 1073 if (net_ratelimit())
1074 printk(KERN_CRIT "protocol %04x is " 1074 printk(KERN_CRIT "protocol %04x is "
1075 "buggy, dev %s\n", 1075 "buggy, dev %s\n",
@@ -1207,7 +1207,7 @@ struct sk_buff *skb_gso_segment(struct sk_buff *skb, int features)
1207 BUG_ON(skb_shinfo(skb)->frag_list); 1207 BUG_ON(skb_shinfo(skb)->frag_list);
1208 1208
1209 skb_reset_mac_header(skb); 1209 skb_reset_mac_header(skb);
1210 skb->mac_len = skb->nh.raw - skb->data; 1210 skb->mac_len = skb->nh.raw - skb->mac.raw;
1211 __skb_pull(skb, skb->mac_len); 1211 __skb_pull(skb, skb->mac_len);
1212 1212
1213 if (unlikely(skb->ip_summed != CHECKSUM_PARTIAL)) { 1213 if (unlikely(skb->ip_summed != CHECKSUM_PARTIAL)) {
@@ -1224,7 +1224,8 @@ struct sk_buff *skb_gso_segment(struct sk_buff *skb, int features)
1224 segs = ERR_PTR(err); 1224 segs = ERR_PTR(err);
1225 if (err || skb_gso_ok(skb, features)) 1225 if (err || skb_gso_ok(skb, features))
1226 break; 1226 break;
1227 __skb_push(skb, skb->data - skb->nh.raw); 1227 __skb_push(skb, (skb->data -
1228 skb_network_header(skb)));
1228 } 1229 }
1229 segs = ptype->gso_segment(skb, features); 1230 segs = ptype->gso_segment(skb, features);
1230 break; 1231 break;
diff --git a/net/core/filter.c b/net/core/filter.c
index 1cc128d05422..d2358a5e6339 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -42,7 +42,7 @@ static void *__load_pointer(struct sk_buff *skb, int k)
42 u8 *ptr = NULL; 42 u8 *ptr = NULL;
43 43
44 if (k >= SKF_NET_OFF) 44 if (k >= SKF_NET_OFF)
45 ptr = skb->nh.raw + k - SKF_NET_OFF; 45 ptr = skb_network_header(skb) + k - SKF_NET_OFF;
46 else if (k >= SKF_LL_OFF) 46 else if (k >= SKF_LL_OFF)
47 ptr = skb_mac_header(skb) + k - SKF_LL_OFF; 47 ptr = skb_mac_header(skb) + k - SKF_LL_OFF;
48 48