@@ -65,7 +65,59 @@ basic_cleanup()
65
65
pft_cleanup
66
66
}
67
67
68
+ atf_test_case " table" " cleanup"
69
+ table_head ()
70
+ {
71
+ atf_set descr ' Test tables and pf_snmp'
72
+ atf_set require.user root
73
+ }
74
+
75
+ table_body ()
76
+ {
77
+ pft_init
78
+
79
+ epair=$( vnet_mkepair)
80
+
81
+ ifconfig ${epair} b 192.0.2.2/24 up
82
+
83
+ vnet_mkjail alcatraz ${epair} a
84
+ jexec alcatraz ifconfig ${epair} a 192.0.2.1/24 up
85
+
86
+ jexec alcatraz pfctl -e
87
+ pft_set_rules alcatraz \
88
+ " table <foo> counters { 192.0.2.0/24 }" \
89
+ " pass in from <foo>"
90
+
91
+ # Start bsnmpd after creating the table so we don't have to wait for
92
+ # a refresh timeout
93
+ jexec alcatraz bsnmpd -c $( atf_get_srcdir) /bsnmpd.conf
94
+
95
+ # Sanity check, and create state
96
+ atf_check -s exit:0 -o ignore \
97
+ ping -c 1 192.0.2.1
98
+
99
+ # We should have one table
100
+ atf_check -s exit:0 -o match:' pfTablesTblNumber.0 = 1' \
101
+ bsnmpwalk -s
[email protected] -i pf_tree.def begemot
102
+
103
+ # We have the 'foo' table
104
+ atf_check -s exit:0 -o match:' pfTablesTblDescr.* = foo' \
105
+ bsnmpwalk -s
[email protected] -i pf_tree.def pfTables
106
+
107
+ # Which contains address 192.0.2.0/24
108
+ atf_check -s exit:0 -o match:' pfTablesAddrNet.* = 192.0.2.0' \
109
+ bsnmpwalk -s
[email protected] -i pf_tree.def pfTables
110
+ atf_check -s exit:0 -o match:' pfTablesAddrPrefix.* = 24' \
111
+ bsnmpwalk -s
[email protected] -i pf_tree.def pfTables
112
+ }
113
+
114
+ table_cleanup ()
115
+ {
116
+ pft_cleanup
117
+ }
118
+
68
119
atf_init_test_cases ()
69
120
{
70
121
atf_add_test_case " basic"
122
+ atf_add_test_case " table"
71
123
}
0 commit comments