Skip to contentSkip to conversation

selftests: netfilter: Add bridge_fastpath.sh

PATCH New Eric Woudstra 1 participant 1 message May 12

Subsystems (4)
lore
Share & tools
lore

Eric Woudstra

author Applied
#0 lore raw

PATCH v5 1/1 selftests: netfilter: Add bridge_fastpath.sh

Add a script to test various scenarios where a bridge is involved in the fastpath. It runs tests in the forward path, and also in a bridged path.

The setup is similar to a basic home router with multiple lan ports.

It uses 3 pairs of veth-devices. Each or all pairs can be replaced by a pair of real interfaces, interconnected by wire. This is necessary to test the behavior when dealing with dsa ports, foreign (dsa) ports and switchdev userports that support SWITCHDEV_OBJ_ID_PORT_VLAN.

See the head of the script for a detailed description.

Run without arguments to perform all tests on veth-devices.

---

This test script is written first for the proposed bridge-fastpath patch-sets, but it's use is more general and can easily be expanded.

Version 5 of this script is testing the following patches:

APPLIED: netfilter: flowtable: inline pppoe encapsulation in xmit path
APPLIED: netfilter: flowtable: inline vlan encapsulation in xmit path
APPLIED: netfilter: flowtable: fix inline pppoe encapsulation in xmit path
APPLIED: netfilter: flowtable: fix inline vlan encapsulation in xmit path

APPLIED: nft_meta: add double-tagged vlan and pppoe support

APPLIED: bridge: No DEV_PATH_BR_VLAN_UNTAG_HW for dsa foreign

PATCHSET V20: conntrack: bridge: add double vlan, pppoe and pppoe-in-q
PATCH V20: netfilter: utils: nf_ip(6)_checksum(_partial) correct data!=networkheader PATCH V20: netfilter: bridge: Add conntrack double vlan and pppoe

PATCH V12: bridge: Introduce DEV_PATH_BR_VLAN_KEEP_HW

PATCHSET V11: netfilter: Add bridge-fastpath (v12 in the making)
PATCH V11: bridge: Add filling forward path from port to port
PATCH V11: net: core: dev: Add dev_fill_bridge_path()
PATCH V11: netfilter: nf_flow_table_offload: Add nf_flow_rule_bridge() PATCH V11: netfilter: nf_flow_table_inet: Add nf_flowtable_type flowtable_bridge PATCH V11: netfilter: nft_flow_offload: Add NFPROTO_BRIDGE to validate PATCH V11: netfilter: nft_flow_offload: Add bridgeflow to nft_flow_offload_eval()

Changes in v5:

Because the patches have changed, also changed the testscript to properly test the newest version of these patches.
- Added rule "meta l4proto tcp" to get nhoff and thoff filled in pkt
- Re-introduced L4 protocol and ip address matching rules
- Added testing conntrack bridge de-/re-fragmentation
- Added --werror option, treat all warnings as errors
- Testing with "shellcheck -x" without errors

Changes in v4:

- Also only match ct state in rule without fastpath.
- Dropped RFC
- Cosmetics

Changes in v3:

- Removed all warnings reported by shellcheck -x -e SC2317
- Improved del_pppoe(), check if interfaces are removed
- Added is_known_issue() to warn instead of error for known issues
- Link down and (hardware) interfaces to default netns at end of script
- Removed matching ip(v6) address

Changes in v2:

- Moved test-series to functions
- Moved code to set_pair_link() up/down
- Added conntrack zone to bridged traffic
- Test bridge chain prerouting in test without fastpath and bridge chain forward in tests with fastpath

Some example outputs of this last version of patches from different hardware, without and with patches that still need to be applied:

ALL VETH:
=========

./bridge_fastpath.sh -t
Setup:
CLIENT 0
veth0cl
|
veth0rt
WAN
ROUTER
LAN1 LAN2
veth1rt veth2rt
| |
veth1cl veth2cl
CLIENT 1 CLIENT 2

Without patches:

PASS:  unaware bridge, without encaps,             without fastpath
PASS:  unaware bridge, with single vlan encap,     without fastpath
WARN:  unaware bridge, with double q vlan encaps,  without fastpath: ipv4/6: established bytes 0 < 4194304
WARN:  unaware bridge, with 802.1ad vlan encaps,   without fastpath: ipv4/6: established bytes 0 < 4194304
WARN:  unaware bridge, with pppoe encap,           without fastpath: ipv4/6: established bytes 0 < 4194304
WARN:  unaware bridge, with pppoe-in-q encaps,     without fastpath: ipv4/6: established bytes 0 < 4194304
PASS:  aware bridge,   without/without vlan encap, without fastpath
PASS:  aware bridge,   with/without vlan encap,    without fastpath
PASS:  aware bridge,   with/with vlan encap,       without fastpath
PASS:  aware bridge,   without/with vlan encap,    without fastpath
PASS:  forward,        without vlan-device, without vlan encap, client1, without fastpath
PASS:  forward,        without vlan-device, without vlan encap, client1, with fastpath
PASS:  forward,        without vlan-device, with vlan encap,    client1, without fastpath
WARN:  forward,        without vlan-device, with vlan encap,    client1, with fastpath: ipv4/6: tcp broken
PASS:  forward,        with vlan-device, without vlan encap, client1, without fastpath
PASS:  forward,        with vlan-device, without vlan encap, client1, with fastpath
PASS:  forward,        with vlan-device, with vlan encap,    client1, without fastpath
PASS:  forward,        with vlan-device, with vlan encap,    client1, with fastpath
PASS:  all tests passed

With patches:

PASS:  unaware bridge, without encaps,             without fastpath
PASS:  unaware bridge, without encaps,             with fastpath
PASS:  unaware bridge, with single vlan encap,     without fastpath
PASS:  unaware bridge, with single vlan encap,     with fastpath
PASS:  unaware bridge, with double q vlan encaps,  without fastpath
PASS:  unaware bridge, with double q vlan encaps,  with fastpath
PASS:  unaware bridge, with 802.1ad vlan encaps,   without fastpath
PASS:  unaware bridge, with 802.1ad vlan encaps,   with fastpath
PASS:  unaware bridge, with pppoe encap,           without fastpath
PASS:  unaware bridge, with pppoe encap,           with fastpath
PASS:  unaware bridge, with pppoe-in-q encaps,     without fastpath
PASS:  unaware bridge, with pppoe-in-q encaps,     with fastpath
PASS:  aware bridge,   without/without vlan encap, without fastpath
PASS:  aware bridge,   without/without vlan encap, with fastpath
PASS:  aware bridge,   with/without vlan encap,    without fastpath
PASS:  aware bridge,   with/without vlan encap,    with fastpath
PASS:  aware bridge,   with/with vlan encap,       without fastpath
PASS:  aware bridge,   with/with vlan encap,       with fastpath
PASS:  aware bridge,   without/with vlan encap,    without fastpath
PASS:  aware bridge,   without/with vlan encap,    with fastpath
PASS:  forward,        without vlan-device, without vlan encap, client1, without fastpath
PASS:  forward,        without vlan-device, without vlan encap, client1, with fastpath
PASS:  forward,        without vlan-device, with vlan encap,    client1, without fastpath
PASS:  forward,        without vlan-device, with vlan encap,    client1, with fastpath
PASS:  forward,        with vlan-device, without vlan encap, client1, without fastpath
PASS:  forward,        with vlan-device, without vlan encap, client1, with fastpath
PASS:  forward,        with vlan-device, with vlan encap,    client1, without fastpath
PASS:  forward,        with vlan-device, with vlan encap,    client1, with fastpath
PASS:  all tests passed

BANANAPI-R3 (lan1 & lan2 are dsa):
============

Without patches:

./bridge_fastpath.sh -t -0 enu1u2,lan2 -1 enu1u1,lan1 -2 lan4,eth1 Setup:

            CLIENT 0
              enu1u2
                |
              lan2
               WAN
              ROUTER
          LAN1      LAN2
          lan1      eth1
           |          |
        enu1u1      lan4
      CLIENT 1      CLIENT 2
PASS:  unaware bridge, without encaps,             without fastpath
PASS:  unaware bridge, with single vlan encap,     without fastpath
WARN:  unaware bridge, with pppoe encap,           without fastpath: ipv4/6: established bytes 0 < 4194304
WARN:  unaware bridge, with pppoe-in-q encaps,     without fastpath: ipv4/6: established bytes 0 < 4194304
PASS:  aware bridge,   without/without vlan encap, without fastpath
PASS:  aware bridge,   with/without vlan encap,    without fastpath
PASS:  aware bridge,   with/with vlan encap,       without fastpath
PASS:  aware bridge,   without/with vlan encap,    without fastpath
PASS:  forward,        without vlan-device, without vlan encap, client1, without fastpath
WARN:  forward,        without vlan-device, without vlan encap, client1, with fastpath: ipv4: counted bytes 2110480 > 2097152
WARN:  forward,        without vlan-device, without vlan encap, client1, with fastpath: ipv6: counted bytes 2116104 > 2097152
PASS:  forward,        without vlan-device, without vlan encap, client1, with hw_fastpath
PASS:  forward,        without vlan-device, without vlan encap, client2, without fastpath
PASS:  forward,        without vlan-device, without vlan encap, client2, with fastpath
PASS:  forward,        without vlan-device, without vlan encap, client2, with hw_fastpath
PASS:  forward,        without vlan-device, with vlan encap,    client1, without fastpath
WARN:  forward,        without vlan-device, with vlan encap,    client1, with fastpath: ipv4/6: tcp broken
WARN:  forward,        without vlan-device, with vlan encap,    client1, with hw_fastpath: ipv4/6: tcp broken
PASS:  forward,        without vlan-device, with vlan encap,    client2, without fastpath
WARN:  forward,        without vlan-device, with vlan encap,    client2, with fastpath: ipv4/6: tcp broken
WARN:  forward,        without vlan-device, with vlan encap,    client2, with hw_fastpath: ipv4/6: tcp broken
PASS:  forward,        with vlan-device, without vlan encap, client1, without fastpath
PASS:  forward,        with vlan-device, without vlan encap, client1, with fastpath
PASS:  forward,        with vlan-device, without vlan encap, client1, with hw_fastpath
PASS:  forward,        with vlan-device, without vlan encap, client2, without fastpath
WARN:  forward,        with vlan-device, without vlan encap, client2, with fastpath: ipv4: counted bytes 2122388 > 2097152
WARN:  forward,        with vlan-device, without vlan encap, client2, with fastpath: ipv6: counted bytes 2129280 > 2097152
WARN:  forward,        with vlan-device, without vlan encap, client2, with hw_fastpath: ipv4: counted bytes 2110428 > 2097152
WARN:  forward,        with vlan-device, without vlan encap, client2, with hw_fastpath: ipv6: counted bytes 2140144 > 2097152
PASS:  forward,        with vlan-device, with vlan encap,    client1, without fastpath
PASS:  forward,        with vlan-device, with vlan encap,    client1, with fastpath
PASS:  forward,        with vlan-device, with vlan encap,    client1, with hw_fastpath
PASS:  forward,        with vlan-device, with vlan encap,    client2, without fastpath
PASS:  forward,        with vlan-device, with vlan encap,    client2, with fastpath
PASS:  forward,        with vlan-device, with vlan encap,    client2, with hw_fastpath
PASS:  all tests passed

With patches:

PASS:  unaware bridge, without encaps,             without fastpath
PASS:  unaware bridge, without encaps,             with fastpath
PASS:  unaware bridge, without encaps,             with hw_fastpath
PASS:  unaware bridge, with single vlan encap,     without fastpath
PASS:  unaware bridge, with single vlan encap,     with fastpath
PASS:  unaware bridge, with single vlan encap,     with hw_fastpath
PASS:  unaware bridge, with pppoe encap,           without fastpath
PASS:  unaware bridge, with pppoe encap,           with fastpath
PASS:  unaware bridge, with pppoe encap,           with hw_fastpath
PASS:  unaware bridge, with pppoe-in-q encaps,     without fastpath
PASS:  unaware bridge, with pppoe-in-q encaps,     with fastpath
PASS:  unaware bridge, with pppoe-in-q encaps,     with hw_fastpath
PASS:  aware bridge,   without/without vlan encap, without fastpath
PASS:  aware bridge,   without/without vlan encap, with fastpath
PASS:  aware bridge,   without/without vlan encap, with hw_fastpath
PASS:  aware bridge,   with/without vlan encap,    without fastpath
PASS:  aware bridge,   with/without vlan encap,    with fastpath
PASS:  aware bridge,   with/without vlan encap,    with hw_fastpath
PASS:  aware bridge,   with/with vlan encap,       without fastpath
PASS:  aware bridge,   with/with vlan encap,       with fastpath
PASS:  aware bridge,   with/with vlan encap,       with hw_fastpath
PASS:  aware bridge,   without/with vlan encap,    without fastpath
PASS:  aware bridge,   without/with vlan encap,    with fastpath
PASS:  aware bridge,   without/with vlan encap,    with hw_fastpath
PASS:  forward,        without vlan-device, without vlan encap, client1, without fastpath
PASS:  forward,        without vlan-device, without vlan encap, client1, with fastpath
PASS:  forward,        without vlan-device, without vlan encap, client1, with hw_fastpath
PASS:  forward,        without vlan-device, without vlan encap, client2, without fastpath
PASS:  forward,        without vlan-device, without vlan encap, client2, with fastpath
PASS:  forward,        without vlan-device, without vlan encap, client2, with hw_fastpath
PASS:  forward,        without vlan-device, with vlan encap,    client1, without fastpath
PASS:  forward,        without vlan-device, with vlan encap,    client1, with fastpath
PASS:  forward,        without vlan-device, with vlan encap,    client1, with hw_fastpath
PASS:  forward,        without vlan-device, with vlan encap,    client2, without fastpath
PASS:  forward,        without vlan-device, with vlan encap,    client2, with fastpath
PASS:  forward,        without vlan-device, with vlan encap,    client2, with hw_fastpath
PASS:  forward,        with vlan-device, without vlan encap, client1, without fastpath
PASS:  forward,        with vlan-device, without vlan encap, client1, with fastpath
PASS:  forward,        with vlan-device, without vlan encap, client1, with hw_fastpath
PASS:  forward,        with vlan-device, without vlan encap, client2, without fastpath
PASS:  forward,        with vlan-device, without vlan encap, client2, with fastpath
PASS:  forward,        with vlan-device, without vlan encap, client2, with hw_fastpath
PASS:  forward,        with vlan-device, with vlan encap,    client1, without fastpath
PASS:  forward,        with vlan-device, with vlan encap,    client1, with fastpath
PASS:  forward,        with vlan-device, with vlan encap,    client1, with hw_fastpath
PASS:  forward,        with vlan-device, with vlan encap,    client2, without fastpath
PASS:  forward,        with vlan-device, with vlan encap,    client2, with fastpath
PASS:  forward,        with vlan-device, with vlan encap,    client2, with hw_fastpath
PASS:  all tests passed
 .../testing/selftests/net/netfilter/Makefile  |    1 +
 .../net/netfilter/bridge_fastpath.sh          | 1096 +++++++++++++++++
 2 files changed, 1097 insertions(+)
 create mode 100755 tools/testing/selftests/net/netfilter/bridge_fastpath.sh
tools/testing/selftests/net/netfilter/Makefile +1 -0
index ee2d1a5254f84..a7edc6654040f 100644
@@ -10,6 +10,7 @@ TEST_PROGS := \
 	br_netfilter.sh \
 	br_netfilter_queue.sh \
 	bridge_brouter.sh \
+	bridge_fastpath.sh \
 	conntrack_clash.sh \
 	conntrack_dump_flush.sh \
 	conntrack_icmp_related.sh \
tools/testing/selftests/net/netfilter/bridge_fastpath.sh new file +1096 -0

1,096 lines not on this page · raw message

Signature · 1 line
2.53.0