aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2007-04-10 23:45:18 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 01:24:46 -0400
commitc1d2bbe1cd6c7bbdc6d532cefebb66c7efb789ce (patch)
tree03a715961ba576a11cbc0e91c5d465e4c4d95d82 /net
parent57effc70a5be9f7804e9a99964eb7265367effca (diff)
[SK_BUFF]: Introduce skb_reset_network_header(skb)
For the common, open coded 'skb->nh.raw = skb->data' operation, so that we can later turn skb->nh.raw into a offset, reducing the size of struct sk_buff in 64bit land while possibly keeping it as a pointer on 32bit. This one touches just the most simple case, next will handle the slightly more "complex" cases. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/appletalk/aarp.c2
-rw-r--r--net/atm/mpc.c2
-rw-r--r--net/ax25/af_ax25.c2
-rw-r--r--net/ax25/ax25_ds_subr.c2
-rw-r--r--net/ax25/ax25_in.c8
-rw-r--r--net/ax25/ax25_ip.c2
-rw-r--r--net/ax25/ax25_out.c2
-rw-r--r--net/ax25/ax25_subr.c4
-rw-r--r--net/core/dev.c5
-rw-r--r--net/core/netpoll.c5
-rw-r--r--net/decnet/dn_dev.c4
-rw-r--r--net/decnet/dn_neigh.c6
-rw-r--r--net/decnet/dn_route.c2
-rw-r--r--net/econet/af_econet.c2
-rw-r--r--net/ieee80211/ieee80211_rx.c2
-rw-r--r--net/ipv4/arp.c2
-rw-r--r--net/ipv4/ip_gre.c2
-rw-r--r--net/ipv4/ip_output.c4
-rw-r--r--net/ipv4/ipip.c4
-rw-r--r--net/ipv4/route.c2
-rw-r--r--net/ipv4/xfrm4_mode_tunnel.c2
-rw-r--r--net/ipv6/ip6_output.c4
-rw-r--r--net/ipv6/ip6_tunnel.c6
-rw-r--r--net/ipv6/sit.c4
-rw-r--r--net/ipv6/xfrm6_mode_beet.c4
-rw-r--r--net/ipv6/xfrm6_mode_tunnel.c4
-rw-r--r--net/ipv6/xfrm6_output.c2
-rw-r--r--net/irda/irlap_frame.c3
-rw-r--r--net/iucv/af_iucv.c2
-rw-r--r--net/llc/llc_sap.c3
-rw-r--r--net/netrom/nr_dev.c2
-rw-r--r--net/packet/af_packet.c6
-rw-r--r--net/tipc/eth_media.c2
-rw-r--r--net/x25/x25_dev.c2
34 files changed, 57 insertions, 53 deletions
diff --git a/net/appletalk/aarp.c b/net/appletalk/aarp.c
index d89d62f3702f..d4e5ba22e246 100644
--- a/net/appletalk/aarp.c
+++ b/net/appletalk/aarp.c
@@ -539,7 +539,7 @@ int aarp_send_ddp(struct net_device *dev, struct sk_buff *skb,
539 int hash; 539 int hash;
540 struct aarp_entry *a; 540 struct aarp_entry *a;
541 541
542 skb->nh.raw = skb->data; 542 skb_reset_network_header(skb);
543 543
544 /* Check for LocalTalk first */ 544 /* Check for LocalTalk first */
545 if (dev->type == ARPHRD_LOCALTLK) { 545 if (dev->type == ARPHRD_LOCALTLK) {
diff --git a/net/atm/mpc.c b/net/atm/mpc.c
index cb3c004ff022..bc15728fd847 100644
--- a/net/atm/mpc.c
+++ b/net/atm/mpc.c
@@ -713,7 +713,7 @@ static void mpc_push(struct atm_vcc *vcc, struct sk_buff *skb)
713 skb_push(new_skb, eg->ctrl_info.DH_length); /* add MAC header */ 713 skb_push(new_skb, eg->ctrl_info.DH_length); /* add MAC header */
714 memcpy(new_skb->data, eg->ctrl_info.DLL_header, eg->ctrl_info.DH_length); 714 memcpy(new_skb->data, eg->ctrl_info.DLL_header, eg->ctrl_info.DH_length);
715 new_skb->protocol = eth_type_trans(new_skb, dev); 715 new_skb->protocol = eth_type_trans(new_skb, dev);
716 new_skb->nh.raw = new_skb->data; 716 skb_reset_network_header(new_skb);
717 717
718 eg->latest_ip_addr = new_skb->nh.iph->saddr; 718 eg->latest_ip_addr = new_skb->nh.iph->saddr;
719 eg->packets_rcvd++; 719 eg->packets_rcvd++;
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index c89e4f6f9025..b1a4d60ce9a8 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -1548,7 +1548,7 @@ static int ax25_sendmsg(struct kiocb *iocb, struct socket *sock,
1548 goto out; 1548 goto out;
1549 } 1549 }
1550 1550
1551 skb->nh.raw = skb->data; 1551 skb_reset_network_header(skb);
1552 1552
1553 /* Add the PID if one is not supplied by the user in the skb */ 1553 /* Add the PID if one is not supplied by the user in the skb */
1554 if (!ax25->pidincl) { 1554 if (!ax25->pidincl) {
diff --git a/net/ax25/ax25_ds_subr.c b/net/ax25/ax25_ds_subr.c
index 9569dd3fa466..a49773ff2b92 100644
--- a/net/ax25/ax25_ds_subr.c
+++ b/net/ax25/ax25_ds_subr.c
@@ -136,7 +136,7 @@ static void ax25_kiss_cmd(ax25_dev *ax25_dev, unsigned char cmd, unsigned char p
136 if ((skb = alloc_skb(2, GFP_ATOMIC)) == NULL) 136 if ((skb = alloc_skb(2, GFP_ATOMIC)) == NULL)
137 return; 137 return;
138 138
139 skb->nh.raw = skb->data; 139 skb_reset_network_header(skb);
140 p = skb_put(skb, 2); 140 p = skb_put(skb, 2);
141 141
142 *p++ = cmd; 142 *p++ = cmd;
diff --git a/net/ax25/ax25_in.c b/net/ax25/ax25_in.c
index 6d11b0633d5a..3b2aac670266 100644
--- a/net/ax25/ax25_in.c
+++ b/net/ax25/ax25_in.c
@@ -61,8 +61,8 @@ static int ax25_rx_fragment(ax25_cb *ax25, struct sk_buff *skb)
61 skb_reserve(skbn, AX25_MAX_HEADER_LEN); 61 skb_reserve(skbn, AX25_MAX_HEADER_LEN);
62 62
63 skbn->dev = ax25->ax25_dev->dev; 63 skbn->dev = ax25->ax25_dev->dev;
64 skb_reset_network_header(skbn);
64 skbn->h.raw = skbn->data; 65 skbn->h.raw = skbn->data;
65 skbn->nh.raw = skbn->data;
66 66
67 /* Copy data from the fragments */ 67 /* Copy data from the fragments */
68 while ((skbo = skb_dequeue(&ax25->frag_queue)) != NULL) { 68 while ((skbo = skb_dequeue(&ax25->frag_queue)) != NULL) {
@@ -123,7 +123,7 @@ int ax25_rx_iframe(ax25_cb *ax25, struct sk_buff *skb)
123 123
124 skb_pull(skb, 1); /* Remove PID */ 124 skb_pull(skb, 1); /* Remove PID */
125 skb_reset_mac_header(skb); 125 skb_reset_mac_header(skb);
126 skb->nh.raw = skb->data; 126 skb_reset_network_header(skb);
127 skb->dev = ax25->ax25_dev->dev; 127 skb->dev = ax25->ax25_dev->dev;
128 skb->pkt_type = PACKET_HOST; 128 skb->pkt_type = PACKET_HOST;
129 skb->protocol = htons(ETH_P_IP); 129 skb->protocol = htons(ETH_P_IP);
@@ -247,7 +247,7 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev,
247 case AX25_P_IP: 247 case AX25_P_IP:
248 skb_pull(skb,2); /* drop PID/CTRL */ 248 skb_pull(skb,2); /* drop PID/CTRL */
249 skb->h.raw = skb->data; 249 skb->h.raw = skb->data;
250 skb->nh.raw = skb->data; 250 skb_reset_network_header(skb);
251 skb->dev = dev; 251 skb->dev = dev;
252 skb->pkt_type = PACKET_HOST; 252 skb->pkt_type = PACKET_HOST;
253 skb->protocol = htons(ETH_P_IP); 253 skb->protocol = htons(ETH_P_IP);
@@ -257,7 +257,7 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev,
257 case AX25_P_ARP: 257 case AX25_P_ARP:
258 skb_pull(skb,2); 258 skb_pull(skb,2);
259 skb->h.raw = skb->data; 259 skb->h.raw = skb->data;
260 skb->nh.raw = skb->data; 260 skb_reset_network_header(skb);
261 skb->dev = dev; 261 skb->dev = dev;
262 skb->pkt_type = PACKET_HOST; 262 skb->pkt_type = PACKET_HOST;
263 skb->protocol = htons(ETH_P_ARP); 263 skb->protocol = htons(ETH_P_ARP);
diff --git a/net/ax25/ax25_ip.c b/net/ax25/ax25_ip.c
index 7f818bbcd1c5..4d4ef35e1782 100644
--- a/net/ax25/ax25_ip.c
+++ b/net/ax25/ax25_ip.c
@@ -171,7 +171,7 @@ int ax25_rebuild_header(struct sk_buff *skb)
171 src_c = *(ax25_address *)(bp + 8); 171 src_c = *(ax25_address *)(bp + 8);
172 172
173 skb_pull(ourskb, AX25_HEADER_LEN - 1); /* Keep PID */ 173 skb_pull(ourskb, AX25_HEADER_LEN - 1); /* Keep PID */
174 ourskb->nh.raw = ourskb->data; 174 skb_reset_network_header(ourskb);
175 175
176 ax25=ax25_send_frame( 176 ax25=ax25_send_frame(
177 ourskb, 177 ourskb,
diff --git a/net/ax25/ax25_out.c b/net/ax25/ax25_out.c
index 223835092b7a..6e08dc8dee40 100644
--- a/net/ax25/ax25_out.c
+++ b/net/ax25/ax25_out.c
@@ -205,7 +205,7 @@ static void ax25_send_iframe(ax25_cb *ax25, struct sk_buff *skb, int poll_bit)
205 if (skb == NULL) 205 if (skb == NULL)
206 return; 206 return;
207 207
208 skb->nh.raw = skb->data; 208 skb_reset_network_header(skb);
209 209
210 if (ax25->modulus == AX25_MODULUS) { 210 if (ax25->modulus == AX25_MODULUS) {
211 frame = skb_push(skb, 1); 211 frame = skb_push(skb, 1);
diff --git a/net/ax25/ax25_subr.c b/net/ax25/ax25_subr.c
index b6c577e3c914..5fe9b2a6697d 100644
--- a/net/ax25/ax25_subr.c
+++ b/net/ax25/ax25_subr.c
@@ -162,7 +162,7 @@ void ax25_send_control(ax25_cb *ax25, int frametype, int poll_bit, int type)
162 162
163 skb_reserve(skb, ax25->ax25_dev->dev->hard_header_len); 163 skb_reserve(skb, ax25->ax25_dev->dev->hard_header_len);
164 164
165 skb->nh.raw = skb->data; 165 skb_reset_network_header(skb);
166 166
167 /* Assume a response - address structure for DTE */ 167 /* Assume a response - address structure for DTE */
168 if (ax25->modulus == AX25_MODULUS) { 168 if (ax25->modulus == AX25_MODULUS) {
@@ -205,7 +205,7 @@ void ax25_return_dm(struct net_device *dev, ax25_address *src, ax25_address *des
205 return; /* Next SABM will get DM'd */ 205 return; /* Next SABM will get DM'd */
206 206
207 skb_reserve(skb, dev->hard_header_len); 207 skb_reserve(skb, dev->hard_header_len);
208 skb->nh.raw = skb->data; 208 skb_reset_network_header(skb);
209 209
210 ax25_digi_invert(digi, &retdigi); 210 ax25_digi_invert(digi, &retdigi);
211 211
diff --git a/net/core/dev.c b/net/core/dev.c
index 560560fe3064..1b0758254ba0 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1074,7 +1074,7 @@ static void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev)
1074 printk(KERN_CRIT "protocol %04x is " 1074 printk(KERN_CRIT "protocol %04x is "
1075 "buggy, dev %s\n", 1075 "buggy, dev %s\n",
1076 skb2->protocol, dev->name); 1076 skb2->protocol, dev->name);
1077 skb2->nh.raw = skb2->data; 1077 skb_reset_network_header(skb2);
1078 } 1078 }
1079 1079
1080 skb2->h.raw = skb2->nh.raw; 1080 skb2->h.raw = skb2->nh.raw;
@@ -1771,7 +1771,8 @@ int netif_receive_skb(struct sk_buff *skb)
1771 1771
1772 __get_cpu_var(netdev_rx_stat).total++; 1772 __get_cpu_var(netdev_rx_stat).total++;
1773 1773
1774 skb->h.raw = skb->nh.raw = skb->data; 1774 skb_reset_network_header(skb);
1775 skb->h.raw = skb->data;
1775 skb->mac_len = skb->nh.raw - skb->mac.raw; 1776 skb->mac_len = skb->nh.raw - skb->mac.raw;
1776 1777
1777 pt_prev = NULL; 1778 pt_prev = NULL;
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 0ad3896bbf62..b4d1cdd58f11 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -359,7 +359,8 @@ static void arp_reply(struct sk_buff *skb)
359 (2 * sizeof(u32))))) 359 (2 * sizeof(u32)))))
360 return; 360 return;
361 361
362 skb->h.raw = skb->nh.raw = skb->data; 362 skb_reset_network_header(skb);
363 skb->h.raw = skb->data;
363 arp = skb->nh.arph; 364 arp = skb->nh.arph;
364 365
365 if ((arp->ar_hrd != htons(ARPHRD_ETHER) && 366 if ((arp->ar_hrd != htons(ARPHRD_ETHER) &&
@@ -389,7 +390,7 @@ static void arp_reply(struct sk_buff *skb)
389 if (!send_skb) 390 if (!send_skb)
390 return; 391 return;
391 392
392 send_skb->nh.raw = send_skb->data; 393 skb_reset_network_header(send_skb);
393 arp = (struct arphdr *) skb_put(send_skb, size); 394 arp = (struct arphdr *) skb_put(send_skb, size);
394 send_skb->dev = skb->dev; 395 send_skb->dev = skb->dev;
395 send_skb->protocol = htons(ETH_P_ARP); 396 send_skb->protocol = htons(ETH_P_ARP);
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c
index 060d725e2942..95871a669dc4 100644
--- a/net/decnet/dn_dev.c
+++ b/net/decnet/dn_dev.c
@@ -913,7 +913,7 @@ static void dn_send_endnode_hello(struct net_device *dev, struct dn_ifaddr *ifa)
913 pktlen = (__le16 *)skb_push(skb,2); 913 pktlen = (__le16 *)skb_push(skb,2);
914 *pktlen = dn_htons(skb->len - 2); 914 *pktlen = dn_htons(skb->len - 2);
915 915
916 skb->nh.raw = skb->data; 916 skb_reset_network_header(skb);
917 917
918 dn_rt_finish_output(skb, dn_rt_all_rt_mcast, msg->id); 918 dn_rt_finish_output(skb, dn_rt_all_rt_mcast, msg->id);
919} 919}
@@ -1005,7 +1005,7 @@ static void dn_send_router_hello(struct net_device *dev, struct dn_ifaddr *ifa)
1005 pktlen = (__le16 *)skb_push(skb, 2); 1005 pktlen = (__le16 *)skb_push(skb, 2);
1006 *pktlen = dn_htons(skb->len - 2); 1006 *pktlen = dn_htons(skb->len - 2);
1007 1007
1008 skb->nh.raw = skb->data; 1008 skb_reset_network_header(skb);
1009 1009
1010 if (dn_am_i_a_router(dn, dn_db, ifa)) { 1010 if (dn_am_i_a_router(dn, dn_db, ifa)) {
1011 struct sk_buff *skb2 = skb_copy(skb, GFP_ATOMIC); 1011 struct sk_buff *skb2 = skb_copy(skb, GFP_ATOMIC);
diff --git a/net/decnet/dn_neigh.c b/net/decnet/dn_neigh.c
index bf701cf5a386..4bf066c416e2 100644
--- a/net/decnet/dn_neigh.c
+++ b/net/decnet/dn_neigh.c
@@ -261,7 +261,7 @@ static int dn_long_output(struct sk_buff *skb)
261 lp->s_class = 0; 261 lp->s_class = 0;
262 lp->pt = 0; 262 lp->pt = 0;
263 263
264 skb->nh.raw = skb->data; 264 skb_reset_network_header(skb);
265 265
266 return NF_HOOK(PF_DECnet, NF_DN_POST_ROUTING, skb, NULL, neigh->dev, dn_neigh_output_packet); 266 return NF_HOOK(PF_DECnet, NF_DN_POST_ROUTING, skb, NULL, neigh->dev, dn_neigh_output_packet);
267} 267}
@@ -300,7 +300,7 @@ static int dn_short_output(struct sk_buff *skb)
300 sp->srcnode = cb->src; 300 sp->srcnode = cb->src;
301 sp->forward = cb->hops & 0x3f; 301 sp->forward = cb->hops & 0x3f;
302 302
303 skb->nh.raw = skb->data; 303 skb_reset_network_header(skb);
304 304
305 return NF_HOOK(PF_DECnet, NF_DN_POST_ROUTING, skb, NULL, neigh->dev, dn_neigh_output_packet); 305 return NF_HOOK(PF_DECnet, NF_DN_POST_ROUTING, skb, NULL, neigh->dev, dn_neigh_output_packet);
306} 306}
@@ -342,7 +342,7 @@ static int dn_phase3_output(struct sk_buff *skb)
342 sp->srcnode = cb->src & dn_htons(0x03ff); 342 sp->srcnode = cb->src & dn_htons(0x03ff);
343 sp->forward = cb->hops & 0x3f; 343 sp->forward = cb->hops & 0x3f;
344 344
345 skb->nh.raw = skb->data; 345 skb_reset_network_header(skb);
346 346
347 return NF_HOOK(PF_DECnet, NF_DN_POST_ROUTING, skb, NULL, neigh->dev, dn_neigh_output_packet); 347 return NF_HOOK(PF_DECnet, NF_DN_POST_ROUTING, skb, NULL, neigh->dev, dn_neigh_output_packet);
348} 348}
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c
index ef94ca56d7bd..34079b7ba1d3 100644
--- a/net/decnet/dn_route.c
+++ b/net/decnet/dn_route.c
@@ -615,7 +615,7 @@ int dn_route_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type
615 flags = *skb->data; 615 flags = *skb->data;
616 } 616 }
617 617
618 skb->nh.raw = skb->data; 618 skb_reset_network_header(skb);
619 619
620 /* 620 /*
621 * Weed out future version DECnet 621 * Weed out future version DECnet
diff --git a/net/econet/af_econet.c b/net/econet/af_econet.c
index 487f879f5a19..099543f5401f 100644
--- a/net/econet/af_econet.c
+++ b/net/econet/af_econet.c
@@ -345,7 +345,7 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock,
345 goto out_unlock; 345 goto out_unlock;
346 346
347 skb_reserve(skb, LL_RESERVED_SPACE(dev)); 347 skb_reserve(skb, LL_RESERVED_SPACE(dev));
348 skb->nh.raw = skb->data; 348 skb_reset_network_header(skb);
349 349
350 eb = (struct ec_cb *)&skb->cb; 350 eb = (struct ec_cb *)&skb->cb;
351 351
diff --git a/net/ieee80211/ieee80211_rx.c b/net/ieee80211/ieee80211_rx.c
index f39bf7c41012..be5ffaf6e8a5 100644
--- a/net/ieee80211/ieee80211_rx.c
+++ b/net/ieee80211/ieee80211_rx.c
@@ -792,7 +792,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
792 skb2->dev = dev; 792 skb2->dev = dev;
793 skb2->protocol = __constant_htons(ETH_P_802_3); 793 skb2->protocol = __constant_htons(ETH_P_802_3);
794 skb_reset_mac_header(skb2); 794 skb_reset_mac_header(skb2);
795 skb2->nh.raw = skb2->data; 795 skb_reset_network_header(skb2);
796 /* skb2->nh.raw = skb2->data + ETH_HLEN; */ 796 /* skb2->nh.raw = skb2->data + ETH_HLEN; */
797 dev_queue_xmit(skb2); 797 dev_queue_xmit(skb2);
798 } 798 }
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index e6e196cd3b8c..8c533ceb9709 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -578,7 +578,7 @@ struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip,
578 return NULL; 578 return NULL;
579 579
580 skb_reserve(skb, LL_RESERVED_SPACE(dev)); 580 skb_reserve(skb, LL_RESERVED_SPACE(dev));
581 skb->nh.raw = skb->data; 581 skb_reset_network_header(skb);
582 arp = (struct arphdr *) skb_put(skb,sizeof(struct arphdr) + 2*(dev->addr_len+4)); 582 arp = (struct arphdr *) skb_put(skb,sizeof(struct arphdr) + 2*(dev->addr_len+4));
583 skb->dev = dev; 583 skb->dev = dev;
584 skb->protocol = htons(ETH_P_ARP); 584 skb->protocol = htons(ETH_P_ARP);
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 88f8aae873f4..ced2c4baf174 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -474,7 +474,7 @@ out:
474 dst_release(skb2->dst); 474 dst_release(skb2->dst);
475 skb2->dst = NULL; 475 skb2->dst = NULL;
476 skb_pull(skb2, skb->data - (u8*)eiph); 476 skb_pull(skb2, skb->data - (u8*)eiph);
477 skb2->nh.raw = skb2->data; 477 skb_reset_network_header(skb2);
478 478
479 /* Try to guess incoming interface */ 479 /* Try to guess incoming interface */
480 memset(&fl, 0, sizeof(fl)); 480 memset(&fl, 0, sizeof(fl));
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index ddba857bd243..32f1a23a80f9 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -593,7 +593,7 @@ slow_path:
593 ip_copy_metadata(skb2, skb); 593 ip_copy_metadata(skb2, skb);
594 skb_reserve(skb2, ll_rs); 594 skb_reserve(skb2, ll_rs);
595 skb_put(skb2, len + hlen); 595 skb_put(skb2, len + hlen);
596 skb2->nh.raw = skb2->data; 596 skb_reset_network_header(skb2);
597 skb2->h.raw = skb2->data + hlen; 597 skb2->h.raw = skb2->data + hlen;
598 598
599 /* 599 /*
@@ -722,7 +722,7 @@ static inline int ip_ufo_append_data(struct sock *sk,
722 skb_put(skb,fragheaderlen + transhdrlen); 722 skb_put(skb,fragheaderlen + transhdrlen);
723 723
724 /* initialize network header pointer */ 724 /* initialize network header pointer */
725 skb->nh.raw = skb->data; 725 skb_reset_network_header(skb);
726 726
727 /* initialize protocol header pointer */ 727 /* initialize protocol header pointer */
728 skb->h.raw = skb->data + fragheaderlen; 728 skb->h.raw = skb->data + fragheaderlen;
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
index 3ec5ce0f5498..5f886c892861 100644
--- a/net/ipv4/ipip.c
+++ b/net/ipv4/ipip.c
@@ -405,7 +405,7 @@ out:
405 dst_release(skb2->dst); 405 dst_release(skb2->dst);
406 skb2->dst = NULL; 406 skb2->dst = NULL;
407 skb_pull(skb2, skb->data - (u8*)eiph); 407 skb_pull(skb2, skb->data - (u8*)eiph);
408 skb2->nh.raw = skb2->data; 408 skb_reset_network_header(skb2);
409 409
410 /* Try to guess incoming interface */ 410 /* Try to guess incoming interface */
411 memset(&fl, 0, sizeof(fl)); 411 memset(&fl, 0, sizeof(fl));
@@ -487,7 +487,7 @@ static int ipip_rcv(struct sk_buff *skb)
487 secpath_reset(skb); 487 secpath_reset(skb);
488 488
489 skb->mac.raw = skb->nh.raw; 489 skb->mac.raw = skb->nh.raw;
490 skb->nh.raw = skb->data; 490 skb_reset_network_header(skb);
491 skb->protocol = htons(ETH_P_IP); 491 skb->protocol = htons(ETH_P_IP);
492 skb->pkt_type = PACKET_HOST; 492 skb->pkt_type = PACKET_HOST;
493 493
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 486ab93127ce..d29861844903 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2748,7 +2748,7 @@ int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void *arg)
2748 through good chunk of routing engine. 2748 through good chunk of routing engine.
2749 */ 2749 */
2750 skb_reset_mac_header(skb); 2750 skb_reset_mac_header(skb);
2751 skb->nh.raw = skb->data; 2751 skb_reset_network_header(skb);
2752 2752
2753 /* Bugfix: need to give ip_route_input enough of an IP header to not gag. */ 2753 /* Bugfix: need to give ip_route_input enough of an IP header to not gag. */
2754 skb->nh.iph->protocol = IPPROTO_ICMP; 2754 skb->nh.iph->protocol = IPPROTO_ICMP;
diff --git a/net/ipv4/xfrm4_mode_tunnel.c b/net/ipv4/xfrm4_mode_tunnel.c
index 8e123e30cf61..ffc6005d1d55 100644
--- a/net/ipv4/xfrm4_mode_tunnel.c
+++ b/net/ipv4/xfrm4_mode_tunnel.c
@@ -129,7 +129,7 @@ static int xfrm4_tunnel_input(struct xfrm_state *x, struct sk_buff *skb)
129 old_mac = skb_mac_header(skb); 129 old_mac = skb_mac_header(skb);
130 skb_set_mac_header(skb, -skb->mac_len); 130 skb_set_mac_header(skb, -skb->mac_len);
131 memmove(skb_mac_header(skb), old_mac, skb->mac_len); 131 memmove(skb_mac_header(skb), old_mac, skb->mac_len);
132 skb->nh.raw = skb->data; 132 skb_reset_network_header(skb);
133 err = 0; 133 err = 0;
134 134
135out: 135out:
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index a5f4562b5d29..4406546d3ce8 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -735,7 +735,7 @@ slow_path:
735 ip6_copy_metadata(frag, skb); 735 ip6_copy_metadata(frag, skb);
736 skb_reserve(frag, LL_RESERVED_SPACE(rt->u.dst.dev)); 736 skb_reserve(frag, LL_RESERVED_SPACE(rt->u.dst.dev));
737 skb_put(frag, len + hlen + sizeof(struct frag_hdr)); 737 skb_put(frag, len + hlen + sizeof(struct frag_hdr));
738 frag->nh.raw = frag->data; 738 skb_reset_network_header(frag);
739 fh = (struct frag_hdr*)(frag->data + hlen); 739 fh = (struct frag_hdr*)(frag->data + hlen);
740 frag->h.raw = frag->data + hlen + sizeof(struct frag_hdr); 740 frag->h.raw = frag->data + hlen + sizeof(struct frag_hdr);
741 741
@@ -976,7 +976,7 @@ static inline int ip6_ufo_append_data(struct sock *sk,
976 skb_put(skb,fragheaderlen + transhdrlen); 976 skb_put(skb,fragheaderlen + transhdrlen);
977 977
978 /* initialize network header pointer */ 978 /* initialize network header pointer */
979 skb->nh.raw = skb->data; 979 skb_reset_network_header(skb);
980 980
981 /* initialize protocol header pointer */ 981 /* initialize protocol header pointer */
982 skb->h.raw = skb->data + fragheaderlen; 982 skb->h.raw = skb->data + fragheaderlen;
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index d8c84d8d7cf8..30df8e6c42cc 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -525,7 +525,7 @@ ip4ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
525 dst_release(skb2->dst); 525 dst_release(skb2->dst);
526 skb2->dst = NULL; 526 skb2->dst = NULL;
527 skb_pull(skb2, offset); 527 skb_pull(skb2, offset);
528 skb2->nh.raw = skb2->data; 528 skb_reset_network_header(skb2);
529 eiph = skb2->nh.iph; 529 eiph = skb2->nh.iph;
530 530
531 /* Try to guess incoming interface */ 531 /* Try to guess incoming interface */
@@ -599,7 +599,7 @@ ip6ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
599 dst_release(skb2->dst); 599 dst_release(skb2->dst);
600 skb2->dst = NULL; 600 skb2->dst = NULL;
601 skb_pull(skb2, offset); 601 skb_pull(skb2, offset);
602 skb2->nh.raw = skb2->data; 602 skb_reset_network_header(skb2);
603 603
604 /* Try to guess incoming interface */ 604 /* Try to guess incoming interface */
605 rt = rt6_lookup(&skb2->nh.ipv6h->saddr, NULL, 0, 0); 605 rt = rt6_lookup(&skb2->nh.ipv6h->saddr, NULL, 0, 0);
@@ -704,7 +704,7 @@ static int ip6_tnl_rcv(struct sk_buff *skb, __u16 protocol,
704 } 704 }
705 secpath_reset(skb); 705 secpath_reset(skb);
706 skb->mac.raw = skb->nh.raw; 706 skb->mac.raw = skb->nh.raw;
707 skb->nh.raw = skb->data; 707 skb_reset_network_header(skb);
708 skb->protocol = htons(protocol); 708 skb->protocol = htons(protocol);
709 skb->pkt_type = PACKET_HOST; 709 skb->pkt_type = PACKET_HOST;
710 memset(skb->cb, 0, sizeof(struct inet6_skb_parm)); 710 memset(skb->cb, 0, sizeof(struct inet6_skb_parm));
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 08d6ed3396e4..0477728578fe 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -340,7 +340,7 @@ out:
340 dst_release(skb2->dst); 340 dst_release(skb2->dst);
341 skb2->dst = NULL; 341 skb2->dst = NULL;
342 skb_pull(skb2, skb->data - (u8*)iph6); 342 skb_pull(skb2, skb->data - (u8*)iph6);
343 skb2->nh.raw = skb2->data; 343 skb_reset_network_header(skb2);
344 344
345 /* Try to guess incoming interface */ 345 /* Try to guess incoming interface */
346 rt6i = rt6_lookup(&iph6->saddr, NULL, NULL, 0); 346 rt6i = rt6_lookup(&iph6->saddr, NULL, NULL, 0);
@@ -383,7 +383,7 @@ static int ipip6_rcv(struct sk_buff *skb)
383 if ((tunnel = ipip6_tunnel_lookup(iph->saddr, iph->daddr)) != NULL) { 383 if ((tunnel = ipip6_tunnel_lookup(iph->saddr, iph->daddr)) != NULL) {
384 secpath_reset(skb); 384 secpath_reset(skb);
385 skb->mac.raw = skb->nh.raw; 385 skb->mac.raw = skb->nh.raw;
386 skb->nh.raw = skb->data; 386 skb_reset_network_header(skb);
387 IPCB(skb)->flags = 0; 387 IPCB(skb)->flags = 0;
388 skb->protocol = htons(ETH_P_IPV6); 388 skb->protocol = htons(ETH_P_IPV6);
389 skb->pkt_type = PACKET_HOST; 389 skb->pkt_type = PACKET_HOST;
diff --git a/net/ipv6/xfrm6_mode_beet.c b/net/ipv6/xfrm6_mode_beet.c
index 79364b1e965a..c015bfde2b1c 100644
--- a/net/ipv6/xfrm6_mode_beet.c
+++ b/net/ipv6/xfrm6_mode_beet.c
@@ -45,7 +45,7 @@ static int xfrm6_beet_output(struct xfrm_state *x, struct sk_buff *skb)
45 skb->h.raw = skb->data + hdr_len; 45 skb->h.raw = skb->data + hdr_len;
46 memmove(skb->data, iph, hdr_len); 46 memmove(skb->data, iph, hdr_len);
47 47
48 skb->nh.raw = skb->data; 48 skb_reset_network_header(skb);
49 top_iph = skb->nh.ipv6h; 49 top_iph = skb->nh.ipv6h;
50 skb->nh.raw = &top_iph->nexthdr; 50 skb->nh.raw = &top_iph->nexthdr;
51 skb->h.ipv6h = top_iph + 1; 51 skb->h.ipv6h = top_iph + 1;
@@ -68,7 +68,7 @@ static int xfrm6_beet_input(struct xfrm_state *x, struct sk_buff *skb)
68 68
69 skb_push(skb, size); 69 skb_push(skb, size);
70 memmove(skb->data, skb->nh.raw, size); 70 memmove(skb->data, skb->nh.raw, size);
71 skb->nh.raw = skb->data; 71 skb_reset_network_header(skb);
72 72
73 old_mac = skb_mac_header(skb); 73 old_mac = skb_mac_header(skb);
74 skb_set_mac_header(skb, -skb->mac_len); 74 skb_set_mac_header(skb, -skb->mac_len);
diff --git a/net/ipv6/xfrm6_mode_tunnel.c b/net/ipv6/xfrm6_mode_tunnel.c
index 5bb0677d3730..8ce5ef2d0b1c 100644
--- a/net/ipv6/xfrm6_mode_tunnel.c
+++ b/net/ipv6/xfrm6_mode_tunnel.c
@@ -53,7 +53,7 @@ static int xfrm6_tunnel_output(struct xfrm_state *x, struct sk_buff *skb)
53 skb_push(skb, x->props.header_len); 53 skb_push(skb, x->props.header_len);
54 iph = skb->nh.ipv6h; 54 iph = skb->nh.ipv6h;
55 55
56 skb->nh.raw = skb->data; 56 skb_reset_network_header(skb);
57 top_iph = skb->nh.ipv6h; 57 top_iph = skb->nh.ipv6h;
58 skb->nh.raw = &top_iph->nexthdr; 58 skb->nh.raw = &top_iph->nexthdr;
59 skb->h.ipv6h = top_iph + 1; 59 skb->h.ipv6h = top_iph + 1;
@@ -111,7 +111,7 @@ static int xfrm6_tunnel_input(struct xfrm_state *x, struct sk_buff *skb)
111 old_mac = skb_mac_header(skb); 111 old_mac = skb_mac_header(skb);
112 skb_set_mac_header(skb, -skb->mac_len); 112 skb_set_mac_header(skb, -skb->mac_len);
113 memmove(skb_mac_header(skb), old_mac, skb->mac_len); 113 memmove(skb_mac_header(skb), old_mac, skb->mac_len);
114 skb->nh.raw = skb->data; 114 skb_reset_network_header(skb);
115 err = 0; 115 err = 0;
116 116
117out: 117out:
diff --git a/net/ipv6/xfrm6_output.c b/net/ipv6/xfrm6_output.c
index c52e9d6c75ec..56364a5f676a 100644
--- a/net/ipv6/xfrm6_output.c
+++ b/net/ipv6/xfrm6_output.c
@@ -82,7 +82,7 @@ static int xfrm6_output_one(struct sk_buff *skb)
82 82
83 spin_unlock_bh(&x->lock); 83 spin_unlock_bh(&x->lock);
84 84
85 skb->nh.raw = skb->data; 85 skb_reset_network_header(skb);
86 86
87 if (!(skb->dst = dst_pop(dst))) { 87 if (!(skb->dst = dst_pop(dst))) {
88 err = -EHOSTUNREACH; 88 err = -EHOSTUNREACH;
diff --git a/net/irda/irlap_frame.c b/net/irda/irlap_frame.c
index 1b7e2490e2e1..7c815de4a3bf 100644
--- a/net/irda/irlap_frame.c
+++ b/net/irda/irlap_frame.c
@@ -94,7 +94,8 @@ void irlap_queue_xmit(struct irlap_cb *self, struct sk_buff *skb)
94 /* Some common init stuff */ 94 /* Some common init stuff */
95 skb->dev = self->netdev; 95 skb->dev = self->netdev;
96 skb_reset_mac_header(skb); 96 skb_reset_mac_header(skb);
97 skb->h.raw = skb->nh.raw = skb->data; 97 skb_reset_network_header(skb);
98 skb->h.raw = skb->data;
98 skb->protocol = htons(ETH_P_IRDA); 99 skb->protocol = htons(ETH_P_IRDA);
99 skb->priority = TC_PRIO_BESTEFFORT; 100 skb->priority = TC_PRIO_BESTEFFORT;
100 101
diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c
index acc94214bde6..a485496059c6 100644
--- a/net/iucv/af_iucv.c
+++ b/net/iucv/af_iucv.c
@@ -954,7 +954,7 @@ static void iucv_callback_rx(struct iucv_path *path, struct iucv_message *msg)
954 } 954 }
955 955
956 skb->h.raw = skb->data; 956 skb->h.raw = skb->data;
957 skb->nh.raw = skb->data; 957 skb_reset_network_header(skb);
958 skb->len = msg->length; 958 skb->len = msg->length;
959 } 959 }
960 960
diff --git a/net/llc/llc_sap.c b/net/llc/llc_sap.c
index 5fa31117e46b..e76bbbfb64bd 100644
--- a/net/llc/llc_sap.c
+++ b/net/llc/llc_sap.c
@@ -38,7 +38,8 @@ struct sk_buff *llc_alloc_frame(struct sock *sk, struct net_device *dev)
38 if (skb) { 38 if (skb) {
39 skb_reset_mac_header(skb); 39 skb_reset_mac_header(skb);
40 skb_reserve(skb, 50); 40 skb_reserve(skb, 50);
41 skb->nh.raw = skb->h.raw = skb->data; 41 skb_reset_network_header(skb);
42 skb->h.raw = skb->data;
42 skb->protocol = htons(ETH_P_802_2); 43 skb->protocol = htons(ETH_P_802_2);
43 skb->dev = dev; 44 skb->dev = dev;
44 if (sk != NULL) 45 if (sk != NULL)
diff --git a/net/netrom/nr_dev.c b/net/netrom/nr_dev.c
index 17c3f1ef83e9..c7b5d930e732 100644
--- a/net/netrom/nr_dev.c
+++ b/net/netrom/nr_dev.c
@@ -57,7 +57,7 @@ int nr_rx_ip(struct sk_buff *skb, struct net_device *dev)
57 /* Spoof incoming device */ 57 /* Spoof incoming device */
58 skb->dev = dev; 58 skb->dev = dev;
59 skb_reset_mac_header(skb); 59 skb_reset_mac_header(skb);
60 skb->nh.raw = skb->data; 60 skb_reset_network_header(skb);
61 skb->pkt_type = PACKET_HOST; 61 skb->pkt_type = PACKET_HOST;
62 62
63 netif_rx(skb); 63 netif_rx(skb);
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 73cb2d3e27d2..1225e751b3f1 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -401,14 +401,14 @@ static int packet_sendmsg_spkt(struct kiocb *iocb, struct socket *sock,
401 * notable one here. This should really be fixed at the driver level. 401 * notable one here. This should really be fixed at the driver level.
402 */ 402 */
403 skb_reserve(skb, LL_RESERVED_SPACE(dev)); 403 skb_reserve(skb, LL_RESERVED_SPACE(dev));
404 skb->nh.raw = skb->data; 404 skb_reset_network_header(skb);
405 405
406 /* Try to align data part correctly */ 406 /* Try to align data part correctly */
407 if (dev->hard_header) { 407 if (dev->hard_header) {
408 skb->data -= dev->hard_header_len; 408 skb->data -= dev->hard_header_len;
409 skb->tail -= dev->hard_header_len; 409 skb->tail -= dev->hard_header_len;
410 if (len < dev->hard_header_len) 410 if (len < dev->hard_header_len)
411 skb->nh.raw = skb->data; 411 skb_reset_network_header(skb);
412 } 412 }
413 413
414 /* Returns -EFAULT on error */ 414 /* Returns -EFAULT on error */
@@ -768,7 +768,7 @@ static int packet_sendmsg(struct kiocb *iocb, struct socket *sock,
768 goto out_unlock; 768 goto out_unlock;
769 769
770 skb_reserve(skb, LL_RESERVED_SPACE(dev)); 770 skb_reserve(skb, LL_RESERVED_SPACE(dev));
771 skb->nh.raw = skb->data; 771 skb_reset_network_header(skb);
772 772
773 if (dev->hard_header) { 773 if (dev->hard_header) {
774 int res; 774 int res;
diff --git a/net/tipc/eth_media.c b/net/tipc/eth_media.c
index 03a9db364538..67bb29b44d1b 100644
--- a/net/tipc/eth_media.c
+++ b/net/tipc/eth_media.c
@@ -73,7 +73,7 @@ static int send_msg(struct sk_buff *buf, struct tipc_bearer *tb_ptr,
73 73
74 clone = skb_clone(buf, GFP_ATOMIC); 74 clone = skb_clone(buf, GFP_ATOMIC);
75 if (clone) { 75 if (clone) {
76 clone->nh.raw = clone->data; 76 skb_reset_network_header(clone);
77 dev = ((struct eth_bearer *)(tb_ptr->usr_handle))->dev; 77 dev = ((struct eth_bearer *)(tb_ptr->usr_handle))->dev;
78 clone->dev = dev; 78 clone->dev = dev;
79 dev->hard_header(clone, dev, ETH_P_TIPC, 79 dev->hard_header(clone, dev, ETH_P_TIPC,
diff --git a/net/x25/x25_dev.c b/net/x25/x25_dev.c
index c7221de98a95..94fd12f3a909 100644
--- a/net/x25/x25_dev.c
+++ b/net/x25/x25_dev.c
@@ -191,7 +191,7 @@ void x25_send_frame(struct sk_buff *skb, struct x25_neigh *nb)
191{ 191{
192 unsigned char *dptr; 192 unsigned char *dptr;
193 193
194 skb->nh.raw = skb->data; 194 skb_reset_network_header(skb);
195 195
196 switch (nb->dev->type) { 196 switch (nb->dev->type) {
197 case ARPHRD_X25: 197 case ARPHRD_X25: