]> git.baikalelectronics.ru Git - kernel.git/commit
netlink/genetlink: pass network namespace to bind/unbind
authorJohannes Berg <johannes.berg@intel.com>
Tue, 23 Dec 2014 20:00:06 +0000 (21:00 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sat, 27 Dec 2014 08:07:50 +0000 (03:07 -0500)
commit6546a9fcd077139e3c0a41ad2ac0fe2794596e0a
treefb696a81e6c2246cec25cfa35741de31c090ed7a
parent8f247f253aced120bce155e5da8d08dc3329d3d4
netlink/genetlink: pass network namespace to bind/unbind

Netlink families can exist in multiple namespaces, and for the most
part multicast subscriptions are per network namespace. Thus it only
makes sense to have bind/unbind notifications per network namespace.

To achieve this, pass the network namespace of a given client socket
to the bind/unbind functions.

Also do this in generic netlink, and there also make sure that any
bind for multicast groups that only exist in init_net is rejected.
This isn't really a problem if it is accepted since a client in a
different namespace will never receive any notifications from such
a group, but it can confuse the family if not rejected (it's also
possible to silently (without telling the family) accept it, but it
would also have to be ignored on unbind so families that take any
kind of action on bind/unbind won't do unnecessary work for invalid
clients like that.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/netlink.h
include/net/genetlink.h
kernel/audit.c
net/netfilter/nfnetlink.c
net/netlink/af_netlink.c
net/netlink/af_netlink.h
net/netlink/genetlink.c