Skip to content

Commit ce73366

Browse files
sbrivio-rhdavem330
authored andcommitted
selftests: pmtu: Introduce tests for IPv4/IPv6 over GENEVE over IPv4/IPv6
Use a router between endpoints, implemented via namespaces, set a low MTU between router and destination endpoint, exceed it and check PMTU value in route exceptions. v2: - Introduce IPv4 tests right away, if iproute2 doesn't support the 'df' link option they will be skipped (David Ahern) Signed-off-by: Stefano Brivio <sbrivio@redhat.com> Reviewed-by: Sabrina Dubroca <sd@queasysnail.net> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent a025fb5 commit ce73366

File tree

1 file changed

+86
-31
lines changed

1 file changed

+86
-31
lines changed

tools/testing/selftests/net/pmtu.sh

Lines changed: 86 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,22 @@
4343
# - pmtu_ipv6_vxlan6_exception
4444
# Same as pmtu_ipv4_vxlan6_exception, but send IPv6 packets from A to B
4545
#
46+
# - pmtu_ipv4_geneve4_exception
47+
# Same as pmtu_ipv4_vxlan4_exception, but using a GENEVE tunnel instead of
48+
# VXLAN
49+
#
50+
# - pmtu_ipv6_geneve4_exception
51+
# Same as pmtu_ipv6_vxlan4_exception, but using a GENEVE tunnel instead of
52+
# VXLAN
53+
#
54+
# - pmtu_ipv4_geneve6_exception
55+
# Same as pmtu_ipv4_vxlan6_exception, but using a GENEVE tunnel instead of
56+
# VXLAN
57+
#
58+
# - pmtu_ipv6_geneve6_exception
59+
# Same as pmtu_ipv6_vxlan6_exception, but using a GENEVE tunnel instead of
60+
# VXLAN
61+
#
4662
# - pmtu_vti4_exception
4763
# Set up vti tunnel on top of veth, with xfrm states and policies, in two
4864
# namespaces with matching endpoints. Check that route exception is not
@@ -93,6 +109,10 @@ tests="
93109
pmtu_ipv6_vxlan4_exception IPv6 over vxlan4: PMTU exceptions
94110
pmtu_ipv4_vxlan6_exception IPv4 over vxlan6: PMTU exceptions
95111
pmtu_ipv6_vxlan6_exception IPv6 over vxlan6: PMTU exceptions
112+
pmtu_ipv4_geneve4_exception IPv4 over geneve4: PMTU exceptions
113+
pmtu_ipv6_geneve4_exception IPv6 over geneve4: PMTU exceptions
114+
pmtu_ipv4_geneve6_exception IPv4 over geneve6: PMTU exceptions
115+
pmtu_ipv6_geneve6_exception IPv6 over geneve6: PMTU exceptions
96116
pmtu_vti6_exception vti6: PMTU exceptions
97117
pmtu_vti4_exception vti4: PMTU exceptions
98118
pmtu_vti4_default_mtu vti4: default MTU assignment
@@ -230,32 +250,50 @@ setup_vti6() {
230250
setup_vti 6 ${veth6_a_addr} ${veth6_b_addr} ${tunnel6_a_addr} ${tunnel6_b_addr} ${tunnel6_mask}
231251
}
232252

233-
setup_vxlan() {
234-
a_addr="${1}"
235-
b_addr="${2}"
236-
opts="${3}"
253+
setup_vxlan_or_geneve() {
254+
type="${1}"
255+
a_addr="${2}"
256+
b_addr="${3}"
257+
opts="${4}"
258+
259+
if [ "${type}" = "vxlan" ]; then
260+
opts="${opts} ttl 64 dstport 4789"
261+
opts_a="local ${a_addr}"
262+
opts_b="local ${b_addr}"
263+
else
264+
opts_a=""
265+
opts_b=""
266+
fi
237267

238-
${ns_a} ip link add vxlan_a type vxlan id 1 local ${a_addr} remote ${b_addr} ttl 64 dstport 4789 ${opts} || return 1
239-
${ns_b} ip link add vxlan_b type vxlan id 1 local ${b_addr} remote ${a_addr} ttl 64 dstport 4789 ${opts}
268+
${ns_a} ip link add ${type}_a type ${type} id 1 ${opts_a} remote ${b_addr} ${opts} || return 1
269+
${ns_b} ip link add ${type}_b type ${type} id 1 ${opts_b} remote ${a_addr} ${opts}
240270

241-
${ns_a} ip addr add ${tunnel4_a_addr}/${tunnel4_mask} dev vxlan_a
242-
${ns_b} ip addr add ${tunnel4_b_addr}/${tunnel4_mask} dev vxlan_b
271+
${ns_a} ip addr add ${tunnel4_a_addr}/${tunnel4_mask} dev ${type}_a
272+
${ns_b} ip addr add ${tunnel4_b_addr}/${tunnel4_mask} dev ${type}_b
243273

244-
${ns_a} ip addr add ${tunnel6_a_addr}/${tunnel6_mask} dev vxlan_a
245-
${ns_b} ip addr add ${tunnel6_b_addr}/${tunnel6_mask} dev vxlan_b
274+
${ns_a} ip addr add ${tunnel6_a_addr}/${tunnel6_mask} dev ${type}_a
275+
${ns_b} ip addr add ${tunnel6_b_addr}/${tunnel6_mask} dev ${type}_b
246276

247-
${ns_a} ip link set vxlan_a up
248-
${ns_b} ip link set vxlan_b up
277+
${ns_a} ip link set ${type}_a up
278+
${ns_b} ip link set ${type}_b up
249279

250280
sleep 1
251281
}
252282

283+
setup_geneve4() {
284+
setup_vxlan_or_geneve geneve ${prefix4}.${a_r1}.1 ${prefix4}.${b_r1}.1 "df set"
285+
}
286+
253287
setup_vxlan4() {
254-
setup_vxlan ${prefix4}.${a_r1}.1 ${prefix4}.${b_r1}.1 "df set"
288+
setup_vxlan_or_geneve vxlan ${prefix4}.${a_r1}.1 ${prefix4}.${b_r1}.1 "df set"
289+
}
290+
291+
setup_geneve6() {
292+
setup_vxlan_or_geneve geneve ${prefix6}:${a_r1}::1 ${prefix6}:${b_r1}::1
255293
}
256294

257295
setup_vxlan6() {
258-
setup_vxlan ${prefix6}:${a_r1}::1 ${prefix6}:${b_r1}::1 ""
296+
setup_vxlan_or_geneve vxlan ${prefix6}:${a_r1}::1 ${prefix6}:${b_r1}::1
259297
}
260298

261299
setup_xfrm() {
@@ -514,22 +552,23 @@ test_pmtu_ipv6_exception() {
514552
test_pmtu_ipvX 6
515553
}
516554

517-
test_pmtu_ipvX_over_vxlanY_exception() {
518-
family=${1}
519-
outer_family=${2}
555+
test_pmtu_ipvX_over_vxlanY_or_geneveY_exception() {
556+
type=${1}
557+
family=${2}
558+
outer_family=${3}
520559
ll_mtu=4000
521560

522561
if [ ${outer_family} -eq 4 ]; then
523-
setup namespaces routing vxlan4 || return 2
524-
# IPv4 header UDP header VXLAN header Ethernet header
525-
exp_mtu=$((${ll_mtu} - 20 - 8 - 8 - 14))
562+
setup namespaces routing ${type}4 || return 2
563+
# IPv4 header UDP header VXLAN/GENEVE header Ethernet header
564+
exp_mtu=$((${ll_mtu} - 20 - 8 - 8 - 14))
526565
else
527-
setup namespaces routing vxlan6 || return 2
528-
# IPv6 header UDP header VXLAN header Ethernet header
529-
exp_mtu=$((${ll_mtu} - 40 - 8 - 8 - 14))
566+
setup namespaces routing ${type}6 || return 2
567+
# IPv6 header UDP header VXLAN/GENEVE header Ethernet header
568+
exp_mtu=$((${ll_mtu} - 40 - 8 - 8 - 14))
530569
fi
531570

532-
trace "${ns_a}" vxlan_a "${ns_b}" vxlan_b \
571+
trace "${ns_a}" ${type}_a "${ns_b}" ${type}_b \
533572
"${ns_a}" veth_A-R1 "${ns_r1}" veth_R1-A \
534573
"${ns_b}" veth_B-R1 "${ns_r1}" veth_R1-B
535574

@@ -547,29 +586,45 @@ test_pmtu_ipvX_over_vxlanY_exception() {
547586
mtu "${ns_b}" veth_B-R1 ${ll_mtu}
548587
mtu "${ns_r1}" veth_R1-B ${ll_mtu}
549588

550-
mtu "${ns_a}" vxlan_a $((${ll_mtu} + 1000))
551-
mtu "${ns_b}" vxlan_b $((${ll_mtu} + 1000))
589+
mtu "${ns_a}" ${type}_a $((${ll_mtu} + 1000))
590+
mtu "${ns_b}" ${type}_b $((${ll_mtu} + 1000))
552591
${ns_a} ${ping} -q -M want -i 0.1 -w 2 -s $((${ll_mtu} + 500)) ${dst} > /dev/null
553592

554593
# Check that exception was created
555594
pmtu="$(route_get_dst_pmtu_from_exception "${ns_a}" ${dst})"
556-
check_pmtu_value ${exp_mtu} "${pmtu}" "exceeding link layer MTU on VXLAN interface"
595+
check_pmtu_value ${exp_mtu} "${pmtu}" "exceeding link layer MTU on ${type} interface"
557596
}
558597

559598
test_pmtu_ipv4_vxlan4_exception() {
560-
test_pmtu_ipvX_over_vxlanY_exception 4 4
599+
test_pmtu_ipvX_over_vxlanY_or_geneveY_exception vxlan 4 4
561600
}
562601

563602
test_pmtu_ipv6_vxlan4_exception() {
564-
test_pmtu_ipvX_over_vxlanY_exception 6 4
603+
test_pmtu_ipvX_over_vxlanY_or_geneveY_exception vxlan 6 4
604+
}
605+
606+
test_pmtu_ipv4_geneve4_exception() {
607+
test_pmtu_ipvX_over_vxlanY_or_geneveY_exception geneve 4 4
608+
}
609+
610+
test_pmtu_ipv6_geneve4_exception() {
611+
test_pmtu_ipvX_over_vxlanY_or_geneveY_exception geneve 6 4
565612
}
566613

567614
test_pmtu_ipv4_vxlan6_exception() {
568-
test_pmtu_ipvX_over_vxlanY_exception 4 6
615+
test_pmtu_ipvX_over_vxlanY_or_geneveY_exception vxlan 4 6
569616
}
570617

571618
test_pmtu_ipv6_vxlan6_exception() {
572-
test_pmtu_ipvX_over_vxlanY_exception 6 6
619+
test_pmtu_ipvX_over_vxlanY_or_geneveY_exception vxlan 6 6
620+
}
621+
622+
test_pmtu_ipv4_geneve6_exception() {
623+
test_pmtu_ipvX_over_vxlanY_or_geneveY_exception geneve 4 6
624+
}
625+
626+
test_pmtu_ipv6_geneve6_exception() {
627+
test_pmtu_ipvX_over_vxlanY_or_geneveY_exception geneve 6 6
573628
}
574629

575630
test_pmtu_vti4_exception() {

0 commit comments

Comments
 (0)