From a60c396063cf0868d5bad54b4e40b26b687d21a0 Mon Sep 17 00:00:00 2001 From: Jozsef Kadlecsik Date: Tue, 27 Jul 2021 12:16:47 +0200 Subject: When parsing protocols by number, do not check it in /etc/protocols. Signed-off-by: Jozsef Kadlecsik --- lib/parse.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/parse.c b/lib/parse.c index aabf2a8..974eaf8 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); -- cgit v1.2.3