59
59
# Same as pmtu_ipv6_vxlan6_exception, but using a GENEVE tunnel instead of
60
60
# VXLAN
61
61
#
62
+ # - pmtu_ipv{4,6}_br_vxlan{4,6}_exception
63
+ # Set up three namespaces, A, B, and C, with routing between A and B over
64
+ # R1. R2 is unused in these tests. A has a veth connection to C, and is
65
+ # connected to B via a VXLAN endpoint, which is directly bridged to C.
66
+ # MTU on the B-R1 link is lower than other MTUs.
67
+ #
68
+ # Check that both C and A are able to communicate with B over the VXLAN
69
+ # tunnel, and that PMTU exceptions with the correct values are created.
70
+ #
71
+ # segment a_r1 segment b_r1 b_r1: 4000
72
+ # .--------------R1--------------. everything
73
+ # C---veth A B else: 5000
74
+ # ' bridge |
75
+ # '---- - - - - - VXLAN - - - - - - - '
76
+ #
77
+ # - pmtu_ipv{4,6}_br_geneve{4,6}_exception
78
+ # Same as pmtu_ipv{4,6}_br_vxlan{4,6}_exception, with a GENEVE tunnel
79
+ # instead.
80
+ #
62
81
# - pmtu_ipv{4,6}_fou{4,6}_exception
63
82
# Same as pmtu_ipv4_vxlan4, but using a direct IPv4/IPv6 encapsulation
64
83
# (FoU) over IPv4/IPv6, instead of VXLAN
@@ -147,6 +166,14 @@ tests="
147
166
pmtu_ipv6_geneve4_exception IPv6 over geneve4: PMTU exceptions 1
148
167
pmtu_ipv4_geneve6_exception IPv4 over geneve6: PMTU exceptions 1
149
168
pmtu_ipv6_geneve6_exception IPv6 over geneve6: PMTU exceptions 1
169
+ pmtu_ipv4_br_vxlan4_exception IPv4, bridged vxlan4: PMTU exceptions 1
170
+ pmtu_ipv6_br_vxlan4_exception IPv6, bridged vxlan4: PMTU exceptions 1
171
+ pmtu_ipv4_br_vxlan6_exception IPv4, bridged vxlan6: PMTU exceptions 1
172
+ pmtu_ipv6_br_vxlan6_exception IPv6, bridged vxlan6: PMTU exceptions 1
173
+ pmtu_ipv4_br_geneve4_exception IPv4, bridged geneve4: PMTU exceptions 1
174
+ pmtu_ipv6_br_geneve4_exception IPv6, bridged geneve4: PMTU exceptions 1
175
+ pmtu_ipv4_br_geneve6_exception IPv4, bridged geneve6: PMTU exceptions 1
176
+ pmtu_ipv6_br_geneve6_exception IPv6, bridged geneve6: PMTU exceptions 1
150
177
pmtu_ipv4_fou4_exception IPv4 over fou4: PMTU exceptions 1
151
178
pmtu_ipv6_fou4_exception IPv6 over fou4: PMTU exceptions 1
152
179
pmtu_ipv4_fou6_exception IPv4 over fou6: PMTU exceptions 1
@@ -173,10 +200,12 @@ tests="
173
200
174
201
NS_A=" ns-A"
175
202
NS_B=" ns-B"
203
+ NS_C=" ns-C"
176
204
NS_R1=" ns-R1"
177
205
NS_R2=" ns-R2"
178
206
ns_a=" ip netns exec ${NS_A} "
179
207
ns_b=" ip netns exec ${NS_B} "
208
+ ns_c=" ip netns exec ${NS_C} "
180
209
ns_r1=" ip netns exec ${NS_R1} "
181
210
ns_r2=" ip netns exec ${NS_R2} "
182
211
@@ -239,9 +268,11 @@ routes_nh="
239
268
240
269
veth4_a_addr=" 192.168.1.1"
241
270
veth4_b_addr=" 192.168.1.2"
271
+ veth4_c_addr=" 192.168.2.10"
242
272
veth4_mask=" 24"
243
273
veth6_a_addr=" fd00:1::a"
244
274
veth6_b_addr=" fd00:1::b"
275
+ veth6_c_addr=" fd00:2::c"
245
276
veth6_mask=" 64"
246
277
247
278
tunnel4_a_addr=" 192.168.2.1"
@@ -428,7 +459,7 @@ setup_ip6ip6() {
428
459
}
429
460
430
461
setup_namespaces () {
431
- for n in ${NS_A} ${NS_B} ${NS_R1} ${NS_R2} ; do
462
+ for n in ${NS_A} ${NS_B} ${NS_C} ${ NS_R1} ${NS_R2} ; do
432
463
ip netns add ${n} || return 1
433
464
434
465
# Disable DAD, so that we don't have to wait to use the
@@ -484,6 +515,7 @@ setup_vxlan_or_geneve() {
484
515
a_addr=" ${2} "
485
516
b_addr=" ${3} "
486
517
opts=" ${4} "
518
+ br_if_a=" ${5} "
487
519
488
520
if [ " ${type} " = " vxlan" ]; then
489
521
opts=" ${opts} ttl 64 dstport 4789"
@@ -497,10 +529,16 @@ setup_vxlan_or_geneve() {
497
529
run_cmd ${ns_a} ip link add ${type} _a type ${type} id 1 ${opts_a} remote ${b_addr} ${opts} || return 1
498
530
run_cmd ${ns_b} ip link add ${type} _b type ${type} id 1 ${opts_b} remote ${a_addr} ${opts}
499
531
500
- run_cmd ${ns_a} ip addr add ${tunnel4_a_addr} /${tunnel4_mask} dev ${type} _a
501
- run_cmd ${ns_b} ip addr add ${tunnel4_b_addr} /${tunnel4_mask} dev ${type} _b
532
+ if [ -n " ${br_if_a} " ]; then
533
+ run_cmd ${ns_a} ip addr add ${tunnel4_a_addr} /${tunnel4_mask} dev ${br_if_a}
534
+ run_cmd ${ns_a} ip addr add ${tunnel6_a_addr} /${tunnel6_mask} dev ${br_if_a}
535
+ run_cmd ${ns_a} ip link set ${type} _a master ${br_if_a}
536
+ else
537
+ run_cmd ${ns_a} ip addr add ${tunnel4_a_addr} /${tunnel4_mask} dev ${type} _a
538
+ run_cmd ${ns_a} ip addr add ${tunnel6_a_addr} /${tunnel6_mask} dev ${type} _a
539
+ fi
502
540
503
- run_cmd ${ns_a } ip addr add ${tunnel6_a_addr } /${tunnel6_mask } dev ${type} _a
541
+ run_cmd ${ns_b } ip addr add ${tunnel4_b_addr } /${tunnel4_mask } dev ${type} _b
504
542
run_cmd ${ns_b} ip addr add ${tunnel6_b_addr} /${tunnel6_mask} dev ${type} _b
505
543
506
544
run_cmd ${ns_a} ip link set ${type} _a up
@@ -516,11 +554,27 @@ setup_vxlan4() {
516
554
}
517
555
518
556
setup_geneve6 () {
519
- setup_vxlan_or_geneve geneve ${prefix6} :${a_r1} ::1 ${prefix6} :${b_r1} ::1
557
+ setup_vxlan_or_geneve geneve ${prefix6} :${a_r1} ::1 ${prefix6} :${b_r1} ::1 " "
520
558
}
521
559
522
560
setup_vxlan6 () {
523
- setup_vxlan_or_geneve vxlan ${prefix6} :${a_r1} ::1 ${prefix6} :${b_r1} ::1
561
+ setup_vxlan_or_geneve vxlan ${prefix6} :${a_r1} ::1 ${prefix6} :${b_r1} ::1 " "
562
+ }
563
+
564
+ setup_bridged_geneve4 () {
565
+ setup_vxlan_or_geneve geneve ${prefix4} .${a_r1} .1 ${prefix4} .${b_r1} .1 " df set" " br0"
566
+ }
567
+
568
+ setup_bridged_vxlan4 () {
569
+ setup_vxlan_or_geneve vxlan ${prefix4} .${a_r1} .1 ${prefix4} .${b_r1} .1 " df set" " br0"
570
+ }
571
+
572
+ setup_bridged_geneve6 () {
573
+ setup_vxlan_or_geneve geneve ${prefix6} :${a_r1} ::1 ${prefix6} :${b_r1} ::1 " " " br0"
574
+ }
575
+
576
+ setup_bridged_vxlan6 () {
577
+ setup_vxlan_or_geneve vxlan ${prefix6} :${a_r1} ::1 ${prefix6} :${b_r1} ::1 " " " br0"
524
578
}
525
579
526
580
setup_xfrm () {
@@ -630,6 +684,20 @@ setup_routing() {
630
684
return 0
631
685
}
632
686
687
+ setup_bridge () {
688
+ run_cmd ${ns_a} ip link add br0 type bridge || return 2
689
+ run_cmd ${ns_a} ip link set br0 up
690
+
691
+ run_cmd ${ns_c} ip link add veth_C-A type veth peer name veth_A-C
692
+ run_cmd ${ns_c} ip link set veth_A-C netns ns-A
693
+
694
+ run_cmd ${ns_a} ip link set veth_A-C up
695
+ run_cmd ${ns_c} ip link set veth_C-A up
696
+ run_cmd ${ns_c} ip addr add ${veth4_c_addr} /${veth4_mask} dev veth_C-A
697
+ run_cmd ${ns_c} ip addr add ${veth6_c_addr} /${veth6_mask} dev veth_C-A
698
+ run_cmd ${ns_a} ip link set veth_A-C master br0
699
+ }
700
+
633
701
setup () {
634
702
[ " $( id -u) " -ne 0 ] && echo " need to run as root" && return $ksft_skip
635
703
@@ -657,7 +725,7 @@ cleanup() {
657
725
done
658
726
tcpdump_pids=
659
727
660
- for n in ${NS_A} ${NS_B} ${NS_R1} ${NS_R2} ; do
728
+ for n in ${NS_A} ${NS_B} ${NS_C} ${ NS_R1} ${NS_R2} ; do
661
729
ip netns del ${n} 2> /dev/null
662
730
done
663
731
}
@@ -892,6 +960,90 @@ test_pmtu_ipv6_geneve6_exception() {
892
960
test_pmtu_ipvX_over_vxlanY_or_geneveY_exception geneve 6 6
893
961
}
894
962
963
+ test_pmtu_ipvX_over_bridged_vxlanY_or_geneveY_exception () {
964
+ type=${1}
965
+ family=${2}
966
+ outer_family=${3}
967
+ ll_mtu=4000
968
+
969
+ if [ ${outer_family} -eq 4 ]; then
970
+ setup namespaces routing bridge bridged_${type} 4 || return 2
971
+ # IPv4 header UDP header VXLAN/GENEVE header Ethernet header
972
+ exp_mtu=$(( ${ll_mtu} - 20 - 8 - 8 - 14 ))
973
+ else
974
+ setup namespaces routing bridge bridged_${type} 6 || return 2
975
+ # IPv6 header UDP header VXLAN/GENEVE header Ethernet header
976
+ exp_mtu=$(( ${ll_mtu} - 40 - 8 - 8 - 14 ))
977
+ fi
978
+
979
+ trace " ${ns_a} " ${type} _a " ${ns_b} " ${type} _b \
980
+ " ${ns_a} " veth_A-R1 " ${ns_r1} " veth_R1-A \
981
+ " ${ns_b} " veth_B-R1 " ${ns_r1} " veth_R1-B \
982
+ " ${ns_a} " br0 " ${ns_a} " veth-A-C \
983
+ " ${ns_c} " veth_C-A
984
+
985
+ if [ ${family} -eq 4 ]; then
986
+ ping=ping
987
+ dst=${tunnel4_b_addr}
988
+ else
989
+ ping=${ping6}
990
+ dst=${tunnel6_b_addr}
991
+ fi
992
+
993
+ # Create route exception by exceeding link layer MTU
994
+ mtu " ${ns_a} " veth_A-R1 $(( ${ll_mtu} + 1000 ))
995
+ mtu " ${ns_a} " br0 $(( ${ll_mtu} + 1000 ))
996
+ mtu " ${ns_a} " veth_A-C $(( ${ll_mtu} + 1000 ))
997
+ mtu " ${ns_c} " veth_C-A $(( ${ll_mtu} + 1000 ))
998
+ mtu " ${ns_r1} " veth_R1-A $(( ${ll_mtu} + 1000 ))
999
+ mtu " ${ns_b} " veth_B-R1 ${ll_mtu}
1000
+ mtu " ${ns_r1} " veth_R1-B ${ll_mtu}
1001
+
1002
+ mtu " ${ns_a} " ${type} _a $(( ${ll_mtu} + 1000 ))
1003
+ mtu " ${ns_b} " ${type} _b $(( ${ll_mtu} + 1000 ))
1004
+
1005
+ run_cmd ${ns_c} ${ping} -q -M want -i 0.1 -c 10 -s $(( ${ll_mtu} + 500 )) ${dst} || return 1
1006
+ run_cmd ${ns_a} ${ping} -q -M want -i 0.1 -w 1 -s $(( ${ll_mtu} + 500 )) ${dst} || return 1
1007
+
1008
+ # Check that exceptions were created
1009
+ pmtu=" $( route_get_dst_pmtu_from_exception " ${ns_c} " ${dst} ) "
1010
+ check_pmtu_value ${exp_mtu} " ${pmtu} " " exceeding link layer MTU on bridged ${type} interface"
1011
+ pmtu=" $( route_get_dst_pmtu_from_exception " ${ns_a} " ${dst} ) "
1012
+ check_pmtu_value ${exp_mtu} " ${pmtu} " " exceeding link layer MTU on locally bridged ${type} interface"
1013
+ }
1014
+
1015
+ test_pmtu_ipv4_br_vxlan4_exception () {
1016
+ test_pmtu_ipvX_over_bridged_vxlanY_or_geneveY_exception vxlan 4 4
1017
+ }
1018
+
1019
+ test_pmtu_ipv6_br_vxlan4_exception () {
1020
+ test_pmtu_ipvX_over_bridged_vxlanY_or_geneveY_exception vxlan 6 4
1021
+ }
1022
+
1023
+ test_pmtu_ipv4_br_geneve4_exception () {
1024
+ test_pmtu_ipvX_over_bridged_vxlanY_or_geneveY_exception geneve 4 4
1025
+ }
1026
+
1027
+ test_pmtu_ipv6_br_geneve4_exception () {
1028
+ test_pmtu_ipvX_over_bridged_vxlanY_or_geneveY_exception geneve 6 4
1029
+ }
1030
+
1031
+ test_pmtu_ipv4_br_vxlan6_exception () {
1032
+ test_pmtu_ipvX_over_bridged_vxlanY_or_geneveY_exception vxlan 4 6
1033
+ }
1034
+
1035
+ test_pmtu_ipv6_br_vxlan6_exception () {
1036
+ test_pmtu_ipvX_over_bridged_vxlanY_or_geneveY_exception vxlan 6 6
1037
+ }
1038
+
1039
+ test_pmtu_ipv4_br_geneve6_exception () {
1040
+ test_pmtu_ipvX_over_bridged_vxlanY_or_geneveY_exception geneve 4 6
1041
+ }
1042
+
1043
+ test_pmtu_ipv6_br_geneve6_exception () {
1044
+ test_pmtu_ipvX_over_bridged_vxlanY_or_geneveY_exception geneve 6 6
1045
+ }
1046
+
895
1047
test_pmtu_ipvX_over_fouY_or_gueY () {
896
1048
inner_family=${1}
897
1049
outer_family=${2}
0 commit comments