aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2008-03-03 15:20:57 -0500
committerDavid S. Miller <davem@davemloft.net>2008-03-03 15:20:57 -0500
commit988b705077d8f922408913f4f521ae073256d4a1 (patch)
tree9b57725b954e1e96a80043ed43d83f8e032b47b6 /net/core
parent8ed7edce82ca0d8d3adba8c08cd42337af6c758c (diff)
[ARP]: Introduce the arp_hdr_len helper.
There are some place, that calculate the ARP header length. These calculations are correct, but a) some operate with "magic" constants, b) enlarge the code length (sometimes at the cost of coding style), c) are not informative from the first glance. The proposal is to introduce a helper, that includes all the good sides of these calculations. Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/netpoll.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 6faa128a4c8..7ae98659d79 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -384,9 +384,7 @@ static void arp_reply(struct sk_buff *skb)
384 if (skb->dev->flags & IFF_NOARP) 384 if (skb->dev->flags & IFF_NOARP)
385 return; 385 return;
386 386
387 if (!pskb_may_pull(skb, (sizeof(struct arphdr) + 387 if (!pskb_may_pull(skb, arp_hdr_len(skb->dev)))
388 (2 * skb->dev->addr_len) +
389 (2 * sizeof(u32)))))
390 return; 388 return;
391 389
392 skb_reset_network_header(skb); 390 skb_reset_network_header(skb);
@@ -414,7 +412,7 @@ static void arp_reply(struct sk_buff *skb)
414 ipv4_is_loopback(tip) || ipv4_is_multicast(tip)) 412 ipv4_is_loopback(tip) || ipv4_is_multicast(tip))
415 return; 413 return;
416 414
417 size = sizeof(struct arphdr) + 2 * (skb->dev->addr_len + 4); 415 size = arp_hdr_len(skb->dev);
418 send_skb = find_skb(np, size + LL_RESERVED_SPACE(np->dev), 416 send_skb = find_skb(np, size + LL_RESERVED_SPACE(np->dev),
419 LL_RESERVED_SPACE(np->dev)); 417 LL_RESERVED_SPACE(np->dev));
420 418