aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjamal <hadi@cyberus.ca>2009-10-18 22:17:56 -0400
committerDavid S. Miller <davem@davemloft.net>2009-10-20 02:22:49 -0400
commit7e75f93eda027d9f9e0203ee6ffd210ea92e98f3 (patch)
tree3e9df7c2456909f1afaf9d63716c34d769557e6c
parent7c734359d3504c869132166d159c7f0649f0ab34 (diff)
pkt_sched: ingress socket filter by mark
Allow bpf to set a filter to drop packets that dont match a specific mark Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/linux/filter.h3
-rw-r--r--net/core/filter.c3
2 files changed, 5 insertions, 1 deletions
diff --git a/include/linux/filter.h b/include/linux/filter.h
index 1354aaf6abbe..909193e25395 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -123,7 +123,8 @@ struct sock_fprog /* Required for SO_ATTACH_FILTER. */
123#define SKF_AD_IFINDEX 8 123#define SKF_AD_IFINDEX 8
124#define SKF_AD_NLATTR 12 124#define SKF_AD_NLATTR 12
125#define SKF_AD_NLATTR_NEST 16 125#define SKF_AD_NLATTR_NEST 16
126#define SKF_AD_MAX 20 126#define SKF_AD_MARK 20
127#define SKF_AD_MAX 24
127#define SKF_NET_OFF (-0x100000) 128#define SKF_NET_OFF (-0x100000)
128#define SKF_LL_OFF (-0x200000) 129#define SKF_LL_OFF (-0x200000)
129 130
diff --git a/net/core/filter.c b/net/core/filter.c
index d1d779ca096d..e3987e1d4839 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -303,6 +303,9 @@ load_b:
303 case SKF_AD_IFINDEX: 303 case SKF_AD_IFINDEX:
304 A = skb->dev->ifindex; 304 A = skb->dev->ifindex;
305 continue; 305 continue;
306 case SKF_AD_MARK:
307 A = skb->mark;
308 continue;
306 case SKF_AD_NLATTR: { 309 case SKF_AD_NLATTR: {
307 struct nlattr *nla; 310 struct nlattr *nla;
308 311