]> git.dujemihanovic.xyz Git - linux.git/commit
selftests: net: local_termination: don't use xfail_on_veth()
authorVladimir Oltean <vladimir.oltean@nxp.com>
Thu, 15 Aug 2024 00:06:59 +0000 (03:06 +0300)
committerDavid S. Miller <davem@davemloft.net>
Fri, 16 Aug 2024 08:59:32 +0000 (09:59 +0100)
commit9aa3749ca4a880c1a59720aab3eacf344ed8d68d
tree04ae5d95016f067e2e2f58fdd040ce9279bf69d9
parent5fea8bb009744bbb90b3f6ca41c558429ee4c849
selftests: net: local_termination: don't use xfail_on_veth()

xfail_on_veth() for this test is an incorrect approximation which gives
false positives and false negatives.

When local_termination fails with "reception succeeded, but should have failed",
it is because the DUT ($h2) accepts packets even when not configured as
promiscuous. This is not something specific to veth; even the bridge
behaves that way, but this is not captured by the xfail_on_veth test.

The IFF_UNICAST_FLT flag is not explicitly exported to user space, but
it can somewhat be determined from the interface's behavior. We have to
create a macvlan upper with a different MAC address. This forces a
dev_uc_add() call in the kernel. When the unicast filtering list is
not empty, but the device doesn't support IFF_UNICAST_FLT,
__dev_set_rx_mode() force-enables promiscuity on the interface, to
ensure correct behavior (that the requested address is received).

We can monitor the change in the promiscuity flag and infer from it
whether the device supports unicast filtering.

There is no equivalent thing for allmulti, unfortunately. We never know
what's hiding behind a device which has allmulti=off. Whether it will
actually perform RX multicast filtering of unknown traffic is a strong
"maybe". The bridge driver, for example, completely ignores the flag.
We'll have to keep the xfail behavior, but instead of XFAIL on just
veth, always XFAIL.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
tools/testing/selftests/net/forwarding/lib.sh
tools/testing/selftests/net/forwarding/local_termination.sh