• Ido Schimmel's avatar
    selftests: fib_rule_tests: Add VRF tests · 7e36c337
    Ido Schimmel authored
    After commit 40867d74 ("net: Add l3mdev index to flow struct and
    avoid oif reset for port devices") it is possible to configure FIB rules
    that match on iif / oif being a l3mdev port. It was not possible before
    as these parameters were reset to the ifindex of the l3mdev device
    itself prior to the FIB rules lookup.
    
    Add tests that cover this functionality as it does not seem to be
    covered by existing ones and I am aware of at least one user that needs
    this functionality in addition to the one mentioned in [1].
    
    Reuse the existing FIB rules tests by simply configuring a VRF prior to
    the test and removing it afterwards. Differentiate the output of the
    non-VRF tests from the VRF tests by appending "(VRF)" to the test name
    if a l3mdev FIB rule is present.
    
    Verified that these tests do fail on kernel 5.15.y which does not
    include the previously mentioned commit:
    
     # ./fib_rule_tests.sh -t fib_rule6_vrf
     [...]
         TEST: rule6 check: oif redirect to table (VRF)                      [FAIL]
     [...]
         TEST: rule6 check: iif redirect to table (VRF)                      [FAIL]
    
     # ./fib_rule_tests.sh -t fib_rule4_vrf
     [...]
         TEST: rule4 check: oif redirect to table (VRF)                      [FAIL]
     [...]
         TEST: rule4 check: iif redirect to table (VRF)                      [FAIL]
    
    [1] https://lore.kernel.org/netdev/20200922131122.GB1601@ICIPI.localdomain/Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
    Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
    Link: https://lore.kernel.org/r/20240409110816.2508498-1-idosch@nvidia.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
    7e36c337
fib_rule_tests.sh 11.6 KB