Skip to contentSkip to conversation

: ingress socket filter by mark

PATCH New jamal 1 participant 1 message Oct 19, 2009

Subsystems (5)
lore
Share & tools
lore

jamal

author
#0 lore raw

PATCH 1/1 : ingress socket filter by mark

apps can specify mark that they want to accept/reject.

cheers,
jamal

commit ec187e3028db866161b881c5ac9eeea4e9bb0f1f

Author: Jamal Hadi Salim <[email protected]>
Date:   Mon Oct 19 08:12:46 2009 -0400

[PATCH]: ingress socket filter by mark

Allow bpf to set a filter to drop packets that dont match a specific mark

include/linux/filter.h +2 -1
index 1354aaf..909193e 100644
@@ -123,7 +123,8 @@ struct sock_fprog	/* Required for SO_ATTACH_FILTER. */
 #define SKF_AD_IFINDEX 	8
 #define SKF_AD_NLATTR	12
 #define SKF_AD_NLATTR_NEST	16
-#define SKF_AD_MAX	20
+#define SKF_AD_MARK 	20
+#define SKF_AD_MAX	24
 #define SKF_NET_OFF   (-0x100000)
 #define SKF_LL_OFF    (-0x200000)
 
net/core/filter.c +3 -0
index d1d779c..e3987e1 100644
@@ -303,6 +303,9 @@ load_b:
 		case SKF_AD_IFINDEX:
 			A = skb->dev->ifindex;
 			continue;
+		case SKF_AD_MARK:
+			A = skb->mark;
+			continue;
 		case SKF_AD_NLATTR: {
 			struct nlattr *nla;