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: <20150506121022.GG25248@pox.localdomain>
Date:	Wed, 6 May 2015 14:10:22 +0200
From:	Thomas Graf <tgraf@...g.ch>
To:	Nicolas Dichtel <nicolas.dichtel@...nd.com>
Cc:	netdev@...r.kernel.org, davem@...emloft.net, ebiederm@...ssion.com
Subject: Re: [PATCH net-next 6/6] netlink: allow to listen "all" netns

On 05/06/15 at 11:58am, Nicolas Dichtel wrote:
> More accurately, listen all netns that have a nsid assigned into the netns
> where the netlink socket is opened.
> For this purpose, a netlink socket option is added:
> NETLINK_LISTEN_ALL_NSID. When this option is set on a netlink socket, this
> socket will receive netlink notifications from all netns that have a nsid
> assigned into the netns where the socket has been opened. The nsid is sent
> to userland via an anscillary data.
> 
> With this patch, a daemon needs only one socket to listen many netns. This
> is useful when the number of netns is high.
> 
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@...nd.com>

[...]

> +/* This function returns true is the peer netns has an id assigned into the
> + * current netns.
> + */
> +bool peernet_has_id(struct net *net, struct net *peer)
> +{
> +	return peernet2id(net, peer) >= 0;
> +}

Missing export?

> +
>  struct net *get_net_ns_by_id(struct net *net, int id)
>  {
>  	unsigned long flags;
> diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
> index ec4adbdcb9b4..bdbde542e952 100644
> --- a/net/netlink/af_netlink.c
> +++ b/net/netlink/af_netlink.c
> @@ -83,6 +83,7 @@ struct listeners {
>  #define NETLINK_RECV_PKTINFO	0x2
>  #define NETLINK_BROADCAST_SEND_ERROR	0x4
>  #define NETLINK_RECV_NO_ENOBUFS	0x8
> +#define NETLINK_LISTEN_ALL	0x10

Maybe name this NETLINK_LISTEN_ALL_NSID just to make it clear?

> +		if (!file_ns_capable(sk->sk_socket->file, p->net->user_ns,
> +				     CAP_NET_BROADCAST))
> +			return;
> +	}
> +	NETLINK_CB(p->skb).net = p->net;

Does this need a get_net()? The netns could disappear while the skb is
queued, right?
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ