From: Jozsef Kadlecsik Date: Tue, 27 Jul 2021 10:16:47 +0000 (+0200) Subject: When parsing protocols by number, do not check it in /etc/protocols. X-Git-Tag: v7.13~1 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=a60c396063cf0868d5bad54b4e40b26b687d21a0;p=thirdparty%2Fipset.git When parsing protocols by number, do not check it in /etc/protocols. Signed-off-by: Jozsef Kadlecsik --- diff --git a/lib/parse.c b/lib/parse.c index aabf2a8f..974eaf86 100644 --- a/lib/parse.c +++ b/lib/parse.c @@ -493,13 +493,13 @@ ipset_parse_proto(struct ipset_session *session, assert(str); if (string_to_u8(session, str, &protonum, IPSET_WARNING) == 0) - protoent = getprotobynumber(protonum); - else { - /* No error, so reset false error messages */ - ipset_session_report_reset(session); - protoent = getprotobyname(strcasecmp(str, "icmpv6") == 0 - ? "ipv6-icmp" : str); - } + return ipset_session_data_set(session, opt, &protonum); + + /* No error, so reset false error messages */ + ipset_session_report_reset(session); + protoent = getprotobyname(strcasecmp(str, "icmpv6") == 0 + ? "ipv6-icmp" : str); + if (protoent == NULL) return syntax_err("cannot parse '%s' " "as a protocol", str);