Skip to content

Commit dd08734

Browse files
Fabian Frederickummakynes
authored andcommitted
selftests: netfilter: add MTU arguments to flowtables
Add some documentation, default values defined in original script and Originator/Link/Responder arguments using getopts like in tools/power/cpupower/bench/cpufreq-bench_plot.sh Signed-off-by: Fabian Frederick <fabf@skynet.be> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
1 parent 6d006a4 commit dd08734

1 file changed

Lines changed: 24 additions & 6 deletions

File tree

‎tools/testing/selftests/netfilter/nft_flowtable.sh‎

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,18 @@
22
# SPDX-License-Identifier: GPL-2.0
33
#
44
# This tests basic flowtable functionality.
5-
# Creates following topology:
5+
# Creates following default topology:
66
#
77
# Originator (MTU 9000) <-Router1-> MTU 1500 <-Router2-> Responder (MTU 2000)
88
# Router1 is the one doing flow offloading, Router2 has no special
99
# purpose other than having a link that is smaller than either Originator
1010
# and responder, i.e. TCPMSS announced values are too large and will still
1111
# result in fragmentation and/or PMTU discovery.
12+
#
13+
# You can check with different Orgininator/Link/Responder MTU eg:
14+
# sh nft_flowtable.sh -o1000 -l500 -r100
15+
#
16+
1217

1318
# Kselftest framework requirement - SKIP code is 4.
1419
ksft_skip=4
@@ -78,11 +83,24 @@ ip -net nsr2 addr add dead:2::1/64 dev veth1
7883
# ns2 is going via nsr2 with a smaller mtu, so that TCPMSS announced by both peers
7984
# is NOT the lowest link mtu.
8085

81-
ip -net nsr1 link set veth0 mtu 9000
82-
ip -net ns1 link set eth0 mtu 9000
86+
omtu=9000
87+
lmtu=1500
88+
rmtu=2000
89+
90+
while getopts "o:l:r:" o
91+
do
92+
case $o in
93+
o) omtu=$OPTARG;;
94+
l) lmtu=$OPTARG;;
95+
r) rmtu=$OPTARG;;
96+
esac
97+
done
98+
99+
ip -net nsr1 link set veth0 mtu $omtu
100+
ip -net ns1 link set eth0 mtu $omtu
83101

84-
ip -net nsr2 link set veth1 mtu 2000
85-
ip -net ns2 link set eth0 mtu 2000
102+
ip -net nsr2 link set veth1 mtu $rmtu
103+
ip -net ns2 link set eth0 mtu $rmtu
86104

87105
# transfer-net between nsr1 and nsr2.
88106
# these addresses are not used for connections.
@@ -136,7 +154,7 @@ table inet filter {
136154
# as PMTUd is off.
137155
# This rule is deleted for the last test, when we expect PMTUd
138156
# to kick in and ensure all packets meet mtu requirements.
139-
meta length gt 1500 accept comment something-to-grep-for
157+
meta length gt $lmtu accept comment something-to-grep-for
140158
141159
# next line blocks connection w.o. working offload.
142160
# we only do this for reverse dir, because we expect packets to

0 commit comments

Comments
 (0)