Commit d54a81d3 authored by David S. Miller's avatar David S. Miller

[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: default avatarDavid S. Miller <davem@davemloft.net>
parent 97be852f
...@@ -472,7 +472,9 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh, ...@@ -472,7 +472,9 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh,
inc_opt = 0; inc_opt = 0;
} }
skb = sock_alloc_send_skb(sk, MAX_HEADER + len + LL_RESERVED_SPACE(dev), skb = sock_alloc_send_skb(sk,
(MAX_HEADER + sizeof(struct ipv6hdr) +
len + LL_RESERVED_SPACE(dev)),
1, &err); 1, &err);
if (skb == NULL) { if (skb == NULL) {
...@@ -561,7 +563,9 @@ void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh, ...@@ -561,7 +563,9 @@ void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh,
if (send_llinfo) if (send_llinfo)
len += ndisc_opt_addr_space(dev); len += ndisc_opt_addr_space(dev);
skb = sock_alloc_send_skb(sk, MAX_HEADER + len + LL_RESERVED_SPACE(dev), skb = sock_alloc_send_skb(sk,
(MAX_HEADER + sizeof(struct ipv6hdr) +
len + LL_RESERVED_SPACE(dev)),
1, &err); 1, &err);
if (skb == NULL) { if (skb == NULL) {
ND_PRINTK0(KERN_ERR ND_PRINTK0(KERN_ERR
...@@ -636,7 +640,9 @@ void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr, ...@@ -636,7 +640,9 @@ void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr,
if (dev->addr_len) if (dev->addr_len)
len += ndisc_opt_addr_space(dev); len += ndisc_opt_addr_space(dev);
skb = sock_alloc_send_skb(sk, MAX_HEADER + len + LL_RESERVED_SPACE(dev), skb = sock_alloc_send_skb(sk,
(MAX_HEADER + sizeof(struct ipv6hdr) +
len + LL_RESERVED_SPACE(dev)),
1, &err); 1, &err);
if (skb == NULL) { if (skb == NULL) {
ND_PRINTK0(KERN_ERR ND_PRINTK0(KERN_ERR
...@@ -1446,7 +1452,9 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh, ...@@ -1446,7 +1452,9 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
rd_len &= ~0x7; rd_len &= ~0x7;
len += rd_len; len += rd_len;
buff = sock_alloc_send_skb(sk, MAX_HEADER + len + LL_RESERVED_SPACE(dev), buff = sock_alloc_send_skb(sk,
(MAX_HEADER + sizeof(struct ipv6hdr) +
len + LL_RESERVED_SPACE(dev)),
1, &err); 1, &err);
if (buff == NULL) { if (buff == NULL) {
ND_PRINTK0(KERN_ERR ND_PRINTK0(KERN_ERR
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment