forked from luck/tmp_suning_uos_patched
netlink: don't send unknown nsid
The NETLINK_F_LISTEN_ALL_NSID otion enables to listen all netns that have a nsid assigned into the netns where the netlink socket is opened. The nsid is sent as metadata to userland, but the existence of this nsid is checked only for netns that are different from the socket netns. Thus, if no nsid is assigned to the socket netns, NETNSA_NSID_NOT_ASSIGNED is reported to the userland. This value is confusing and useless. After this patch, only valid nsid are sent to userland. Reported-by: Flavio Leitner <fbl@sysclose.org> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
5ea6d691aa
commit
7212462fa6
|
@ -62,6 +62,7 @@
|
||||||
#include <asm/cacheflush.h>
|
#include <asm/cacheflush.h>
|
||||||
#include <linux/hash.h>
|
#include <linux/hash.h>
|
||||||
#include <linux/genetlink.h>
|
#include <linux/genetlink.h>
|
||||||
|
#include <linux/net_namespace.h>
|
||||||
|
|
||||||
#include <net/net_namespace.h>
|
#include <net/net_namespace.h>
|
||||||
#include <net/sock.h>
|
#include <net/sock.h>
|
||||||
|
@ -1415,6 +1416,7 @@ static void do_one_broadcast(struct sock *sk,
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
NETLINK_CB(p->skb2).nsid = peernet2id(sock_net(sk), p->net);
|
NETLINK_CB(p->skb2).nsid = peernet2id(sock_net(sk), p->net);
|
||||||
|
if (NETLINK_CB(p->skb2).nsid != NETNSA_NSID_NOT_ASSIGNED)
|
||||||
NETLINK_CB(p->skb2).nsid_is_set = true;
|
NETLINK_CB(p->skb2).nsid_is_set = true;
|
||||||
val = netlink_broadcast_deliver(sk, p->skb2);
|
val = netlink_broadcast_deliver(sk, p->skb2);
|
||||||
if (val < 0) {
|
if (val < 0) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user