summaryrefslogtreecommitdiff
path: root/lib/libpfctl
diff options
context:
space:
mode:
authorReid Linnemann <rlinnemann@netgate.com>2022-04-22 11:54:51 +0000
committerKristof Provost <kp@FreeBSD.org>2022-04-22 17:53:20 +0000
commit0abcc1d2d33aef2333dab28e1ec1858cf45b314a (patch)
tree7a3557fa14e5da6a6a90baa08dd795bd91dd9c1c /lib/libpfctl
parent1452bfcd9bbcb2f5bbb89fa38d01ce51dd9b6d44 (diff)
Diffstat (limited to 'lib/libpfctl')
-rw-r--r--lib/libpfctl/libpfctl.c10
-rw-r--r--lib/libpfctl/libpfctl.h2
2 files changed, 11 insertions, 1 deletions
diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c
index 89123bd80ad5..6a883a814902 100644
--- a/lib/libpfctl/libpfctl.c
+++ b/lib/libpfctl/libpfctl.c
@@ -512,6 +512,10 @@ pf_nvrule_to_rule(const nvlist_t *nvl, struct pfctl_rule *rule)
pf_nvuint_64_array(nvl, "packets", 2, rule->packets, NULL);
pf_nvuint_64_array(nvl, "bytes", 2, rule->bytes, NULL);
+ if (nvlist_exists_number(nvl, "timestamp")) {
+ rule->last_active_timestamp = nvlist_get_number(nvl, "timestamp");
+ }
+
rule->os_fingerprint = nvlist_get_number(nvl, "os_fingerprint");
rule->rtableid = nvlist_get_number(nvl, "rtableid");
@@ -642,6 +646,10 @@ pfctl_nveth_rule_to_eth_rule(const nvlist_t *nvl, struct pfctl_eth_rule *rule)
rule->bytes[0] = nvlist_get_number(nvl, "bytes-in");
rule->bytes[1] = nvlist_get_number(nvl, "bytes-out");
+ if (nvlist_exists_number(nvl, "timestamp")) {
+ rule->last_active_timestamp = nvlist_get_number(nvl, "timestamp");
+ }
+
strlcpy(rule->qname, nvlist_get_string(nvl, "qname"), PF_QNAME_SIZE);
strlcpy(rule->tagname, nvlist_get_string(nvl, "tagname"),
PF_TAG_NAME_SIZE);
@@ -737,7 +745,7 @@ pfctl_get_eth_rule(int dev, uint32_t nr, uint32_t ticket,
nvlist_add_number(nvl, "nr", nr);
nvlist_add_bool(nvl, "clear", clear);
- if ((ret = pfctl_do_ioctl(dev, DIOCGETETHRULE, 2048, &nvl)) != 0)
+ if ((ret = pfctl_do_ioctl(dev, DIOCGETETHRULE, 4096, &nvl)) != 0)
return (ret);
pfctl_nveth_rule_to_eth_rule(nvl, rule);
diff --git a/lib/libpfctl/libpfctl.h b/lib/libpfctl/libpfctl.h
index 440ca2fe0d10..ab4b6a27c787 100644
--- a/lib/libpfctl/libpfctl.h
+++ b/lib/libpfctl/libpfctl.h
@@ -99,6 +99,7 @@ struct pfctl_eth_rule {
uint64_t evaluations;
uint64_t packets[2];
uint64_t bytes[2];
+ uint32_t last_active_timestamp;
/* Action */
char qname[PF_QNAME_SIZE];
@@ -171,6 +172,7 @@ struct pfctl_rule {
uint64_t evaluations;
uint64_t packets[2];
uint64_t bytes[2];
+ uint32_t last_active_timestamp;
struct pfi_kif *kif;
struct pfctl_anchor *anchor;