Patches 5/10 to 10/10 add tests to verify default MTU assignment
for vti4 and vti6 interfaces, to check that MTU values set on new
link and link changes are properly taken and validated, and to
verify PMTU exceptions on vti4 interfaces.
Patch 1/10 reverses function return codes as suggested by David
Ahern.
Patch 2/10 fixes the helper to fetch exceptions MTU to run in the
passed namespace.
Patches 3/10 and 4/10 are preparation work to make it easier to
introduce those tests.
v2: Reverse return codes, and make output prettier in 4/9 by
using padded printf, test descriptions and buffered error
strings. Remove accidental output to /dev/kmsg from 10/10
(was 9/9).
Stefano Brivio (10):
selftests: pmtu: Reverse return codes of functions
selftests: pmtu: Use namespace command prefix to fetch route mtu
selftests: pmtu: Factor out MTU parsing helper
selftests: pmtu: Introduce support for multiple tests
selftests: pmtu: Add pmtu_vti4_default_mtu test
selftests: pmtu: Add pmtu_vti6_default_mtu test
selftests: pmtu: Add test_pmtu_vti4_exception test
selftests: pmtu: Add pmtu_vti4_link_add_mtu test
selftests: pmtu: Add pmtu_vti6_link_add_mtu test
selftests: pmtu: Add pmtu_vti6_link_change_mtu test
tools/testing/selftests/net/pmtu.sh | 442 ++++++++++++++++++++++++++++++------
1 file changed, 376 insertions(+), 66 deletions(-)
--
2.15.1
David suggests it's more intuitive to return non-zero on
failures, and zero on success.
No need to introduce tail 'return 0' in functions, they will
return the exit code of the last command anyway.
Suggested-by: David Ahern <redacted>
Signed-off-by: Stefano Brivio <redacted>
---
v2: Introduced
tools/testing/selftests/net/pmtu.sh | 24 ++++++++----------------
1 file changed, 8 insertions(+), 16 deletions(-)
@@ -79,13 +71,13 @@ setup() {["$(id-u)"-ne0]&&echo"SKIP: need to run as root"&&exit0-setup_namespaces&&echo"SKIP: namespaces not supported"&&exit0-setup_veth&&echo"SKIP: veth not supported"&&exit0+setup_namespaces||{echo"SKIP: namespaces not supported";exit0;}+setup_veth||{echo"SKIP: veth not supported";exit0;}case${tunnel_type}in"vti6")-setup_vti6&&echo"SKIP: vti6 not supported"&&exit0-setup_xfrm&&echo"SKIP: xfrm not supported"&&exit0+setup_vti6||{echo"SKIP: vti6 not supported";exit0;}+setup_xfrm||{echo"SKIP: xfrm not supported";exit0;};;*);;
In 7af137b72131 ("selftests: net: Introduce first PMTU test") I
accidentally assumed route_get_* helpers would run from a single
namespace. Make them a bit more generic, by passing the
namespace command prefix as a parameter instead.
Fixes: 7af137b72131 ("selftests: net: Introduce first PMTU test")
Signed-off-by: Stefano Brivio <redacted>
---
v2: No changes
tools/testing/selftests/net/pmtu.sh | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
@@ -125,7 +127,7 @@ test_pmtu_vti6_exception() {${ns_a}ping6-q-i0.1-w2-s60000${vti6_b_addr}>/dev/null# Check that exception was created-if["$(route_get_dst_pmtu_from_exception${vti6_b_addr})"=""];then+if["$(route_get_dst_pmtu_from_exception"${ns_a}"${vti6_b_addr})"=""];thenecho"FAIL: Tunnel exceeding link layer MTU didn't create route exception"exit1fi
@@ -133,14 +135,14 @@ test_pmtu_vti6_exception() {# Decrease tunnel MTU, check for PMTU decrease in route exceptionmtu"${ns_a}"vti_a3000-if["$(route_get_dst_pmtu_from_exception${vti6_b_addr})"-ne3000];then+if["$(route_get_dst_pmtu_from_exception"${ns_a}"${vti6_b_addr})"-ne3000];thenecho"FAIL: Decreasing tunnel MTU didn't decrease route exception PMTU"exit1fi# Increase tunnel MTU, check for PMTU increase in route exceptionmtu"${ns_a}"vti_a9000-if["$(route_get_dst_pmtu_from_exception${vti6_b_addr})"-ne9000];then+if["$(route_get_dst_pmtu_from_exception"${ns_a}"${vti6_b_addr})"-ne9000];thenecho"FAIL: Increasing tunnel MTU didn't increase route exception PMTU"exit1fi
...so that it can be used for any iproute command output.
Signed-off-by: Stefano Brivio <redacted>
---
v2: No changes
tools/testing/selftests/net/pmtu.sh | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
Introduce list of tests and their descriptions, and loop on it
in main body.
Tests will now just take care of calling setup with a list of
"units" they need, and return 0 on success, 1 on failure, 2 if
the test had to be skipped.
Main script body will take care of displaying results and
cleaning up after every test. Introduce guard variable so that
we don't clean up twice in case of interrupts or unexpected
failures.
The pmtu_vti6_exception test can now run its third step even if
the previous one failed, as we can return values from it.
Also introduce support to display test descriptions, and display
aligned OK/FAIL/SKIP test outcomes. Buffer error strings so that
in case of failure we can display them right under the outcome
for each test.
Signed-off-by: Stefano Brivio <redacted>
---
v2: Reversed return codes, display test description instead of
name, support list of tests with description, display test
outcome with padded printf and OK, FAIL, SKIP (David Ahern),
buffer errors and display them below the outcome. Run third
test step in test_pmtu_vti6_exception even if previous one
failed.
tools/testing/selftests/net/pmtu.sh | 87 ++++++++++++++++++++++++++-----------
1 file changed, 61 insertions(+), 26 deletions(-)
@@ -5,13 +5,16 @@## Tests currently implemented:#-# - test_pmtu_vti6_exception+# - pmtu_vti6_exception# Set up vti6 tunnel on top of veth, with xfrm states and policies, in two# namespaces with matching endpoints. Check that route exception is# created by exceeding link layer MTU with ping to other endpoint. Then# decrease and increase MTU of tunnel, checking that route exception PMTU# changes accordingly+tests="+pmtu_vti6_exceptionvti6:PMTUexceptions"+NS_A="ns-$(mktemp-uXXXXXX)"NS_B="ns-$(mktemp-uXXXXXX)"ns_a="ip netns exec ${NS_A}"
@@ -67,26 +83,19 @@ setup_xfrm() {} setup(){-tunnel_type="$1"--["$(id-u)"-ne0]&&echo"SKIP: need to run as root"&&exit0--setup_namespaces||{echo"SKIP: namespaces not supported";exit0;}-setup_veth||{echo"SKIP: veth not supported";exit0;}+["$(id-u)"-ne0]&&echo" need to run as root"&&return1-case${tunnel_type}in-"vti6")-setup_vti6||{echo"SKIP: vti6 not supported";exit0;}-setup_xfrm||{echo"SKIP: xfrm not supported";exit0;}-;;-*)-;;-esac+cleanup_done=0+forargdo+evalsetup_${arg}||{echo" ${arg} not supported";return1;}+done} cleanup(){+[${cleanup_done}-eq1]&&returnipnetnsdel${NS_A}2>/dev/nullipnetnsdel${NS_B}2>/dev/null+cleanup_done=1} mtu(){
@@ -122,7 +131,8 @@ route_get_dst_pmtu_from_exception() {} test_pmtu_vti6_exception(){-setupvti6+setupnamespacesvethvti6xfrm||return2+fail=0# Create route exception by exceeding link layer MTUmtu"${ns_a}"veth_a4000
@@ -133,30 +143,55 @@ test_pmtu_vti6_exception() {# Check that exception was createdif["$(route_get_dst_pmtu_from_exception"${ns_a}"${vti6_b_addr})"=""];then-echo"FAIL: Tunnel exceeding link layer MTU didn't create route exception"-exit1+err" tunnel exceeding link layer MTU didn't create route exception"+return1fi# Decrease tunnel MTU, check for PMTU decrease in route exceptionmtu"${ns_a}"vti_a3000if["$(route_get_dst_pmtu_from_exception"${ns_a}"${vti6_b_addr})"-ne3000];then-echo"FAIL: Decreasing tunnel MTU didn't decrease route exception PMTU"-exit1+err" decreasing tunnel MTU didn't decrease route exception PMTU"+fail=1fi# Increase tunnel MTU, check for PMTU increase in route exceptionmtu"${ns_a}"vti_a9000if["$(route_get_dst_pmtu_from_exception"${ns_a}"${vti6_b_addr})"-ne9000];then-echo"FAIL: Increasing tunnel MTU didn't increase route exception PMTU"-exit1+err" increasing tunnel MTU didn't increase route exception PMTU"+fail=1fi-echo"PASS"+return${fail}}trapcleanupEXIT-test_pmtu_vti6_exception--exit0+exitcode=0+desc=0+IFS=" +"+fortin${tests};do+[$desc-eq0]&&name="${t}"&&desc=1&&continue||desc=0++(+unsetIFS+evaltest_${name}+ret=$?+cleanup++if[$ret-eq0];then+printf"TEST: %-60s [ OK ]\n""${t}"+elif[$ret-eq1];then+printf"TEST: %-60s [FAIL]\n""${t}"+err_flush+exit1+elif[$ret-eq2];then+printf"TEST: %-60s [SKIP]\n""${t}"+err_flush+fi+)+[$?-ne0]&&exitcode=1+done++exit${exitcode}
This test checks that the MTU assigned by default to a vti (IPv4)
interface created on top of veth is simply veth's MTU minus the
length of the encapsulated IPv4 header.
Signed-off-by: Stefano Brivio <redacted>
---
v2: Adjusted return codes for 4/10, added test description, error
strings now buffered
tools/testing/selftests/net/pmtu.sh | 86 +++++++++++++++++++++++++++++++------
1 file changed, 73 insertions(+), 13 deletions(-)
@@ -1,7 +1,8 @@#!/bin/sh# SPDX-License-Identifier: GPL-2.0#-# Check that route PMTU values match expectations+# Check that route PMTU values match expectations, and that initial device MTU+# values are assigned correctly## Tests currently implemented:#
@@ -11,19 +12,32 @@# created by exceeding link layer MTU with ping to other endpoint. Then# decrease and increase MTU of tunnel, checking that route exception PMTU# changes accordingly+#+# - pmtu_vti4_default_mtu+# Set up vti4 tunnel on top of veth, in two namespaces with matching+# endpoints. Check that MTU assigned to vti interface is the MTU of the+# lower layer (veth) minus additional lower layer headers (zero, for veth)+# minus IPv4 header lengthtests="-pmtu_vti6_exceptionvti6:PMTUexceptions"+pmtu_vti6_exceptionvti6:PMTUexceptions+pmtu_vti4_default_mtuvti4:defaultMTUassignment"NS_A="ns-$(mktemp-uXXXXXX)"NS_B="ns-$(mktemp-uXXXXXX)"ns_a="ip netns exec ${NS_A}"ns_b="ip netns exec ${NS_B}"+veth4_a_addr="192.168.1.1"+veth4_b_addr="192.168.1.2"+veth4_mask="24"veth6_a_addr="fd00:1::a"veth6_b_addr="fd00:1::b"veth6_mask="64"+vti4_a_addr="192.168.2.1"+vti4_b_addr="192.168.2.2"+vti4_mask="24"vti6_a_addr="fd00:2::a"vti6_b_addr="fd00:2::b"vti6_mask="64"
@@ -137,8 +185,8 @@ test_pmtu_vti6_exception() {# Create route exception by exceeding link layer MTUmtu"${ns_a}"veth_a4000mtu"${ns_b}"veth_b4000-mtu"${ns_a}"vti_a5000-mtu"${ns_b}"vti_b5000+mtu"${ns_a}"vti6_a5000+mtu"${ns_b}"vti6_b5000${ns_a}ping6-q-i0.1-w2-s60000${vti6_b_addr}>/dev/null# Check that exception was created
@@ -148,7 +196,7 @@ test_pmtu_vti6_exception() {fi# Decrease tunnel MTU, check for PMTU decrease in route exception-mtu"${ns_a}"vti_a3000+mtu"${ns_a}"vti6_a3000if["$(route_get_dst_pmtu_from_exception"${ns_a}"${vti6_b_addr})"-ne3000];thenerr" decreasing tunnel MTU didn't decrease route exception PMTU"
@@ -156,7 +204,7 @@ test_pmtu_vti6_exception() {fi# Increase tunnel MTU, check for PMTU increase in route exception-mtu"${ns_a}"vti_a9000+mtu"${ns_a}"vti6_a9000if["$(route_get_dst_pmtu_from_exception"${ns_a}"${vti6_b_addr})"-ne9000];thenerr" increasing tunnel MTU didn't increase route exception PMTU"fail=1
@@ -165,6 +213,18 @@ test_pmtu_vti6_exception() {return${fail}}+test_pmtu_vti4_default_mtu(){+setupnamespacesvethvti4||return2++# Check that MTU of vti device is MTU of veth minus IPv4 header length+veth_mtu="$(link_get_mtu"${ns_a}"veth_a)"+vti4_mtu="$(link_get_mtu"${ns_a}"vti4_a)"+if[$((veth_mtu-vti4_mtu))-ne20];then+err" vti MTU ${vti4_mtu} is not veth MTU ${veth_mtu} minus IPv4 header length"+return1+fi+}+trapcleanupEXITexitcode=0
Same as pmtu_vti4_default_mtu, but on IPv6 with vti6.
Signed-off-by: Stefano Brivio <redacted>
---
v2: Adjusted return codes for 4/10, added test description, error
strings now buffered
tools/testing/selftests/net/pmtu.sh | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
@@ -18,10 +18,14 @@# endpoints. Check that MTU assigned to vti interface is the MTU of the# lower layer (veth) minus additional lower layer headers (zero, for veth)# minus IPv4 header length+#+# - pmtu_vti6_default_mtu+# Same as above, for IPv6tests="pmtu_vti6_exceptionvti6:PMTUexceptions-pmtu_vti4_default_mtuvti4:defaultMTUassignment"+pmtu_vti4_default_mtuvti4:defaultMTUassignment+pmtu_vti6_default_mtuvti6:defaultMTUassignment"NS_A="ns-$(mktemp-uXXXXXX)"NS_B="ns-$(mktemp-uXXXXXX)"
@@ -225,6 +229,18 @@ test_pmtu_vti4_default_mtu() {fi}+test_pmtu_vti6_default_mtu(){+setupnamespacesvethvti6||return2++# Check that MTU of vti device is MTU of veth minus IPv6 header length+veth_mtu="$(link_get_mtu"${ns_a}"veth_a)"+vti6_mtu="$(link_get_mtu"${ns_a}"vti6_a)"+if[$((veth_mtu-vti6_mtu))-ne40];then+err" vti MTU ${vti6_mtu} is not veth MTU ${veth_mtu} minus IPv6 header length"+return1+fi+}+trapcleanupEXITexitcode=0
This test checks that PMTU exceptions are created only when
needed on IPv4 routes with vti and xfrm, and their PMTU value is
checked as well.
We can't adopt the same approach as test_pmtu_vti6_exception()
here, because on IPv4 administrative MTU changes won't be
reflected directly on PMTU.
Signed-off-by: Stefano Brivio <redacted>
---
v2: Adjusted return codes for 4/10, added test description, error
strings now buffered
tools/testing/selftests/net/pmtu.sh | 80 ++++++++++++++++++++++++++++++++-----
1 file changed, 70 insertions(+), 10 deletions(-)
@@ -6,6 +6,14 @@## Tests currently implemented:#+# - pmtu_vti4_exception+# Set up vti tunnel on top of veth, with xfrm states and policies, in two+# namespaces with matching endpoints. Check that route exception is not+# created if link layer MTU is not exceeded, then exceed it and check that+# exception is created with the expected PMTU. The approach described+# below for IPv6 doesn't apply here, because, on IPv4, administrative MTU+# changes alone won't affect PMTU+## - pmtu_vti6_exception# Set up vti6 tunnel on top of veth, with xfrm states and policies, in two# namespaces with matching endpoints. Check that route exception is
@@ -182,8 +203,47 @@ route_get_dst_pmtu_from_exception() {mtu_parse"$(route_get_dst_exception"${ns_cmd}"${dst})"}+test_pmtu_vti4_exception(){+setupnamespacesvethvti4xfrm4||return2++veth_mtu=1500+vti_mtu=$((veth_mtu-20))++# SPI SN IV ICV pad length next header+esp_payload_rfc4106=$((vti_mtu-4-4-8-16-1-1))+ping_payload=$((esp_payload_rfc4106-28))++mtu"${ns_a}"veth_a${veth_mtu}+mtu"${ns_b}"veth_b${veth_mtu}+mtu"${ns_a}"vti4_a${vti_mtu}+mtu"${ns_b}"vti4_b${vti_mtu}++# Send DF packet without exceeding link layer MTU, check that no+# exception is created+${ns_a}ping-q-Mwant-i0.1-w2-s${ping_payload}${vti4_b_addr}>/dev/null+pmtu="$(route_get_dst_pmtu_from_exception"${ns_a}"${vti4_b_addr})"+if["${pmtu}"!=""];then+err" unexpected exception created with PMTU ${pmtu} for IP payload length ${esp_payload_rfc4106}"+return1+fi++# Now exceed link layer MTU by one byte, check that exception is created+${ns_a}ping-q-Mwant-i0.1-w2-s$((ping_payload+1))${vti4_b_addr}>/dev/null+pmtu="$(route_get_dst_pmtu_from_exception"${ns_a}"${vti4_b_addr})"+if["${pmtu}"=""];then+err" exception not created for IP payload length $((esp_payload_rfc4106+1))"+return1+fi++# ...with the right PMTU value+if[${pmtu}-ne${esp_payload_rfc4106}];then+err" wrong PMTU ${pmtu} in exception, expected: ${esp_payload_rfc4106}"+return1+fi+}+ test_pmtu_vti6_exception(){-setupnamespacesvethvti6xfrm||return2+setupnamespacesvethvti6xfrm6||return2fail=0# Create route exception by exceeding link layer MTU
This test checks that MTU given on vti link creation is actually
configured, and that tunnel is not created with an invalid MTU
value.
Signed-off-by: Stefano Brivio <redacted>
---
v2: Adjusted return codes for 4/10, added test description, error
strings now buffered
tools/testing/selftests/net/pmtu.sh | 45 ++++++++++++++++++++++++++++++++++++-
1 file changed, 44 insertions(+), 1 deletion(-)
@@ -29,12 +29,17 @@## - pmtu_vti6_default_mtu# Same as above, for IPv6+#+# - pmtu_vti4_link_add_mtu+# Set up vti4 interface passing MTU value at link creation, check MTU is+# configured, and that link is not created with invalid MTU valuestests="pmtu_vti6_exceptionvti6:PMTUexceptionspmtu_vti4_exceptionvti4:PMTUexceptionspmtu_vti4_default_mtuvti4:defaultMTUassignment-pmtu_vti6_default_mtuvti6:defaultMTUassignment"+pmtu_vti6_default_mtuvti6:defaultMTUassignment+pmtu_vti4_link_add_mtuvti4:MTUsettingonlinkcreation"NS_A="ns-$(mktemp-uXXXXXX)"NS_B="ns-$(mktemp-uXXXXXX)"
@@ -301,6 +306,44 @@ test_pmtu_vti6_default_mtu() {fi}+test_pmtu_vti4_link_add_mtu(){+setupnamespaces||return2++${ns_a}iplinkaddvti4_atypevtilocal${veth4_a_addr}remote${veth4_b_addr}key10+[$?-ne0]&&err" vti not supported"&&return2+${ns_a}iplinkdelvti4_a++fail=0++min=68+max=$((65528-20))+# Check invalid values first+forvin$((min-1))$((max+1));do+${ns_a}iplinkaddvti4_amtu${v}typevtilocal${veth4_a_addr}remote${veth4_b_addr}key102>/dev/null+# This can fail, or MTU can be adjusted to a proper value+[$?-ne0]&&continue+mtu="$(link_get_mtu"${ns_a}"vti4_a)"+if[${mtu}-lt${min}-o${mtu}-gt${max}];then+err" vti tunnel created with invalid MTU ${mtu}"+fail=1+fi+${ns_a}iplinkdelvti4_a+done++# Now check valid values+forvin${min}1300${max};do+${ns_a}iplinkaddvti4_amtu${v}typevtilocal${veth4_a_addr}remote${veth4_b_addr}key10+mtu="$(link_get_mtu"${ns_a}"vti4_a)"+${ns_a}iplinkdelvti4_a+if["${mtu}"!="${v}"];then+err" vti MTU ${mtu} doesn't match configured value ${v}"+fail=1+fi+done++return${fail}+}+trapcleanupEXITexitcode=0
@@ -33,13 +33,17 @@# - pmtu_vti4_link_add_mtu# Set up vti4 interface passing MTU value at link creation, check MTU is# configured, and that link is not created with invalid MTU values+#+# - pmtu_vti6_link_add_mtu+# Same as above, for IPv6tests="pmtu_vti6_exceptionvti6:PMTUexceptionspmtu_vti4_exceptionvti4:PMTUexceptionspmtu_vti4_default_mtuvti4:defaultMTUassignmentpmtu_vti6_default_mtuvti6:defaultMTUassignment-pmtu_vti4_link_add_mtuvti4:MTUsettingonlinkcreation"+pmtu_vti4_link_add_mtuvti4:MTUsettingonlinkcreation+pmtu_vti6_link_add_mtuvti6:MTUsettingonlinkcreation"NS_A="ns-$(mktemp-uXXXXXX)"NS_B="ns-$(mktemp-uXXXXXX)"
@@ -344,6 +348,44 @@ test_pmtu_vti4_link_add_mtu() {return${fail}}+test_pmtu_vti6_link_add_mtu(){+setupnamespaces||return2++${ns_a}iplinkaddvti6_atypevti6local${veth6_a_addr}remote${veth6_b_addr}key10+[$?-ne0]&&err" vti6 not supported"&&return2+${ns_a}iplinkdelvti6_a++fail=0++min=1280+max=$((65535-40))+# Check invalid values first+forvin$((min-1))$((max+1));do+${ns_a}iplinkaddvti6_amtu${v}typevti6local${veth6_a_addr}remote${veth6_b_addr}key102>/dev/null+# This can fail, or MTU can be adjusted to a proper value+[$?-ne0]&&continue+mtu="$(link_get_mtu"${ns_a}"vti6_a)"+if[${mtu}-lt${min}-o${mtu}-gt${max}];then+err" vti6 tunnel created with invalid MTU ${v}"+fail=1+fi+${ns_a}iplinkdelvti6_a+done++# Now check valid values+forvin12801300$((65535-40));do+${ns_a}iplinkaddvti6_amtu${v}typevti6local${veth6_a_addr}remote${veth6_b_addr}key10+mtu="$(link_get_mtu"${ns_a}"vti6_a)"+${ns_a}iplinkdelvti6_a+if["${mtu}"!="${v}"];then+err" vti6 MTU ${mtu} doesn't match configured value ${v}"+fail=1+fi+done++return${fail}+}+trapcleanupEXITexitcode=0
This test checks that MTU configured from userspace is used on
link creation and changes, and that when it's not passed from
userspace, it's calculated properly from the MTU of the lower
layer.
Signed-off-by: Stefano Brivio <redacted>
---
v2: Adjusted return codes for 4/10, added test description, error
strings now buffered. Removed accidental output to /dev/kmsg.
tools/testing/selftests/net/pmtu.sh | 67 +++++++++++++++++++++++++++++++++----
1 file changed, 61 insertions(+), 6 deletions(-)
@@ -36,14 +36,21 @@## - pmtu_vti6_link_add_mtu# Same as above, for IPv6+#+# - pmtu_vti6_link_change_mtu+# Set up two dummy interfaces with different MTUs, create a vti6 tunnel+# and check that configured MTU is used on link creation and changes, and+# that MTU is properly calculated instead when MTU is not configured from+# userspacetests="-pmtu_vti6_exceptionvti6:PMTUexceptions-pmtu_vti4_exceptionvti4:PMTUexceptions-pmtu_vti4_default_mtuvti4:defaultMTUassignment-pmtu_vti6_default_mtuvti6:defaultMTUassignment-pmtu_vti4_link_add_mtuvti4:MTUsettingonlinkcreation-pmtu_vti6_link_add_mtuvti6:MTUsettingonlinkcreation"+pmtu_vti6_exceptionvti6:PMTUexceptions+pmtu_vti4_exceptionvti4:PMTUexceptions+pmtu_vti4_default_mtuvti4:defaultMTUassignment+pmtu_vti6_default_mtuvti6:defaultMTUassignment+pmtu_vti4_link_add_mtuvti4:MTUsettingonlinkcreation+pmtu_vti6_link_add_mtuvti6:MTUsettingonlinkcreation+pmtu_vti6_link_change_mtuvti6:MTUchangesonlinkchanges"NS_A="ns-$(mktemp-uXXXXXX)"NS_B="ns-$(mktemp-uXXXXXX)"
@@ -386,6 +397,50 @@ test_pmtu_vti6_link_add_mtu() {return${fail}}+test_pmtu_vti6_link_change_mtu(){+setupnamespaces||return2++${ns_a}iplinkadddummy0mtu1500typedummy+[$?-ne0]&&err" dummy not supported"&&return2+${ns_a}iplinkadddummy1mtu3000typedummy+${ns_a}iplinksetdummy0up+${ns_a}iplinksetdummy1up++${ns_a}ipaddradd${dummy6_0_addr}/${dummy6_mask}devdummy0+${ns_a}ipaddradd${dummy6_1_addr}/${dummy6_mask}devdummy1++fail=0++# Create vti6 interface bound to device, passing MTU, check it+${ns_a}iplinkaddvti6_amtu1300typevti6remote${dummy6_0_addr}local${dummy6_0_addr}+mtu="$(link_get_mtu"${ns_a}"vti6_a)"+if[${mtu}-ne1300];then+err" vti6 MTU ${mtu} doesn't match configured value 1300"+fail=1+fi++# Move to another device with different MTU, without passing MTU, check+# MTU is adjusted+echo"${ns_a} ip link set vti6_a type vti6 remote ${dummy6_1_addr} local ${dummy6_1_addr}">/dev/kmsg+${ns_a}iplinksetvti6_atypevti6remote${dummy6_1_addr}local${dummy6_1_addr}+mtu="$(link_get_mtu"${ns_a}"vti6_a)"+if[${mtu}-ne$((3000-40))];then+err" vti MTU ${mtu} is not dummy MTU 3000 minus IPv6 header length"+fail=1+fi++# Move it back, passing MTU, check MTU is not overridden+echo"${ns_a} ip link set vti6_a mtu 1280 type vti6 remote ${dummy6_0_addr} local ${dummy6_0_addr}">/dev/kmsg+${ns_a}iplinksetvti6_amtu1280typevti6remote${dummy6_0_addr}local${dummy6_0_addr}+mtu="$(link_get_mtu"${ns_a}"vti6_a)"+if[${mtu}-ne1280];then+err" vti6 MTU ${mtu} doesn't match configured value 1280"+fail=1+fi++return${fail}+}+trapcleanupEXITexitcode=0
Patches 5/10 to 10/10 add tests to verify default MTU assignment
for vti4 and vti6 interfaces, to check that MTU values set on new
link and link changes are properly taken and validated, and to
verify PMTU exceptions on vti4 interfaces.
Patch 1/10 reverses function return codes as suggested by David
Ahern.
Patch 2/10 fixes the helper to fetch exceptions MTU to run in the
passed namespace.
Patches 3/10 and 4/10 are preparation work to make it easier to
introduce those tests.
v2: Reverse return codes, and make output prettier in 4/9 by
using padded printf, test descriptions and buffered error
strings. Remove accidental output to /dev/kmsg from 10/10
(was 9/9).
From: David Ahern <hidden> Date: 2018-03-18 17:31:15
On 3/16/18 7:31 PM, Stefano Brivio wrote:
Patches 5/10 to 10/10 add tests to verify default MTU assignment
for vti4 and vti6 interfaces, to check that MTU values set on new
link and link changes are properly taken and validated, and to
verify PMTU exceptions on vti4 interfaces.
Patch 1/10 reverses function return codes as suggested by David
Ahern.
Patch 2/10 fixes the helper to fetch exceptions MTU to run in the
passed namespace.
Patches 3/10 and 4/10 are preparation work to make it easier to
introduce those tests.
v2: Reverse return codes, and make output prettier in 4/9 by
using padded printf, test descriptions and buffered error
strings. Remove accidental output to /dev/kmsg from 10/10
(was 9/9).
pulling pmtu.sh from net-next I see log messages on console:
[ 890.741117] ip netns exec ns-kFUQx6 ip link set vti6_a type vti6
remote fc00:1001::0 local fc00:1001::0
[ 890.837569] ip netns exec ns-kFUQx6 ip link set vti6_a mtu 1280 type
vti6 remote fc00:1000::0 local fc00:1000::0
On Sun, 18 Mar 2018 11:31:10 -0600
David Ahern [off-list ref] wrote:
On 3/16/18 7:31 PM, Stefano Brivio wrote:
quoted
Patches 5/10 to 10/10 add tests to verify default MTU assignment
for vti4 and vti6 interfaces, to check that MTU values set on new
link and link changes are properly taken and validated, and to
verify PMTU exceptions on vti4 interfaces.
Patch 1/10 reverses function return codes as suggested by David
Ahern.
Patch 2/10 fixes the helper to fetch exceptions MTU to run in the
passed namespace.
Patches 3/10 and 4/10 are preparation work to make it easier to
introduce those tests.
v2: Reverse return codes, and make output prettier in 4/9 by
using padded printf, test descriptions and buffered error
strings. Remove accidental output to /dev/kmsg from 10/10
(was 9/9).
pulling pmtu.sh from net-next I see log messages on console:
[ 890.741117] ip netns exec ns-kFUQx6 ip link set vti6_a type vti6
remote fc00:1001::0 local fc00:1001::0
[ 890.837569] ip netns exec ns-kFUQx6 ip link set vti6_a mtu 1280 type
vti6 remote fc00:1000::0 local fc00:1000::0
Thanks for checking. I accidentally left two more prints to kernel log
in 10/10, I'll send another patch to remove them.
--
Stefano