From b730879ffa50716e3894b91cc3bac851cf37f2cb Mon Sep 17 00:00:00 2001 From: Max Laier Date: Tue, 7 Jun 2005 14:11:17 +0000 Subject: [PATCH] add_proto() now fills proto for us so stop to 'guess' the protocol from the command and rather trust the value add_proto filled in. While here, fix an oversight in the pretty printing of ip6/4 options. --- sbin/ipfw/ipfw2.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c index c645e0b14175..686174d207e1 100644 --- a/sbin/ipfw/ipfw2.c +++ b/sbin/ipfw/ipfw2.c @@ -1575,7 +1575,7 @@ show_ipfw(struct ip_fw *rule, int pcwidth, int bcwidth) case O_IP6_SRC: case O_IP6_SRC_MASK: case O_IP6_SRC_ME: - show_prerequisites(&flags, HAVE_PROTO6, 0); + show_prerequisites(&flags, HAVE_PROTO, 0); if (!(flags & HAVE_SRCIP)) printf(" from"); if ((cmd->len & F_OR) && !or_block) @@ -3991,10 +3991,7 @@ add(int ac, char *av[]) NEED1("missing protocol"); if (add_proto(cmd, *av, &proto)) { av++; ac--; - if (F_LEN(cmd) == 0) /* plain IP */ - proto = 0; - else { - proto = cmd->arg1; + if (F_LEN(cmd) != 0) { prev = cmd; cmd = next_cmd(cmd); }