Skip to contentSkip to conversation

iptables (kernel): add secmark match

PATCH In review Mr Dash Four 1 participant 1 message Mar 5, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/2 iptables (kernel): add secmark match

This patch is part of the kernel changes needed for the "secmark" match in iptables.

---
 include/uapi/linux/netfilter/Kbuild       |    1 +
 include/uapi/linux/netfilter/xt_secmark.h |   24 ++++++
 net/netfilter/Kconfig                     |   10 +++
 net/netfilter/Makefile                    |    1 +
 net/netfilter/xt_secmark.c                |  117 +++++++++++++++++++++++++++++
 5 files changed, 153 insertions(+)
 create mode 100644 include/uapi/linux/netfilter/xt_secmark.h
 create mode 100644 net/netfilter/xt_secmark.c
include/uapi/linux/netfilter/Kbuild +1 -0
index 4111577..4884edd 100644
@@ -69,6 +69,7 @@ header-y += xt_rateest.h
 header-y += xt_realm.h
 header-y += xt_recent.h
 header-y += xt_sctp.h
+header-y += xt_secmark.h
 header-y += xt_set.h
 header-y += xt_socket.h
 header-y += xt_state.h
include/uapi/linux/netfilter/xt_secmark.h new file +24 -0
new file mode 100644
index 0000000..c74a35d
@@ -0,0 +1,24 @@
+#ifndef _XT_SECMARK_MATCH_H
+#define _XT_SECMARK_MATCH_H
+
+#include <linux/types.h>
+
+/*
+ * Header file for iptables xt_secmark match
+ *
+ * This is intended for use by various security subsystems (but not
+ * at the same time).
+ *
+ * 'mode' refers to the specific security subsystem which the
+ * packets are being marked for.
+ */
+#define SECMARK_MODE_SEL	0x01		/* SELinux */
+#define SECMARK_SECCTX_MAX	256
+
+struct xt_secmark_match_info {
+	__u8 mode;
+	__u32 secid;
+	char secctx[SECMARK_SECCTX_MAX];
+};
+
+#endif /* _XT_SECMARK_MATCH_H */
net/netfilter/Kconfig +10 -0
index 56d22ca..d53ea14 100644
@@ -1166,6 +1166,16 @@ config NETFILTER_XT_MATCH_RECENT
 	Short options are available by using 'iptables -m recent -h'
 	Official Website: <http://snowman.net/projects/ipt_recent/>
 
+config NETFILTER_XT_MATCH_SECMARK
+	tristate '"secmark" match support'
+	depends on NF_CONNTRACK && NF_CONNTRACK_SECMARK
+	default m if NETFILTER_ADVANCED=n
+	help
+	  The SECMARK match allows matching on security marking of network
+	  packets, for use with security subsystems.
+
+	  To compile it as a module, choose M here.  If unsure, say N.
+
 config NETFILTER_XT_MATCH_SCTP
 	tristate  '"sctp" protocol match support'
 	depends on NETFILTER_ADVANCED
net/netfilter/Makefile +1 -0
index a1abf87..686c4c3 100644
@@ -139,6 +139,7 @@ obj-$(CONFIG_NETFILTER_XT_MATCH_STRING) += xt_string.o
 obj-$(CONFIG_NETFILTER_XT_MATCH_TCPMSS) += xt_tcpmss.o
 obj-$(CONFIG_NETFILTER_XT_MATCH_TIME) += xt_time.o
 obj-$(CONFIG_NETFILTER_XT_MATCH_U32) += xt_u32.o
+obj-$(CONFIG_NETFILTER_XT_MATCH_SECMARK) += xt_secmark.o
 
 # ipset
 obj-$(CONFIG_IP_SET) += ipset/
net/netfilter/xt_secmark.c new file +117 -0

117 lines not on this page · raw message

--
selinux mailing list
[email protected]
https://admin.fedoraproject.org/mailman/listinfo/selinux