aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
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/ipv4
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/ipv4')
-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
5 files changed, 9 insertions, 9 deletions
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