]> git.ipfire.org Git - thirdparty/linux.git/commit
selftests: netfilter: add nft_fib_nexthop test
authorJiayuan Chen <jiayuan.chen@linux.dev>
Wed, 20 May 2026 02:34:11 +0000 (10:34 +0800)
committerFlorian Westphal <fw@strlen.de>
Fri, 22 May 2026 10:28:46 +0000 (12:28 +0200)
commita40aaaef2f8f5a17a779eeac7032f2f7d5322406
tree8ed9fcd51a06d15ffd88c1778fba441a66bc17b2
parentf81b0c2d281faa93e4c2b7247047922aaf3e4ba6
selftests: netfilter: add nft_fib_nexthop test

Functional coverage of nft_fib6_eval()'s nexthop enumeration over
three route shapes:

  1) single external nexthop (nhid)
  2) external nexthop group (nhid -> group)
  3) old-style multipath (nexthop ... nexthop ...)

Each scenario places one nexthop on the input device (veth0). For
(2) and (3) the matching nexthop is the second member, so the walk
has to traverse beyond the primary nh. Two nft counters on prerouting
verify the data path: one increments only when fib reports veth0 as
the oif, the other counts "missing" results and must stay at zero.

  ./nft_fib_nexthop.sh
  PASS: single external nexthop (nhid -> veth0)
  PASS: nexthop group (dummy0 + veth0)
  PASS: old-style multipath (sibling on veth0)

Suggested-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Signed-off-by: Florian Westphal <fw@strlen.de>
tools/testing/selftests/net/netfilter/Makefile
tools/testing/selftests/net/netfilter/nft_fib_nexthop.sh [new file with mode: 0755]