diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2007-03-19 18:33:04 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:24:41 -0400 |
commit | 98e399f82ab3a6d863d1d4a7ea48925cc91c830e (patch) | |
tree | 5f84043aeec1ec27c2e8e6cc25b5d2e6c3d07343 | |
parent | 31713c333ddbb66d694829082620b69b71c4b09a (diff) |
[SK_BUFF]: Introduce skb_mac_header()
For the places where we need a pointer to the mac header, it is still legal to
touch skb->mac.raw directly if just adding to, subtracting from or setting it
to another layer header.
This one also converts some more cases to skb_reset_mac_header() that my
regex missed as it had no spaces before nor after '=', ugh.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
49 files changed, 108 insertions, 88 deletions
diff --git a/arch/um/drivers/daemon_kern.c b/arch/um/drivers/daemon_kern.c index 9c2e7a758f21..adeece11e596 100644 --- a/arch/um/drivers/daemon_kern.c +++ b/arch/um/drivers/daemon_kern.c | |||
@@ -46,7 +46,7 @@ static int daemon_read(int fd, struct sk_buff **skb, | |||
46 | { | 46 | { |
47 | *skb = ether_adjust_skb(*skb, ETH_HEADER_OTHER); | 47 | *skb = ether_adjust_skb(*skb, ETH_HEADER_OTHER); |
48 | if(*skb == NULL) return(-ENOMEM); | 48 | if(*skb == NULL) return(-ENOMEM); |
49 | return(net_recvfrom(fd, (*skb)->mac.raw, | 49 | return(net_recvfrom(fd, skb_mac_header(*skb), |
50 | (*skb)->dev->mtu + ETH_HEADER_OTHER)); | 50 | (*skb)->dev->mtu + ETH_HEADER_OTHER)); |
51 | } | 51 | } |
52 | 52 | ||
diff --git a/arch/um/drivers/mcast_kern.c b/arch/um/drivers/mcast_kern.c index 52ccb7b53cd2..e6b8e0dd72a8 100644 --- a/arch/um/drivers/mcast_kern.c +++ b/arch/um/drivers/mcast_kern.c | |||
@@ -50,7 +50,7 @@ static int mcast_read(int fd, struct sk_buff **skb, struct uml_net_private *lp) | |||
50 | { | 50 | { |
51 | *skb = ether_adjust_skb(*skb, ETH_HEADER_OTHER); | 51 | *skb = ether_adjust_skb(*skb, ETH_HEADER_OTHER); |
52 | if(*skb == NULL) return(-ENOMEM); | 52 | if(*skb == NULL) return(-ENOMEM); |
53 | return(net_recvfrom(fd, (*skb)->mac.raw, | 53 | return(net_recvfrom(fd, skb_mac_header(*skb), |
54 | (*skb)->dev->mtu + ETH_HEADER_OTHER)); | 54 | (*skb)->dev->mtu + ETH_HEADER_OTHER)); |
55 | } | 55 | } |
56 | 56 | ||
diff --git a/arch/um/drivers/pcap_kern.c b/arch/um/drivers/pcap_kern.c index e67362acf0e7..948849343ca4 100644 --- a/arch/um/drivers/pcap_kern.c +++ b/arch/um/drivers/pcap_kern.c | |||
@@ -36,7 +36,7 @@ static int pcap_read(int fd, struct sk_buff **skb, | |||
36 | { | 36 | { |
37 | *skb = ether_adjust_skb(*skb, ETH_HEADER_OTHER); | 37 | *skb = ether_adjust_skb(*skb, ETH_HEADER_OTHER); |
38 | if(*skb == NULL) return(-ENOMEM); | 38 | if(*skb == NULL) return(-ENOMEM); |
39 | return(pcap_user_read(fd, (*skb)->mac.raw, | 39 | return(pcap_user_read(fd, skb_mac_header(*skb), |
40 | (*skb)->dev->mtu + ETH_HEADER_OTHER, | 40 | (*skb)->dev->mtu + ETH_HEADER_OTHER, |
41 | (struct pcap_data *) &lp->user)); | 41 | (struct pcap_data *) &lp->user)); |
42 | } | 42 | } |
diff --git a/arch/um/drivers/slip_kern.c b/arch/um/drivers/slip_kern.c index 25634bd1f585..125c44f77638 100644 --- a/arch/um/drivers/slip_kern.c +++ b/arch/um/drivers/slip_kern.c | |||
@@ -49,7 +49,7 @@ static unsigned short slip_protocol(struct sk_buff *skbuff) | |||
49 | static int slip_read(int fd, struct sk_buff **skb, | 49 | static int slip_read(int fd, struct sk_buff **skb, |
50 | struct uml_net_private *lp) | 50 | struct uml_net_private *lp) |
51 | { | 51 | { |
52 | return(slip_user_read(fd, (*skb)->mac.raw, (*skb)->dev->mtu, | 52 | return(slip_user_read(fd, skb_mac_header(*skb), (*skb)->dev->mtu, |
53 | (struct slip_data *) &lp->user)); | 53 | (struct slip_data *) &lp->user)); |
54 | } | 54 | } |
55 | 55 | ||
diff --git a/arch/um/drivers/slirp_kern.c b/arch/um/drivers/slirp_kern.c index b3ed8fb874ab..0a0324a6d290 100644 --- a/arch/um/drivers/slirp_kern.c +++ b/arch/um/drivers/slirp_kern.c | |||
@@ -53,7 +53,7 @@ static unsigned short slirp_protocol(struct sk_buff *skbuff) | |||
53 | static int slirp_read(int fd, struct sk_buff **skb, | 53 | static int slirp_read(int fd, struct sk_buff **skb, |
54 | struct uml_net_private *lp) | 54 | struct uml_net_private *lp) |
55 | { | 55 | { |
56 | return(slirp_user_read(fd, (*skb)->mac.raw, (*skb)->dev->mtu, | 56 | return(slirp_user_read(fd, skb_mac_header(*skb), (*skb)->dev->mtu, |
57 | (struct slirp_data *) &lp->user)); | 57 | (struct slirp_data *) &lp->user)); |
58 | } | 58 | } |
59 | 59 | ||
diff --git a/arch/um/os-Linux/drivers/ethertap_kern.c b/arch/um/os-Linux/drivers/ethertap_kern.c index 70541821775f..12689141414d 100644 --- a/arch/um/os-Linux/drivers/ethertap_kern.c +++ b/arch/um/os-Linux/drivers/ethertap_kern.c | |||
@@ -43,7 +43,7 @@ static int etap_read(int fd, struct sk_buff **skb, struct uml_net_private *lp) | |||
43 | 43 | ||
44 | *skb = ether_adjust_skb(*skb, ETH_HEADER_ETHERTAP); | 44 | *skb = ether_adjust_skb(*skb, ETH_HEADER_ETHERTAP); |
45 | if(*skb == NULL) return(-ENOMEM); | 45 | if(*skb == NULL) return(-ENOMEM); |
46 | len = net_recvfrom(fd, (*skb)->mac.raw, | 46 | len = net_recvfrom(fd, skb_mac_header(*skb), |
47 | (*skb)->dev->mtu + 2 * ETH_HEADER_ETHERTAP); | 47 | (*skb)->dev->mtu + 2 * ETH_HEADER_ETHERTAP); |
48 | if(len <= 0) return(len); | 48 | if(len <= 0) return(len); |
49 | skb_pull(*skb, 2); | 49 | skb_pull(*skb, 2); |
diff --git a/arch/um/os-Linux/drivers/tuntap_kern.c b/arch/um/os-Linux/drivers/tuntap_kern.c index 76570a2c25c3..f1714e7fb1d0 100644 --- a/arch/um/os-Linux/drivers/tuntap_kern.c +++ b/arch/um/os-Linux/drivers/tuntap_kern.c | |||
@@ -43,7 +43,7 @@ static int tuntap_read(int fd, struct sk_buff **skb, | |||
43 | { | 43 | { |
44 | *skb = ether_adjust_skb(*skb, ETH_HEADER_OTHER); | 44 | *skb = ether_adjust_skb(*skb, ETH_HEADER_OTHER); |
45 | if(*skb == NULL) return(-ENOMEM); | 45 | if(*skb == NULL) return(-ENOMEM); |
46 | return(net_read(fd, (*skb)->mac.raw, | 46 | return(net_read(fd, skb_mac_header(*skb), |
47 | (*skb)->dev->mtu + ETH_HEADER_OTHER)); | 47 | (*skb)->dev->mtu + ETH_HEADER_OTHER)); |
48 | } | 48 | } |
49 | 49 | ||
diff --git a/drivers/block/aoe/aoe.h b/drivers/block/aoe/aoe.h index 4c34f8d31cc9..1d8466817943 100644 --- a/drivers/block/aoe/aoe.h +++ b/drivers/block/aoe/aoe.h | |||
@@ -53,7 +53,7 @@ struct aoe_hdr { | |||
53 | 53 | ||
54 | static inline struct aoe_hdr *aoe_hdr(const struct sk_buff *skb) | 54 | static inline struct aoe_hdr *aoe_hdr(const struct sk_buff *skb) |
55 | { | 55 | { |
56 | return (struct aoe_hdr *)skb->mac.raw; | 56 | return (struct aoe_hdr *)skb_mac_header(skb); |
57 | } | 57 | } |
58 | #endif | 58 | #endif |
59 | 59 | ||
diff --git a/drivers/ieee1394/eth1394.h b/drivers/ieee1394/eth1394.h index c45cbff9138d..1e8356535149 100644 --- a/drivers/ieee1394/eth1394.h +++ b/drivers/ieee1394/eth1394.h | |||
@@ -90,7 +90,7 @@ struct eth1394hdr { | |||
90 | 90 | ||
91 | static inline struct eth1394hdr *eth1394_hdr(const struct sk_buff *skb) | 91 | static inline struct eth1394hdr *eth1394_hdr(const struct sk_buff *skb) |
92 | { | 92 | { |
93 | return (struct eth1394hdr *)skb->mac.raw; | 93 | return (struct eth1394hdr *)skb_mac_header(skb); |
94 | } | 94 | } |
95 | #endif | 95 | #endif |
96 | 96 | ||
diff --git a/drivers/media/dvb/dvb-core/dvb_net.c b/drivers/media/dvb/dvb-core/dvb_net.c index 76e9c36597eb..c6b004182d91 100644 --- a/drivers/media/dvb/dvb-core/dvb_net.c +++ b/drivers/media/dvb/dvb-core/dvb_net.c | |||
@@ -174,7 +174,7 @@ static unsigned short dvb_net_eth_type_trans(struct sk_buff *skb, | |||
174 | struct ethhdr *eth; | 174 | struct ethhdr *eth; |
175 | unsigned char *rawp; | 175 | unsigned char *rawp; |
176 | 176 | ||
177 | skb->mac.raw=skb->data; | 177 | skb_reset_mac_header(skb); |
178 | skb_pull(skb,dev->hard_header_len); | 178 | skb_pull(skb,dev->hard_header_len); |
179 | eth = eth_hdr(skb); | 179 | eth = eth_hdr(skb); |
180 | 180 | ||
diff --git a/drivers/message/fusion/mptlan.c b/drivers/message/fusion/mptlan.c index d5b878d56280..21fe1b66808c 100644 --- a/drivers/message/fusion/mptlan.c +++ b/drivers/message/fusion/mptlan.c | |||
@@ -714,6 +714,7 @@ mpt_lan_sdu_send (struct sk_buff *skb, struct net_device *dev) | |||
714 | LANSendRequest_t *pSendReq; | 714 | LANSendRequest_t *pSendReq; |
715 | SGETransaction32_t *pTrans; | 715 | SGETransaction32_t *pTrans; |
716 | SGESimple64_t *pSimple; | 716 | SGESimple64_t *pSimple; |
717 | const unsigned char *mac; | ||
717 | dma_addr_t dma; | 718 | dma_addr_t dma; |
718 | unsigned long flags; | 719 | unsigned long flags; |
719 | int ctx; | 720 | int ctx; |
@@ -784,6 +785,7 @@ mpt_lan_sdu_send (struct sk_buff *skb, struct net_device *dev) | |||
784 | // IOC_AND_NETDEV_NAMES_s_s(dev), | 785 | // IOC_AND_NETDEV_NAMES_s_s(dev), |
785 | // ctx, skb, skb->data)); | 786 | // ctx, skb, skb->data)); |
786 | 787 | ||
788 | mac = skb_mac_header(skb); | ||
787 | #ifdef QLOGIC_NAA_WORKAROUND | 789 | #ifdef QLOGIC_NAA_WORKAROUND |
788 | { | 790 | { |
789 | struct NAA_Hosed *nh; | 791 | struct NAA_Hosed *nh; |
@@ -793,12 +795,12 @@ mpt_lan_sdu_send (struct sk_buff *skb, struct net_device *dev) | |||
793 | drops. */ | 795 | drops. */ |
794 | read_lock_irq(&bad_naa_lock); | 796 | read_lock_irq(&bad_naa_lock); |
795 | for (nh = mpt_bad_naa; nh != NULL; nh=nh->next) { | 797 | for (nh = mpt_bad_naa; nh != NULL; nh=nh->next) { |
796 | if ((nh->ieee[0] == skb->mac.raw[0]) && | 798 | if ((nh->ieee[0] == mac[0]) && |
797 | (nh->ieee[1] == skb->mac.raw[1]) && | 799 | (nh->ieee[1] == mac[1]) && |
798 | (nh->ieee[2] == skb->mac.raw[2]) && | 800 | (nh->ieee[2] == mac[2]) && |
799 | (nh->ieee[3] == skb->mac.raw[3]) && | 801 | (nh->ieee[3] == mac[3]) && |
800 | (nh->ieee[4] == skb->mac.raw[4]) && | 802 | (nh->ieee[4] == mac[4]) && |
801 | (nh->ieee[5] == skb->mac.raw[5])) { | 803 | (nh->ieee[5] == mac[5])) { |
802 | cur_naa = nh->NAA; | 804 | cur_naa = nh->NAA; |
803 | dlprintk ((KERN_INFO "mptlan/sdu_send: using NAA value " | 805 | dlprintk ((KERN_INFO "mptlan/sdu_send: using NAA value " |
804 | "= %04x.\n", cur_naa)); | 806 | "= %04x.\n", cur_naa)); |
@@ -810,12 +812,12 @@ mpt_lan_sdu_send (struct sk_buff *skb, struct net_device *dev) | |||
810 | #endif | 812 | #endif |
811 | 813 | ||
812 | pTrans->TransactionDetails[0] = cpu_to_le32((cur_naa << 16) | | 814 | pTrans->TransactionDetails[0] = cpu_to_le32((cur_naa << 16) | |
813 | (skb->mac.raw[0] << 8) | | 815 | (mac[0] << 8) | |
814 | (skb->mac.raw[1] << 0)); | 816 | (mac[1] << 0)); |
815 | pTrans->TransactionDetails[1] = cpu_to_le32((skb->mac.raw[2] << 24) | | 817 | pTrans->TransactionDetails[1] = cpu_to_le32((mac[2] << 24) | |
816 | (skb->mac.raw[3] << 16) | | 818 | (mac[3] << 16) | |
817 | (skb->mac.raw[4] << 8) | | 819 | (mac[4] << 8) | |
818 | (skb->mac.raw[5] << 0)); | 820 | (mac[5] << 0)); |
819 | 821 | ||
820 | pSimple = (SGESimple64_t *) &pTrans->TransactionDetails[2]; | 822 | pSimple = (SGESimple64_t *) &pTrans->TransactionDetails[2]; |
821 | 823 | ||
diff --git a/drivers/net/arcnet/capmode.c b/drivers/net/arcnet/capmode.c index 6c764b66e9cc..f6a87bd20ff2 100644 --- a/drivers/net/arcnet/capmode.c +++ b/drivers/net/arcnet/capmode.c | |||
@@ -123,7 +123,7 @@ static void rx(struct net_device *dev, int bufnum, | |||
123 | skb_put(skb, length + ARC_HDR_SIZE + sizeof(int)); | 123 | skb_put(skb, length + ARC_HDR_SIZE + sizeof(int)); |
124 | skb->dev = dev; | 124 | skb->dev = dev; |
125 | skb_reset_mac_header(skb); | 125 | skb_reset_mac_header(skb); |
126 | pkt = (struct archdr *)skb->mac.raw; | 126 | pkt = (struct archdr *)skb_mac_header(skb); |
127 | skb_pull(skb, ARC_HDR_SIZE); | 127 | skb_pull(skb, ARC_HDR_SIZE); |
128 | 128 | ||
129 | /* up to sizeof(pkt->soft) has already been copied from the card */ | 129 | /* up to sizeof(pkt->soft) has already been copied from the card */ |
@@ -269,7 +269,7 @@ static int ack_tx(struct net_device *dev, int acked) | |||
269 | ackskb->dev = dev; | 269 | ackskb->dev = dev; |
270 | 270 | ||
271 | skb_reset_mac_header(ackskb); | 271 | skb_reset_mac_header(ackskb); |
272 | ackpkt = (struct archdr *)ackskb->mac.raw; | 272 | ackpkt = (struct archdr *)skb_mac_header(ackskb); |
273 | /* skb_pull(ackskb, ARC_HDR_SIZE); */ | 273 | /* skb_pull(ackskb, ARC_HDR_SIZE); */ |
274 | 274 | ||
275 | 275 | ||
diff --git a/drivers/net/plip.c b/drivers/net/plip.c index 6bb085f54437..8754cf3356b0 100644 --- a/drivers/net/plip.c +++ b/drivers/net/plip.c | |||
@@ -546,7 +546,7 @@ static __be16 plip_type_trans(struct sk_buff *skb, struct net_device *dev) | |||
546 | struct ethhdr *eth; | 546 | struct ethhdr *eth; |
547 | unsigned char *rawp; | 547 | unsigned char *rawp; |
548 | 548 | ||
549 | skb->mac.raw=skb->data; | 549 | skb_reset_mac_header(skb); |
550 | skb_pull(skb,dev->hard_header_len); | 550 | skb_pull(skb,dev->hard_header_len); |
551 | eth = eth_hdr(skb); | 551 | eth = eth_hdr(skb); |
552 | 552 | ||
diff --git a/drivers/net/slip.c b/drivers/net/slip.c index 2f4b1de7a2b4..65bd20fac820 100644 --- a/drivers/net/slip.c +++ b/drivers/net/slip.c | |||
@@ -363,7 +363,7 @@ sl_bump(struct slip *sl) | |||
363 | } | 363 | } |
364 | skb->dev = sl->dev; | 364 | skb->dev = sl->dev; |
365 | memcpy(skb_put(skb,count), sl->rbuff, count); | 365 | memcpy(skb_put(skb,count), sl->rbuff, count); |
366 | skb->mac.raw=skb->data; | 366 | skb_reset_mac_header(skb); |
367 | skb->protocol=htons(ETH_P_IP); | 367 | skb->protocol=htons(ETH_P_IP); |
368 | netif_rx(skb); | 368 | netif_rx(skb); |
369 | sl->dev->last_rx = jiffies; | 369 | sl->dev->last_rx = jiffies; |
diff --git a/drivers/net/wan/hostess_sv11.c b/drivers/net/wan/hostess_sv11.c index a02c5fb40567..9ba3e4ee6ec7 100644 --- a/drivers/net/wan/hostess_sv11.c +++ b/drivers/net/wan/hostess_sv11.c | |||
@@ -59,7 +59,7 @@ static void hostess_input(struct z8530_channel *c, struct sk_buff *skb) | |||
59 | /* Drop the CRC - it's not a good idea to try and negotiate it ;) */ | 59 | /* Drop the CRC - it's not a good idea to try and negotiate it ;) */ |
60 | skb_trim(skb, skb->len-2); | 60 | skb_trim(skb, skb->len-2); |
61 | skb->protocol=__constant_htons(ETH_P_WAN_PPP); | 61 | skb->protocol=__constant_htons(ETH_P_WAN_PPP); |
62 | skb->mac.raw=skb->data; | 62 | skb_reset_mac_header(skb); |
63 | skb->dev=c->netdevice; | 63 | skb->dev=c->netdevice; |
64 | /* | 64 | /* |
65 | * Send it to the PPP layer. We don't have time to process | 65 | * Send it to the PPP layer. We don't have time to process |
diff --git a/drivers/net/wan/sealevel.c b/drivers/net/wan/sealevel.c index 70fb1b98b1dd..131358108c5a 100644 --- a/drivers/net/wan/sealevel.c +++ b/drivers/net/wan/sealevel.c | |||
@@ -61,7 +61,7 @@ static void sealevel_input(struct z8530_channel *c, struct sk_buff *skb) | |||
61 | /* Drop the CRC - it's not a good idea to try and negotiate it ;) */ | 61 | /* Drop the CRC - it's not a good idea to try and negotiate it ;) */ |
62 | skb_trim(skb, skb->len-2); | 62 | skb_trim(skb, skb->len-2); |
63 | skb->protocol=htons(ETH_P_WAN_PPP); | 63 | skb->protocol=htons(ETH_P_WAN_PPP); |
64 | skb->mac.raw=skb->data; | 64 | skb_reset_mac_header(skb); |
65 | skb->dev=c->netdevice; | 65 | skb->dev=c->netdevice; |
66 | /* | 66 | /* |
67 | * Send it to the PPP layer. We don't have time to process | 67 | * Send it to the PPP layer. We don't have time to process |
diff --git a/drivers/net/wan/syncppp.c b/drivers/net/wan/syncppp.c index 218f7b574ab3..67fc67cfd452 100644 --- a/drivers/net/wan/syncppp.c +++ b/drivers/net/wan/syncppp.c | |||
@@ -227,7 +227,7 @@ static void sppp_input (struct net_device *dev, struct sk_buff *skb) | |||
227 | unsigned long flags; | 227 | unsigned long flags; |
228 | 228 | ||
229 | skb->dev=dev; | 229 | skb->dev=dev; |
230 | skb->mac.raw=skb->data; | 230 | skb_reset_mac_header(skb); |
231 | 231 | ||
232 | if (dev->flags & IFF_RUNNING) | 232 | if (dev->flags & IFF_RUNNING) |
233 | { | 233 | { |
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index 692a23f9834d..7fe0a61091a6 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c | |||
@@ -2444,7 +2444,7 @@ static int add_airo_dev( struct net_device *dev ); | |||
2444 | 2444 | ||
2445 | static int wll_header_parse(struct sk_buff *skb, unsigned char *haddr) | 2445 | static int wll_header_parse(struct sk_buff *skb, unsigned char *haddr) |
2446 | { | 2446 | { |
2447 | memcpy(haddr, skb->mac.raw + 10, ETH_ALEN); | 2447 | memcpy(haddr, skb_mac_header(skb) + 10, ETH_ALEN); |
2448 | return ETH_ALEN; | 2448 | return ETH_ALEN; |
2449 | } | 2449 | } |
2450 | 2450 | ||
diff --git a/drivers/net/wireless/hostap/hostap_main.c b/drivers/net/wireless/hostap/hostap_main.c index 0e29ff762879..c2616e7b0059 100644 --- a/drivers/net/wireless/hostap/hostap_main.c +++ b/drivers/net/wireless/hostap/hostap_main.c | |||
@@ -590,20 +590,20 @@ void hostap_dump_tx_header(const char *name, const struct hfa384x_tx_frame *tx) | |||
590 | 590 | ||
591 | int hostap_80211_header_parse(struct sk_buff *skb, unsigned char *haddr) | 591 | int hostap_80211_header_parse(struct sk_buff *skb, unsigned char *haddr) |
592 | { | 592 | { |
593 | memcpy(haddr, skb->mac.raw + 10, ETH_ALEN); /* addr2 */ | 593 | memcpy(haddr, skb_mac_header(skb) + 10, ETH_ALEN); /* addr2 */ |
594 | return ETH_ALEN; | 594 | return ETH_ALEN; |
595 | } | 595 | } |
596 | 596 | ||
597 | 597 | ||
598 | int hostap_80211_prism_header_parse(struct sk_buff *skb, unsigned char *haddr) | 598 | int hostap_80211_prism_header_parse(struct sk_buff *skb, unsigned char *haddr) |
599 | { | 599 | { |
600 | if (*(u32 *)skb->mac.raw == LWNG_CAP_DID_BASE) { | 600 | const unsigned char *mac = skb_mac_header(skb); |
601 | memcpy(haddr, skb->mac.raw + | 601 | |
602 | sizeof(struct linux_wlan_ng_prism_hdr) + 10, | 602 | if (*(u32 *)mac == LWNG_CAP_DID_BASE) { |
603 | memcpy(haddr, mac + sizeof(struct linux_wlan_ng_prism_hdr) + 10, | ||
603 | ETH_ALEN); /* addr2 */ | 604 | ETH_ALEN); /* addr2 */ |
604 | } else { /* (*(u32 *)skb->mac.raw == htonl(LWNG_CAPHDR_VERSION)) */ | 605 | } else { /* (*(u32 *)mac == htonl(LWNG_CAPHDR_VERSION)) */ |
605 | memcpy(haddr, skb->mac.raw + | 606 | memcpy(haddr, mac + sizeof(struct linux_wlan_ng_cap_hdr) + 10, |
606 | sizeof(struct linux_wlan_ng_cap_hdr) + 10, | ||
607 | ETH_ALEN); /* addr2 */ | 607 | ETH_ALEN); /* addr2 */ |
608 | } | 608 | } |
609 | return ETH_ALEN; | 609 | return ETH_ALEN; |
diff --git a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c index f1415bff527f..062286dc8e15 100644 --- a/drivers/net/wireless/orinoco.c +++ b/drivers/net/wireless/orinoco.c | |||
@@ -689,7 +689,7 @@ static void orinoco_stat_gather(struct net_device *dev, | |||
689 | /* Note : gcc will optimise the whole section away if | 689 | /* Note : gcc will optimise the whole section away if |
690 | * WIRELESS_SPY is not defined... - Jean II */ | 690 | * WIRELESS_SPY is not defined... - Jean II */ |
691 | if (SPY_NUMBER(priv)) { | 691 | if (SPY_NUMBER(priv)) { |
692 | orinoco_spy_gather(dev, skb->mac.raw + ETH_ALEN, | 692 | orinoco_spy_gather(dev, skb_mac_header(skb) + ETH_ALEN, |
693 | desc->signal, desc->silence); | 693 | desc->signal, desc->silence); |
694 | } | 694 | } |
695 | } | 695 | } |
diff --git a/drivers/net/wireless/wavelan.c b/drivers/net/wireless/wavelan.c index 69cb1471096b..2bf77b1ee531 100644 --- a/drivers/net/wireless/wavelan.c +++ b/drivers/net/wireless/wavelan.c | |||
@@ -2517,7 +2517,8 @@ wv_packet_read(struct net_device * dev, u16 buf_off, int sksize) | |||
2517 | skb->protocol = eth_type_trans(skb, dev); | 2517 | skb->protocol = eth_type_trans(skb, dev); |
2518 | 2518 | ||
2519 | #ifdef DEBUG_RX_INFO | 2519 | #ifdef DEBUG_RX_INFO |
2520 | wv_packet_info(skb->mac.raw, sksize, dev->name, "wv_packet_read"); | 2520 | wv_packet_info(skb_mac_header(skb), sksize, dev->name, |
2521 | "wv_packet_read"); | ||
2521 | #endif /* DEBUG_RX_INFO */ | 2522 | #endif /* DEBUG_RX_INFO */ |
2522 | 2523 | ||
2523 | /* Statistics-gathering and associated stuff. | 2524 | /* Statistics-gathering and associated stuff. |
@@ -2553,7 +2554,7 @@ wv_packet_read(struct net_device * dev, u16 buf_off, int sksize) | |||
2553 | 2554 | ||
2554 | /* Spying stuff */ | 2555 | /* Spying stuff */ |
2555 | #ifdef IW_WIRELESS_SPY | 2556 | #ifdef IW_WIRELESS_SPY |
2556 | wl_spy_gather(dev, skb->mac.raw + WAVELAN_ADDR_SIZE, | 2557 | wl_spy_gather(dev, skb_mac_header(skb) + WAVELAN_ADDR_SIZE, |
2557 | stats); | 2558 | stats); |
2558 | #endif /* IW_WIRELESS_SPY */ | 2559 | #endif /* IW_WIRELESS_SPY */ |
2559 | #ifdef HISTOGRAM | 2560 | #ifdef HISTOGRAM |
diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c index 9351ee773314..67b867f837ca 100644 --- a/drivers/net/wireless/wavelan_cs.c +++ b/drivers/net/wireless/wavelan_cs.c | |||
@@ -2889,7 +2889,7 @@ wv_packet_read(struct net_device * dev, | |||
2889 | skb->protocol = eth_type_trans(skb, dev); | 2889 | skb->protocol = eth_type_trans(skb, dev); |
2890 | 2890 | ||
2891 | #ifdef DEBUG_RX_INFO | 2891 | #ifdef DEBUG_RX_INFO |
2892 | wv_packet_info(skb->mac.raw, sksize, dev->name, "wv_packet_read"); | 2892 | wv_packet_info(skb_mac_header(skb), sksize, dev->name, "wv_packet_read"); |
2893 | #endif /* DEBUG_RX_INFO */ | 2893 | #endif /* DEBUG_RX_INFO */ |
2894 | 2894 | ||
2895 | /* Statistics gathering & stuff associated. | 2895 | /* Statistics gathering & stuff associated. |
@@ -2923,7 +2923,7 @@ wv_packet_read(struct net_device * dev, | |||
2923 | #endif /* WAVELAN_ROAMING */ | 2923 | #endif /* WAVELAN_ROAMING */ |
2924 | 2924 | ||
2925 | #ifdef WIRELESS_SPY | 2925 | #ifdef WIRELESS_SPY |
2926 | wl_spy_gather(dev, skb->mac.raw + WAVELAN_ADDR_SIZE, stats); | 2926 | wl_spy_gather(dev, skb_mac_header(skb) + WAVELAN_ADDR_SIZE, stats); |
2927 | #endif /* WIRELESS_SPY */ | 2927 | #endif /* WIRELESS_SPY */ |
2928 | #ifdef HISTOGRAM | 2928 | #ifdef HISTOGRAM |
2929 | wl_his_gather(dev, stats); | 2929 | wl_his_gather(dev, stats); |
diff --git a/drivers/s390/net/claw.c b/drivers/s390/net/claw.c index 7809a79feec7..6dd64d0c8d45 100644 --- a/drivers/s390/net/claw.c +++ b/drivers/s390/net/claw.c | |||
@@ -3525,8 +3525,8 @@ unpack_next: | |||
3525 | memcpy(skb_put(skb,len_of_data), | 3525 | memcpy(skb_put(skb,len_of_data), |
3526 | privptr->p_mtc_envelope, | 3526 | privptr->p_mtc_envelope, |
3527 | len_of_data); | 3527 | len_of_data); |
3528 | skb->mac.raw=skb->data; | ||
3529 | skb->dev=dev; | 3528 | skb->dev=dev; |
3529 | skb_reset_mac_header(skb); | ||
3530 | skb->protocol=htons(ETH_P_IP); | 3530 | skb->protocol=htons(ETH_P_IP); |
3531 | skb->ip_summed=CHECKSUM_UNNECESSARY; | 3531 | skb->ip_summed=CHECKSUM_UNNECESSARY; |
3532 | privptr->stats.rx_packets++; | 3532 | privptr->stats.rx_packets++; |
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h index ab08f35cbc35..f6863fbcf334 100644 --- a/include/linux/if_ether.h +++ b/include/linux/if_ether.h | |||
@@ -112,7 +112,7 @@ struct ethhdr { | |||
112 | 112 | ||
113 | static inline struct ethhdr *eth_hdr(const struct sk_buff *skb) | 113 | static inline struct ethhdr *eth_hdr(const struct sk_buff *skb) |
114 | { | 114 | { |
115 | return (struct ethhdr *)skb->mac.raw; | 115 | return (struct ethhdr *)skb_mac_header(skb); |
116 | } | 116 | } |
117 | 117 | ||
118 | #ifdef CONFIG_SYSCTL | 118 | #ifdef CONFIG_SYSCTL |
diff --git a/include/linux/if_tr.h b/include/linux/if_tr.h index 2f94cf2c7abb..046e9d95ba9a 100644 --- a/include/linux/if_tr.h +++ b/include/linux/if_tr.h | |||
@@ -47,7 +47,7 @@ struct trh_hdr { | |||
47 | 47 | ||
48 | static inline struct trh_hdr *tr_hdr(const struct sk_buff *skb) | 48 | static inline struct trh_hdr *tr_hdr(const struct sk_buff *skb) |
49 | { | 49 | { |
50 | return (struct trh_hdr *)skb->mac.raw; | 50 | return (struct trh_hdr *)skb_mac_header(skb); |
51 | } | 51 | } |
52 | #ifdef CONFIG_SYSCTL | 52 | #ifdef CONFIG_SYSCTL |
53 | extern struct ctl_table tr_table[]; | 53 | extern struct ctl_table tr_table[]; |
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h index d103580c72d2..544490d9d0bd 100644 --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h | |||
@@ -51,7 +51,7 @@ struct vlan_ethhdr { | |||
51 | 51 | ||
52 | static inline struct vlan_ethhdr *vlan_eth_hdr(const struct sk_buff *skb) | 52 | static inline struct vlan_ethhdr *vlan_eth_hdr(const struct sk_buff *skb) |
53 | { | 53 | { |
54 | return (struct vlan_ethhdr *)skb->mac.raw; | 54 | return (struct vlan_ethhdr *)skb_mac_header(skb); |
55 | } | 55 | } |
56 | 56 | ||
57 | struct vlan_hdr { | 57 | struct vlan_hdr { |
diff --git a/include/linux/netfilter_bridge/ebt_802_3.h b/include/linux/netfilter_bridge/ebt_802_3.h index 07f044ff1a6b..a11b0c2017fd 100644 --- a/include/linux/netfilter_bridge/ebt_802_3.h +++ b/include/linux/netfilter_bridge/ebt_802_3.h | |||
@@ -54,7 +54,7 @@ struct ebt_802_3_hdr { | |||
54 | 54 | ||
55 | static inline struct ebt_802_3_hdr *ebt_802_3_hdr(const struct sk_buff *skb) | 55 | static inline struct ebt_802_3_hdr *ebt_802_3_hdr(const struct sk_buff *skb) |
56 | { | 56 | { |
57 | return (struct ebt_802_3_hdr *)skb->mac.raw; | 57 | return (struct ebt_802_3_hdr *)skb_mac_header(skb); |
58 | } | 58 | } |
59 | #endif | 59 | #endif |
60 | 60 | ||
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 43ab6cbf8446..dff81af454b7 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -960,6 +960,16 @@ static inline void skb_reserve(struct sk_buff *skb, int len) | |||
960 | skb->tail += len; | 960 | skb->tail += len; |
961 | } | 961 | } |
962 | 962 | ||
963 | static inline unsigned char *skb_mac_header(const struct sk_buff *skb) | ||
964 | { | ||
965 | return skb->mac.raw; | ||
966 | } | ||
967 | |||
968 | static inline int skb_mac_header_was_set(const struct sk_buff *skb) | ||
969 | { | ||
970 | return skb->mac.raw != NULL; | ||
971 | } | ||
972 | |||
963 | static inline void skb_reset_mac_header(struct sk_buff *skb) | 973 | static inline void skb_reset_mac_header(struct sk_buff *skb) |
964 | { | 974 | { |
965 | skb->mac.raw = skb->data; | 975 | skb->mac.raw = skb->data; |
diff --git a/net/802/hippi.c b/net/802/hippi.c index d87190038edb..87ffc12b6891 100644 --- a/net/802/hippi.c +++ b/net/802/hippi.c | |||
@@ -132,7 +132,7 @@ __be16 hippi_type_trans(struct sk_buff *skb, struct net_device *dev) | |||
132 | */ | 132 | */ |
133 | skb->dev = dev; | 133 | skb->dev = dev; |
134 | skb_reset_mac_header(skb); | 134 | skb_reset_mac_header(skb); |
135 | hip = (struct hippi_hdr *)skb->mac.raw; | 135 | hip = (struct hippi_hdr *)skb_mac_header(skb); |
136 | skb_pull(skb, HIPPI_HLEN); | 136 | skb_pull(skb, HIPPI_HLEN); |
137 | 137 | ||
138 | /* | 138 | /* |
diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c index 32b82705b685..934f25993ce8 100644 --- a/net/appletalk/ddp.c +++ b/net/appletalk/ddp.c | |||
@@ -1484,7 +1484,7 @@ static int ltalk_rcv(struct sk_buff *skb, struct net_device *dev, | |||
1484 | struct packet_type *pt, struct net_device *orig_dev) | 1484 | struct packet_type *pt, struct net_device *orig_dev) |
1485 | { | 1485 | { |
1486 | /* Expand any short form frames */ | 1486 | /* Expand any short form frames */ |
1487 | if (skb->mac.raw[2] == 1) { | 1487 | if (skb_mac_header(skb)[2] == 1) { |
1488 | struct ddpehdr *ddp; | 1488 | struct ddpehdr *ddp; |
1489 | /* Find our address */ | 1489 | /* Find our address */ |
1490 | struct atalk_addr *ap = atalk_find_dev_addr(dev); | 1490 | struct atalk_addr *ap = atalk_find_dev_addr(dev); |
@@ -1510,8 +1510,8 @@ static int ltalk_rcv(struct sk_buff *skb, struct net_device *dev, | |||
1510 | * we write the network numbers ! | 1510 | * we write the network numbers ! |
1511 | */ | 1511 | */ |
1512 | 1512 | ||
1513 | ddp->deh_dnode = skb->mac.raw[0]; /* From physical header */ | 1513 | ddp->deh_dnode = skb_mac_header(skb)[0]; /* From physical header */ |
1514 | ddp->deh_snode = skb->mac.raw[1]; /* From physical header */ | 1514 | ddp->deh_snode = skb_mac_header(skb)[1]; /* From physical header */ |
1515 | 1515 | ||
1516 | ddp->deh_dnet = ap->s_net; /* Network number */ | 1516 | ddp->deh_dnet = ap->s_net; /* Network number */ |
1517 | ddp->deh_snet = ap->s_net; | 1517 | ddp->deh_snet = ap->s_net; |
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c index 62605dc5a2c8..c89e4f6f9025 100644 --- a/net/ax25/af_ax25.c +++ b/net/ax25/af_ax25.c | |||
@@ -1645,9 +1645,10 @@ static int ax25_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1645 | struct sockaddr_ax25 *sax = (struct sockaddr_ax25 *)msg->msg_name; | 1645 | struct sockaddr_ax25 *sax = (struct sockaddr_ax25 *)msg->msg_name; |
1646 | ax25_digi digi; | 1646 | ax25_digi digi; |
1647 | ax25_address src; | 1647 | ax25_address src; |
1648 | const unsigned char *mac = skb_mac_header(skb); | ||
1648 | 1649 | ||
1649 | ax25_addr_parse(skb->mac.raw+1, skb->data-skb->mac.raw-1, &src, NULL, &digi, NULL, NULL); | 1650 | ax25_addr_parse(mac + 1, skb->data - mac - 1, &src, NULL, |
1650 | 1651 | &digi, NULL, NULL); | |
1651 | sax->sax25_family = AF_AX25; | 1652 | sax->sax25_family = AF_AX25; |
1652 | /* We set this correctly, even though we may not let the | 1653 | /* We set this correctly, even though we may not let the |
1653 | application know the digi calls further down (because it | 1654 | application know the digi calls further down (because it |
diff --git a/net/bluetooth/bnep/core.c b/net/bluetooth/bnep/core.c index b1c2fa96c69e..97156c4abc8d 100644 --- a/net/bluetooth/bnep/core.c +++ b/net/bluetooth/bnep/core.c | |||
@@ -364,17 +364,20 @@ static inline int bnep_rx_frame(struct bnep_session *s, struct sk_buff *skb) | |||
364 | 364 | ||
365 | case BNEP_COMPRESSED_SRC_ONLY: | 365 | case BNEP_COMPRESSED_SRC_ONLY: |
366 | memcpy(__skb_put(nskb, ETH_ALEN), s->eh.h_dest, ETH_ALEN); | 366 | memcpy(__skb_put(nskb, ETH_ALEN), s->eh.h_dest, ETH_ALEN); |
367 | memcpy(__skb_put(nskb, ETH_ALEN), skb->mac.raw, ETH_ALEN); | 367 | memcpy(__skb_put(nskb, ETH_ALEN), skb_mac_header(skb), ETH_ALEN); |
368 | put_unaligned(s->eh.h_proto, (__be16 *) __skb_put(nskb, 2)); | 368 | put_unaligned(s->eh.h_proto, (__be16 *) __skb_put(nskb, 2)); |
369 | break; | 369 | break; |
370 | 370 | ||
371 | case BNEP_COMPRESSED_DST_ONLY: | 371 | case BNEP_COMPRESSED_DST_ONLY: |
372 | memcpy(__skb_put(nskb, ETH_ALEN), skb->mac.raw, ETH_ALEN); | 372 | memcpy(__skb_put(nskb, ETH_ALEN), skb_mac_header(skb), |
373 | memcpy(__skb_put(nskb, ETH_ALEN + 2), s->eh.h_source, ETH_ALEN + 2); | 373 | ETH_ALEN); |
374 | memcpy(__skb_put(nskb, ETH_ALEN + 2), s->eh.h_source, | ||
375 | ETH_ALEN + 2); | ||
374 | break; | 376 | break; |
375 | 377 | ||
376 | case BNEP_GENERAL: | 378 | case BNEP_GENERAL: |
377 | memcpy(__skb_put(nskb, ETH_ALEN * 2), skb->mac.raw, ETH_ALEN * 2); | 379 | memcpy(__skb_put(nskb, ETH_ALEN * 2), skb_mac_header(skb), |
380 | ETH_ALEN * 2); | ||
378 | put_unaligned(s->eh.h_proto, (__be16 *) __skb_put(nskb, 2)); | 381 | put_unaligned(s->eh.h_proto, (__be16 *) __skb_put(nskb, 2)); |
379 | break; | 382 | break; |
380 | } | 383 | } |
diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c index 5439a3c46c3e..1163c4f69899 100644 --- a/net/bridge/br_netfilter.c +++ b/net/bridge/br_netfilter.c | |||
@@ -753,7 +753,8 @@ static unsigned int br_nf_post_routing(unsigned int hook, struct sk_buff **pskb, | |||
753 | #ifdef CONFIG_NETFILTER_DEBUG | 753 | #ifdef CONFIG_NETFILTER_DEBUG |
754 | /* Be very paranoid. This probably won't happen anymore, but let's | 754 | /* Be very paranoid. This probably won't happen anymore, but let's |
755 | * keep the check just to be sure... */ | 755 | * keep the check just to be sure... */ |
756 | if (skb->mac.raw < skb->head || skb->mac.raw + ETH_HLEN > skb->data) { | 756 | if (skb_mac_header(skb) < skb->head || |
757 | skb_mac_header(skb) + ETH_HLEN > skb->data) { | ||
757 | printk(KERN_CRIT "br_netfilter: Argh!! br_nf_post_routing: " | 758 | printk(KERN_CRIT "br_netfilter: Argh!! br_nf_post_routing: " |
758 | "bad mac.raw pointer.\n"); | 759 | "bad mac.raw pointer.\n"); |
759 | goto print_error; | 760 | goto print_error; |
@@ -808,7 +809,7 @@ print_error: | |||
808 | if (realoutdev) | 809 | if (realoutdev) |
809 | printk("[%s]", realoutdev->name); | 810 | printk("[%s]", realoutdev->name); |
810 | } | 811 | } |
811 | printk(" head:%p, raw:%p, data:%p\n", skb->head, skb->mac.raw, | 812 | printk(" head:%p, raw:%p, data:%p\n", skb->head, skb_mac_header(skb), |
812 | skb->data); | 813 | skb->data); |
813 | dump_stack(); | 814 | dump_stack(); |
814 | return NF_ACCEPT; | 815 | return NF_ACCEPT; |
diff --git a/net/core/dev.c b/net/core/dev.c index 2fcaf5bc4a9c..560560fe3064 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -1232,7 +1232,7 @@ struct sk_buff *skb_gso_segment(struct sk_buff *skb, int features) | |||
1232 | } | 1232 | } |
1233 | rcu_read_unlock(); | 1233 | rcu_read_unlock(); |
1234 | 1234 | ||
1235 | __skb_push(skb, skb->data - skb->mac.raw); | 1235 | __skb_push(skb, skb->data - skb_mac_header(skb)); |
1236 | 1236 | ||
1237 | return segs; | 1237 | return segs; |
1238 | } | 1238 | } |
diff --git a/net/core/filter.c b/net/core/filter.c index 8d185a089c53..1cc128d05422 100644 --- a/net/core/filter.c +++ b/net/core/filter.c | |||
@@ -44,7 +44,7 @@ static void *__load_pointer(struct sk_buff *skb, int k) | |||
44 | if (k >= SKF_NET_OFF) | 44 | if (k >= SKF_NET_OFF) |
45 | ptr = skb->nh.raw + k - SKF_NET_OFF; | 45 | ptr = skb->nh.raw + k - SKF_NET_OFF; |
46 | else if (k >= SKF_LL_OFF) | 46 | else if (k >= SKF_LL_OFF) |
47 | ptr = skb->mac.raw + k - SKF_LL_OFF; | 47 | ptr = skb_mac_header(skb) + k - SKF_LL_OFF; |
48 | 48 | ||
49 | if (ptr >= skb->head && ptr < skb->tail) | 49 | if (ptr >= skb->head && ptr < skb->tail) |
50 | return ptr; | 50 | return ptr; |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 8f6ebd0d3693..1493c95f633e 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -1878,7 +1878,7 @@ struct sk_buff *skb_segment(struct sk_buff *skb, int features) | |||
1878 | struct sk_buff *segs = NULL; | 1878 | struct sk_buff *segs = NULL; |
1879 | struct sk_buff *tail = NULL; | 1879 | struct sk_buff *tail = NULL; |
1880 | unsigned int mss = skb_shinfo(skb)->gso_size; | 1880 | unsigned int mss = skb_shinfo(skb)->gso_size; |
1881 | unsigned int doffset = skb->data - skb->mac.raw; | 1881 | unsigned int doffset = skb->data - skb_mac_header(skb); |
1882 | unsigned int offset = doffset; | 1882 | unsigned int offset = doffset; |
1883 | unsigned int headroom; | 1883 | unsigned int headroom; |
1884 | unsigned int len; | 1884 | unsigned int len; |
diff --git a/net/ipv4/netfilter/ipt_LOG.c b/net/ipv4/netfilter/ipt_LOG.c index d9c37fd94228..c697971fe317 100644 --- a/net/ipv4/netfilter/ipt_LOG.c +++ b/net/ipv4/netfilter/ipt_LOG.c | |||
@@ -399,9 +399,9 @@ ipt_log_packet(unsigned int pf, | |||
399 | /* MAC logging for input chain only. */ | 399 | /* MAC logging for input chain only. */ |
400 | printk("MAC="); | 400 | printk("MAC="); |
401 | if (skb->dev && skb->dev->hard_header_len | 401 | if (skb->dev && skb->dev->hard_header_len |
402 | && skb->mac.raw != (void*)skb->nh.iph) { | 402 | && skb->mac.raw != skb->nh.raw) { |
403 | int i; | 403 | int i; |
404 | unsigned char *p = skb->mac.raw; | 404 | const unsigned char *p = skb_mac_header(skb); |
405 | for (i = 0; i < skb->dev->hard_header_len; i++,p++) | 405 | for (i = 0; i < skb->dev->hard_header_len; i++,p++) |
406 | printk("%02x%c", *p, | 406 | printk("%02x%c", *p, |
407 | i==skb->dev->hard_header_len - 1 | 407 | i==skb->dev->hard_header_len - 1 |
diff --git a/net/ipv4/netfilter/ipt_ULOG.c b/net/ipv4/netfilter/ipt_ULOG.c index 9718b666a380..fae2a34d23d0 100644 --- a/net/ipv4/netfilter/ipt_ULOG.c +++ b/net/ipv4/netfilter/ipt_ULOG.c | |||
@@ -251,9 +251,9 @@ static void ipt_ulog_packet(unsigned int hooknum, | |||
251 | *(pm->prefix) = '\0'; | 251 | *(pm->prefix) = '\0'; |
252 | 252 | ||
253 | if (in && in->hard_header_len > 0 | 253 | if (in && in->hard_header_len > 0 |
254 | && skb->mac.raw != (void *) skb->nh.iph | 254 | && skb->mac.raw != skb->nh.raw |
255 | && in->hard_header_len <= ULOG_MAC_LEN) { | 255 | && in->hard_header_len <= ULOG_MAC_LEN) { |
256 | memcpy(pm->mac, skb->mac.raw, in->hard_header_len); | 256 | memcpy(pm->mac, skb_mac_header(skb), in->hard_header_len); |
257 | pm->mac_len = in->hard_header_len; | 257 | pm->mac_len = in->hard_header_len; |
258 | } else | 258 | } else |
259 | pm->mac_len = 0; | 259 | pm->mac_len = 0; |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 29ee7be45aa6..486ab93127ce 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
@@ -1698,9 +1698,9 @@ static void ip_handle_martian_source(struct net_device *dev, | |||
1698 | printk(KERN_WARNING "martian source %u.%u.%u.%u from " | 1698 | printk(KERN_WARNING "martian source %u.%u.%u.%u from " |
1699 | "%u.%u.%u.%u, on dev %s\n", | 1699 | "%u.%u.%u.%u, on dev %s\n", |
1700 | NIPQUAD(daddr), NIPQUAD(saddr), dev->name); | 1700 | NIPQUAD(daddr), NIPQUAD(saddr), dev->name); |
1701 | if (dev->hard_header_len && skb->mac.raw) { | 1701 | if (dev->hard_header_len && skb_mac_header_was_set(skb)) { |
1702 | int i; | 1702 | int i; |
1703 | unsigned char *p = skb->mac.raw; | 1703 | const unsigned char *p = skb_mac_header(skb); |
1704 | printk(KERN_WARNING "ll header: "); | 1704 | printk(KERN_WARNING "ll header: "); |
1705 | for (i = 0; i < dev->hard_header_len; i++, p++) { | 1705 | for (i = 0; i < dev->hard_header_len; i++, p++) { |
1706 | printk("%02x", *p); | 1706 | printk("%02x", *p); |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 1ec05bd673a7..f5e019cefc15 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -3633,7 +3633,7 @@ tcp_collapse(struct sock *sk, struct sk_buff_head *list, | |||
3633 | if (!nskb) | 3633 | if (!nskb) |
3634 | return; | 3634 | return; |
3635 | 3635 | ||
3636 | skb_set_mac_header(nskb, skb->mac.raw - skb->head); | 3636 | skb_set_mac_header(nskb, skb_mac_header(skb) - skb->head); |
3637 | nskb->nh.raw = nskb->data + (skb->nh.raw - skb->head); | 3637 | nskb->nh.raw = nskb->data + (skb->nh.raw - skb->head); |
3638 | nskb->h.raw = nskb->data + (skb->h.raw - skb->head); | 3638 | nskb->h.raw = nskb->data + (skb->h.raw - skb->head); |
3639 | 3639 | ||
diff --git a/net/ipv4/xfrm4_mode_tunnel.c b/net/ipv4/xfrm4_mode_tunnel.c index f09055d3a768..8e123e30cf61 100644 --- a/net/ipv4/xfrm4_mode_tunnel.c +++ b/net/ipv4/xfrm4_mode_tunnel.c | |||
@@ -126,9 +126,9 @@ static int xfrm4_tunnel_input(struct xfrm_state *x, struct sk_buff *skb) | |||
126 | skb->protocol = htons(ETH_P_IPV6); | 126 | skb->protocol = htons(ETH_P_IPV6); |
127 | } | 127 | } |
128 | #endif | 128 | #endif |
129 | old_mac = skb->mac.raw; | 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.raw, old_mac, skb->mac_len); | 131 | memmove(skb_mac_header(skb), old_mac, skb->mac_len); |
132 | skb->nh.raw = skb->data; | 132 | skb->nh.raw = skb->data; |
133 | err = 0; | 133 | err = 0; |
134 | 134 | ||
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 053147a0027e..a3e3d9e2f44b 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c | |||
@@ -828,7 +828,8 @@ static void ndisc_recv_ns(struct sk_buff *skb) | |||
828 | if (ifp->flags & (IFA_F_TENTATIVE|IFA_F_OPTIMISTIC)) { | 828 | if (ifp->flags & (IFA_F_TENTATIVE|IFA_F_OPTIMISTIC)) { |
829 | if (dad) { | 829 | if (dad) { |
830 | if (dev->type == ARPHRD_IEEE802_TR) { | 830 | if (dev->type == ARPHRD_IEEE802_TR) { |
831 | unsigned char *sadr = skb->mac.raw; | 831 | const unsigned char *sadr; |
832 | sadr = skb_mac_header(skb); | ||
832 | if (((sadr[8] ^ dev->dev_addr[0]) & 0x7f) == 0 && | 833 | if (((sadr[8] ^ dev->dev_addr[0]) & 0x7f) == 0 && |
833 | sadr[9] == dev->dev_addr[1] && | 834 | sadr[9] == dev->dev_addr[1] && |
834 | sadr[10] == dev->dev_addr[2] && | 835 | sadr[10] == dev->dev_addr[2] && |
diff --git a/net/ipv6/netfilter/ip6t_LOG.c b/net/ipv6/netfilter/ip6t_LOG.c index afaa039d0b7b..fc9e51a77784 100644 --- a/net/ipv6/netfilter/ip6t_LOG.c +++ b/net/ipv6/netfilter/ip6t_LOG.c | |||
@@ -397,7 +397,7 @@ ip6t_log_packet(unsigned int pf, | |||
397 | printk("MAC="); | 397 | printk("MAC="); |
398 | if (skb->dev && (len = skb->dev->hard_header_len) && | 398 | if (skb->dev && (len = skb->dev->hard_header_len) && |
399 | skb->mac.raw != skb->nh.raw) { | 399 | skb->mac.raw != skb->nh.raw) { |
400 | unsigned char *p = skb->mac.raw; | 400 | const unsigned char *p = skb_mac_header(skb); |
401 | int i; | 401 | int i; |
402 | 402 | ||
403 | if (skb->dev->type == ARPHRD_SIT && | 403 | if (skb->dev->type == ARPHRD_SIT && |
@@ -412,7 +412,8 @@ ip6t_log_packet(unsigned int pf, | |||
412 | printk(" "); | 412 | printk(" "); |
413 | 413 | ||
414 | if (skb->dev->type == ARPHRD_SIT) { | 414 | if (skb->dev->type == ARPHRD_SIT) { |
415 | struct iphdr *iph = (struct iphdr *)skb->mac.raw; | 415 | const struct iphdr *iph = |
416 | (struct iphdr *)skb_mac_header(skb); | ||
416 | printk("TUNNEL=%u.%u.%u.%u->%u.%u.%u.%u ", | 417 | printk("TUNNEL=%u.%u.%u.%u->%u.%u.%u.%u ", |
417 | NIPQUAD(iph->saddr), | 418 | NIPQUAD(iph->saddr), |
418 | NIPQUAD(iph->daddr)); | 419 | NIPQUAD(iph->daddr)); |
diff --git a/net/ipv6/netfilter/ip6t_eui64.c b/net/ipv6/netfilter/ip6t_eui64.c index 967bed71d4a8..c2676066a80f 100644 --- a/net/ipv6/netfilter/ip6t_eui64.c +++ b/net/ipv6/netfilter/ip6t_eui64.c | |||
@@ -32,8 +32,8 @@ match(const struct sk_buff *skb, | |||
32 | unsigned char eui64[8]; | 32 | unsigned char eui64[8]; |
33 | int i = 0; | 33 | int i = 0; |
34 | 34 | ||
35 | if (!(skb->mac.raw >= skb->head && | 35 | if (!(skb_mac_header(skb) >= skb->head && |
36 | (skb->mac.raw + ETH_HLEN) <= skb->data) && | 36 | (skb_mac_header(skb) + ETH_HLEN) <= skb->data) && |
37 | offset != 0) { | 37 | offset != 0) { |
38 | *hotdrop = 1; | 38 | *hotdrop = 1; |
39 | return 0; | 39 | return 0; |
diff --git a/net/ipv6/xfrm6_mode_beet.c b/net/ipv6/xfrm6_mode_beet.c index 53cfe1a10ccd..79364b1e965a 100644 --- a/net/ipv6/xfrm6_mode_beet.c +++ b/net/ipv6/xfrm6_mode_beet.c | |||
@@ -70,9 +70,9 @@ static int xfrm6_beet_input(struct xfrm_state *x, struct sk_buff *skb) | |||
70 | memmove(skb->data, skb->nh.raw, size); | 70 | memmove(skb->data, skb->nh.raw, size); |
71 | skb->nh.raw = skb->data; | 71 | skb->nh.raw = skb->data; |
72 | 72 | ||
73 | old_mac = skb->mac.raw; | 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); |
75 | memmove(skb->mac.raw, old_mac, skb->mac_len); | 75 | memmove(skb_mac_header(skb), old_mac, skb->mac_len); |
76 | 76 | ||
77 | ip6h = skb->nh.ipv6h; | 77 | ip6h = skb->nh.ipv6h; |
78 | ip6h->payload_len = htons(skb->len - size); | 78 | ip6h->payload_len = htons(skb->len - size); |
diff --git a/net/ipv6/xfrm6_mode_tunnel.c b/net/ipv6/xfrm6_mode_tunnel.c index d2c560c181a1..5bb0677d3730 100644 --- a/net/ipv6/xfrm6_mode_tunnel.c +++ b/net/ipv6/xfrm6_mode_tunnel.c | |||
@@ -108,9 +108,9 @@ static int xfrm6_tunnel_input(struct xfrm_state *x, struct sk_buff *skb) | |||
108 | ip6ip_ecn_decapsulate(skb); | 108 | ip6ip_ecn_decapsulate(skb); |
109 | skb->protocol = htons(ETH_P_IP); | 109 | skb->protocol = htons(ETH_P_IP); |
110 | } | 110 | } |
111 | old_mac = skb->mac.raw; | 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.raw, old_mac, skb->mac_len); | 113 | memmove(skb_mac_header(skb), old_mac, skb->mac_len); |
114 | skb->nh.raw = skb->data; | 114 | skb->nh.raw = skb->data; |
115 | err = 0; | 115 | err = 0; |
116 | 116 | ||
diff --git a/net/netfilter/xt_mac.c b/net/netfilter/xt_mac.c index d430d90d7b26..1d3a1d98b885 100644 --- a/net/netfilter/xt_mac.c +++ b/net/netfilter/xt_mac.c | |||
@@ -37,8 +37,8 @@ match(const struct sk_buff *skb, | |||
37 | const struct xt_mac_info *info = matchinfo; | 37 | const struct xt_mac_info *info = matchinfo; |
38 | 38 | ||
39 | /* Is mac pointer valid? */ | 39 | /* Is mac pointer valid? */ |
40 | return (skb->mac.raw >= skb->head | 40 | return (skb_mac_header(skb) >= skb->head && |
41 | && (skb->mac.raw + ETH_HLEN) <= skb->data | 41 | (skb_mac_header(skb) + ETH_HLEN) <= skb->data |
42 | /* If so, compare... */ | 42 | /* If so, compare... */ |
43 | && ((!compare_ether_addr(eth_hdr(skb)->h_source, info->srcaddr)) | 43 | && ((!compare_ether_addr(eth_hdr(skb)->h_source, info->srcaddr)) |
44 | ^ info->invert)); | 44 | ^ info->invert)); |
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 6f8c72d2413b..73cb2d3e27d2 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -284,7 +284,7 @@ static int packet_rcv_spkt(struct sk_buff *skb, struct net_device *dev, struct | |||
284 | * Incoming packets have ll header pulled, | 284 | * Incoming packets have ll header pulled, |
285 | * push it back. | 285 | * push it back. |
286 | * | 286 | * |
287 | * For outgoing ones skb->data == skb->mac.raw | 287 | * For outgoing ones skb->data == skb_mac_header(skb) |
288 | * so that this procedure is noop. | 288 | * so that this procedure is noop. |
289 | */ | 289 | */ |
290 | 290 | ||
@@ -303,7 +303,7 @@ static int packet_rcv_spkt(struct sk_buff *skb, struct net_device *dev, struct | |||
303 | 303 | ||
304 | spkt = &PACKET_SKB_CB(skb)->sa.pkt; | 304 | spkt = &PACKET_SKB_CB(skb)->sa.pkt; |
305 | 305 | ||
306 | skb_push(skb, skb->data-skb->mac.raw); | 306 | skb_push(skb, skb->data - skb_mac_header(skb)); |
307 | 307 | ||
308 | /* | 308 | /* |
309 | * The SOCK_PACKET socket receives _all_ frames. | 309 | * The SOCK_PACKET socket receives _all_ frames. |
@@ -488,7 +488,7 @@ static int packet_rcv(struct sk_buff *skb, struct net_device *dev, struct packet | |||
488 | never delivered to user. | 488 | never delivered to user. |
489 | */ | 489 | */ |
490 | if (sk->sk_type != SOCK_DGRAM) | 490 | if (sk->sk_type != SOCK_DGRAM) |
491 | skb_push(skb, skb->data - skb->mac.raw); | 491 | skb_push(skb, skb->data - skb_mac_header(skb)); |
492 | else if (skb->pkt_type == PACKET_OUTGOING) { | 492 | else if (skb->pkt_type == PACKET_OUTGOING) { |
493 | /* Special case: outgoing packets have ll header at head */ | 493 | /* Special case: outgoing packets have ll header at head */ |
494 | skb_pull(skb, skb->nh.raw - skb->data); | 494 | skb_pull(skb, skb->nh.raw - skb->data); |
@@ -592,7 +592,7 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev, struct packe | |||
592 | 592 | ||
593 | if (dev->hard_header) { | 593 | if (dev->hard_header) { |
594 | if (sk->sk_type != SOCK_DGRAM) | 594 | if (sk->sk_type != SOCK_DGRAM) |
595 | skb_push(skb, skb->data - skb->mac.raw); | 595 | skb_push(skb, skb->data - skb_mac_header(skb)); |
596 | else if (skb->pkt_type == PACKET_OUTGOING) { | 596 | else if (skb->pkt_type == PACKET_OUTGOING) { |
597 | /* Special case: outgoing packets have ll header at head */ | 597 | /* Special case: outgoing packets have ll header at head */ |
598 | skb_pull(skb, skb->nh.raw - skb->data); | 598 | skb_pull(skb, skb->nh.raw - skb->data); |
diff --git a/net/tipc/eth_media.c b/net/tipc/eth_media.c index f71ba9db611e..03a9db364538 100644 --- a/net/tipc/eth_media.c +++ b/net/tipc/eth_media.c | |||
@@ -99,8 +99,8 @@ static int recv_msg(struct sk_buff *buf, struct net_device *dev, | |||
99 | 99 | ||
100 | if (likely(eb_ptr->bearer)) { | 100 | if (likely(eb_ptr->bearer)) { |
101 | if (likely(!dev->promiscuity) || | 101 | if (likely(!dev->promiscuity) || |
102 | !memcmp(buf->mac.raw,dev->dev_addr,ETH_ALEN) || | 102 | !memcmp(skb_mac_header(buf), dev->dev_addr, ETH_ALEN) || |
103 | !memcmp(buf->mac.raw,dev->broadcast,ETH_ALEN)) { | 103 | !memcmp(skb_mac_header(buf), dev->broadcast, ETH_ALEN)) { |
104 | size = msg_size((struct tipc_msg *)buf->data); | 104 | size = msg_size((struct tipc_msg *)buf->data); |
105 | skb_trim(buf, size); | 105 | skb_trim(buf, size); |
106 | if (likely(buf->len == size)) { | 106 | if (likely(buf->len == size)) { |