提交 f2c929fe 编写于 作者: S Stefano Brivio 提交者: David S. Miller

selftests: pmtu: Factor out MTU parsing helper

...so that it can be used for any iproute command output.
Signed-off-by: NStefano Brivio <sbrivio@redhat.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 822d2f86
...@@ -97,6 +97,16 @@ mtu() { ...@@ -97,6 +97,16 @@ mtu() {
${ns_cmd} ip link set dev ${dev} mtu ${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() { route_get_dst_exception() {
ns_cmd="${1}" ns_cmd="${1}"
dst="${2}" dst="${2}"
...@@ -108,12 +118,7 @@ route_get_dst_pmtu_from_exception() { ...@@ -108,12 +118,7 @@ route_get_dst_pmtu_from_exception() {
ns_cmd="${1}" ns_cmd="${1}"
dst="${2}" dst="${2}"
exception="$(route_get_dst_exception "${ns_cmd}" ${dst})" mtu_parse "$(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
} }
test_pmtu_vti6_exception() { test_pmtu_vti6_exception() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册