diff options
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/pfctl/pfctl.c | 12 | ||||
-rw-r--r-- | sbin/pfctl/pfctl_parser.c | 44 | ||||
-rw-r--r-- | sbin/pfctl/pfctl_parser.h | 4 |
3 files changed, 32 insertions, 28 deletions
diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index 17000299990..c231a2e6232 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfctl.c,v 1.46 2001/10/02 18:18:28 frantzen Exp $ */ +/* $OpenBSD: pfctl.c,v 1.47 2001/10/04 21:54:15 dhartmei Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -57,7 +57,7 @@ int pfctl_clear_states(int, int); int pfctl_hint(int, const char *, int); int pfctl_show_rules(int, int); int pfctl_show_nat(int); -int pfctl_show_states(int, u_int8_t); +int pfctl_show_states(int, u_int8_t, int); int pfctl_show_status(int); int pfctl_rules(int, char *, int); int pfctl_nat(int, char *, int); @@ -321,7 +321,7 @@ pfctl_show_nat(int dev) } int -pfctl_show_states(int dev, u_int8_t proto) +pfctl_show_states(int dev, u_int8_t proto, int opts) { struct pfioc_states ps; struct pf_state *p; @@ -352,7 +352,7 @@ pfctl_show_states(int dev, u_int8_t proto) p = ps.ps_states; for (i = 0; i < ps.ps_len; i += sizeof(*p)) { if (!proto || (p->proto == proto)) - print_state(p); + print_state(p, opts); p++; } return (0); @@ -790,7 +790,7 @@ main(int argc, char *argv[]) pfctl_show_nat(dev); break; case 's': - pfctl_show_states(dev, 0); + pfctl_show_states(dev, 0, opts); break; case 'i': pfctl_show_status(dev); @@ -798,7 +798,7 @@ main(int argc, char *argv[]) case 'a': pfctl_show_rules(dev, opts); pfctl_show_nat(dev); - pfctl_show_states(dev, 0); + pfctl_show_states(dev, 0, opts); pfctl_show_status(dev); break; default: diff --git a/sbin/pfctl/pfctl_parser.c b/sbin/pfctl/pfctl_parser.c index 0876836e906..2a9c6886a17 100644 --- a/sbin/pfctl/pfctl_parser.c +++ b/sbin/pfctl/pfctl_parser.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfctl_parser.c,v 1.50 2001/09/15 23:23:40 wilfried Exp $ */ +/* $OpenBSD: pfctl_parser.c,v 1.51 2001/10/04 21:54:15 dhartmei Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -531,7 +531,7 @@ print_status(struct pf_status *s) } void -print_state(struct pf_state *s) +print_state(struct pf_state *s, int opts) { struct pf_state_peer *src, *dst; u_int8_t hrs, min, sec; @@ -582,28 +582,32 @@ print_state(struct pf_state *s) } else { printf(" <BAD STATE LEVELS>\n"); } - printf(" "); - print_seq(src); - printf(" "); - print_seq(dst); - printf("\n"); + if (opts & PF_OPT_VERBOSE) { + printf(" "); + print_seq(src); + printf(" "); + print_seq(dst); + printf("\n"); + } } else { printf(" %u:%u\n", src->state, dst->state); } - sec = s->creation % 60; - s->creation /= 60; - min = s->creation % 60; - s->creation /= 60; - hrs = s->creation; - printf(" age %.2u:%.2u:%.2u", hrs, min, sec); - sec = s->expire % 60; - s->expire /= 60; - min = s->expire % 60; - s->expire /= 60; - hrs = s->expire; - printf(", expires in %.2u:%.2u:%.2u", hrs, min, sec); - printf(", %u pkts, %u bytes\n", s->packets, s->bytes); + if (opts & PF_OPT_VERBOSE) { + sec = s->creation % 60; + s->creation /= 60; + min = s->creation % 60; + s->creation /= 60; + hrs = s->creation; + printf(" age %.2u:%.2u:%.2u", hrs, min, sec); + sec = s->expire % 60; + s->expire /= 60; + min = s->expire % 60; + s->expire /= 60; + hrs = s->expire; + printf(", expires in %.2u:%.2u:%.2u", hrs, min, sec); + printf(", %u pkts, %u bytes\n", s->packets, s->bytes); + } } void diff --git a/sbin/pfctl/pfctl_parser.h b/sbin/pfctl/pfctl_parser.h index 4edc13476e5..ddc13232132 100644 --- a/sbin/pfctl/pfctl_parser.h +++ b/sbin/pfctl/pfctl_parser.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pfctl_parser.h,v 1.11 2001/10/01 17:58:16 markus Exp $ */ +/* $OpenBSD: pfctl_parser.h,v 1.12 2001/10/04 21:54:15 dhartmei Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -61,7 +61,7 @@ void print_rule(struct pf_rule *); void print_nat(struct pf_nat *); void print_binat(struct pf_binat *); void print_rdr(struct pf_rdr *); -void print_state(struct pf_state *); +void print_state(struct pf_state *, int); void print_status(struct pf_status *); struct icmptypeent { |