aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/ndisc.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2011-11-17 21:20:04 -0500
committerDavid S. Miller <davem@davemloft.net>2011-11-18 14:37:09 -0500
commita7ae1992248e5cf9dc5bd35695ab846d27efe15f (patch)
treeed3f450a41ca5975aecae2850105ca22f98ca318 /net/ipv6/ndisc.c
parent660882432909dbe611f1792eda158188065cb9f1 (diff)
ipv6: Remove all uses of LL_ALLOCATED_SPACE
ipv6: Remove all uses of LL_ALLOCATED_SPACE The macro LL_ALLOCATED_SPACE was ill-conceived. It applies the alignment to the sum of needed_headroom and needed_tailroom. As the amount that is then reserved for head room is needed_headroom with alignment, this means that the tail room left may be too small. This patch replaces all uses of LL_ALLOCATED_SPACE in net/ipv6 with the macro LL_RESERVED_SPACE and direct reference to needed_tailroom. This also fixes the problem with needed_headroom changing between allocating the skb and reserving the head room. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/ndisc.c')
-rw-r--r--net/ipv6/ndisc.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 4a2098222625..d699ddcad4ce 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -446,6 +446,8 @@ struct sk_buff *ndisc_build_skb(struct net_device *dev,
446 struct sock *sk = net->ipv6.ndisc_sk; 446 struct sock *sk = net->ipv6.ndisc_sk;
447 struct sk_buff *skb; 447 struct sk_buff *skb;
448 struct icmp6hdr *hdr; 448 struct icmp6hdr *hdr;
449 int hlen = LL_RESERVED_SPACE(dev);
450 int tlen = dev->needed_tailroom;
449 int len; 451 int len;
450 int err; 452 int err;
451 u8 *opt; 453 u8 *opt;
@@ -459,7 +461,7 @@ struct sk_buff *ndisc_build_skb(struct net_device *dev,
459 461
460 skb = sock_alloc_send_skb(sk, 462 skb = sock_alloc_send_skb(sk,
461 (MAX_HEADER + sizeof(struct ipv6hdr) + 463 (MAX_HEADER + sizeof(struct ipv6hdr) +
462 len + LL_ALLOCATED_SPACE(dev)), 464 len + hlen + tlen),
463 1, &err); 465 1, &err);
464 if (!skb) { 466 if (!skb) {
465 ND_PRINTK0(KERN_ERR 467 ND_PRINTK0(KERN_ERR
@@ -468,7 +470,7 @@ struct sk_buff *ndisc_build_skb(struct net_device *dev,
468 return NULL; 470 return NULL;
469 } 471 }
470 472
471 skb_reserve(skb, LL_RESERVED_SPACE(dev)); 473 skb_reserve(skb, hlen);
472 ip6_nd_hdr(sk, skb, dev, saddr, daddr, IPPROTO_ICMPV6, len); 474 ip6_nd_hdr(sk, skb, dev, saddr, daddr, IPPROTO_ICMPV6, len);
473 475
474 skb->transport_header = skb->tail; 476 skb->transport_header = skb->tail;
@@ -1533,6 +1535,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
1533 struct inet6_dev *idev; 1535 struct inet6_dev *idev;
1534 struct flowi6 fl6; 1536 struct flowi6 fl6;
1535 u8 *opt; 1537 u8 *opt;
1538 int hlen, tlen;
1536 int rd_len; 1539 int rd_len;
1537 int err; 1540 int err;
1538 u8 ha_buf[MAX_ADDR_LEN], *ha = NULL; 1541 u8 ha_buf[MAX_ADDR_LEN], *ha = NULL;
@@ -1590,9 +1593,11 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
1590 rd_len &= ~0x7; 1593 rd_len &= ~0x7;
1591 len += rd_len; 1594 len += rd_len;
1592 1595
1596 hlen = LL_RESERVED_SPACE(dev);
1597 tlen = dev->needed_tailroom;
1593 buff = sock_alloc_send_skb(sk, 1598 buff = sock_alloc_send_skb(sk,
1594 (MAX_HEADER + sizeof(struct ipv6hdr) + 1599 (MAX_HEADER + sizeof(struct ipv6hdr) +
1595 len + LL_ALLOCATED_SPACE(dev)), 1600 len + hlen + tlen),
1596 1, &err); 1601 1, &err);
1597 if (buff == NULL) { 1602 if (buff == NULL) {
1598 ND_PRINTK0(KERN_ERR 1603 ND_PRINTK0(KERN_ERR
@@ -1601,7 +1606,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
1601 goto release; 1606 goto release;
1602 } 1607 }
1603 1608
1604 skb_reserve(buff, LL_RESERVED_SPACE(dev)); 1609 skb_reserve(buff, hlen);
1605 ip6_nd_hdr(sk, buff, dev, &saddr_buf, &ipv6_hdr(skb)->saddr, 1610 ip6_nd_hdr(sk, buff, dev, &saddr_buf, &ipv6_hdr(skb)->saddr,
1606 IPPROTO_ICMPV6, len); 1611 IPPROTO_ICMPV6, len);
1607 1612