[PATCH 01/20] Audit: make audit netlink socket net namespace unaware

Gao feng gaofeng at cn.fujitsu.com
Thu Oct 24 07:31:46 UTC 2013

Add a compare function which always return true for
audit netlink socket, this will cause audit netlink
sockets netns unaware, and no matter which netns the
user space audit netlink sockets belong to, they all
can find out and communicate with audit_sock.

This gets rid of the necessary to create per-netns
audit kernel side socket(audit_sock), it's pain to
depend on and get reference of netns for auditns.

Signed-off-by: Gao feng <gaofeng at cn.fujitsu.com>
 kernel/audit.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/kernel/audit.c b/kernel/audit.c
index 7b0e23a..468950b 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -886,12 +886,18 @@ static void audit_receive(struct sk_buff  *skb)
+static bool audit_compare(struct net *net, struct sock *sk)
+	return true;
 /* Initialize audit support at boot time. */
 static int __init audit_init(void)
 	int i;
 	struct netlink_kernel_cfg cfg = {
 		.input	= audit_receive,
+		.compare = audit_compare,
 	if (audit_initialized == AUDIT_DISABLED)

More information about the Containers mailing list