FreeBSD Bugzilla – Attachment 256136 Details for
Bug 282984
pfctl: add -T `makezero` to touch pfras_tzero _only_ for non-zero entries
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
pf (tests): Set cleared time when zeroing stats for table addresses
0001-pf-tests-Set-cleared-time-when-zeroing-stats-for-tab.patch (text/plain), 2.48 KB, created by
Leonid Evdokimov
on 2024-12-25 14:15:42 UTC
(
hide
)
Description:
pf (tests): Set cleared time when zeroing stats for table addresses
Filename:
MIME Type:
Creator:
Leonid Evdokimov
Created:
2024-12-25 14:15:42 UTC
Size:
2.48 KB
patch
obsolete
>From 19583b71f07892b29e29a37871d6da9250c4bd12 Mon Sep 17 00:00:00 2001 >From: Leonid Evdokimov <leon@darkk.net.ru> >Date: Wed, 25 Dec 2024 16:57:49 +0300 >Subject: [PATCH] pf (tests): Set cleared time when zeroing stats for table > addresses >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Tests for https://reviews.freebsd.org/D47697 > >PR: 282877, 282984 >Sponsored by: ScheiÃe und Pisse Stiftung >Signed-off-by: Leonid Evdokimov <leon@darkk.net.ru> >--- > tests/sys/netpfil/pf/table.sh | 33 +++++++++++++++++++++++++++++++-- > 1 file changed, 31 insertions(+), 2 deletions(-) > >diff --git a/tests/sys/netpfil/pf/table.sh b/tests/sys/netpfil/pf/table.sh >index 62c9d66d80ce..d580a5d5c7b2 100644 >--- a/tests/sys/netpfil/pf/table.sh >+++ b/tests/sys/netpfil/pf/table.sh >@@ -116,6 +116,20 @@ zero_one_head() > atf_set require.user root > } > >+pfctl_alcatraz_cleared_ctime() >+{ >+ jexec alcatraz pfctl -t "$1" -vvT show | awk -v ip="$2" ' >+ ($1 == ip) { m = 1 } >+ ($1 == "Cleared:" && m) { >+ sub("[[:space:]]*Cleared:[[:space:]]*", ""); print; exit }' >+} >+ >+ctime_to_unixtime() >+{ >+ # NB: it's not TZ=UTC, it's TZ=/etc/localtime >+ date -jf '%a %b %d %H:%M:%S %Y' "$1" '+%s' >+} >+ > zero_one_body() > { > epair_send=$(vnet_mkepair) >@@ -145,16 +159,31 @@ zero_one_body() > -o match:'Out/Pass:.*'"$TABLE_STATS_NONZERO_REGEXP" \ > jexec alcatraz pfctl -t foo -T show -vv > >+ local uniq base ts1 ts3 >+ uniq=`jexec alcatraz pfctl -t foo -vvT show | sort -u | grep -c Cleared` >+ atf_check_equal 1 "$uniq" # time they were added >+ >+ base=`pfctl_alcatraz_cleared_ctime foo 192.0.2.1` >+ > atf_check -s exit:0 -e ignore \ > jexec alcatraz pfctl -t foo -T zero 192.0.2.3 > >+ ts1=`pfctl_alcatraz_cleared_ctime foo 192.0.2.1` >+ atf_check_equal "$base" "$ts1" >+ >+ ts3=`pfctl_alcatraz_cleared_ctime foo 192.0.2.3` >+ atf_check test "$ts1" != "$ts3" >+ >+ ts1=`ctime_to_unixtime "$ts1"` >+ ts3=`ctime_to_unixtime "$ts3"` >+ atf_check test $(( "$ts3" - "$ts1" )) -lt 10 # (3 pings * 2) + epsilon >+ atf_check test "$ts1" -lt "$ts3" >+ > # We now have a zeroed and a non-zeroed counter, so both patterns > # should match > atf_check -s exit:0 -e ignore \ > -o match:'In/Pass:.*'"$TABLE_STATS_NONZERO_REGEXP" \ > -o match:'Out/Pass:.*'"$TABLE_STATS_NONZERO_REGEXP" \ >- jexec alcatraz pfctl -t foo -T show -vv >- atf_check -s exit:0 -e ignore \ > -o match:'In/Pass:.*'"$TABLE_STATS_ZERO_REGEXP" \ > -o match:'Out/Pass:.*'"$TABLE_STATS_ZERO_REGEXP" \ > jexec alcatraz pfctl -t foo -T show -vv >-- >2.47.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 282984
:
255466
|
255471
|
255628
|
256136