[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>
diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c
index 74062dc..1a6aeac 100644
--- a/drivers/block/aoe/aoecmd.c
+++ b/drivers/block/aoe/aoecmd.c
@@ -28,7 +28,7 @@
skb = alloc_skb(len, GFP_ATOMIC);
if (skb) {
skb_reset_mac_header(skb);
- skb->nh.raw = skb->data;
+ skb_reset_network_header(skb);
skb->protocol = __constant_htons(ETH_P_AOE);
skb->priority = 0;
skb->next = skb->prev = NULL;
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c
index b5cf2a6..4dd7120 100644
--- a/drivers/net/cxgb3/sge.c
+++ b/drivers/net/cxgb3/sge.c
@@ -1621,7 +1621,8 @@
{
rq->offload_pkts++;
skb_reset_mac_header(skb);
- skb->nh.raw = skb->h.raw = skb->data;
+ skb_reset_network_header(skb);
+ skb->h.raw = skb->data;
if (rq->polling) {
rx_gather[gather_idx++] = skb;
diff --git a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c
index d254269..656f278 100644
--- a/drivers/net/hamradio/bpqether.c
+++ b/drivers/net/hamradio/bpqether.c
@@ -282,7 +282,7 @@
}
skb->protocol = ax25_type_trans(skb, dev);
- skb->nh.raw = skb->data;
+ skb_reset_network_header(skb);
dev->hard_header(skb, dev, ETH_P_BPQ, bpq->dest_addr, NULL, 0);
bpq->stats.tx_packets++;
bpq->stats.tx_bytes+=skb->len;
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
index a71d8e0..af476d2 100644
--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -91,7 +91,7 @@
break;
skb_reserve(nskb, 32);
skb_set_mac_header(nskb, -ETH_HLEN);
- nskb->nh.raw = nskb->data;
+ skb_reset_network_header(nskb);
iph = nskb->nh.iph;
memcpy(nskb->data, skb->nh.raw, doffset);
if (skb_copy_bits(skb,
diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c
index 3080a44..e947906 100644
--- a/drivers/net/pppoe.c
+++ b/drivers/net/pppoe.c
@@ -799,7 +799,7 @@
/* Reserve space for headers. */
skb_reserve(skb, dev->hard_header_len);
- skb->nh.raw = skb->data;
+ skb_reset_network_header(skb);
skb->dev = dev;
@@ -884,7 +884,7 @@
memcpy(ph, &hdr, sizeof(struct pppoe_hdr));
skb2->protocol = __constant_htons(ETH_P_PPP_SES);
- skb2->nh.raw = skb2->data;
+ skb_reset_network_header(skb2);
skb2->dev = dev;
diff --git a/drivers/net/wan/hdlc_cisco.c b/drivers/net/wan/hdlc_cisco.c
index c9664fd..00e0aaa 100644
--- a/drivers/net/wan/hdlc_cisco.c
+++ b/drivers/net/wan/hdlc_cisco.c
@@ -124,7 +124,7 @@
skb_put(skb, sizeof(struct cisco_packet));
skb->priority = TC_PRIO_CONTROL;
skb->dev = dev;
- skb->nh.raw = skb->data;
+ skb_reset_network_header(skb);
dev_queue_xmit(skb);
}
diff --git a/drivers/net/wan/hdlc_fr.c b/drivers/net/wan/hdlc_fr.c
index 3240d10..b747228 100644
--- a/drivers/net/wan/hdlc_fr.c
+++ b/drivers/net/wan/hdlc_fr.c
@@ -590,7 +590,7 @@
skb_put(skb, i);
skb->priority = TC_PRIO_CONTROL;
skb->dev = dev;
- skb->nh.raw = skb->data;
+ skb_reset_network_header(skb);
dev_queue_xmit(skb);
}
diff --git a/drivers/net/wan/lmc/lmc_main.c b/drivers/net/wan/lmc/lmc_main.c
index 6d28883..d4851465 100644
--- a/drivers/net/wan/lmc/lmc_main.c
+++ b/drivers/net/wan/lmc/lmc_main.c
@@ -1668,7 +1668,7 @@
skb->protocol = lmc_proto_type(sc, skb);
skb->protocol = htons(ETH_P_WAN_PPP);
skb_reset_mac_header(skb);
-// skb->nh.raw = skb->data;
+ /* skb_reset_network_header(skb); */
skb->dev = dev;
lmc_proto_netif(sc, skb);
@@ -1706,7 +1706,7 @@
nsb->protocol = lmc_proto_type(sc, skb);
skb_reset_mac_header(nsb);
-// nsb->nh.raw = nsb->data;
+ /* skb_reset_network_header(nsb); */
nsb->dev = dev;
lmc_proto_netif(sc, nsb);
}
diff --git a/drivers/net/wireless/hostap/hostap_80211_rx.c b/drivers/net/wireless/hostap/hostap_80211_rx.c
index e4082f9..7b7c1ca 100644
--- a/drivers/net/wireless/hostap/hostap_80211_rx.c
+++ b/drivers/net/wireless/hostap/hostap_80211_rx.c
@@ -1076,8 +1076,8 @@
skb2->dev = dev;
skb2->protocol = __constant_htons(ETH_P_802_3);
skb_reset_mac_header(skb2);
- skb2->nh.raw = skb2->data;
- /* skb2->nh.raw = skb2->data + ETH_HLEN; */
+ skb_reset_network_header(skb2);
+ /* skb2->nh.raw += ETH_HLEN; */
dev_queue_xmit(skb2);
}
diff --git a/drivers/net/wireless/hostap/hostap_ap.c b/drivers/net/wireless/hostap/hostap_ap.c
index cc18f96..797d950 100644
--- a/drivers/net/wireless/hostap/hostap_ap.c
+++ b/drivers/net/wireless/hostap/hostap_ap.c
@@ -983,7 +983,7 @@
skb->dev = dev;
skb_reset_mac_header(skb);
- skb->nh.raw = skb->data;
+ skb_reset_network_header(skb);
dev_queue_xmit(skb);
}
#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */
diff --git a/drivers/net/wireless/hostap/hostap_main.c b/drivers/net/wireless/hostap/hostap_main.c
index c2616e7..1f9edd9 100644
--- a/drivers/net/wireless/hostap/hostap_main.c
+++ b/drivers/net/wireless/hostap/hostap_main.c
@@ -1064,7 +1064,7 @@
skb->dev = dev;
skb_reset_mac_header(skb);
- skb->nh.raw = skb->data;
+ skb_reset_network_header(skb);
dev_queue_xmit(skb);
return 0;
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index dff81af..6440c78 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -960,6 +960,11 @@
skb->tail += len;
}
+static inline void skb_reset_network_header(struct sk_buff *skb)
+{
+ skb->nh.raw = skb->data;
+}
+
static inline unsigned char *skb_mac_header(const struct sk_buff *skb)
{
return skb->mac.raw;
diff --git a/include/net/llc_pdu.h b/include/net/llc_pdu.h
index 4e62099..778f75a 100644
--- a/include/net/llc_pdu.h
+++ b/include/net/llc_pdu.h
@@ -235,7 +235,7 @@
struct llc_pdu_un *pdu;
skb_push(skb, hlen);
- skb->nh.raw = skb->data;
+ skb_reset_network_header(skb);
pdu = llc_pdu_un_hdr(skb);
pdu->dsap = dsap;
pdu->ssap = ssap;
diff --git a/net/appletalk/aarp.c b/net/appletalk/aarp.c
index d89d62f..d4e5ba2 100644
--- a/net/appletalk/aarp.c
+++ b/net/appletalk/aarp.c
@@ -539,7 +539,7 @@
int hash;
struct aarp_entry *a;
- skb->nh.raw = skb->data;
+ skb_reset_network_header(skb);
/* Check for LocalTalk first */
if (dev->type == ARPHRD_LOCALTLK) {
diff --git a/net/atm/mpc.c b/net/atm/mpc.c
index cb3c004..bc15728 100644
--- a/net/atm/mpc.c
+++ b/net/atm/mpc.c
@@ -713,7 +713,7 @@
skb_push(new_skb, eg->ctrl_info.DH_length); /* add MAC header */
memcpy(new_skb->data, eg->ctrl_info.DLL_header, eg->ctrl_info.DH_length);
new_skb->protocol = eth_type_trans(new_skb, dev);
- new_skb->nh.raw = new_skb->data;
+ skb_reset_network_header(new_skb);
eg->latest_ip_addr = new_skb->nh.iph->saddr;
eg->packets_rcvd++;
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index c89e4f6..b1a4d60 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -1548,7 +1548,7 @@
goto out;
}
- skb->nh.raw = skb->data;
+ skb_reset_network_header(skb);
/* Add the PID if one is not supplied by the user in the skb */
if (!ax25->pidincl) {
diff --git a/net/ax25/ax25_ds_subr.c b/net/ax25/ax25_ds_subr.c
index 9569dd3..a49773f 100644
--- a/net/ax25/ax25_ds_subr.c
+++ b/net/ax25/ax25_ds_subr.c
@@ -136,7 +136,7 @@
if ((skb = alloc_skb(2, GFP_ATOMIC)) == NULL)
return;
- skb->nh.raw = skb->data;
+ skb_reset_network_header(skb);
p = skb_put(skb, 2);
*p++ = cmd;
diff --git a/net/ax25/ax25_in.c b/net/ax25/ax25_in.c
index 6d11b06..3b2aac6 100644
--- a/net/ax25/ax25_in.c
+++ b/net/ax25/ax25_in.c
@@ -61,8 +61,8 @@
skb_reserve(skbn, AX25_MAX_HEADER_LEN);
skbn->dev = ax25->ax25_dev->dev;
+ skb_reset_network_header(skbn);
skbn->h.raw = skbn->data;
- skbn->nh.raw = skbn->data;
/* Copy data from the fragments */
while ((skbo = skb_dequeue(&ax25->frag_queue)) != NULL) {
@@ -123,7 +123,7 @@
skb_pull(skb, 1); /* Remove PID */
skb_reset_mac_header(skb);
- skb->nh.raw = skb->data;
+ skb_reset_network_header(skb);
skb->dev = ax25->ax25_dev->dev;
skb->pkt_type = PACKET_HOST;
skb->protocol = htons(ETH_P_IP);
@@ -247,7 +247,7 @@
case AX25_P_IP:
skb_pull(skb,2); /* drop PID/CTRL */
skb->h.raw = skb->data;
- skb->nh.raw = skb->data;
+ skb_reset_network_header(skb);
skb->dev = dev;
skb->pkt_type = PACKET_HOST;
skb->protocol = htons(ETH_P_IP);
@@ -257,7 +257,7 @@
case AX25_P_ARP:
skb_pull(skb,2);
skb->h.raw = skb->data;
- skb->nh.raw = skb->data;
+ skb_reset_network_header(skb);
skb->dev = dev;
skb->pkt_type = PACKET_HOST;
skb->protocol = htons(ETH_P_ARP);
diff --git a/net/ax25/ax25_ip.c b/net/ax25/ax25_ip.c
index 7f818bb..4d4ef35 100644
--- a/net/ax25/ax25_ip.c
+++ b/net/ax25/ax25_ip.c
@@ -171,7 +171,7 @@
src_c = *(ax25_address *)(bp + 8);
skb_pull(ourskb, AX25_HEADER_LEN - 1); /* Keep PID */
- ourskb->nh.raw = ourskb->data;
+ skb_reset_network_header(ourskb);
ax25=ax25_send_frame(
ourskb,
diff --git a/net/ax25/ax25_out.c b/net/ax25/ax25_out.c
index 2238350..6e08dc8 100644
--- a/net/ax25/ax25_out.c
+++ b/net/ax25/ax25_out.c
@@ -205,7 +205,7 @@
if (skb == NULL)
return;
- skb->nh.raw = skb->data;
+ skb_reset_network_header(skb);
if (ax25->modulus == AX25_MODULUS) {
frame = skb_push(skb, 1);
diff --git a/net/ax25/ax25_subr.c b/net/ax25/ax25_subr.c
index b6c577e..5fe9b2a 100644
--- a/net/ax25/ax25_subr.c
+++ b/net/ax25/ax25_subr.c
@@ -162,7 +162,7 @@
skb_reserve(skb, ax25->ax25_dev->dev->hard_header_len);
- skb->nh.raw = skb->data;
+ skb_reset_network_header(skb);
/* Assume a response - address structure for DTE */
if (ax25->modulus == AX25_MODULUS) {
@@ -205,7 +205,7 @@
return; /* Next SABM will get DM'd */
skb_reserve(skb, dev->hard_header_len);
- skb->nh.raw = skb->data;
+ skb_reset_network_header(skb);
ax25_digi_invert(digi, &retdigi);
diff --git a/net/core/dev.c b/net/core/dev.c
index 560560f..1b07582 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1074,7 +1074,7 @@
printk(KERN_CRIT "protocol %04x is "
"buggy, dev %s\n",
skb2->protocol, dev->name);
- skb2->nh.raw = skb2->data;
+ skb_reset_network_header(skb2);
}
skb2->h.raw = skb2->nh.raw;
@@ -1771,7 +1771,8 @@
__get_cpu_var(netdev_rx_stat).total++;
- skb->h.raw = skb->nh.raw = skb->data;
+ skb_reset_network_header(skb);
+ skb->h.raw = skb->data;
skb->mac_len = skb->nh.raw - skb->mac.raw;
pt_prev = NULL;
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 0ad3896..b4d1cdd 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -359,7 +359,8 @@
(2 * sizeof(u32)))))
return;
- skb->h.raw = skb->nh.raw = skb->data;
+ skb_reset_network_header(skb);
+ skb->h.raw = skb->data;
arp = skb->nh.arph;
if ((arp->ar_hrd != htons(ARPHRD_ETHER) &&
@@ -389,7 +390,7 @@
if (!send_skb)
return;
- send_skb->nh.raw = send_skb->data;
+ skb_reset_network_header(send_skb);
arp = (struct arphdr *) skb_put(send_skb, size);
send_skb->dev = skb->dev;
send_skb->protocol = htons(ETH_P_ARP);
diff --git a/net/decnet/dn_dev.c b/net/decnet/dn_dev.c
index 060d725..95871a6 100644
--- a/net/decnet/dn_dev.c
+++ b/net/decnet/dn_dev.c
@@ -913,7 +913,7 @@
pktlen = (__le16 *)skb_push(skb,2);
*pktlen = dn_htons(skb->len - 2);
- skb->nh.raw = skb->data;
+ skb_reset_network_header(skb);
dn_rt_finish_output(skb, dn_rt_all_rt_mcast, msg->id);
}
@@ -1005,7 +1005,7 @@
pktlen = (__le16 *)skb_push(skb, 2);
*pktlen = dn_htons(skb->len - 2);
- skb->nh.raw = skb->data;
+ skb_reset_network_header(skb);
if (dn_am_i_a_router(dn, dn_db, ifa)) {
struct sk_buff *skb2 = skb_copy(skb, GFP_ATOMIC);
diff --git a/net/decnet/dn_neigh.c b/net/decnet/dn_neigh.c
index bf701cf..4bf066c 100644
--- a/net/decnet/dn_neigh.c
+++ b/net/decnet/dn_neigh.c
@@ -261,7 +261,7 @@
lp->s_class = 0;
lp->pt = 0;
- skb->nh.raw = skb->data;
+ skb_reset_network_header(skb);
return NF_HOOK(PF_DECnet, NF_DN_POST_ROUTING, skb, NULL, neigh->dev, dn_neigh_output_packet);
}
@@ -300,7 +300,7 @@
sp->srcnode = cb->src;
sp->forward = cb->hops & 0x3f;
- skb->nh.raw = skb->data;
+ skb_reset_network_header(skb);
return NF_HOOK(PF_DECnet, NF_DN_POST_ROUTING, skb, NULL, neigh->dev, dn_neigh_output_packet);
}
@@ -342,7 +342,7 @@
sp->srcnode = cb->src & dn_htons(0x03ff);
sp->forward = cb->hops & 0x3f;
- skb->nh.raw = skb->data;
+ skb_reset_network_header(skb);
return NF_HOOK(PF_DECnet, NF_DN_POST_ROUTING, skb, NULL, neigh->dev, dn_neigh_output_packet);
}
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c
index ef94ca5..34079b7 100644
--- a/net/decnet/dn_route.c
+++ b/net/decnet/dn_route.c
@@ -615,7 +615,7 @@
flags = *skb->data;
}
- skb->nh.raw = skb->data;
+ skb_reset_network_header(skb);
/*
* Weed out future version DECnet
diff --git a/net/econet/af_econet.c b/net/econet/af_econet.c
index 487f879..099543f 100644
--- a/net/econet/af_econet.c
+++ b/net/econet/af_econet.c
@@ -345,7 +345,7 @@
goto out_unlock;
skb_reserve(skb, LL_RESERVED_SPACE(dev));
- skb->nh.raw = skb->data;
+ skb_reset_network_header(skb);
eb = (struct ec_cb *)&skb->cb;
diff --git a/net/ieee80211/ieee80211_rx.c b/net/ieee80211/ieee80211_rx.c
index f39bf7c..be5ffaf 100644
--- a/net/ieee80211/ieee80211_rx.c
+++ b/net/ieee80211/ieee80211_rx.c
@@ -792,7 +792,7 @@
skb2->dev = dev;
skb2->protocol = __constant_htons(ETH_P_802_3);
skb_reset_mac_header(skb2);
- skb2->nh.raw = skb2->data;
+ skb_reset_network_header(skb2);
/* skb2->nh.raw = skb2->data + ETH_HLEN; */
dev_queue_xmit(skb2);
}
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index e6e196c..8c533ce 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -578,7 +578,7 @@
return NULL;
skb_reserve(skb, LL_RESERVED_SPACE(dev));
- skb->nh.raw = skb->data;
+ skb_reset_network_header(skb);
arp = (struct arphdr *) skb_put(skb,sizeof(struct arphdr) + 2*(dev->addr_len+4));
skb->dev = dev;
skb->protocol = htons(ETH_P_ARP);
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 88f8aae..ced2c4b 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -474,7 +474,7 @@
dst_release(skb2->dst);
skb2->dst = NULL;
skb_pull(skb2, skb->data - (u8*)eiph);
- skb2->nh.raw = skb2->data;
+ skb_reset_network_header(skb2);
/* Try to guess incoming interface */
memset(&fl, 0, sizeof(fl));
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index ddba857..32f1a23 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -593,7 +593,7 @@
ip_copy_metadata(skb2, skb);
skb_reserve(skb2, ll_rs);
skb_put(skb2, len + hlen);
- skb2->nh.raw = skb2->data;
+ skb_reset_network_header(skb2);
skb2->h.raw = skb2->data + hlen;
/*
@@ -722,7 +722,7 @@
skb_put(skb,fragheaderlen + transhdrlen);
/* initialize network header pointer */
- skb->nh.raw = skb->data;
+ skb_reset_network_header(skb);
/* initialize protocol header pointer */
skb->h.raw = skb->data + fragheaderlen;
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
index 3ec5ce0..5f886c8 100644
--- a/net/ipv4/ipip.c
+++ b/net/ipv4/ipip.c
@@ -405,7 +405,7 @@
dst_release(skb2->dst);
skb2->dst = NULL;
skb_pull(skb2, skb->data - (u8*)eiph);
- skb2->nh.raw = skb2->data;
+ skb_reset_network_header(skb2);
/* Try to guess incoming interface */
memset(&fl, 0, sizeof(fl));
@@ -487,7 +487,7 @@
secpath_reset(skb);
skb->mac.raw = skb->nh.raw;
- skb->nh.raw = skb->data;
+ skb_reset_network_header(skb);
skb->protocol = htons(ETH_P_IP);
skb->pkt_type = PACKET_HOST;
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 486ab93..d2986184 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2748,7 +2748,7 @@
through good chunk of routing engine.
*/
skb_reset_mac_header(skb);
- skb->nh.raw = skb->data;
+ skb_reset_network_header(skb);
/* Bugfix: need to give ip_route_input enough of an IP header to not gag. */
skb->nh.iph->protocol = IPPROTO_ICMP;
diff --git a/net/ipv4/xfrm4_mode_tunnel.c b/net/ipv4/xfrm4_mode_tunnel.c
index 8e123e3..ffc6005 100644
--- a/net/ipv4/xfrm4_mode_tunnel.c
+++ b/net/ipv4/xfrm4_mode_tunnel.c
@@ -129,7 +129,7 @@
old_mac = skb_mac_header(skb);
skb_set_mac_header(skb, -skb->mac_len);
memmove(skb_mac_header(skb), old_mac, skb->mac_len);
- skb->nh.raw = skb->data;
+ skb_reset_network_header(skb);
err = 0;
out:
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index a5f4562..4406546 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -735,7 +735,7 @@
ip6_copy_metadata(frag, skb);
skb_reserve(frag, LL_RESERVED_SPACE(rt->u.dst.dev));
skb_put(frag, len + hlen + sizeof(struct frag_hdr));
- frag->nh.raw = frag->data;
+ skb_reset_network_header(frag);
fh = (struct frag_hdr*)(frag->data + hlen);
frag->h.raw = frag->data + hlen + sizeof(struct frag_hdr);
@@ -976,7 +976,7 @@
skb_put(skb,fragheaderlen + transhdrlen);
/* initialize network header pointer */
- skb->nh.raw = skb->data;
+ skb_reset_network_header(skb);
/* initialize protocol header pointer */
skb->h.raw = skb->data + fragheaderlen;
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c
index d8c84d8..30df8e6c 100644
--- a/net/ipv6/ip6_tunnel.c
+++ b/net/ipv6/ip6_tunnel.c
@@ -525,7 +525,7 @@
dst_release(skb2->dst);
skb2->dst = NULL;
skb_pull(skb2, offset);
- skb2->nh.raw = skb2->data;
+ skb_reset_network_header(skb2);
eiph = skb2->nh.iph;
/* Try to guess incoming interface */
@@ -599,7 +599,7 @@
dst_release(skb2->dst);
skb2->dst = NULL;
skb_pull(skb2, offset);
- skb2->nh.raw = skb2->data;
+ skb_reset_network_header(skb2);
/* Try to guess incoming interface */
rt = rt6_lookup(&skb2->nh.ipv6h->saddr, NULL, 0, 0);
@@ -704,7 +704,7 @@
}
secpath_reset(skb);
skb->mac.raw = skb->nh.raw;
- skb->nh.raw = skb->data;
+ skb_reset_network_header(skb);
skb->protocol = htons(protocol);
skb->pkt_type = PACKET_HOST;
memset(skb->cb, 0, sizeof(struct inet6_skb_parm));
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 08d6ed3..0477728 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -340,7 +340,7 @@
dst_release(skb2->dst);
skb2->dst = NULL;
skb_pull(skb2, skb->data - (u8*)iph6);
- skb2->nh.raw = skb2->data;
+ skb_reset_network_header(skb2);
/* Try to guess incoming interface */
rt6i = rt6_lookup(&iph6->saddr, NULL, NULL, 0);
@@ -383,7 +383,7 @@
if ((tunnel = ipip6_tunnel_lookup(iph->saddr, iph->daddr)) != NULL) {
secpath_reset(skb);
skb->mac.raw = skb->nh.raw;
- skb->nh.raw = skb->data;
+ skb_reset_network_header(skb);
IPCB(skb)->flags = 0;
skb->protocol = htons(ETH_P_IPV6);
skb->pkt_type = PACKET_HOST;
diff --git a/net/ipv6/xfrm6_mode_beet.c b/net/ipv6/xfrm6_mode_beet.c
index 79364b1..c015bfd 100644
--- a/net/ipv6/xfrm6_mode_beet.c
+++ b/net/ipv6/xfrm6_mode_beet.c
@@ -45,7 +45,7 @@
skb->h.raw = skb->data + hdr_len;
memmove(skb->data, iph, hdr_len);
- skb->nh.raw = skb->data;
+ skb_reset_network_header(skb);
top_iph = skb->nh.ipv6h;
skb->nh.raw = &top_iph->nexthdr;
skb->h.ipv6h = top_iph + 1;
@@ -68,7 +68,7 @@
skb_push(skb, size);
memmove(skb->data, skb->nh.raw, size);
- skb->nh.raw = skb->data;
+ skb_reset_network_header(skb);
old_mac = skb_mac_header(skb);
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 5bb0677..8ce5ef2 100644
--- a/net/ipv6/xfrm6_mode_tunnel.c
+++ b/net/ipv6/xfrm6_mode_tunnel.c
@@ -53,7 +53,7 @@
skb_push(skb, x->props.header_len);
iph = skb->nh.ipv6h;
- skb->nh.raw = skb->data;
+ skb_reset_network_header(skb);
top_iph = skb->nh.ipv6h;
skb->nh.raw = &top_iph->nexthdr;
skb->h.ipv6h = top_iph + 1;
@@ -111,7 +111,7 @@
old_mac = skb_mac_header(skb);
skb_set_mac_header(skb, -skb->mac_len);
memmove(skb_mac_header(skb), old_mac, skb->mac_len);
- skb->nh.raw = skb->data;
+ skb_reset_network_header(skb);
err = 0;
out:
diff --git a/net/ipv6/xfrm6_output.c b/net/ipv6/xfrm6_output.c
index c52e9d6..56364a5 100644
--- a/net/ipv6/xfrm6_output.c
+++ b/net/ipv6/xfrm6_output.c
@@ -82,7 +82,7 @@
spin_unlock_bh(&x->lock);
- skb->nh.raw = skb->data;
+ skb_reset_network_header(skb);
if (!(skb->dst = dst_pop(dst))) {
err = -EHOSTUNREACH;
diff --git a/net/irda/irlap_frame.c b/net/irda/irlap_frame.c
index 1b7e249..7c815de 100644
--- a/net/irda/irlap_frame.c
+++ b/net/irda/irlap_frame.c
@@ -94,7 +94,8 @@
/* Some common init stuff */
skb->dev = self->netdev;
skb_reset_mac_header(skb);
- skb->h.raw = skb->nh.raw = skb->data;
+ skb_reset_network_header(skb);
+ skb->h.raw = skb->data;
skb->protocol = htons(ETH_P_IRDA);
skb->priority = TC_PRIO_BESTEFFORT;
diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c
index acc9421..a485496 100644
--- a/net/iucv/af_iucv.c
+++ b/net/iucv/af_iucv.c
@@ -954,7 +954,7 @@
}
skb->h.raw = skb->data;
- skb->nh.raw = skb->data;
+ skb_reset_network_header(skb);
skb->len = msg->length;
}
diff --git a/net/llc/llc_sap.c b/net/llc/llc_sap.c
index 5fa3111..e76bbbf 100644
--- a/net/llc/llc_sap.c
+++ b/net/llc/llc_sap.c
@@ -38,7 +38,8 @@
if (skb) {
skb_reset_mac_header(skb);
skb_reserve(skb, 50);
- skb->nh.raw = skb->h.raw = skb->data;
+ skb_reset_network_header(skb);
+ skb->h.raw = skb->data;
skb->protocol = htons(ETH_P_802_2);
skb->dev = dev;
if (sk != NULL)
diff --git a/net/netrom/nr_dev.c b/net/netrom/nr_dev.c
index 17c3f1e..c7b5d93 100644
--- a/net/netrom/nr_dev.c
+++ b/net/netrom/nr_dev.c
@@ -57,7 +57,7 @@
/* Spoof incoming device */
skb->dev = dev;
skb_reset_mac_header(skb);
- skb->nh.raw = skb->data;
+ skb_reset_network_header(skb);
skb->pkt_type = PACKET_HOST;
netif_rx(skb);
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 73cb2d3..1225e75 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -401,14 +401,14 @@
* notable one here. This should really be fixed at the driver level.
*/
skb_reserve(skb, LL_RESERVED_SPACE(dev));
- skb->nh.raw = skb->data;
+ skb_reset_network_header(skb);
/* Try to align data part correctly */
if (dev->hard_header) {
skb->data -= dev->hard_header_len;
skb->tail -= dev->hard_header_len;
if (len < dev->hard_header_len)
- skb->nh.raw = skb->data;
+ skb_reset_network_header(skb);
}
/* Returns -EFAULT on error */
@@ -768,7 +768,7 @@
goto out_unlock;
skb_reserve(skb, LL_RESERVED_SPACE(dev));
- skb->nh.raw = skb->data;
+ skb_reset_network_header(skb);
if (dev->hard_header) {
int res;
diff --git a/net/tipc/eth_media.c b/net/tipc/eth_media.c
index 03a9db3..67bb29b 100644
--- a/net/tipc/eth_media.c
+++ b/net/tipc/eth_media.c
@@ -73,7 +73,7 @@
clone = skb_clone(buf, GFP_ATOMIC);
if (clone) {
- clone->nh.raw = clone->data;
+ skb_reset_network_header(clone);
dev = ((struct eth_bearer *)(tb_ptr->usr_handle))->dev;
clone->dev = dev;
dev->hard_header(clone, dev, ETH_P_TIPC,
diff --git a/net/x25/x25_dev.c b/net/x25/x25_dev.c
index c7221de..94fd12f 100644
--- a/net/x25/x25_dev.c
+++ b/net/x25/x25_dev.c
@@ -191,7 +191,7 @@
{
unsigned char *dptr;
- skb->nh.raw = skb->data;
+ skb_reset_network_header(skb);
switch (nb->dev->type) {
case ARPHRD_X25: