diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2006-12-03 00:00:06 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-12-03 00:06:31 -0500 |
commit | d54a81d341af80875c201890500f727c8188dd9b (patch) | |
tree | 90ea4b2fe248fd3b0e10f846329868c12f8b4123 | |
parent | 97be852f81c5bb114aab31974af2c061eb86a6de (diff) |
[IPV6] NDISC: Calculate packet length correctly for allocation.
MAX_HEADER does not include the ipv6 header length in it,
so we need to add it in explicitly.
With help from YOSHIFUJI Hideaki.
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/ipv6/ndisc.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c index 73eb8c33e9f0..89d527ebd7f6 100644 --- a/net/ipv6/ndisc.c +++ b/net/ipv6/ndisc.c | |||
@@ -472,7 +472,9 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh, | |||
472 | inc_opt = 0; | 472 | inc_opt = 0; |
473 | } | 473 | } |
474 | 474 | ||
475 | skb = sock_alloc_send_skb(sk, MAX_HEADER + len + LL_RESERVED_SPACE(dev), | 475 | skb = sock_alloc_send_skb(sk, |
476 | (MAX_HEADER + sizeof(struct ipv6hdr) + | ||
477 | len + LL_RESERVED_SPACE(dev)), | ||
476 | 1, &err); | 478 | 1, &err); |
477 | 479 | ||
478 | if (skb == NULL) { | 480 | if (skb == NULL) { |
@@ -561,7 +563,9 @@ void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh, | |||
561 | if (send_llinfo) | 563 | if (send_llinfo) |
562 | len += ndisc_opt_addr_space(dev); | 564 | len += ndisc_opt_addr_space(dev); |
563 | 565 | ||
564 | skb = sock_alloc_send_skb(sk, MAX_HEADER + len + LL_RESERVED_SPACE(dev), | 566 | skb = sock_alloc_send_skb(sk, |
567 | (MAX_HEADER + sizeof(struct ipv6hdr) + | ||
568 | len + LL_RESERVED_SPACE(dev)), | ||
565 | 1, &err); | 569 | 1, &err); |
566 | if (skb == NULL) { | 570 | if (skb == NULL) { |
567 | ND_PRINTK0(KERN_ERR | 571 | ND_PRINTK0(KERN_ERR |
@@ -636,7 +640,9 @@ void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr, | |||
636 | if (dev->addr_len) | 640 | if (dev->addr_len) |
637 | len += ndisc_opt_addr_space(dev); | 641 | len += ndisc_opt_addr_space(dev); |
638 | 642 | ||
639 | skb = sock_alloc_send_skb(sk, MAX_HEADER + len + LL_RESERVED_SPACE(dev), | 643 | skb = sock_alloc_send_skb(sk, |
644 | (MAX_HEADER + sizeof(struct ipv6hdr) + | ||
645 | len + LL_RESERVED_SPACE(dev)), | ||
640 | 1, &err); | 646 | 1, &err); |
641 | if (skb == NULL) { | 647 | if (skb == NULL) { |
642 | ND_PRINTK0(KERN_ERR | 648 | ND_PRINTK0(KERN_ERR |
@@ -1446,7 +1452,9 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh, | |||
1446 | rd_len &= ~0x7; | 1452 | rd_len &= ~0x7; |
1447 | len += rd_len; | 1453 | len += rd_len; |
1448 | 1454 | ||
1449 | buff = sock_alloc_send_skb(sk, MAX_HEADER + len + LL_RESERVED_SPACE(dev), | 1455 | buff = sock_alloc_send_skb(sk, |
1456 | (MAX_HEADER + sizeof(struct ipv6hdr) + | ||
1457 | len + LL_RESERVED_SPACE(dev)), | ||
1450 | 1, &err); | 1458 | 1, &err); |
1451 | if (buff == NULL) { | 1459 | if (buff == NULL) { |
1452 | ND_PRINTK0(KERN_ERR | 1460 | ND_PRINTK0(KERN_ERR |