Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-7]: src/usr.sbin/npf/npfctl Pull up following revision(s) (reques...



details:   https://anonhg.NetBSD.org/src/rev/8ab575a2fba0
branches:  netbsd-7
changeset: 799404:8ab575a2fba0
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Thu Jun 04 07:34:26 2015 +0000

description:
Pull up following revision(s) (requested by rmind in ticket #820):
        usr.sbin/npf/npfctl/npf_show.c: revision 1.19
npfctl: fix the from/to port mess up when showing the rules.

diffstat:

 usr.sbin/npf/npfctl/npf_show.c |  17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diffs (59 lines):

diff -r 3f8777ae553a -r 8ab575a2fba0 usr.sbin/npf/npfctl/npf_show.c
--- a/usr.sbin/npf/npfctl/npf_show.c    Thu Jun 04 05:42:38 2015 +0000
+++ b/usr.sbin/npf/npfctl/npf_show.c    Thu Jun 04 07:34:26 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: npf_show.c,v 1.15.2.2 2015/03/21 17:49:03 snj Exp $    */
+/*     $NetBSD: npf_show.c,v 1.15.2.3 2015/06/04 07:34:26 msaitoh Exp $        */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: npf_show.c,v 1.15.2.2 2015/03/21 17:49:03 snj Exp $");
+__RCSID("$NetBSD: npf_show.c,v 1.15.2.3 2015/06/04 07:34:26 msaitoh Exp $");
 
 #include <sys/socket.h>
 #include <netinet/in.h>
@@ -214,14 +214,14 @@
        char *p;
 
        if (ctx->curmark == BM_SRC_PORTS && (ctx->flags & SEEN_SRC) == 0)
-               any_str = "to any ";
+               any_str = "from any ";
        if (ctx->curmark == BM_DST_PORTS && (ctx->flags & SEEN_DST) == 0)
-               any_str = "from any ";
+               any_str = "to any ";
 
        if (fport != tport) {
-               easprintf(&p, "%s%u:%u", any_str, fport, tport);
+               easprintf(&p, "%sport %u:%u", any_str, fport, tport);
        } else {
-               easprintf(&p, "%s%u", any_str, fport);
+               easprintf(&p, "%sport %u", any_str, fport);
        }
        return p;
 }
@@ -271,11 +271,11 @@
 
        { BM_SRC_CIDR,  "from %s",      ", ", SEEN_SRC, print_address,  6 },
        { BM_SRC_TABLE, "from <%s>",    NULL, SEEN_SRC, print_table,    1 },
-       { BM_SRC_PORTS, "port %s",      ", ", 0,        print_portrange,2 },
+       { BM_SRC_PORTS, "%s",           ", ", 0,        print_portrange,2 },
 
        { BM_DST_CIDR,  "to %s",        ", ", SEEN_DST, print_address,  6 },
        { BM_DST_TABLE, "to <%s>",      NULL, SEEN_DST, print_table,    1 },
-       { BM_DST_PORTS, "port %s",      ", ", 0,        print_portrange,2 },
+       { BM_DST_PORTS, "%s",           ", ", 0,        print_portrange,2 },
 };
 
 static const char * __attribute__((format_arg(2)))
@@ -351,6 +351,7 @@
                    "pcap-filter \"...\"" : "unrecognized-bytecode");
                return;
        }
+       ctx->flags = 0;
 
        /*
         * BPF filter criteria described by the byte-code marks.



Home | Main Index | Thread Index | Old Index