ndisc: Fix skb allocation size for link layer options.
Subsystems (3)
RFC PATCH 1/1 ndisc: Fix skb allocation size for link layer options.
Signed-off-by Stephan Gatzka <[email protected]>
--- net/ipv6/ndisc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/ipv6/ndisc.c +3 -2
@@ -392,7 +392,7 @@ static struct sk_buff *ndisc_build_skb(struct net_device *dev, len =sizeof (struct icmp6hdr ) + (target ?sizeof (*target) :0 );if (llinfo) - len +=ndisc_opt_addr_space (dev); + len +=sizeof (struct nd_opt_hdr ) +ndisc_opt_addr_space (dev); skb = sock_alloc_send_skb(sk, (MAX_HEADER + sizeof(struct ipv6hdr) +
@@ -1424,7 +1424,8 @@ void ndisc_send_redirect(struct sk_buff *skb, const struct in6_addr *target)memcpy (ha_buf, neigh->ha, dev->addr_len);read_unlock_bh (&neigh->lock); ha = ha_buf; - len +=ndisc_opt_addr_space (dev); + len +=sizeof (struct nd_opt_hdr ) + +ndisc_opt_addr_space (dev); }else read_unlock_bh (&neigh->lock);
Signature · 1 line
1.7.9.5
Quoted 20 lines · Stephan Gatzka
Signed-off-by Stephan Gatzka <[email protected]>--- net/ipv6/ndisc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)net/ipv6/ndisc.c +1
-1@@ -392,7 +392,7 @@ static struct sk_buff *ndisc_build_skb(struct net_device *dev, len =sizeof (struct icmp6hdr ) + (target ?sizeof (*target) :0 );if (llinfo) - len +=ndisc_opt_addr_space (dev); + len +=sizeof (struct nd_opt_hdr ) +ndisc_opt_addr_space (dev); skb = sock_alloc_send_skb(sk, (MAX_HEADER + sizeof(struct ipv6hdr) +
net/ipv6/ndisc.c void ndisc_send_redirect(struct sk_buff *skb, const struct in6_addr *target) · line 1431
Quoted 9 lines
net/ipv6/ndisc.c +2
-1@@ -1424,7 +1424,8 @@ void ndisc_send_redirect(struct sk_buff *skb, const struct in6_addr *target)memcpy (ha_buf, neigh->ha, dev->addr_len);read_unlock_bh (&neigh->lock); ha = ha_buf; - len +=ndisc_opt_addr_space (dev); + len +=sizeof (struct nd_opt_hdr ) + +ndisc_opt_addr_space (dev); }else read_unlock_bh (&neigh->lock);
Disagree. NDISC_OPT_SPACE() takes care size of nd option header.
--yoshfuji
Quoted 17 lines · YOSHIFUJI Hideaki
Quoted 16 lines · Stephan Gatzka
Signed-off-by Stephan Gatzka <[email protected]>--- net/ipv6/ndisc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)net/ipv6/ndisc.c +1
-1@@ -392,7 +392,7 @@ static struct sk_buff *ndisc_build_skb(struct net_device *dev, len =sizeof (struct icmp6hdr ) + (target ?sizeof (*target) :0 );if (llinfo) - len +=ndisc_opt_addr_space (dev); + len +=sizeof (struct nd_opt_hdr ) +ndisc_opt_addr_space (dev);
Quoted 15 lines
net/ipv6/ndisc.c void ndisc_send_redirect(struct sk_buff *skb, const struct in6_addr *target) · line 1431
Quoted 13 lines
net/ipv6/ndisc.c +2
-1skb = sock_alloc_send_skb(sk, (MAX_HEADER + sizeof(struct ipv6hdr) +@@ -1424,7 +1424,8 @@ void ndisc_send_redirect(struct sk_buff *skb, const struct in6_addr *target)memcpy (ha_buf, neigh->ha, dev->addr_len);read_unlock_bh (&neigh->lock); ha = ha_buf; - len +=ndisc_opt_addr_space (dev); + len +=sizeof (struct nd_opt_hdr ) + +ndisc_opt_addr_space (dev); }else read_unlock_bh (&neigh->lock);Disagree.
NDISC_OPT_SPACE()takes care size of nd option header.
Please note:
static inline int ndisc_opt_addr_space(struct net_device *dev)
{
return NDISC_OPT_SPACE(dev->addr_len + ndisc_addr_option_pad(dev->type));
}--yoshfuji
Quoted 3 lines
Disagree.
NDISC_OPT_SPACE()takes care size of nd option header.
Agree. I misunderstood this, my fault.
Maybe it's better to write:
#define NDISC_OPT_SPACE(len) (((len)+sizeof(nd_opt_hdr)+7)&~7)
Regards,
Stephan