Skip to contentSkip to conversation

libsepol: update sort order for netifcon definitions

PATCH Superseded Christian Göttsche 2 participants 6 messages May 30, 2025 – Jun 13, 2025 SELinux security module

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 libsepol: update sort order for netifcon definitions

From: Christian Göttsche <[email protected]>

Order netifcon definitions with a wildcard interface name last in object contexts, so the kernel tries to match literal names first.

---
 libsepol/cil/src/cil_post.c     | 36 ++++++++++++++++++++++++++++++---
 libsepol/src/kernel_to_common.c | 36 ++++++++++++++++++++++++++++++---
 2 files changed, 66 insertions(+), 6 deletions(-)
libsepol/cil/src/cil_post.c +33 -3
index d63a5496..70e5b734 100644
@@ -316,10 +316,40 @@ int cil_post_genfscon_compare(const void *a, const void *b)
 
 int cil_post_netifcon_compare(const void *a, const void *b)
 {
-	struct cil_netifcon *anetifcon = *(struct cil_netifcon**)a;
-	struct cil_netifcon *bnetifcon = *(struct cil_netifcon**)b;
+	/* keep in sync with kernel_to_common.c:netif_data_cmp() */
+	const struct cil_netifcon *anetifcon = *(struct cil_netifcon**)a;
+	const struct cil_netifcon *bnetifcon = *(struct cil_netifcon**)b;
+	const char *a_name = anetifcon->interface_str;
+	const char *b_name = bnetifcon->interface_str;
+	size_t a_stem = strcspn(a_name, "*?");
+	size_t b_stem = strcspn(b_name, "*?");
+	size_t a_len = strlen(a_name);
+	size_t b_len = strlen(b_name);
+	int a_iswildcard = a_stem != a_len;
+	int b_iswildcard = b_stem != b_len;
+	int rc;
+
+	/* order non-wildcards first */
+	rc = spaceship_cmp(a_iswildcard, b_iswildcard);
+	if (rc)
+		return rc;
+
+	/* order non-wildcards alphabetically */
+	if (!a_iswildcard)
+		return strcmp(a_name, b_name);
+
+	/* order by decreasing stem length */
+	rc = spaceship_cmp(a_stem, b_stem);
+	if (rc)
+		return -rc;
+
+	/* order '?' (0x3f) before '*' (0x2A) */
+	rc = spaceship_cmp(a_name[a_stem], b_name[b_stem]);
+	if (rc)
+		return -rc;
 
-	return  strcmp(anetifcon->interface_str, bnetifcon->interface_str);
+	/* order alphabetically */
+	return strcmp(a_name, b_name);
 }
 
 int cil_post_ibendportcon_compare(const void *a, const void *b)
libsepol/src/kernel_to_common.c +33 -3
index 44f0be23..e4338ec6 100644
@@ -441,10 +441,40 @@ static int portcon_data_cmp(const void *a, const void *b)
 
 static int netif_data_cmp(const void *a, const void *b)
 {
-	struct ocontext *const *aa = a;
-	struct ocontext *const *bb = b;
+	/* keep in sync with cil_post.c:cil_post_netifcon_compare() */
+	const struct ocontext *const *aa = a;
+	const struct ocontext *const *bb = b;
+	const char *a_name = (*aa)->u.name;
+	const char *b_name = (*bb)->u.name;
+	size_t a_stem = strcspn(a_name, "*?");
+	size_t b_stem = strcspn(b_name, "*?");
+	size_t a_len = strlen(a_name);
+	size_t b_len = strlen(b_name);
+	int a_iswildcard = a_stem != a_len;
+	int b_iswildcard = b_stem != b_len;
+	int rc;
 
-	return strcmp((*aa)->u.name, (*bb)->u.name);
+	/* order non-wildcards first */
+	rc = spaceship_cmp(a_iswildcard, b_iswildcard);
+	if (rc)
+		return rc;
+
+	/* order non-wildcards alphabetically */
+	if (!a_iswildcard)
+		return strcmp(a_name, b_name);
+
+	/* order by decreasing stem length */
+	rc = spaceship_cmp(a_stem, b_stem);
+	if (rc)
+		return -rc;
+
+	/* order '?' (0x3f) before '*' (0x2A) */
+	rc = spaceship_cmp(a_name[a_stem], b_name[b_stem]);
+	if (rc)
+		return -rc;
+
+	/* order alphabetically */
+	return strcmp(a_name, b_name);
 }
 
 static int node_data_cmp(const void *a, const void *b)
Signature · 1 line
2.49.0
#1 lore raw

PATCH 2/4 libsepol: add netif_wildcard polcap

From: Christian Göttsche <[email protected]>

The kernel supports wildcard in network interface names with a new policy capability 'netif_wildcard'.

---
v2: add patch

---
 libsepol/include/sepol/policydb/polcaps.h | 1 +
 libsepol/src/polcaps.c                    | 1 +
 2 files changed, 2 insertions(+)
libsepol/include/sepol/policydb/polcaps.h +1 -0
index 1aa9b30a..7bebe4da 100644
@@ -17,6 +17,7 @@ enum {
 	POLICYDB_CAP_IOCTL_SKIP_CLOEXEC,
 	POLICYDB_CAP_USERSPACE_INITIAL_CONTEXT,
 	POLICYDB_CAP_NETLINK_XPERM,
+	POLICYDB_CAP_NETIF_WILDCARD,
 	__POLICYDB_CAP_MAX
 };
 #define POLICYDB_CAP_MAX (__POLICYDB_CAP_MAX - 1)
libsepol/src/polcaps.c +1 -0
index 6b28c84e..ec6c902d 100644
@@ -16,6 +16,7 @@ static const char * const polcap_names[POLICYDB_CAP_MAX + 1] = {
 	[POLICYDB_CAP_IOCTL_SKIP_CLOEXEC]		= "ioctl_skip_cloexec",
 	[POLICYDB_CAP_USERSPACE_INITIAL_CONTEXT]	= "userspace_initial_context",
 	[POLICYDB_CAP_NETLINK_XPERM]			= "netlink_xperm",
+	[POLICYDB_CAP_NETIF_WILDCARD]			= "netif_wildcard",
 };
 
 int sepol_polcap_getnum(const char *name)
Signature · 1 line
2.49.0
#2 lore raw

PATCH 3/4 checkpolicy: add support for wildcard netifcon names

In reply to Christian Göttsche

From: Christian Göttsche <[email protected]>

Support network interface names containing wildcards.

---
 checkpolicy/policy_parse.y                         | 8 +++++++-
 checkpolicy/policy_scan.l                          | 1 +
 checkpolicy/tests/policy_allonce.conf              | 4 ++++
 checkpolicy/tests/policy_allonce.expected.conf     | 4 ++++
 checkpolicy/tests/policy_allonce.expected_opt.conf | 4 ++++
 5 files changed, 20 insertions(+), 1 deletion(-)
checkpolicy/policy_parse.y +7 -1
index 7e117222..f9181eaf 100644
@@ -153,6 +153,7 @@ typedef int (* require_func_t)(int pass);
 %token POLICYCAP
 %token PERMISSIVE
 %token FILESYSTEM
+%token NETIFNAME
 %token DEFAULT_USER DEFAULT_ROLE DEFAULT_TYPE DEFAULT_RANGE
 %token LOW_HIGH LOW HIGH GLBLUB
 %token INVALID_CHAR
@@ -748,7 +749,7 @@ opt_netif_contexts      : netif_contexts
 netif_contexts		: netif_context_def
 			| netif_contexts netif_context_def
 			;
-netif_context_def	: NETIFCON identifier security_context_def security_context_def
+netif_context_def	: NETIFCON netifname security_context_def security_context_def
 			{if (define_netif_context()) YYABORT;}
 			;
 opt_node_contexts       : node_contexts 
@@ -901,6 +902,11 @@ path     		: PATH
 filename		: FILENAME
 			{ yytext[strlen(yytext) - 1] = '\0'; if (insert_id(yytext + 1,0)) YYABORT; }
 			;
+netifname		: NETIFNAME
+			{ if (insert_id(yytext,0)) YYABORT; }
+                        | IDENTIFIER
+			{ if (insert_id(yytext,0)) YYABORT; }
+                        ;
 number			: NUMBER 
 			{ unsigned long x;
 			  errno = 0;
checkpolicy/policy_scan.l +1 -0
index 7bdea427..0076062d 100644
@@ -298,6 +298,7 @@ GLBLUB				{ return(GLBLUB); }
 {hexval}{0,4}":"{hexval}{0,4}":"({hexval}|[:.])*  { return(IPV6_ADDR); }
 {hexval}{0,4}":"{hexval}{0,4}":"({hexval}|[:.])*"/"{digit}{1,3}	{ return(IPV6_CIDR); }
 {digit}+(\.({alnum}|[_.])*)?    { return(VERSION_IDENTIFIER); }
+({alnum}({alnum}|[\*\?_]){0,15}|[\*\?]({alnum}|[\*\?_]){1,15})	{ return(NETIFNAME); }
 #line[ ]{digit}+[ ]\"[^\n]*\"	{ set_source_line_and_file(yytext+6); }
 #line[ ]{digit}+	        {
 				  errno = 0;
checkpolicy/tests/policy_allonce.conf +4 -0
index 95a0f265..469eb9b6 100644
@@ -74,6 +74,10 @@ genfscon proc "/file1" -- USER1:ROLE1:TYPE1
 genfscon proc "/path/to/file" USER1:ROLE1:TYPE1
 portcon tcp 80 USER1:ROLE1:TYPE1
 portcon udp 100-200 USER1:ROLE1:TYPE1
+netifcon net? USER1:ROLE1:TYPE1 USER1:ROLE1:TYPE1
+netifcon net* USER1:ROLE1:TYPE1 USER1:ROLE1:TYPE1
+netifcon netx* USER1:ROLE1:TYPE1 USER1:ROLE1:TYPE1
+netifcon net USER1:ROLE1:TYPE1 USER1:ROLE1:TYPE1
 netifcon lo USER1:ROLE1:TYPE1 USER1:ROLE1:TYPE1
 nodecon 127.0.0.1 255.255.255.255 USER1:ROLE1:TYPE1
 nodecon 192.168.42.0 255.255.0.0 USER1:ROLE1:TYPE1
checkpolicy/tests/policy_allonce.expected.conf +4 -0
index 79d62319..b3a51bef 100644
@@ -80,6 +80,10 @@ genfscon proc "/path/to/file" USER1:ROLE1:TYPE1
 portcon tcp 80 USER1:ROLE1:TYPE1
 portcon udp 100-200 USER1:ROLE1:TYPE1
 netifcon lo USER1:ROLE1:TYPE1 USER1:ROLE1:TYPE1
+netifcon net USER1:ROLE1:TYPE1 USER1:ROLE1:TYPE1
+netifcon netx* USER1:ROLE1:TYPE1 USER1:ROLE1:TYPE1
+netifcon net? USER1:ROLE1:TYPE1 USER1:ROLE1:TYPE1
+netifcon net* USER1:ROLE1:TYPE1 USER1:ROLE1:TYPE1
 nodecon 127.0.0.1 255.255.255.255 USER1:ROLE1:TYPE1
 nodecon 127.0.0.0 255.255.255.0 USER1:ROLE1:TYPE1
 nodecon 192.168.0.0 255.255.0.0 USER1:ROLE1:TYPE1
checkpolicy/tests/policy_allonce.expected_opt.conf +4 -0
index fa4e319b..a7914c64 100644
@@ -80,6 +80,10 @@ genfscon proc "/path/to/file" USER1:ROLE1:TYPE1
 portcon tcp 80 USER1:ROLE1:TYPE1
 portcon udp 100-200 USER1:ROLE1:TYPE1
 netifcon lo USER1:ROLE1:TYPE1 USER1:ROLE1:TYPE1
+netifcon net USER1:ROLE1:TYPE1 USER1:ROLE1:TYPE1
+netifcon netx* USER1:ROLE1:TYPE1 USER1:ROLE1:TYPE1
+netifcon net? USER1:ROLE1:TYPE1 USER1:ROLE1:TYPE1
+netifcon net* USER1:ROLE1:TYPE1 USER1:ROLE1:TYPE1
 nodecon 127.0.0.1 255.255.255.255 USER1:ROLE1:TYPE1
 nodecon 127.0.0.0 255.255.255.0 USER1:ROLE1:TYPE1
 nodecon 192.168.0.0 255.255.0.0 USER1:ROLE1:TYPE1
Signature · 1 line
2.49.0
#3 lore raw

Re: [PATCH 3/4] checkpolicy: add support for wildcard netifcon names

Quoted 52 lines · Christian Göttsche

From: Christian Göttsche <[email protected]>

Support network interface names containing wildcards.

---
 checkpolicy/policy_parse.y                         | 8 +++++++-
 checkpolicy/policy_scan.l                          | 1 +
 checkpolicy/tests/policy_allonce.conf              | 4 ++++
 checkpolicy/tests/policy_allonce.expected.conf     | 4 ++++
 checkpolicy/tests/policy_allonce.expected_opt.conf | 4 ++++
 5 files changed, 20 insertions(+), 1 deletion(-)
checkpolicy/policy_parse.y +7 -1
index 7e117222..f9181eaf 100644
@@ -153,6 +153,7 @@ typedef int (* require_func_t)(int pass);
 %token POLICYCAP
 %token PERMISSIVE
 %token FILESYSTEM
+%token NETIFNAME
 %token DEFAULT_USER DEFAULT_ROLE DEFAULT_TYPE DEFAULT_RANGE
 %token LOW_HIGH LOW HIGH GLBLUB
 %token INVALID_CHAR
@@ -748,7 +749,7 @@ opt_netif_contexts      : netif_contexts
 netif_contexts         : netif_context_def
                        | netif_contexts netif_context_def
                        ;
-netif_context_def      : NETIFCON identifier security_context_def security_context_def
+netif_context_def      : NETIFCON netifname security_context_def security_context_def
                        {if (define_netif_context()) YYABORT;}
                        ;
 opt_node_contexts       : node_contexts
@@ -901,6 +902,11 @@ path               : PATH
 filename               : FILENAME
                        { yytext[strlen(yytext) - 1] = '\0'; if (insert_id(yytext + 1,0)) YYABORT; }
                        ;
+netifname              : NETIFNAME
+                       { if (insert_id(yytext,0)) YYABORT; }
+                        | IDENTIFIER
+                       { if (insert_id(yytext,0)) YYABORT; }
+                        ;
 number                 : NUMBER
                        { unsigned long x;
                          errno = 0;
checkpolicy/policy_scan.l +0 -0
index 7bdea427..0076062d 100644

checkpolicy/policy_scan.l GLBLUB { return(GLBLUB); } · line 301

Quoted 4 lines
checkpolicy/policy_scan.l +1 -0
@@ -298,6 +298,7 @@ GLBLUB                              { return(GLBLUB); }
 {hexval}{0,4}":"{hexval}{0,4}":"({hexval}|[:.])*  { return(IPV6_ADDR); }
 {hexval}{0,4}":"{hexval}{0,4}":"({hexval}|[:.])*"/"{digit}{1,3}        { return(IPV6_CIDR); }
 {digit}+(\.({alnum}|[_.])*)?    { return(VERSION_IDENTIFIER); }
+({alnum}({alnum}|[\*\?_]){0,15}|[\*\?]({alnum}|[\*\?_]){1,15}) { return(NETIFNAME); }

Overall, this patch series looks good. The sorting all seems to work as expected.

There are a few issues with the handling of netif names. CIL will accept both "*" and "?" as the netif name, but checkpolicy does not. I don't know if this is desired or not. Might need to add a function in cil_verify.c to check that the netif name is legal. Also, checkpolicy gives a syntax error for any netif name that starts with a number but does not have "*" or "?" in it. My guess is that it is matching something other than NETIFNAME.

Thanks,
Jim

Quoted 52 lines
checkpolicy/policy_scan.l +0 -0
 #line[ ]{digit}+[ ]\"[^\n]*\"  { set_source_line_and_file(yytext+6); }
 #line[ ]{digit}+               {
                                  errno = 0;
checkpolicy/tests/policy_allonce.conf +4 -0
index 95a0f265..469eb9b6 100644
@@ -74,6 +74,10 @@ genfscon proc "/file1" -- USER1:ROLE1:TYPE1
 genfscon proc "/path/to/file" USER1:ROLE1:TYPE1
 portcon tcp 80 USER1:ROLE1:TYPE1
 portcon udp 100-200 USER1:ROLE1:TYPE1
+netifcon net? USER1:ROLE1:TYPE1 USER1:ROLE1:TYPE1
+netifcon net* USER1:ROLE1:TYPE1 USER1:ROLE1:TYPE1
+netifcon netx* USER1:ROLE1:TYPE1 USER1:ROLE1:TYPE1
+netifcon net USER1:ROLE1:TYPE1 USER1:ROLE1:TYPE1
 netifcon lo USER1:ROLE1:TYPE1 USER1:ROLE1:TYPE1
 nodecon 127.0.0.1 255.255.255.255 USER1:ROLE1:TYPE1
 nodecon 192.168.42.0 255.255.0.0 USER1:ROLE1:TYPE1
checkpolicy/tests/policy_allonce.expected.conf +4 -0
index 79d62319..b3a51bef 100644
@@ -80,6 +80,10 @@ genfscon proc "/path/to/file" USER1:ROLE1:TYPE1
 portcon tcp 80 USER1:ROLE1:TYPE1
 portcon udp 100-200 USER1:ROLE1:TYPE1
 netifcon lo USER1:ROLE1:TYPE1 USER1:ROLE1:TYPE1
+netifcon net USER1:ROLE1:TYPE1 USER1:ROLE1:TYPE1
+netifcon netx* USER1:ROLE1:TYPE1 USER1:ROLE1:TYPE1
+netifcon net? USER1:ROLE1:TYPE1 USER1:ROLE1:TYPE1
+netifcon net* USER1:ROLE1:TYPE1 USER1:ROLE1:TYPE1
 nodecon 127.0.0.1 255.255.255.255 USER1:ROLE1:TYPE1
 nodecon 127.0.0.0 255.255.255.0 USER1:ROLE1:TYPE1
 nodecon 192.168.0.0 255.255.0.0 USER1:ROLE1:TYPE1
checkpolicy/tests/policy_allonce.expected_opt.conf +4 -1
index fa4e319b..a7914c64 100644
@@ -80,6 +80,10 @@ genfscon proc "/path/to/file" USER1:ROLE1:TYPE1
 portcon tcp 80 USER1:ROLE1:TYPE1
 portcon udp 100-200 USER1:ROLE1:TYPE1
 netifcon lo USER1:ROLE1:TYPE1 USER1:ROLE1:TYPE1
+netifcon net USER1:ROLE1:TYPE1 USER1:ROLE1:TYPE1
+netifcon netx* USER1:ROLE1:TYPE1 USER1:ROLE1:TYPE1
+netifcon net? USER1:ROLE1:TYPE1 USER1:ROLE1:TYPE1
+netifcon net* USER1:ROLE1:TYPE1 USER1:ROLE1:TYPE1
 nodecon 127.0.0.1 255.255.255.255 USER1:ROLE1:TYPE1
 nodecon 127.0.0.0 255.255.255.0 USER1:ROLE1:TYPE1
 nodecon 192.168.0.0 255.255.0.0 USER1:ROLE1:TYPE1
--

2.49.0

#4 lore raw

Re: [PATCH 3/4] checkpolicy: add support for wildcard netifcon names

Quoted 71 lines · James Carter
Quoted 52 lines · Christian Göttsche

From: Christian Göttsche <[email protected]>

Support network interface names containing wildcards.

---
 checkpolicy/policy_parse.y                         | 8 +++++++-
 checkpolicy/policy_scan.l                          | 1 +
 checkpolicy/tests/policy_allonce.conf              | 4 ++++
 checkpolicy/tests/policy_allonce.expected.conf     | 4 ++++
 checkpolicy/tests/policy_allonce.expected_opt.conf | 4 ++++
 5 files changed, 20 insertions(+), 1 deletion(-)
checkpolicy/policy_parse.y +7 -1
index 7e117222..f9181eaf 100644
@@ -153,6 +153,7 @@ typedef int (* require_func_t)(int pass);
 %token POLICYCAP
 %token PERMISSIVE
 %token FILESYSTEM
+%token NETIFNAME
 %token DEFAULT_USER DEFAULT_ROLE DEFAULT_TYPE DEFAULT_RANGE
 %token LOW_HIGH LOW HIGH GLBLUB
 %token INVALID_CHAR
@@ -748,7 +749,7 @@ opt_netif_contexts      : netif_contexts
 netif_contexts         : netif_context_def
                        | netif_contexts netif_context_def
                        ;
-netif_context_def      : NETIFCON identifier security_context_def security_context_def
+netif_context_def      : NETIFCON netifname security_context_def security_context_def
                        {if (define_netif_context()) YYABORT;}
                        ;
 opt_node_contexts       : node_contexts
@@ -901,6 +902,11 @@ path               : PATH
 filename               : FILENAME
                        { yytext[strlen(yytext) - 1] = '\0'; if (insert_id(yytext + 1,0)) YYABORT; }
                        ;
+netifname              : NETIFNAME
+                       { if (insert_id(yytext,0)) YYABORT; }
+                        | IDENTIFIER
+                       { if (insert_id(yytext,0)) YYABORT; }
+                        ;
 number                 : NUMBER
                        { unsigned long x;
                          errno = 0;
checkpolicy/policy_scan.l +0 -0
index 7bdea427..0076062d 100644

checkpolicy/policy_scan.l GLBLUB { return(GLBLUB); } · line 301

Quoted 4 lines
checkpolicy/policy_scan.l +1 -0
@@ -298,6 +298,7 @@ GLBLUB                              { return(GLBLUB); }
 {hexval}{0,4}":"{hexval}{0,4}":"({hexval}|[:.])*  { return(IPV6_ADDR); }
 {hexval}{0,4}":"{hexval}{0,4}":"({hexval}|[:.])*"/"{digit}{1,3}        { return(IPV6_CIDR); }
 {digit}+(\.({alnum}|[_.])*)?    { return(VERSION_IDENTIFIER); }
+({alnum}({alnum}|[\*\?_]){0,15}|[\*\?]({alnum}|[\*\?_]){1,15}) { return(NETIFNAME); }

Overall, this patch series looks good. The sorting all seems to work as expected.

There are a few issues with the handling of netif names. CIL will accept both "*" and "?" as the netif name, but checkpolicy does not. I don't know if this is desired or not. Might need to add a function in cil_verify.c to check that the netif name is legal. Also, checkpolicy gives a syntax error for any netif name that starts with a number but does not have "*" or "?" in it. My guess is that it is matching something other than NETIFNAME.

Quoted 3 lines

Thanks,
Jim

So a netifname can match a NETIFNAME, IDENTIFIER, or a FILESYSTEM. The first two are already allowed, but it looks like the last one needs to be added.
Thanks,
Jim

Quoted 52 lines
Quoted 52 lines
checkpolicy/policy_scan.l +0 -0
 #line[ ]{digit}+[ ]\"[^\n]*\"  { set_source_line_and_file(yytext+6); }
 #line[ ]{digit}+               {
                                  errno = 0;
checkpolicy/tests/policy_allonce.conf +4 -0
index 95a0f265..469eb9b6 100644
@@ -74,6 +74,10 @@ genfscon proc "/file1" -- USER1:ROLE1:TYPE1
 genfscon proc "/path/to/file" USER1:ROLE1:TYPE1
 portcon tcp 80 USER1:ROLE1:TYPE1
 portcon udp 100-200 USER1:ROLE1:TYPE1
+netifcon net? USER1:ROLE1:TYPE1 USER1:ROLE1:TYPE1
+netifcon net* USER1:ROLE1:TYPE1 USER1:ROLE1:TYPE1
+netifcon netx* USER1:ROLE1:TYPE1 USER1:ROLE1:TYPE1
+netifcon net USER1:ROLE1:TYPE1 USER1:ROLE1:TYPE1
 netifcon lo USER1:ROLE1:TYPE1 USER1:ROLE1:TYPE1
 nodecon 127.0.0.1 255.255.255.255 USER1:ROLE1:TYPE1
 nodecon 192.168.42.0 255.255.0.0 USER1:ROLE1:TYPE1
checkpolicy/tests/policy_allonce.expected.conf +4 -0
index 79d62319..b3a51bef 100644
@@ -80,6 +80,10 @@ genfscon proc "/path/to/file" USER1:ROLE1:TYPE1
 portcon tcp 80 USER1:ROLE1:TYPE1
 portcon udp 100-200 USER1:ROLE1:TYPE1
 netifcon lo USER1:ROLE1:TYPE1 USER1:ROLE1:TYPE1
+netifcon net USER1:ROLE1:TYPE1 USER1:ROLE1:TYPE1
+netifcon netx* USER1:ROLE1:TYPE1 USER1:ROLE1:TYPE1
+netifcon net? USER1:ROLE1:TYPE1 USER1:ROLE1:TYPE1
+netifcon net* USER1:ROLE1:TYPE1 USER1:ROLE1:TYPE1
 nodecon 127.0.0.1 255.255.255.255 USER1:ROLE1:TYPE1
 nodecon 127.0.0.0 255.255.255.0 USER1:ROLE1:TYPE1
 nodecon 192.168.0.0 255.255.0.0 USER1:ROLE1:TYPE1
checkpolicy/tests/policy_allonce.expected_opt.conf +4 -1
index fa4e319b..a7914c64 100644
@@ -80,6 +80,10 @@ genfscon proc "/path/to/file" USER1:ROLE1:TYPE1
 portcon tcp 80 USER1:ROLE1:TYPE1
 portcon udp 100-200 USER1:ROLE1:TYPE1
 netifcon lo USER1:ROLE1:TYPE1 USER1:ROLE1:TYPE1
+netifcon net USER1:ROLE1:TYPE1 USER1:ROLE1:TYPE1
+netifcon netx* USER1:ROLE1:TYPE1 USER1:ROLE1:TYPE1
+netifcon net? USER1:ROLE1:TYPE1 USER1:ROLE1:TYPE1
+netifcon net* USER1:ROLE1:TYPE1 USER1:ROLE1:TYPE1
 nodecon 127.0.0.1 255.255.255.255 USER1:ROLE1:TYPE1
 nodecon 127.0.0.0 255.255.255.0 USER1:ROLE1:TYPE1
 nodecon 192.168.0.0 255.255.0.0 USER1:ROLE1:TYPE1
--

2.49.0

#5 lore raw

PATCH 4/4 secilc/test: add test for wildcard netifcon statement

In reply to Christian Göttsche

From: Christian Göttsche <[email protected]>

---
 secilc/test/policy.cil | 1 +
 1 file changed, 1 insertion(+)
secilc/test/policy.cil +1 -0
index d0d52d0d..9761fb4f 100644
@@ -288,6 +288,7 @@
 	(portcon sctp (1024 1035) system_u_bin_t_l2h)
 	(genfscon - "/usr/bin" system_u_bin_t_l2h)
 	(netifcon eth0 system_u_bin_t_l2h system_u_bin_t_l2h) ;different contexts?
+	(netifcon podman* system_u_bin_t_l2h system_u_bin_t_l2h)
 	(fsuse xattr ext3 system_u_bin_t_l2h)
 	
 	; XEN
Signature · 1 line
2.49.0