# Test skeleton for kernel fixes: # b2f742c846ca netfilter: nf_tables: restart set lookup on base_seq change # a60f7bf4a152 netfilter: nft_set_rbtree: continue traversal if element is inactive # .. and related patches. # # Generate traffic and then flush the set contents and replace # them with the same matching entries. # # Fail when a packet gets through. # global variables: # R, S, C (network namespaces). # ip_s (server address) # helpers: # set_flush_add_atomic_cleanup # set_flush_add_create_topo # set_flush_add_atomic_run_test [ -z "$TIMEOUT" ] && TIMEOUT=30 set_flush_add_atomic_cleanup() { local tmp="$1" local i rm -f "$tmp" ip netns exec $R $NFT --debug netlink list ruleset for i in $C $S $R;do kill $(ip netns pid $i) 2>/dev/null ip netns del $i done } check_counter() { local tmp="$1" local then="$2" if ip netns exec $R $NFT list chain ip filter block-spoofed | grep -q 'counter packets 0 bytes 0'; then return 0 fi local now=$(date +%s) echo "$0 failed counter check after $((now-then))s" rm -f "$tmp" kill $(ip netns pid $C) 2>/dev/null return 1 } load_ruleset() { local type="$1" local flags="$2" local elements="$3" local expr="$4" ip netns exec $R $NFT -f - <