Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F143152257
D32892.id98198.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D32892.id98198.diff
View Options
Index: lib/libpfctl/libpfctl.c
===================================================================
--- lib/libpfctl/libpfctl.c
+++ lib/libpfctl/libpfctl.c
@@ -287,14 +287,20 @@
static void
pf_nvaddr_wrap_to_addr_wrap(const nvlist_t *nvl, struct pf_addr_wrap *addr)
{
+ bzero(addr, sizeof(*addr));
+
addr->type = nvlist_get_number(nvl, "type");
addr->iflags = nvlist_get_number(nvl, "iflags");
- if (addr->type == PF_ADDR_DYNIFTL)
+ if (addr->type == PF_ADDR_DYNIFTL) {
strlcpy(addr->v.ifname, nvlist_get_string(nvl, "ifname"),
IFNAMSIZ);
- if (addr->type == PF_ADDR_TABLE)
+ addr->p.dyncnt = nvlist_get_number(nvl, "dynctl");
+ }
+ if (addr->type == PF_ADDR_TABLE) {
strlcpy(addr->v.tblname, nvlist_get_string(nvl, "tblname"),
PF_TABLE_NAME_SIZE);
+ addr->p.tblcnt = nvlist_get_number(nvl, "tblcnt");
+ }
pf_nvaddr_to_addr(nvlist_get_nvlist(nvl, "addr"), &addr->v.a.addr);
pf_nvaddr_to_addr(nvlist_get_nvlist(nvl, "mask"), &addr->v.a.mask);
Index: sys/netpfil/pf/pf_nv.c
===================================================================
--- sys/netpfil/pf/pf_nv.c
+++ sys/netpfil/pf/pf_nv.c
@@ -327,6 +327,8 @@
{
nvlist_t *nvl;
nvlist_t *tmp;
+ uint64_t num;
+ struct pfr_ktable *kt;
nvl = nvlist_create(0);
if (nvl == NULL)
@@ -334,10 +336,25 @@
nvlist_add_number(nvl, "type", addr->type);
nvlist_add_number(nvl, "iflags", addr->iflags);
- if (addr->type == PF_ADDR_DYNIFTL)
+ if (addr->type == PF_ADDR_DYNIFTL) {
nvlist_add_string(nvl, "ifname", addr->v.ifname);
- if (addr->type == PF_ADDR_TABLE)
+ num = 0;
+ if (addr->p.dyn != NULL)
+ num = addr->p.dyn->pfid_acnt4 +
+ addr->p.dyn->pfid_acnt6;
+ nvlist_add_number(nvl, "dyncnt", num);
+ }
+ if (addr->type == PF_ADDR_TABLE) {
nvlist_add_string(nvl, "tblname", addr->v.tblname);
+ num = -1;
+ kt = addr->p.tbl;
+ if ((kt->pfrkt_flags & PFR_TFLAG_ACTIVE) &&
+ kt->pfrkt_root != NULL)
+ kt = kt->pfrkt_root;
+ if (kt->pfrkt_flags & PFR_TFLAG_ACTIVE)
+ num = kt->pfrkt_cnt;
+ nvlist_add_number(nvl, "tblcnt", num);
+ }
tmp = pf_addr_to_nvaddr(&addr->v.a.addr);
if (tmp == NULL)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Jan 27, 3:37 PM (9 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28057984
Default Alt Text
D32892.id98198.diff (2 KB)
Attached To
Mode
D32892: pf: ensure we populate dyncnt/tblcnt in struct pf_addr_wrap
Attached
Detach File
Event Timeline
Log In to Comment