From 89756afbe41b1f1ef4c2af3dc1350da2726f07e1 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Mon, 18 Jan 2021 13:56:32 +0100 Subject: [PATCH] proto/names: add SCTP if not defined in system If SCTP is missing from /etc/protocols, add it manually. (cherry picked from commit bf00285d0acf87c794f6569eb51d1f7d1247a0da) --- src/util-proto-name.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/util-proto-name.c b/src/util-proto-name.c index a7954c3020..fbd76a51d1 100644 --- a/src/util-proto-name.c +++ b/src/util-proto-name.c @@ -33,6 +33,16 @@ char *known_proto[256]; static int init_once = 0; +static void SetDefault(const uint8_t proto, const char *string) +{ + if (known_proto[proto] == NULL) { + known_proto[proto] = SCStrdup(string); + if (unlikely(known_proto[proto] == NULL)) { + FatalError(SC_ERR_MEM_ALLOC, "failed to alloc protocol name"); + } + } +} + /** * \brief Function to load the protocol names from the specified protocol * file. @@ -86,6 +96,8 @@ void SCProtoNameInit() } fclose(fp); } + + SetDefault(IPPROTO_SCTP, "SCTP"); } /** -- 2.47.2