Skip to contentSkip to conversation

Allow protocol number zero

PATCH Applied Brian Haley 2 participants 2 messages Mar 19, 2019 – Mar 20, 2019 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Allow protocol number zero

/etc/protocols defines protocol zero as 'ip' for IPv4, and 'hopopt' for IPv6, which can be used with conntrack as '-p ip' or '-p hopopt'. However it's equivalent, '-p 0' is considered unsupported. Change the range check in findproto() to allow zero as well.

---
 src/conntrack.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/conntrack.c +1 -1
index daa93db..97132a9 100644
@@ -628,7 +628,7 @@ static struct ctproto_handler *findproto(char *name, int *pnum)
 	}
 	/* using a protocol number? */
 	protonum = atoi(name);
-	if (protonum > 0 && protonum <= IPPROTO_MAX) {
+	if (protonum >= 0 && protonum <= IPPROTO_MAX) {
 		/* try lookup by number, perhaps this protocol is supported */
 		list_for_each_entry(cur, &proto_list, head) {
 			if (cur->protonum == protonum) {
Signature · 1 line
2.17.1
maintainer Applied
#1 lore raw
Quoted 5 lines · Brian Haley

/etc/protocols defines protocol zero as 'ip' for IPv4, and 'hopopt' for IPv6, which can be used with conntrack as '-p ip' or '-p hopopt'. However it's equivalent, '-p 0' is considered unsupported. Change the range check in findproto() to allow zero as well.

Applied, thanks.