Page MenuHomeFreeBSD

D60119.diff
No OneTemporary

D60119.diff

diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c
--- a/lib/libpfctl/libpfctl.c
+++ b/lib/libpfctl/libpfctl.c
@@ -2783,6 +2783,7 @@
{ .type = PFR_A_NET, .off = _OUT(pfra_net), .cb = snl_attr_get_uint8 },
{ .type = PFR_A_NOT, .off = _OUT(pfra_not), .cb = snl_attr_get_bool },
{ .type = PFR_A_ADDR, .off = _OUT(pfra_ip6addr), .cb = snl_attr_get_in6_addr },
+ { .type = PFR_A_FBACK, .off = _OUT(pfra_fback), .cb = snl_attr_get_uint8 },
};
#undef _OUT
SNL_DECLARE_ATTR_PARSER(pfr_addr_parser, ap_pfr_addr);
diff --git a/sys/netpfil/pf/pf_nl.h b/sys/netpfil/pf/pf_nl.h
--- a/sys/netpfil/pf/pf_nl.h
+++ b/sys/netpfil/pf/pf_nl.h
@@ -498,6 +498,7 @@
PFR_A_NET = 2, /* uint8_t */
PFR_A_NOT = 3, /* bool */
PFR_A_ADDR = 4, /* in6_addr */
+ PFR_A_FBACK = 5, /* uint8_t */
};
enum pf_table_addrs_t {
diff --git a/sys/netpfil/pf/pf_nl.c b/sys/netpfil/pf/pf_nl.c
--- a/sys/netpfil/pf/pf_nl.c
+++ b/sys/netpfil/pf/pf_nl.c
@@ -2315,6 +2315,7 @@
nlattr_add_u8(nw, PFR_A_NET, a->pfra_net);
nlattr_add_bool(nw, PFR_A_NOT, a->pfra_not);
nlattr_add_in6_addr(nw, PFR_A_ADDR, &a->pfra_u._pfra_ip6addr);
+ nlattr_add_u8(nw, PFR_A_FBACK, a->pfra_fback);
nlattr_set_len(nw, off);
diff --git a/tests/sys/netpfil/pf/table.sh b/tests/sys/netpfil/pf/table.sh
--- a/tests/sys/netpfil/pf/table.sh
+++ b/tests/sys/netpfil/pf/table.sh
@@ -949,6 +949,38 @@
pft_cleanup
}
+atf_test_case "show_no_counters" "cleanup"
+show_no_counters_head()
+{
+ atf_set descr 'Test pfctl -v -T show on a table without counters'
+ atf_set require.user root
+}
+
+show_no_counters_body()
+{
+ pft_init
+
+ vnet_mkjail alcatraz
+ jexec alcatraz pfctl -e
+
+ pft_set_rules alcatraz \
+ "table <foo> persist { 192.0.2.1 }" \
+ "table <bar> persist counters { 192.0.2.1 }" \
+ "pass all"
+
+ atf_check -s exit:0 -e ignore \
+ -o match:"Cleared:" -o not-match:"In/Block:" \
+ jexec alcatraz pfctl -t foo -v -T show
+ atf_check -s exit:0 -e ignore \
+ -o match:"Cleared:" -o match:"In/Block:" \
+ jexec alcatraz pfctl -t bar -v -T show
+}
+
+show_no_counters_cleanup()
+{
+ pft_cleanup
+}
+
atf_init_test_cases()
{
atf_add_test_case "v4_counters"
@@ -972,4 +1004,5 @@
atf_add_test_case "replace_verbose"
atf_add_test_case "load"
atf_add_test_case "test"
+ atf_add_test_case "show_no_counters"
}

File Metadata

Mime Type
text/plain
Expires
Wed, Sep 30, 3:23 PM (17 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
39951233
Default Alt Text
D60119.diff (2 KB)

Event Timeline