Skip to content

Commit ec2a950

Browse files
Simon Hormanapconole
authored andcommitted
tests: Handle marks using nft if available.
Update the "offloads - ping over vxlan tunnel with gbp - offloads enabled" test to use nft, instead of iptables, if available. This is part of an effort to use nft in place of iptables throughout the testsuite. Unlike other patches towards this series, simply inline nft support into the test, rather than using macros. This matches the current iptables support in this test. Signed-off-by: Simon Horman <[email protected]> Signed-off-by: Aaron Conole <[email protected]>
1 parent 91ee067 commit ec2a950

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

tests/system-offloads-traffic.at

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -812,6 +812,7 @@ OVS_CHECK_VXLAN()
812812

813813
OVS_TRAFFIC_VSWITCHD_START([], [], [-- set Open_vSwitch . other_config:hw-offload=true])
814814
AT_SKIP_IF([! grep -q "probe tc: vxlan gbp is supported." ovs-vswitchd.log])
815+
AT_SKIP_IF([test $HAVE_NFT = no -a $HAVE_IPTABLES = no])
815816
ADD_BR([br-underlay])
816817

817818
AT_CHECK([ovs-ofctl add-flow br-underlay "actions=normal"])
@@ -832,8 +833,32 @@ AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"])
832833

833834
ADD_NATIVE_TUNNEL([vxlan], [at_vxlan1], [at_ns0], [172.31.1.100], [10.1.1.1/24],
834835
[id 0 dstport 4789 gbp])
835-
NS_CHECK_EXEC([at_ns0], [iptables -I OUTPUT -p ip -j MARK --set-mark 512 2>/dev/null], [0])
836-
NS_CHECK_EXEC([at_ns0], [iptables -I INPUT -m mark --mark 512 -j ACCEPT 2>/dev/null], [0], [ignore])
836+
837+
if test $HAVE_NFT = yes; then
838+
NS_CHECK_EXEC([at_ns0], [nft -f - << EOF
839+
table ip filter {
840+
chain OUTPUT {
841+
type filter hook output priority filter; policy accept;
842+
counter meta mark set 512
843+
}
844+
}
845+
846+
table ip filter {
847+
chain INPUT {
848+
type filter hook input priority filter; policy accept;
849+
mark 512 counter accept;
850+
}
851+
}
852+
EOF
853+
])
854+
else
855+
NS_CHECK_EXEC([at_ns0],
856+
[iptables -I OUTPUT -p ip -j MARK --set-mark 512 2>/dev/null],
857+
[0])
858+
NS_CHECK_EXEC([at_ns0],
859+
[iptables -I INPUT -m mark --mark 512 -j ACCEPT 2>/dev/null],
860+
[0], [ignore])
861+
fi
837862

838863
dnl First, check the underlay.
839864
NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -W 2 172.31.1.100 | FORMAT_PING], [0], [dnl

0 commit comments

Comments
 (0)