|
|
dde0f0 |
From d68976d353bf334c43fd084f9cc4535874860006 Mon Sep 17 00:00:00 2001
|
|
|
dde0f0 |
From: Vit Mojzis <vmojzis@redhat.com>
|
|
|
dde0f0 |
Date: Tue, 8 Oct 2019 14:22:12 +0200
|
|
|
dde0f0 |
Subject: [PATCH] libsemanage: Add support for DCCP and SCTP protocols
|
|
|
dde0f0 |
|
|
|
dde0f0 |
This is necessary for "semanage port" to be able to handle DCCP and SCTP
|
|
|
dde0f0 |
protocols.
|
|
|
dde0f0 |
|
|
|
dde0f0 |
Fixes:
|
|
|
dde0f0 |
"port_parse" only handles TCP and UDP protocols
|
|
|
dde0f0 |
|
|
|
dde0f0 |
Signed-off-by: Vit Mojzis <vmojzis@redhat.com>
|
|
|
dde0f0 |
---
|
|
|
dde0f0 |
libsemanage/include/semanage/port_record.h | 2 ++
|
|
|
dde0f0 |
libsemanage/src/ports_file.c | 4 ++++
|
|
|
dde0f0 |
2 files changed, 6 insertions(+)
|
|
|
dde0f0 |
|
|
|
dde0f0 |
diff --git a/libsemanage/include/semanage/port_record.h b/libsemanage/include/semanage/port_record.h
|
|
|
dde0f0 |
index 20ae4bd9..71074800 100644
|
|
|
dde0f0 |
--- a/libsemanage/include/semanage/port_record.h
|
|
|
dde0f0 |
+++ b/libsemanage/include/semanage/port_record.h
|
|
|
dde0f0 |
@@ -16,6 +16,8 @@ typedef struct semanage_port_key semanage_port_key_t;
|
|
|
dde0f0 |
|
|
|
dde0f0 |
#define SEMANAGE_PROTO_UDP 0
|
|
|
dde0f0 |
#define SEMANAGE_PROTO_TCP 1
|
|
|
dde0f0 |
+#define SEMANAGE_PROTO_DCCP 2
|
|
|
dde0f0 |
+#define SEMANAGE_PROTO_SCTP 3
|
|
|
dde0f0 |
|
|
|
dde0f0 |
/* Key */
|
|
|
dde0f0 |
extern int semanage_port_compare(const semanage_port_t * port,
|
|
|
dde0f0 |
diff --git a/libsemanage/src/ports_file.c b/libsemanage/src/ports_file.c
|
|
|
dde0f0 |
index 46ee2f00..4738d467 100644
|
|
|
dde0f0 |
--- a/libsemanage/src/ports_file.c
|
|
|
dde0f0 |
+++ b/libsemanage/src/ports_file.c
|
|
|
dde0f0 |
@@ -84,6 +84,10 @@ static int port_parse(semanage_handle_t * handle,
|
|
|
dde0f0 |
semanage_port_set_proto(port, SEMANAGE_PROTO_TCP);
|
|
|
dde0f0 |
else if (!strcasecmp(str, "udp"))
|
|
|
dde0f0 |
semanage_port_set_proto(port, SEMANAGE_PROTO_UDP);
|
|
|
dde0f0 |
+ else if (!strcasecmp(str, "dccp"))
|
|
|
dde0f0 |
+ semanage_port_set_proto(port, SEMANAGE_PROTO_DCCP);
|
|
|
dde0f0 |
+ else if (!strcasecmp(str, "sctp"))
|
|
|
dde0f0 |
+ semanage_port_set_proto(port, SEMANAGE_PROTO_SCTP);
|
|
|
dde0f0 |
else {
|
|
|
dde0f0 |
ERR(handle, "invalid protocol \"%s\" (%s: %u):\n%s", str,
|
|
|
dde0f0 |
info->filename, info->lineno, info->orig_line);
|
|
|
dde0f0 |
--
|
|
|
dde0f0 |
2.21.0
|
|
|
dde0f0 |
|