setup_ipv4() creates a GRETAP tunnel with FOU encap and configures a FOU port via "ip fou add". Both require the fou module, which cannot be auto-loaded.
The test assumes CONFIG_NET_FOU=y, which matches the default selftests config, but fails on kernels built with CONFIG_NET_FOU=m. Without the fou module, tunnel creation fails and the test reports a false failure with 0/100 received packets: RTNETLINK answers: Invalid argument TEST: FOU/GRETAP IPv4 multicast encap resubmit (received 0/100) [FAIL] Load the fou module and skip the subtest cleanly when unavailable. This matches the existing fou6 handling in this script and the pattern used in pmtu.sh. modprobe is a no-op when CONFIG_NET_FOU=y, so default selftest builds remain unchanged. Signed-off-by: Qingshuang Fu <[email protected]> --- v2: - Dropped Fixes tag, target net-next instead - Dropped comment inside setup_ipv4() per review feedback - v1: https://lore.kernel.org/all/[email protected]/ tools/testing/selftests/net/fou_mcast_encap.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/net/fou_mcast_encap.sh b/tools/testing/selftests/net/fou_mcast_encap.sh index 70210d39fba3..5f84d58d3075 100755 --- a/tools/testing/selftests/net/fou_mcast_encap.sh +++ b/tools/testing/selftests/net/fou_mcast_encap.sh @@ -51,8 +51,6 @@ setup_common() { } setup_ipv4() { - # IPv4 FOU (CONFIG_NET_FOU) is built in on kernels configured for - # these tests, so no module load is needed here. ip -n "$NSENDER" addr add 10.0.0.1/24 dev veth_s ip -n "$NRECV" addr add 10.0.0.2/24 dev veth_r @@ -160,8 +158,13 @@ run_ping_test() { } setup_common -setup_ipv4 -run_ping_test -4 eoudp4 "$TUN4_R" "FOU/GRETAP IPv4 multicast encap resubmit" + +if modprobe -q fou; then + setup_ipv4 + run_ping_test -4 eoudp4 "$TUN4_R" "FOU/GRETAP IPv4 multicast encap resubmit" +else + log_test_skip "FOU/GRETAP IPv4 multicast encap resubmit" +fi if setup_ipv6; then run_ping_test -6 eoudp6 "$TUN6_R" "FOU/ip6gretap IPv6 multicast encap resubmit" -- 2.25.1

