From: Victor Julien Date: Mon, 18 Jan 2021 12:56:32 +0000 (+0100) Subject: proto/names: add SCTP if not defined in system X-Git-Tag: suricata-5.0.6~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d29c40ffaf865b1d3f4db83b3979c718e2594bba;p=thirdparty%2Fsuricata.git proto/names: add SCTP if not defined in system If SCTP is missing from /etc/protocols, add it manually. (cherry picked from commit bf00285d0acf87c794f6569eb51d1f7d1247a0da) --- diff --git a/src/util-proto-name.c b/src/util-proto-name.c index 2392682d7b..1094a8632b 100644 --- a/src/util-proto-name.c +++ b/src/util-proto-name.c @@ -32,6 +32,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. @@ -85,6 +95,8 @@ void SCProtoNameInit() } fclose(fp); } + + SetDefault(IPPROTO_SCTP, "SCTP"); } /**