Blame SOURCES/0002-libsemanage-Add-support-for-DCCP-and-SCTP-protocols.patch

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