diff options
| author | Reid Linnemann <rlinnemann@netgate.com> | 2022-04-22 11:54:51 +0000 |
|---|---|---|
| committer | Kristof Provost <kp@FreeBSD.org> | 2022-04-22 17:53:20 +0000 |
| commit | 0abcc1d2d33aef2333dab28e1ec1858cf45b314a (patch) | |
| tree | 7a3557fa14e5da6a6a90baa08dd795bd91dd9c1c /sbin/pfctl | |
| parent | 1452bfcd9bbcb2f5bbb89fa38d01ce51dd9b6d44 (diff) | |
Diffstat (limited to 'sbin/pfctl')
| -rw-r--r-- | sbin/pfctl/pfctl.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index 150a375b316a..a1f8e5fedd4c 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -1016,6 +1016,18 @@ pfctl_print_eth_rule_counters(struct pfctl_eth_rule *rule, int opts) (unsigned long long)(rule->bytes[0] + rule->bytes[1])); } + if (opts & PF_OPT_VERBOSE2) { + char timestr[30]; + + if (rule->last_active_timestamp != 0) { + time_t last_active = rule->last_active_timestamp; + bcopy(ctime(&last_active), timestr, sizeof(timestr)); + *strchr(timestr, '\n') = '\0'; + } else { + snprintf(timestr, sizeof(timestr), "N/A"); + } + printf(" [ Last Active Time: %s ]\n", timestr); + } } void @@ -1055,6 +1067,17 @@ pfctl_print_rule_counters(struct pfctl_rule *rule, int opts) (unsigned)rule->cuid, (unsigned)rule->cpid, (uintmax_t)rule->states_tot); } + if (opts & PF_OPT_VERBOSE2) { + char timestr[30]; + if (rule->last_active_timestamp != 0) { + time_t last_active = rule->last_active_timestamp; + bcopy(ctime(&last_active), timestr, sizeof(timestr)); + *strchr(timestr, '\n') = '\0'; + } else { + snprintf(timestr, sizeof(timestr), "N/A"); + } + printf(" [ Last Active Time: %s ]\n", timestr); + } } void |
