aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/net/pmtu.sh
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2018-03-17 02:31:40 +0100
committerDavid S. Miller <davem@davemloft.net>2018-03-17 20:15:14 -0400
commitf2c929feeccd3d56be284b9e24e04cd3c4779a4f (patch)
treedfd6fb1910edbb3949a6ed1fd30b06e90e44eb4c /tools/testing/selftests/net/pmtu.sh
parentselftests: pmtu: Use namespace command prefix to fetch route mtu (diff)
downloadlinux-dev-f2c929feeccd3d56be284b9e24e04cd3c4779a4f.tar.xz
linux-dev-f2c929feeccd3d56be284b9e24e04cd3c4779a4f.zip
selftests: pmtu: Factor out MTU parsing helper
...so that it can be used for any iproute command output. Signed-off-by: Stefano Brivio <sbrivio@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools/testing/selftests/net/pmtu.sh')
-rwxr-xr-xtools/testing/selftests/net/pmtu.sh17
1 files changed, 11 insertions, 6 deletions
diff --git a/tools/testing/selftests/net/pmtu.sh b/tools/testing/selftests/net/pmtu.sh
index 0d010f982272..2d33e533ad36 100755
--- a/tools/testing/selftests/net/pmtu.sh
+++ b/tools/testing/selftests/net/pmtu.sh
@@ -97,6 +97,16 @@ mtu() {
${ns_cmd} ip link set dev ${dev} mtu ${mtu}
}
+mtu_parse() {
+ input="${1}"
+
+ next=0
+ for i in ${input}; do
+ [ ${next} -eq 1 ] && echo "${i}" && return
+ [ "${i}" = "mtu" ] && next=1
+ done
+}
+
route_get_dst_exception() {
ns_cmd="${1}"
dst="${2}"
@@ -108,12 +118,7 @@ route_get_dst_pmtu_from_exception() {
ns_cmd="${1}"
dst="${2}"
- exception="$(route_get_dst_exception "${ns_cmd}" ${dst})"
- next=0
- for i in ${exception}; do
- [ ${next} -eq 1 ] && echo "${i}" && return
- [ "${i}" = "mtu" ] && next=1
- done
+ mtu_parse "$(route_get_dst_exception "${ns_cmd}" ${dst})"
}
test_pmtu_vti6_exception() {