Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 89987
b: refs/heads/master
c: 988b705
h: refs/heads/master
i:
  89985: b6f99b6
  89983: d18b1fa
v: v3
  • Loading branch information
Pavel Emelyanov authored and David S. Miller committed Mar 3, 2008
1 parent 1e21898 commit 1ed05fa
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8ed7edce82ca0d8d3adba8c08cd42337af6c758c
refs/heads/master: 988b705077d8f922408913f4f521ae073256d4a1
5 changes: 1 addition & 4 deletions trunk/drivers/net/bonding/bond_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2646,10 +2646,7 @@ static int bond_arp_rcv(struct sk_buff *skb, struct net_device *dev, struct pack
if (!slave || !slave_do_arp_validate(bond, slave))
goto out_unlock;

/* ARP header, plus 2 device addresses, plus 2 IP addresses. */
if (!pskb_may_pull(skb, (sizeof(struct arphdr) +
(2 * dev->addr_len) +
(2 * sizeof(u32)))))
if (!pskb_may_pull(skb, arp_hdr_len(dev)))
goto out_unlock;

arp = arp_hdr(skb);
Expand Down
6 changes: 6 additions & 0 deletions trunk/include/linux/if_arp.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,12 @@ static inline struct arphdr *arp_hdr(const struct sk_buff *skb)
{
return (struct arphdr *)skb_network_header(skb);
}

static inline int arp_hdr_len(struct net_device *dev)
{
/* ARP header, plus 2 device addresses, plus 2 IP addresses. */
return sizeof(struct arphdr) + (dev->addr_len + sizeof(u32)) * 2;
}
#endif

#endif /* _LINUX_IF_ARP_H */
6 changes: 2 additions & 4 deletions trunk/net/core/netpoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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));

Expand Down
9 changes: 3 additions & 6 deletions trunk/net/ipv4/arp.c
Original file line number Diff line number Diff line change
Expand Up @@ -570,14 +570,13 @@ struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip,
* Allocate a buffer
*/

skb = alloc_skb(sizeof(struct arphdr)+ 2*(dev->addr_len+4)
+ LL_RESERVED_SPACE(dev), GFP_ATOMIC);
skb = alloc_skb(arp_hdr_len(dev) + LL_RESERVED_SPACE(dev), GFP_ATOMIC);
if (skb == NULL)
return NULL;

skb_reserve(skb, LL_RESERVED_SPACE(dev));
skb_reset_network_header(skb);
arp = (struct arphdr *) skb_put(skb,sizeof(struct arphdr) + 2*(dev->addr_len+4));
arp = (struct arphdr *) skb_put(skb, arp_hdr_len(dev));
skb->dev = dev;
skb->protocol = htons(ETH_P_ARP);
if (src_hw == NULL)
Expand Down Expand Up @@ -916,9 +915,7 @@ static int arp_rcv(struct sk_buff *skb, struct net_device *dev,
goto freeskb;

/* ARP header, plus 2 device addresses, plus 2 IP addresses. */
if (!pskb_may_pull(skb, (sizeof(struct arphdr) +
(2 * dev->addr_len) +
(2 * sizeof(u32)))))
if (!pskb_may_pull(skb, arp_hdr_len(dev)))
goto freeskb;

arp = arp_hdr(skb);
Expand Down
5 changes: 1 addition & 4 deletions trunk/net/ipv4/ipconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -459,10 +459,7 @@ ic_rarp_recv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt
if (rarp->ar_pro != htons(ETH_P_IP))
goto drop;

if (!pskb_may_pull(skb,
sizeof(struct arphdr) +
(2 * dev->addr_len) +
(2 * 4)))
if (!pskb_may_pull(skb, arp_hdr_len(dev)))
goto drop;

/* OK, it is all there and looks valid, process... */
Expand Down
5 changes: 1 addition & 4 deletions trunk/net/ipv4/netfilter/arp_tables.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,7 @@ unsigned int arpt_do_table(struct sk_buff *skb,
void *table_base;
struct xt_table_info *private;

/* ARP header, plus 2 device addresses, plus 2 IP addresses. */
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 NF_DROP;

indev = in ? in->name : nulldevname;
Expand Down

0 comments on commit 1ed05fa

Please sign in to comment.