Patchwork [net-next,v2,5/5] sock_diag: notify when filter change

login
register
mail settings
Submitter Nicolas Dichtel
Date April 24, 2013, 3:52 p.m.
Message ID <1366818756-4234-6-git-send-email-nicolas.dichtel@6wind.com>
Download mbox | patch
Permalink /patch/239251/
State Changes Requested
Delegated to: David Miller
Headers show

Comments

Nicolas Dichtel - April 24, 2013, 3:52 p.m.
Filter is advertised in packet diag messages, hence we may update the status
when a filter is updated.

Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
 net/core/filter.c | 3 +++
 1 file changed, 3 insertions(+)

Patch

diff --git a/net/core/filter.c b/net/core/filter.c
index dad2a17..021048a 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -40,6 +40,7 @@ 
 #include <linux/ratelimit.h>
 #include <linux/seccomp.h>
 #include <linux/if_vlan.h>
+#include <linux/sock_diag.h>
 
 /* No hurry in this branch
  *
@@ -755,6 +756,7 @@  int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk)
 
 	if (old_fp)
 		sk_filter_uncharge(sk, old_fp);
+	sock_diag_notify(sk);
 	return 0;
 }
 EXPORT_SYMBOL_GPL(sk_attach_filter);
@@ -773,6 +775,7 @@  int sk_detach_filter(struct sock *sk)
 		RCU_INIT_POINTER(sk->sk_filter, NULL);
 		sk_filter_uncharge(sk, filter);
 		ret = 0;
+		sock_diag_notify(sk);
 	}
 	return ret;
 }