From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx3-rdu2.redhat.com ([66.187.233.73]:44518 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752875AbeCQBcF (ORCPT ); Fri, 16 Mar 2018 21:32:05 -0400 From: Stefano Brivio To: "David S . Miller" Cc: David Ahern , Sabrina Dubroca , Steffen Klassert , netdev@vger.kernel.org Subject: [PATCH net-next 03/10 v2] selftests: pmtu: Factor out MTU parsing helper Date: Sat, 17 Mar 2018 02:31:40 +0100 Message-Id: <98e75304b581d456817a13535ed3cf4f66b955d0.1521249420.git.sbrivio@redhat.com> In-Reply-To: References: In-Reply-To: References: Sender: netdev-owner@vger.kernel.org List-ID: ...so that it can be used for any iproute command output. Signed-off-by: Stefano Brivio --- v2: No changes 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 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() { -- 2.15.1