netfilter: ebtables: create audit records for replaces
authorNicolas Dichtel <nicolas.dichtel@6wind.com>
Mon, 8 Sep 2014 12:11:45 +0000 (14:11 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 9 Sep 2014 14:31:28 +0000 (16:31 +0200)
This is already done for x_tables (family AF_INET and AF_INET6), let's
do it for AF_BRIDGE also.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/bridge/netfilter/ebtables.c

index 6d69631b9f4d2bf5c667d1f76e4f5bc384cdf61c..d9a8c05d995d14466d2cef02fcd571d4ad009272 100644 (file)
@@ -26,6 +26,7 @@
 #include <asm/uaccess.h>
 #include <linux/smp.h>
 #include <linux/cpumask.h>
+#include <linux/audit.h>
 #include <net/sock.h>
 /* needed for logical [in,out]-dev filtering */
 #include "../br_private.h"
@@ -1058,6 +1059,20 @@ static int do_replace_finish(struct net *net, struct ebt_replace *repl,
        vfree(table);
 
        vfree(counterstmp);
+
+#ifdef CONFIG_AUDIT
+       if (audit_enabled) {
+               struct audit_buffer *ab;
+
+               ab = audit_log_start(current->audit_context, GFP_KERNEL,
+                                    AUDIT_NETFILTER_CFG);
+               if (ab) {
+                       audit_log_format(ab, "table=%s family=%u entries=%u",
+                                        repl->name, AF_BRIDGE, repl->nentries);
+                       audit_log_end(ab);
+               }
+       }
+#endif
        return ret;
 
 free_unlock: