protoent = getprotobyname(strcasecmp(str, "icmpv6") == 0
? "ipv6-icmp" : str);
- if (protoent == NULL)
- return syntax_err("cannot parse '%s' "
- "as a protocol name", str);
+ if (protoent == NULL) {
+ uint8_t protonum;
+ int err;
+
+ if (!((err = string_to_u8(session, str, &protonum) == 0) &&
+ (protoent = getprotobynumber(protonum)) != NULL))
+ return syntax_err("cannot parse '%s' "
+ "as a protocol", str);
+ }
proto = protoent->p_proto;
if (!proto)
return syntax_err("Unsupported protocol '%s'", str);