#!/bin/bash # check iif/iifname/oifgroup/iiftype match. # Kselftest framework requirement - SKIP code is 4. ksft_skip=4 sfx=$(mktemp -u "XXXXXXXX") ns0="ns0-$sfx" if ! nft --version > /dev/null 2>&1; then echo "SKIP: Could not run test without nft tool" exit $ksft_skip fi cleanup() { ip netns del "$ns0" } ip netns add "$ns0" ip -net "$ns0" link set lo up ip -net "$ns0" addr add 127.0.0.1 dev lo trap cleanup EXIT currentyear=$(date +%Y) lastyear=$((currentyear-1)) ip netns exec "$ns0" nft -f /dev/stdin < /dev/null check_lo_counters "2" true check_one_counter oskuidcounter "1" true check_one_counter oskgidcounter "1" true check_one_counter imarkcounter "1" true check_one_counter omarkcounter "1" true check_one_counter ilastyearcounter "0" true if [ $ret -eq 0 ];then echo "OK: nftables meta iif/oif counters at expected values" else exit $ret fi #First CPU execution and counter taskset -p 01 $$ > /dev/null ip netns exec "$ns0" nft reset counters > /dev/null ip netns exec "$ns0" ping -q -c 1 127.0.0.1 > /dev/null check_one_counter icpu0counter "2" true if [ $ret -eq 0 ];then echo "OK: nftables meta cpu counter at expected values" fi exit $ret