selftests/bpf: Make sure we trigger metadata kfuncs for dst 8080
authorStanislav Fomichev <sdf@google.com>
Mon, 4 Dec 2023 17:44:23 +0000 (09:44 -0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Tue, 5 Dec 2023 14:11:24 +0000 (15:11 +0100)
commit5ffb260f754bf838507fe0c23d05254b33e2bf3d
tree7f8ad0d113c75357f2f759c58aec83cbf185be84
parent5c399ae080ae507954f6f2efefc7349f8ed0e051
selftests/bpf: Make sure we trigger metadata kfuncs for dst 8080

xdp_metadata test is flaky sometimes:

  verify_xsk_metadata:FAIL:rx_hash_type unexpected rx_hash_type: actual 8 != expected 0

Where 8 means XDP_RSS_TYPE_L4_ANY and is exported from veth driver only when
'skb->l4_hash' condition is met. This makes me think that the program is
triggering again for some other packet.

Let's have a filter, similar to xdp_hw_metadata, where we trigger XDP kfuncs
only for UDP packets destined to port 8080.

Signed-off-by: Stanislav Fomichev <sdf@google.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20231204174423.3460052-1-sdf@google.com
tools/testing/selftests/bpf/progs/xdp_metadata.c