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] [day] [month] [year] [list]
Message-ID: <ec59cfd5-97fa-d254-c3b2-3775c216770d@gmail.com>
Date:   Thu, 23 Sep 2021 08:22:08 -0600
From:   David Ahern <dsahern@...il.com>
To:     Xiao Liang <shaw.leon@...il.com>, netdev <netdev@...r.kernel.org>
Cc:     "David S. Miller" <davem@...emloft.net>,
        Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
        David Ahern <dsahern@...nel.org>,
        Jakub Kicinski <kuba@...nel.org>,
        Martin KaFai Lau <kafai@...com>
Subject: Re: [PATCH net v2] net: ipv4: Fix rtnexthop len when RTA_FLOW is
 present

On 9/23/21 1:22 AM, Xiao Liang wrote:
> diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
> index b42c429cebbe..e9818faaff4d 100644
> --- a/net/ipv4/fib_semantics.c
> +++ b/net/ipv4/fib_semantics.c
> @@ -1661,7 +1661,7 @@ EXPORT_SYMBOL_GPL(fib_nexthop_info);
>  
>  #if IS_ENABLED(CONFIG_IP_ROUTE_MULTIPATH) || IS_ENABLED(CONFIG_IPV6)
>  int fib_add_nexthop(struct sk_buff *skb, const struct fib_nh_common *nhc,
> -		    int nh_weight, u8 rt_family)
> +		    int nh_weight, u8 rt_family, u32 nh_tclassid)
>  {
>  	const struct net_device *dev = nhc->nhc_dev;
>  	struct rtnexthop *rtnh;
> @@ -1679,6 +1679,12 @@ int fib_add_nexthop(struct sk_buff *skb, const struct fib_nh_common *nhc,
>  
>  	rtnh->rtnh_flags = flags;
>  
> +#ifdef CONFIG_IP_ROUTE_CLASSID
> +	if (nh_tclassid &&
> +	    nla_put_u32(skb, RTA_FLOW, nh_tclassid))
> +		goto nla_put_failure;
> +#endif

I think we can drop the ifdef here if 0 is always passed when the CONFIG
is not enabled.

> +
>  	/* length of rtnetlink header + attributes */
>  	rtnh->rtnh_len = nlmsg_get_pos(skb) - (void *)rtnh;
>  
> @@ -1707,13 +1713,8 @@ static int fib_add_multipath(struct sk_buff *skb, struct fib_info *fi)
>  
>  	for_nexthops(fi) {
>  		if (fib_add_nexthop(skb, &nh->nh_common, nh->fib_nh_weight,
> -				    AF_INET) < 0)
> +				    AF_INET, nh->nh_tclassid) < 0)

This will fail to compile if the CONFIG is not enabled. Use a temp variable:
		__u32 nh_tclassid = 0;

#ifdef CONFIG_IP_ROUTE_CLASSID
        	nh_tclassid = nh->nh_tclassid
#endif

then pass that to fib_add_nexthop

>  			goto nla_put_failure;
> -#ifdef CONFIG_IP_ROUTE_CLASSID
> -		if (nh->nh_tclassid &&
> -		    nla_put_u32(skb, RTA_FLOW, nh->nh_tclassid))
> -			goto nla_put_failure;
> -#endif
>  	} endfor_nexthops(fi);
>  
>  mp_end:



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ