* [Patch RFC] ndisc: Fix skb allocation size for link layer options.
@ 2012-12-28 13:46 Stephan Gatzka
2012-12-29 15:29 ` YOSHIFUJI Hideaki
0 siblings, 1 reply; 4+ messages in thread
From: Stephan Gatzka @ 2012-12-28 13:46 UTC (permalink / raw)
To: netdev; +Cc: yoshfuji, Stephan Gatzka
Signed-off-by: Stephan Gatzka <stephan.gatzka@gmail.com>
---
net/ipv6/ndisc.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 6574175..b12b94c 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -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);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Patch RFC] ndisc: Fix skb allocation size for link layer options.
2012-12-28 13:46 [Patch RFC] ndisc: Fix skb allocation size for link layer options Stephan Gatzka
@ 2012-12-29 15:29 ` YOSHIFUJI Hideaki
2012-12-29 15:32 ` YOSHIFUJI Hideaki
2012-12-29 16:37 ` Stephan Gatzka
0 siblings, 2 replies; 4+ messages in thread
From: YOSHIFUJI Hideaki @ 2012-12-29 15:29 UTC (permalink / raw)
To: Stephan Gatzka; +Cc: netdev, YOSHIFUJI Hideaki
Stephan Gatzka wrote:
> Signed-off-by: Stephan Gatzka <stephan.gatzka@gmail.com>
> ---
> net/ipv6/ndisc.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
> index 6574175..b12b94c 100644
> --- a/net/ipv6/ndisc.c
> +++ b/net/ipv6/ndisc.c
> @@ -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);
>
>
Disagree. NDISC_OPT_SPACE() takes care size of nd option header.
--yoshfuji
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Patch RFC] ndisc: Fix skb allocation size for link layer options.
2012-12-29 15:29 ` YOSHIFUJI Hideaki
@ 2012-12-29 15:32 ` YOSHIFUJI Hideaki
2012-12-29 16:37 ` Stephan Gatzka
1 sibling, 0 replies; 4+ messages in thread
From: YOSHIFUJI Hideaki @ 2012-12-29 15:32 UTC (permalink / raw)
To: Stephan Gatzka; +Cc: YOSHIFUJI Hideaki, netdev
YOSHIFUJI Hideaki wrote:
> Stephan Gatzka wrote:
>> Signed-off-by: Stephan Gatzka <stephan.gatzka@gmail.com>
>> ---
>> net/ipv6/ndisc.c | 5 +++--
>> 1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
>> index 6574175..b12b94c 100644
>> --- a/net/ipv6/ndisc.c
>> +++ b/net/ipv6/ndisc.c
>> @@ -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);
>>
>>
>
> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Patch RFC] ndisc: Fix skb allocation size for link layer options.
2012-12-29 15:29 ` YOSHIFUJI Hideaki
2012-12-29 15:32 ` YOSHIFUJI Hideaki
@ 2012-12-29 16:37 ` Stephan Gatzka
1 sibling, 0 replies; 4+ messages in thread
From: Stephan Gatzka @ 2012-12-29 16:37 UTC (permalink / raw)
To: YOSHIFUJI Hideaki; +Cc: netdev
>
> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-12-29 16:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-28 13:46 [Patch RFC] ndisc: Fix skb allocation size for link layer options Stephan Gatzka
2012-12-29 15:29 ` YOSHIFUJI Hideaki
2012-12-29 15:32 ` YOSHIFUJI Hideaki
2012-12-29 16:37 ` Stephan Gatzka
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).