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]
Message-ID: <3e9595ec-f233-4d93-84ff-77e0183c73a7@kernel.org>
Date: Tue, 14 May 2024 09:13:41 -0600
From: David Ahern <dsahern@...nel.org>
To: xu.xin16@....com.cn, davem@...emloft.net, edumazet@...gle.com,
 kuba@...nel.org, pabeni@...hat.com
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org, dsahern@...il.com,
 fan.yu9@....com.cn, yang.yang29@....com.cn, si.hao@....com.cn,
 zhang.yunkai@....com.cn, he.peilin@....com.cn
Subject: Re: [PATCH] net/ipv6: Fix route deleting failure when metric equals 0

On 5/14/24 6:11 AM, xu.xin16@....com.cn wrote:
> From: xu xin <xu.xin16@....com.cn>
> 
> Problem
> =========
> After commit 67f695134703 ("ipv6: Move setting default metric for routes"),
> we noticed that the logic of assigning the default value of fc_metirc
> changed in the ioctl process. That is, when users use ioctl(fd, SIOCADDRT,
> rt) with a non-zero metric to add a route,  then they may fail to delete a
> route with passing in a metric value of 0 to the kernel by ioctl(fd,
> SIOCDELRT, rt). But iproute can succeed in deleting it.
> 
> As a reference, when using iproute tools by netlink to delete routes with
> a metric parameter equals 0, like the command as follows:
> 
> 	ip -6 route del fe80::/64 via fe81::5054:ff:fe11:3451 dev eth0 metric 0
> 
> the user can still succeed in deleting the route entry with the smallest
> metric.
> 
> Root Reason
> ===========
> After commit 67f695134703 ("ipv6: Move setting default metric for routes"),
> When ioctl() pass in SIOCDELRT with a zero metric, rtmsg_to_fib6_config()
> will set a defalut value (1024) to cfg->fc_metric in kernel, and in
> ip6_route_del() and the line 4074 at net/ipv3/route.c, it will check by
> 
> 	if (cfg->fc_metric && cfg->fc_metric != rt->fib6_metric)
> 		continue;
> 
> and the condition is true and skip the later procedure (deleting route)
> because cfg->fc_metric != rt->fib6_metric. But before that commit,
> cfg->fc_metric is still zero there, so the condition is false and it
> will do the following procedure (deleting).
> 
> Solution
> ========
> In order to keep a consistent behaviour across netlink() and ioctl(), we
> should allow to delete a route with a metric value of 0. So we only do
> the default setting of fc_metric in route adding.
> 
> CC: stable@...r.kernel.org # 5.4+
> Fixes: 67f695134703 ("ipv6: Move setting default metric for routes")
> Co-developed-by: Fan Yu <fan.yu9@....com.cn>
> Signed-off-by: Fan Yu <fan.yu9@....com.cn>
> Signed-off-by: xu xin <xu.xin16@....com.cn>
> ---
>  net/ipv6/route.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 

Reviewed-by: David Ahern <dsahern@...nel.org>



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ