All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] netlink: include netnsid only when netns differs.
@ 2017-05-30 21:33 Flavio Leitner
  2017-05-31  8:38 ` Nicolas Dichtel
  0 siblings, 1 reply; 15+ messages in thread
From: Flavio Leitner @ 2017-05-30 21:33 UTC (permalink / raw)
  To: netdev; +Cc: Flavio Leitner

Don't include netns id for notifications broadcasts when the
socket and the skb are in the same netns because it will be
an error which can't be distinguished from a peer netns failing
to allocate an id.

Signed-off-by: Flavio Leitner <fbl@sysclose.org>
---
 net/netlink/af_netlink.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index ee841f0..b9f1392 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -1414,8 +1414,10 @@ static void do_one_broadcast(struct sock *sk,
 		p->skb2 = NULL;
 		goto out;
 	}
-	NETLINK_CB(p->skb2).nsid = peernet2id(sock_net(sk), p->net);
-	NETLINK_CB(p->skb2).nsid_is_set = true;
+	if (!net_eq(sock_net(sk), p->net)) {
+		NETLINK_CB(p->skb2).nsid = peernet2id(sock_net(sk), p->net);
+		NETLINK_CB(p->skb2).nsid_is_set = true;
+	}
 	val = netlink_broadcast_deliver(sk, p->skb2);
 	if (val < 0) {
 		netlink_overrun(sk);
-- 
2.9.4

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2017-06-09 17:33 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-30 21:33 [PATCH net-next] netlink: include netnsid only when netns differs Flavio Leitner
2017-05-31  8:38 ` Nicolas Dichtel
2017-05-31 12:28   ` Flavio Leitner
2017-05-31 13:48     ` Nicolas Dichtel
2017-05-31 18:34       ` Flavio Leitner
2017-06-01  7:57         ` Nicolas Dichtel
2017-06-01  8:00           ` [PATCH net] netlink: don't send unknown nsid Nicolas Dichtel
2017-06-01 15:50             ` David Miller
2017-06-01 17:02             ` Flavio Leitner
2017-06-01 20:42               ` Nicolas Dichtel
2017-06-01 22:44                 ` Flavio Leitner
2017-06-05  8:40                   ` Nicolas Dichtel
2017-06-07 18:40                     ` Flavio Leitner
2017-06-08  8:31                       ` Nicolas Dichtel
2017-06-09 17:33                         ` Flavio Leitner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.