aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2007-03-19 18:33:04 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 01:24:41 -0400
commit98e399f82ab3a6d863d1d4a7ea48925cc91c830e (patch)
tree5f84043aeec1ec27c2e8e6cc25b5d2e6c3d07343 /net
parent31713c333ddbb66d694829082620b69b71c4b09a (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>
Diffstat (limited to 'net')
-rw-r--r--net/802/hippi.c2
-rw-r--r--net/appletalk/ddp.c6
-rw-r--r--net/ax25/af_ax25.c5
-rw-r--r--net/bluetooth/bnep/core.c11
-rw-r--r--net/bridge/br_netfilter.c5
-rw-r--r--net/core/dev.c2
-rw-r--r--net/core/filter.c2
-rw-r--r--net/core/skbuff.c2
-rw-r--r--net/ipv4/netfilter/ipt_LOG.c4
-rw-r--r--net/ipv4/netfilter/ipt_ULOG.c4
-rw-r--r--net/ipv4/route.c4
-rw-r--r--net/ipv4/tcp_input.c2
-rw-r--r--net/ipv4/xfrm4_mode_tunnel.c4
-rw-r--r--net/ipv6/ndisc.c3
-rw-r--r--net/ipv6/netfilter/ip6t_LOG.c5
-rw-r--r--net/ipv6/netfilter/ip6t_eui64.c4
-rw-r--r--net/ipv6/xfrm6_mode_beet.c4
-rw-r--r--net/ipv6/xfrm6_mode_tunnel.c4
-rw-r--r--net/netfilter/xt_mac.c4
-rw-r--r--net/packet/af_packet.c8
-rw-r--r--net/tipc/eth_media.c4
21 files changed, 48 insertions, 41 deletions
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)) {