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: <1c9f75cc-b9c0-0f5d-9b92-b37f639ce25b@kernel.org>
Date: Mon, 24 Jul 2023 09:02:42 -0600
From: David Ahern <dsahern@...nel.org>
To: Hangbin Liu <liuhangbin@...il.com>, netdev@...r.kernel.org
Cc: "David S . Miller" <davem@...emloft.net>,
 Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>,
 Paolo Abeni <pabeni@...hat.com>, Ido Schimmel <idosch@...sch.org>,
 Beniamino Galvani <bgalvani@...hat.com>
Subject: Re: [PATCHv3 net-next] IPv6: add extack info for IPv6 address
 add/delete

On 7/24/23 1:50 AM, Hangbin Liu wrote:
> Add extack info for IPv6 address add/delete, which would be useful for
> users to understand the problem without having to read kernel code.
> 
> Suggested-by: Beniamino Galvani <bgalvani@...hat.com>
> Signed-off-by: Hangbin Liu <liuhangbin@...il.com>
> ---
> v3: * Update extack message. Pass extack to addrconf_f6i_alloc().
>     * Return "IPv6 is disabled" for addrconf_add_dev(), as the same
>       with ndisc_allow_add() does.
>     * Set dup addr extack message in inet6_rtm_newaddr() instead of
>       ipv6_add_addr_hash().
> v2: Update extack msg for dead dev. Remove msg for NOBUFS error.
>     Add extack for ipv6_add_addr_hash()
> ---
>  include/net/ip6_route.h |  2 +-
>  net/ipv6/addrconf.c     | 63 +++++++++++++++++++++++++++++------------
>  net/ipv6/anycast.c      |  2 +-
>  net/ipv6/route.c        |  5 ++--
>  4 files changed, 50 insertions(+), 22 deletions(-)
> 

This patch is getting long enough, so:
Reviewed-by: David Ahern <dsahern@...nel.org>

Followup requests below. Thanks,

> diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
> index 19eb4b3d26ea..53dea18a4a07 100644
> --- a/net/ipv6/addrconf.c
> +++ b/net/ipv6/addrconf.c
> @@ -1068,15 +1068,19 @@ ipv6_add_addr(struct inet6_dev *idev, struct ifa6_config *cfg,
>  	     !(cfg->ifa_flags & IFA_F_MCAUTOJOIN)) ||
>  	    (!(idev->dev->flags & IFF_LOOPBACK) &&
>  	     !netif_is_l3_master(idev->dev) &&
> -	     addr_type & IPV6_ADDR_LOOPBACK))
> +	     addr_type & IPV6_ADDR_LOOPBACK)) {
> +		NL_SET_ERR_MSG(extack, "Cannot assign requested address");
>  		return ERR_PTR(-EADDRNOTAVAIL);
> +	}

It would be good to split the above checks into separate ones with more
specific messages.

>  
>  	if (idev->dead) {
> -		err = -ENODEV;			/*XXX*/
> +		NL_SET_ERR_MSG(extack, "IPv6 device is going away");
> +		err = -ENODEV;
>  		goto out;
>  	}
>  
>  	if (idev->cnf.disable_ipv6) {
> +		NL_SET_ERR_MSG(extack, "IPv6 is disabled on this device");
>  		err = -EACCES;
>  		goto out;
>  	}

...

>  
>  	if (cfg->ifa_flags & IFA_F_MCAUTOJOIN) {
>  		int ret = ipv6_mc_config(net->ipv6.mc_autojoin_sk,
>  					 true, cfg->pfx, ifindex);

and pass extack to this one for better message as well.

>  
> -		if (ret < 0)
> +		if (ret < 0) {
> +			NL_SET_ERR_MSG(extack, "Multicast auto join failed");
>  			return ret;
> +		}
>  	}
>  
>  	cfg->scope = ipv6_addr_scope(cfg->pfx);



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ