table.sh (d0b2dbfa0ecf2bbc9709efc5e20baf8e4b44bbbf) table.sh (6463b6b59152fb1695bbe0de78f6e2675c5a765a)
1#
2# SPDX-License-Identifier: BSD-2-Clause
3#
4# Copyright (c) 2020 Mark Johnston <markj@FreeBSD.org>
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:

--- 95 unchanged lines hidden (view full) ---

104 jexec alcatraz pfctl -t foo6 -T show -vv
105}
106
107v6_counters_cleanup()
108{
109 pft_cleanup
110}
111
1#
2# SPDX-License-Identifier: BSD-2-Clause
3#
4# Copyright (c) 2020 Mark Johnston <markj@FreeBSD.org>
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:

--- 95 unchanged lines hidden (view full) ---

104 jexec alcatraz pfctl -t foo6 -T show -vv
105}
106
107v6_counters_cleanup()
108{
109 pft_cleanup
110}
111
112atf_test_case "zero_one" "cleanup"
113zero_one_head()
114{
115 atf_set descr 'Test zeroing a single address in a table'
116 atf_set require.user root
117}
118
119zero_one_body()
120{
121 epair_send=$(vnet_mkepair)
122 ifconfig ${epair_send}a 192.0.2.1/24 up
123 ifconfig ${epair_send}a inet alias 192.0.2.3/24
124
125 vnet_mkjail alcatraz ${epair_send}b
126 jexec alcatraz ifconfig ${epair_send}b 192.0.2.2/24 up
127 jexec alcatraz pfctl -e
128
129 pft_set_rules alcatraz \
130 "table <foo> counters { 192.0.2.1, 192.0.2.3 }" \
131 "block all" \
132 "pass in from <foo> to any" \
133 "pass out from any to <foo>" \
134 "set skip on lo"
135
136 atf_check -s exit:0 -o ignore ping -c 3 -S 192.0.2.1 192.0.2.2
137 atf_check -s exit:0 -o ignore ping -c 3 -S 192.0.2.3 192.0.2.2
138
139 jexec alcatraz pfctl -t foo -T show -vv
140
141 atf_check -s exit:0 -e ignore \
142 -o match:'In/Block:.*'"$TABLE_STATS_ZERO_REGEXP" \
143 -o match:'In/Pass:.*'"$TABLE_STATS_NONZERO_REGEXP" \
144 -o match:'Out/Block:.*'"$TABLE_STATS_ZERO_REGEXP" \
145 -o match:'Out/Pass:.*'"$TABLE_STATS_NONZERO_REGEXP" \
146 jexec alcatraz pfctl -t foo -T show -vv
147
148 atf_check -s exit:0 -e ignore \
149 jexec alcatraz pfctl -t foo -T zero 192.0.2.3
150
151 # We now have a zeroed and a non-zeroed counter, so both patterns
152 # should match
153 atf_check -s exit:0 -e ignore \
154 -o match:'In/Pass:.*'"$TABLE_STATS_NONZERO_REGEXP" \
155 -o match:'Out/Pass:.*'"$TABLE_STATS_NONZERO_REGEXP" \
156 jexec alcatraz pfctl -t foo -T show -vv
157 atf_check -s exit:0 -e ignore \
158 -o match:'In/Pass:.*'"$TABLE_STATS_ZERO_REGEXP" \
159 -o match:'Out/Pass:.*'"$TABLE_STATS_ZERO_REGEXP" \
160 jexec alcatraz pfctl -t foo -T show -vv
161}
162
163zero_one_cleanup()
164{
165 pft_cleanup
166}
167
112atf_test_case "pr251414" "cleanup"
113pr251414_head()
114{
115 atf_set descr 'Test PR 251414'
116 atf_set require.user root
117}
118
119pr251414_body()

--- 199 unchanged lines hidden (view full) ---

319{
320 pft_cleanup
321}
322
323atf_init_test_cases()
324{
325 atf_add_test_case "v4_counters"
326 atf_add_test_case "v6_counters"
168atf_test_case "pr251414" "cleanup"
169pr251414_head()
170{
171 atf_set descr 'Test PR 251414'
172 atf_set require.user root
173}
174
175pr251414_body()

--- 199 unchanged lines hidden (view full) ---

375{
376 pft_cleanup
377}
378
379atf_init_test_cases()
380{
381 atf_add_test_case "v4_counters"
382 atf_add_test_case "v6_counters"
383 atf_add_test_case "zero_one"
327 atf_add_test_case "pr251414"
328 atf_add_test_case "automatic"
329 atf_add_test_case "network"
330 atf_add_test_case "pr259689"
331 atf_add_test_case "precreate"
332 atf_add_test_case "anchor"
333}
384 atf_add_test_case "pr251414"
385 atf_add_test_case "automatic"
386 atf_add_test_case "network"
387 atf_add_test_case "pr259689"
388 atf_add_test_case "precreate"
389 atf_add_test_case "anchor"
390}