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]
Date: Tue, 18 Jul 2023 08:43:20 -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>, Beniamino Galvani <bgalvani@...hat.com>
Subject: Re: [PATCH net-next] IPv6: add extack info for inet6_addr_add/del

On 7/17/23 3:33 AM, Hangbin Liu wrote:
> Add extack info for inet6_addr_add(), ipv6_add_addr() and
> inet6_addr_del(), 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>
> ---
>  net/ipv6/addrconf.c | 66 ++++++++++++++++++++++++++++++++-------------
>  1 file changed, 48 insertions(+), 18 deletions(-)
> 
> diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
> index e5213e598a04..199de4b37f24 100644
> --- a/net/ipv6/addrconf.c
> +++ b/net/ipv6/addrconf.c
> @@ -1066,15 +1066,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);
> +	}
>  
>  	if (idev->dead) {
> -		err = -ENODEV;			/*XXX*/
> +		NL_SET_ERR_MSG(extack, "No such device");

ENODEV error string gives the same information. Here we can be more
informative with something like "Device marked as dead".


> +		err = -ENODEV;
>  		goto out;
>  	}
>  
>  	if (idev->cnf.disable_ipv6) {
> +		NL_SET_ERR_MSG(extack, "IPv6 is disabled on this device");
>  		err = -EACCES;
>  		goto out;
>  	}
> @@ -1097,12 +1101,14 @@ ipv6_add_addr(struct inet6_dev *idev, struct ifa6_config *cfg,
>  
>  	ifa = kzalloc(sizeof(*ifa), gfp_flags | __GFP_ACCOUNT);
>  	if (!ifa) {
> +		NL_SET_ERR_MSG(extack, "No buffer space available");

If I recall correctly, extack messages are not returned for memory
allocation failure since it will be the same as strerror(ENOMEM) and
strerror(ENOBUFS).


>  		err = -ENOBUFS;
>  		goto out;
>  	}
>  
>  	f6i = addrconf_f6i_alloc(net, idev, cfg->pfx, false, gfp_flags);
>  	if (IS_ERR(f6i)) {
> +		NL_SET_ERR_MSG(extack, "Dest allocate failed");
>  		err = PTR_ERR(f6i);
>  		f6i = NULL;
>  		goto out;
> @@ -1142,6 +1148,7 @@ ipv6_add_addr(struct inet6_dev *idev, struct ifa6_config *cfg,
>  
>  	err = ipv6_add_addr_hash(idev->dev, ifa);
>  	if (err < 0) {
> +		NL_SET_ERR_MSG(extack, "IPv6 address add failed");

Add extack to ipv6_add_addr_hash and convert the debug string in that
function to to return the error.

>  		rcu_read_unlock();
>  		goto out;
>  	}


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ