From c6ec022631120877cc41f3f0050172787636823e Mon Sep 17 00:00:00 2001 From: Hajimu UMEMOTO Date: Sun, 5 Mar 2006 15:55:46 +0000 Subject: [PATCH] Revert `proto ip' back to the previous behavior. The kernel side of ipfw2 doesn't allow zero as protocol number. MFC after: 3 days --- sbin/ipfw/ipfw.8 | 2 -- sbin/ipfw/ipfw2.c | 6 +++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/sbin/ipfw/ipfw.8 b/sbin/ipfw/ipfw.8 index 911af5c81977..679b9809e874 100644 --- a/sbin/ipfw/ipfw.8 +++ b/sbin/ipfw/ipfw.8 @@ -845,8 +845,6 @@ Matches any packet. .El .Pp The -.Cm ip -and .Cm ipv6 in .Cm proto diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c index 9ce30b84cd23..195e991b906d 100644 --- a/sbin/ipfw/ipfw2.c +++ b/sbin/ipfw/ipfw2.c @@ -3590,8 +3590,8 @@ add_proto0(ipfw_insn *cmd, char *av, u_char *protop) char *ep; int proto; - proto = strtol(av, &ep, 0); - if (*ep != '\0' || proto < 0) { + proto = strtol(av, &ep, 10); + if (*ep != '\0' || proto <= 0) { if ((pe = getprotobyname(av)) == NULL) return NULL; proto = pe->p_proto; @@ -3607,7 +3607,7 @@ add_proto(ipfw_insn *cmd, char *av, u_char *protop) { u_char proto = IPPROTO_IP; - if (_substrcmp(av, "all") == 0) + if (_substrcmp(av, "all") == 0 || strcmp(av, "ip") == 0) ; /* do not set O_IP4 nor O_IP6 */ else if (strcmp(av, "ip4") == 0) /* explicit "just IPv4" rule */