lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 14 Feb 2023 18:39:35 +0100
From:   Alexander Lobakin <alexandr.lobakin@...el.com>
To:     Lu Wei <luwei32@...wei.com>
CC:     <davem@...emloft.net>, <dsahern@...nel.org>, <edumazet@...gle.com>,
        <kuba@...nel.org>, <pabeni@...hat.com>, <netdev@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH net] ipv6: Add lwtunnel encap size of all siblings in
 nexthop calculation

From: Lu Wei <luwei32@...wei.com>
Date: Tue, 14 Feb 2023 17:29:33 +0800

> In function rt6_nlmsg_size(), the length of nexthop is calculated
> by multipling the nexthop length of fib6_info and the number of
> siblings. However if the fib6_info has no lwtunnel but the siblings
> have lwtunnels, the nexthop length is less than it should be, and
> it will trigger a warning in inet6_rt_notify() as follows:

[...]

> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index e74e0361fd92..a6983a13dd20 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -5540,16 +5540,17 @@ static size_t rt6_nlmsg_size(struct fib6_info *f6i)
>  		nexthop_for_each_fib6_nh(f6i->nh, rt6_nh_nlmsg_size,
>  					 &nexthop_len);
>  	} else {
> +		struct fib6_info *sibling, *next_sibling;
>  		struct fib6_nh *nh = f6i->fib6_nh;
>  
>  		nexthop_len = 0;
>  		if (f6i->fib6_nsiblings) {
> -			nexthop_len = nla_total_size(0)	 /* RTA_MULTIPATH */
> -				    + NLA_ALIGN(sizeof(struct rtnexthop))
> -				    + nla_total_size(16) /* RTA_GATEWAY */
> -				    + lwtunnel_get_encap_size(nh->fib_nh_lws);
> +			rt6_nh_nlmsg_size(nh, &nexthop_len);
>  
> -			nexthop_len *= f6i->fib6_nsiblings;
> +			list_for_each_entry_safe(sibling, next_sibling,
> +						 &f6i->fib6_siblings, fib6_siblings) {
> +				rt6_nh_nlmsg_size(sibling->fib6_nh, &nexthop_len);
> +			}

Just a random nitpick that you shouldn't put braces {} around oneliners :D

>  		}
>  		nexthop_len += lwtunnel_get_encap_size(nh->fib_nh_lws);
>  	}
Thanks,
Olek

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ