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: <e439e851-435d-430d-b7fb-7666ea496954@lunn.ch>
Date: Fri, 7 Feb 2025 00:02:34 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Nicolas Dichtel <nicolas.dichtel@...nd.com>
Cc: "David S . Miller" <davem@...emloft.net>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	Eric Dumazet <edumazet@...gle.com>,
	Alexander Lobakin <aleksander.lobakin@...el.com>,
	netdev@...r.kernel.org
Subject: Re: [PATCH net 2/2] net: enhance error message for 'netns local'
 iface

On Thu, Feb 06, 2025 at 05:50:27PM +0100, Nicolas Dichtel wrote:
> The current message is "Invalid argument". Let's help the user by
> explaining the error.
> 
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@...nd.com>
> ---
>  net/core/rtnetlink.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
> index 5032e65b8faa..91b358bdfe5c 100644
> --- a/net/core/rtnetlink.c
> +++ b/net/core/rtnetlink.c
> @@ -3024,8 +3024,12 @@ static int do_setlink(const struct sk_buff *skb, struct net_device *dev,
>  		new_ifindex = nla_get_s32_default(tb[IFLA_NEW_IFINDEX], 0);
>  
>  		err = __dev_change_net_namespace(dev, tgt_net, pat, new_ifindex);
> -		if (err)
> +		if (err) {
> +			if (dev->netns_local)
> +				NL_SET_ERR_MSG(extack,
> +					       "The interface has the 'netns local' property");

This seems to have the wrong order. Why even try calling
__dev_change_net_namespace() if you know it is going to fail?

Maybe this NL_SET_ERR_MSG() should be pushed into
__dev_change_net_namespace()? You could then return useful messages if
the altnames conflict, the ifindex is already in use, etc.

	Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ