History log of /linux-master/tools/testing/selftests/net/forwarding/mirror_gre_lib.sh
Revision Date Author Comments
# 9f2af915 26-Jan-2024 Benjamin Poirier <bpoirier@nvidia.com>

selftests: forwarding: Redefine relative_path variable

The following code which is part of lib.sh:
relative_path="${BASH_SOURCE%/*}"
if [[ "$relative_path" == "${BASH_SOURCE}" ]]; then
relative_path="."
fi

reimplements functionality that is part of `dirname`:
$ dirname ""
.

To avoid this duplication, replace "relative_path" by "net_forwarding_dir",
a new variable defined using dirname.

Furthermore, to avoid the potential confusion about what "relative_path" is
about (cwd, test script directory or test library directory), define
"net_forwarding_dir" as the absolute path to net/forwarding/.

Tested-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Hangbin Liu <liuhangbin@gmail.com>
Signed-off-by: Benjamin Poirier <bpoirier@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# e88bc0f2 05-Jul-2018 Petr Machata <petrm@mellanox.com>

selftests: forwarding: Allow importing dependent libraries

The next patch introduces a new mlxsw-specific test that uses
mirror_gre_lib.sh and mirror_gre_topo_lib.sh.

However when sourcing their own deps, these libraries assume that the
test that's running is in the same directory. That's not the case for
driver-specific tests.

So change the libraries to source their deps through $relative_path.
That variable is set up by lib.sh, which should be imported by the test
in question in any case.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# ec9fdc99 28-Jun-2018 Petr Machata <petrm@mellanox.com>

selftests: forwarding: Tweak tc filters for mirror-to-gretap tests

When running mirror_gre_bridge_1d_vlan tests on veth, several issues
cause spurious failures:

- vlan_ethtype should be ip, not ipv6 even in mirror-to-ip6gretap case,
because the overlay packet is still IPv4.
- Similarly ip_proto matches the innermost IP protocol, so can't be used
to filter out GRE packet. Drop the corresponding condition.
- Because the above fixes the filters to match in slow path as well,
they need to be made skip_hw so as not to double-count packets.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# f52f460c 31-May-2018 Petr Machata <petrm@mellanox.com>

selftests: forwarding: mirror_gre_lib: Add STP test

Add a reusable full test that toggles STP state of a given bridge port
and checks that the mirroring reacts appropriately. The test will be
used by bridge tests in follow-up patches.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 1893150f 24-May-2018 Petr Machata <petrm@mellanox.com>

selftests: forwarding: mirror_gre_lib: Support VLAN

Add full_test_span_gre_dir_vlan_ips() and full_test_span_gre_dir_vlan()
to support mirror-to-gre tests that involve VLAN.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# d5ea2bfc 24-May-2018 Petr Machata <petrm@mellanox.com>

selftests: forwarding: mirror_gre_lib: Extract generic functions

For non-GRE mirroring tests, a functions along the lines of
do_test_span_gre_dir_ips() and test_span_gre_dir_ips() are necessary,
but such that they don't assume tunnels are involved. Extract the code
from mirror_gre_lib.sh to mirror_lib.sh and convert to just use a given
device without assuming it's named "h3-$tundev". Convert the two
above-mentioned functions to wrappers that pass along the correct device
name.

Add test_span_dir() and fail_test_span_dir() to round up the API for use
by following patches.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 7d4cbae0 26-Apr-2018 Petr Machata <petrm@mellanox.com>

selftests: forwarding: Add libs for gretap mirror testing

To simplify implementation of mirror-to-gretap tests, extend lib.sh with
several new functions that might potentially be useful more
broadly (although right now the mirroring tests will be the only
client).

Also add mirror_lib.sh with code useful for mirroring tests,
mirror_gre_lib.sh with code specifically useful for mirror-to-gretap
tests, and mirror_gre_topo.sh that primes a given test with a good
baseline topology that the test can then tweak to its liking.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>