[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <4667f7185a20101ca24733a837eef7848a289cf3.1521129192.git.sbrivio@redhat.com>
Date: Thu, 15 Mar 2018 17:18:22 +0100
From: Stefano Brivio <sbrivio@...hat.com>
To: "David S . Miller" <davem@...emloft.net>
Cc: Sabrina Dubroca <sd@...asysnail.net>,
Steffen Klassert <steffen.klassert@...unet.com>,
netdev@...r.kernel.org
Subject: [PATCH net-next 2/9] selftests: pmtu: Factor out MTU parsing helper
...so that it can be used for any iproute command output.
Signed-off-by: Stefano Brivio <sbrivio@...hat.com>
---
tools/testing/selftests/net/pmtu.sh | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/tools/testing/selftests/net/pmtu.sh b/tools/testing/selftests/net/pmtu.sh
index 7a7845e415e4..fc79cc6f49a6 100755
--- a/tools/testing/selftests/net/pmtu.sh
+++ b/tools/testing/selftests/net/pmtu.sh
@@ -105,6 +105,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}"
@@ -116,12 +126,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() {
--
2.15.1
Powered by blists - more mailing lists