setools: Add sctp portcon support
PATCH 1/1 setools: Add sctp portcon support
Allow setools to interpret SCTP portcon policy statements
Signed-off-by Richard Haines <[email protected]>
--- libqpol/policy_define.c | 2 ++ setools/policyrep/netcontext.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-)
libqpol/policy_define.c +2 -0
@@ -4933,6 +4933,8 @@ int define_port_context(unsigned int low, unsigned int high) protocol =IPPROTO_UDP ; }else if ((strcmp (id,"dccp" ) ==0 ) || (strcmp (id,"DCCP" ) ==0 )) { protocol =IPPROTO_DCCP ; + }else if ((strcmp (id,"sctp" ) ==0 ) || (strcmp (id,"SCTP" ) ==0 )) { + protocol =IPPROTO_SCTP ; }else {yyerror2 ("unrecognized protocol %s" , id); goto bad;
setools/policyrep/netcontext.py +2 -1
@@ -17,7 +17,7 @@ # License along with SETools. If not, see # <http://www.gnu.org/licenses/>. # -from socket import AF_INET, AF_INET6, IPPROTO_TCP, IPPROTO_UDP, getprotobyname +from socket import AF_INET, AF_INET6, IPPROTO_TCP, IPPROTO_UDP, IPPROTO_SCTP, getprotobyname from collections import namedtuple from ipaddress import ip_address, ip_network
@@ -196,6 +196,7 @@ class PortconProtocol(int, PolicyEnum): tcp = IPPROTO_TCP udp = IPPROTO_UDP dccp = IPPROTO_DCCP + sctp = IPPROTO_SCTP class Portcon(NetContext):
Signature · 1 line
2.14.3
Quoted 35 lines · Richard Haines via Selinux
Allow setools to interpret SCTP portcon policy statements
Signed-off-by Richard Haines <[email protected]>--- libqpol/policy_define.c | 2 ++ setools/policyrep/netcontext.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-)libqpol/policy_define.c +2
-0@@ -4933,6 +4933,8 @@ int define_port_context(unsigned int low, unsigned int high) protocol =IPPROTO_UDP ; }else if ((strcmp (id,"dccp" ) ==0 ) || (strcmp (id,"DCCP" ) ==0 )) { protocol =IPPROTO_DCCP ; + }else if ((strcmp (id,"sctp" ) ==0 ) || (strcmp (id,"SCTP" ) ==0 )) { + protocol =IPPROTO_SCTP ; }else {yyerror2 ("unrecognized protocol %s" , id); goto bad;setools/policyrep/netcontext.py +1
-1@@ -17,7 +17,7 @@ # License along with SETools. If not, see # <http://www.gnu.org/licenses/>. # -from socket import AF_INET, AF_INET6, IPPROTO_TCP, IPPROTO_UDP, getprotobyname +from socket import AF_INET, AF_INET6, IPPROTO_TCP, IPPROTO_UDP, IPPROTO_SCTP, getprotobyname from collections import namedtuple from ipaddress import ip_address, ip_network
setools/policyrep/netcontext.py class PortconProtocol(int, PolicyEnum): · line 202
Quoted 7 lines
setools/policyrep/netcontext.py +1
-0@@ -196,6 +196,7 @@ class PortconProtocol(int, PolicyEnum): tcp = IPPROTO_TCP udp = IPPROTO_UDP dccp = IPPROTO_DCCP + sctp = IPPROTO_SCTP class Portcon(NetContext):
Thanks for the patch, but I'm reimplementing the SETools policyrep, so I've added the equivalent support already.
Signature · 1 line
Chris PeBenito