• Vladimir Oltean's avatar
    selftests: net: local_termination: don't use xfail_on_veth() · 9aa3749c
    Vladimir Oltean authored
    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: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    9aa3749c
lib.sh 44.5 KB