diff options
author | melifaro <melifaro@FreeBSD.org> | 2015-02-05 14:08:33 +0000 |
---|---|---|
committer | melifaro <melifaro@FreeBSD.org> | 2015-02-05 14:08:33 +0000 |
commit | be47553309d1c25b349c4ca6256e5a0231688a4b (patch) | |
tree | 013de40b9e85189f6a9a45c7cb82e733e13dacfd /sbin | |
parent | 0f5a4f05172d1e32bc8aab85dde9cdbbd48a007f (diff) | |
download | FreeBSD-src-be47553309d1c25b349c4ca6256e5a0231688a4b.zip FreeBSD-src-be47553309d1c25b349c4ca6256e5a0231688a4b.tar.gz |
Retrieve counters from kernel if rule timstamping is requested.
PR: kern/197271
Submitted by: lev
Sponsored by: Yandex LLC
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/ipfw/ipfw2.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c index 2c98466..d16d9e7 100644 --- a/sbin/ipfw/ipfw2.c +++ b/sbin/ipfw/ipfw2.c @@ -61,6 +61,7 @@ struct format_opts { int bcwidth; int pcwidth; int show_counters; + int show_time; /* show timestamp */ uint32_t set_mask; /* enabled sets mask */ uint32_t flags; /* request flags */ uint32_t first; /* first rule to request */ @@ -2402,7 +2403,7 @@ list_static_range(struct cmdline_opts *co, struct format_opts *fo, for (n = seen = 0; n < rcnt; n++, rtlv = (ipfw_obj_tlv *)((caddr_t)rtlv + rtlv->length)) { - if (fo->show_counters != 0) { + if ((fo->show_counters | fo->show_time) != 0) { cntr = (struct ip_fw_bcounter *)(rtlv + 1); r = (struct ip_fw_rule *)((caddr_t)cntr + cntr->size); } else { @@ -2504,10 +2505,11 @@ ipfw_list(int ac, char *av[], int show_counters) /* get configuraion from kernel */ cfg = NULL; sfo.show_counters = show_counters; + sfo.show_time = co.do_time; sfo.flags = IPFW_CFG_GET_STATIC; if (co.do_dynamic != 0) sfo.flags |= IPFW_CFG_GET_STATES; - if (sfo.show_counters != 0) + if ((sfo.show_counters | sfo.show_time) != 0) sfo.flags |= IPFW_CFG_GET_COUNTERS; if (ipfw_get_config(&co, &sfo, &cfg, &sz) != 0) err(EX_OSERR, "retrieving config failed"); |