[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>
This commit is contained in:
committed by
David S. Miller
parent
8ed7edce82
commit
988b705077
@@ -384,9 +384,7 @@ static void arp_reply(struct sk_buff *skb)
|
||||
if (skb->dev->flags & IFF_NOARP)
|
||||
return;
|
||||
|
||||
if (!pskb_may_pull(skb, (sizeof(struct arphdr) +
|
||||
(2 * skb->dev->addr_len) +
|
||||
(2 * sizeof(u32)))))
|
||||
if (!pskb_may_pull(skb, arp_hdr_len(skb->dev)))
|
||||
return;
|
||||
|
||||
skb_reset_network_header(skb);
|
||||
@@ -414,7 +412,7 @@ static void arp_reply(struct sk_buff *skb)
|
||||
ipv4_is_loopback(tip) || ipv4_is_multicast(tip))
|
||||
return;
|
||||
|
||||
size = sizeof(struct arphdr) + 2 * (skb->dev->addr_len + 4);
|
||||
size = arp_hdr_len(skb->dev);
|
||||
send_skb = find_skb(np, size + LL_RESERVED_SPACE(np->dev),
|
||||
LL_RESERVED_SPACE(np->dev));
|
||||
|
||||
|
Reference in New Issue
Block a user