|
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}_fou{4,6}_exception |
| 63 | +# Same as pmtu_ipv4_vxlan4, but using a direct IPv4/IPv6 encapsulation |
| 64 | +# (FoU) over IPv4/IPv6, instead of VXLAN |
| 65 | +# |
| 66 | +# - pmtu_ipv{4,6}_fou{4,6}_exception |
| 67 | +# Same as pmtu_ipv4_vxlan4, but using a generic UDP IPv4/IPv6 |
| 68 | +# encapsulation (GUE) over IPv4/IPv6, instead of VXLAN |
| 69 | +# |
62 | 70 | # - pmtu_vti4_exception
|
63 | 71 | # Set up vti tunnel on top of veth, with xfrm states and policies, in two
|
64 | 72 | # namespaces with matching endpoints. Check that route exception is not
|
@@ -113,6 +121,14 @@ tests="
|
113 | 121 | pmtu_ipv6_geneve4_exception IPv6 over geneve4: PMTU exceptions
|
114 | 122 | pmtu_ipv4_geneve6_exception IPv4 over geneve6: PMTU exceptions
|
115 | 123 | pmtu_ipv6_geneve6_exception IPv6 over geneve6: PMTU exceptions
|
| 124 | + pmtu_ipv4_fou4_exception IPv4 over fou4: PMTU exceptions |
| 125 | + pmtu_ipv6_fou4_exception IPv6 over fou4: PMTU exceptions |
| 126 | + pmtu_ipv4_fou6_exception IPv4 over fou6: PMTU exceptions |
| 127 | + pmtu_ipv6_fou6_exception IPv6 over fou6: PMTU exceptions |
| 128 | + pmtu_ipv4_gue4_exception IPv4 over gue4: PMTU exceptions |
| 129 | + pmtu_ipv6_gue4_exception IPv6 over gue4: PMTU exceptions |
| 130 | + pmtu_ipv4_gue6_exception IPv4 over gue6: PMTU exceptions |
| 131 | + pmtu_ipv6_gue6_exception IPv6 over gue6: PMTU exceptions |
116 | 132 | pmtu_vti6_exception vti6: PMTU exceptions
|
117 | 133 | pmtu_vti4_exception vti4: PMTU exceptions
|
118 | 134 | pmtu_vti4_default_mtu vti4: default MTU assignment
|
@@ -200,6 +216,89 @@ nsname() {
|
200 | 216 | eval echo \$NS_$1
|
201 | 217 | }
|
202 | 218 |
|
| 219 | +setup_fou_or_gue() { |
| 220 | + outer="${1}" |
| 221 | + inner="${2}" |
| 222 | + encap="${3}" |
| 223 | + |
| 224 | + if [ "${outer}" = "4" ]; then |
| 225 | + modprobe fou || return 2 |
| 226 | + a_addr="${prefix4}.${a_r1}.1" |
| 227 | + b_addr="${prefix4}.${b_r1}.1" |
| 228 | + if [ "${inner}" = "4" ]; then |
| 229 | + type="ipip" |
| 230 | + ipproto="4" |
| 231 | + else |
| 232 | + type="sit" |
| 233 | + ipproto="41" |
| 234 | + fi |
| 235 | + else |
| 236 | + modprobe fou6 || return 2 |
| 237 | + a_addr="${prefix6}:${a_r1}::1" |
| 238 | + b_addr="${prefix6}:${b_r1}::1" |
| 239 | + if [ "${inner}" = "4" ]; then |
| 240 | + type="ip6tnl" |
| 241 | + mode="mode ipip6" |
| 242 | + ipproto="4 -6" |
| 243 | + else |
| 244 | + type="ip6tnl" |
| 245 | + mode="mode ip6ip6" |
| 246 | + ipproto="41 -6" |
| 247 | + fi |
| 248 | + fi |
| 249 | + |
| 250 | + ${ns_a} ip fou add port 5555 ipproto ${ipproto} || return 2 |
| 251 | + ${ns_a} ip link add ${encap}_a type ${type} ${mode} local ${a_addr} remote ${b_addr} encap ${encap} encap-sport auto encap-dport 5556 || return 2 |
| 252 | + |
| 253 | + ${ns_b} ip fou add port 5556 ipproto ${ipproto} |
| 254 | + ${ns_b} ip link add ${encap}_b type ${type} ${mode} local ${b_addr} remote ${a_addr} encap ${encap} encap-sport auto encap-dport 5555 |
| 255 | + |
| 256 | + if [ "${inner}" = "4" ]; then |
| 257 | + ${ns_a} ip addr add ${tunnel4_a_addr}/${tunnel4_mask} dev ${encap}_a |
| 258 | + ${ns_b} ip addr add ${tunnel4_b_addr}/${tunnel4_mask} dev ${encap}_b |
| 259 | + else |
| 260 | + ${ns_a} ip addr add ${tunnel6_a_addr}/${tunnel6_mask} dev ${encap}_a |
| 261 | + ${ns_b} ip addr add ${tunnel6_b_addr}/${tunnel6_mask} dev ${encap}_b |
| 262 | + fi |
| 263 | + |
| 264 | + ${ns_a} ip link set ${encap}_a up |
| 265 | + ${ns_b} ip link set ${encap}_b up |
| 266 | + |
| 267 | + sleep 1 |
| 268 | +} |
| 269 | + |
| 270 | +setup_fou44() { |
| 271 | + setup_fou_or_gue 4 4 fou |
| 272 | +} |
| 273 | + |
| 274 | +setup_fou46() { |
| 275 | + setup_fou_or_gue 4 6 fou |
| 276 | +} |
| 277 | + |
| 278 | +setup_fou64() { |
| 279 | + setup_fou_or_gue 6 4 fou |
| 280 | +} |
| 281 | + |
| 282 | +setup_fou66() { |
| 283 | + setup_fou_or_gue 6 6 fou |
| 284 | +} |
| 285 | + |
| 286 | +setup_gue44() { |
| 287 | + setup_fou_or_gue 4 4 gue |
| 288 | +} |
| 289 | + |
| 290 | +setup_gue46() { |
| 291 | + setup_fou_or_gue 4 6 gue |
| 292 | +} |
| 293 | + |
| 294 | +setup_gue64() { |
| 295 | + setup_fou_or_gue 6 4 gue |
| 296 | +} |
| 297 | + |
| 298 | +setup_gue66() { |
| 299 | + setup_fou_or_gue 6 6 gue |
| 300 | +} |
| 301 | + |
203 | 302 | setup_namespaces() {
|
204 | 303 | for n in ${NS_A} ${NS_B} ${NS_R1} ${NS_R2}; do
|
205 | 304 | ip netns add ${n} || return 1
|
@@ -627,6 +726,86 @@ test_pmtu_ipv6_geneve6_exception() {
|
627 | 726 | test_pmtu_ipvX_over_vxlanY_or_geneveY_exception geneve 6 6
|
628 | 727 | }
|
629 | 728 |
|
| 729 | +test_pmtu_ipvX_over_fouY_or_gueY() { |
| 730 | + inner_family=${1} |
| 731 | + outer_family=${2} |
| 732 | + encap=${3} |
| 733 | + ll_mtu=4000 |
| 734 | + |
| 735 | + setup namespaces routing ${encap}${outer_family}${inner_family} || return 2 |
| 736 | + trace "${ns_a}" ${encap}_a "${ns_b}" ${encap}_b \ |
| 737 | + "${ns_a}" veth_A-R1 "${ns_r1}" veth_R1-A \ |
| 738 | + "${ns_b}" veth_B-R1 "${ns_r1}" veth_R1-B |
| 739 | + |
| 740 | + if [ ${inner_family} -eq 4 ]; then |
| 741 | + ping=ping |
| 742 | + dst=${tunnel4_b_addr} |
| 743 | + else |
| 744 | + ping=${ping6} |
| 745 | + dst=${tunnel6_b_addr} |
| 746 | + fi |
| 747 | + |
| 748 | + if [ "${encap}" = "gue" ]; then |
| 749 | + encap_overhead=4 |
| 750 | + else |
| 751 | + encap_overhead=0 |
| 752 | + fi |
| 753 | + |
| 754 | + if [ ${outer_family} -eq 4 ]; then |
| 755 | + # IPv4 header UDP header |
| 756 | + exp_mtu=$((${ll_mtu} - 20 - 8 - ${encap_overhead})) |
| 757 | + else |
| 758 | + # IPv6 header Option 4 UDP header |
| 759 | + exp_mtu=$((${ll_mtu} - 40 - 8 - 8 - ${encap_overhead})) |
| 760 | + fi |
| 761 | + |
| 762 | + # Create route exception by exceeding link layer MTU |
| 763 | + mtu "${ns_a}" veth_A-R1 $((${ll_mtu} + 1000)) |
| 764 | + mtu "${ns_r1}" veth_R1-A $((${ll_mtu} + 1000)) |
| 765 | + mtu "${ns_b}" veth_B-R1 ${ll_mtu} |
| 766 | + mtu "${ns_r1}" veth_R1-B ${ll_mtu} |
| 767 | + |
| 768 | + mtu "${ns_a}" ${encap}_a $((${ll_mtu} + 1000)) |
| 769 | + mtu "${ns_b}" ${encap}_b $((${ll_mtu} + 1000)) |
| 770 | + ${ns_a} ${ping} -q -M want -i 0.1 -w 2 -s $((${ll_mtu} + 500)) ${dst} > /dev/null |
| 771 | + |
| 772 | + # Check that exception was created |
| 773 | + pmtu="$(route_get_dst_pmtu_from_exception "${ns_a}" ${dst})" |
| 774 | + check_pmtu_value ${exp_mtu} "${pmtu}" "exceeding link layer MTU on ${encap} interface" |
| 775 | +} |
| 776 | + |
| 777 | +test_pmtu_ipv4_fou4_exception() { |
| 778 | + test_pmtu_ipvX_over_fouY_or_gueY 4 4 fou |
| 779 | +} |
| 780 | + |
| 781 | +test_pmtu_ipv6_fou4_exception() { |
| 782 | + test_pmtu_ipvX_over_fouY_or_gueY 6 4 fou |
| 783 | +} |
| 784 | + |
| 785 | +test_pmtu_ipv4_fou6_exception() { |
| 786 | + test_pmtu_ipvX_over_fouY_or_gueY 4 6 fou |
| 787 | +} |
| 788 | + |
| 789 | +test_pmtu_ipv6_fou6_exception() { |
| 790 | + test_pmtu_ipvX_over_fouY_or_gueY 6 6 fou |
| 791 | +} |
| 792 | + |
| 793 | +test_pmtu_ipv4_gue4_exception() { |
| 794 | + test_pmtu_ipvX_over_fouY_or_gueY 4 4 gue |
| 795 | +} |
| 796 | + |
| 797 | +test_pmtu_ipv6_gue4_exception() { |
| 798 | + test_pmtu_ipvX_over_fouY_or_gueY 6 4 gue |
| 799 | +} |
| 800 | + |
| 801 | +test_pmtu_ipv4_gue6_exception() { |
| 802 | + test_pmtu_ipvX_over_fouY_or_gueY 4 6 gue |
| 803 | +} |
| 804 | + |
| 805 | +test_pmtu_ipv6_gue6_exception() { |
| 806 | + test_pmtu_ipvX_over_fouY_or_gueY 6 6 gue |
| 807 | +} |
| 808 | + |
630 | 809 | test_pmtu_vti4_exception() {
|
631 | 810 | setup namespaces veth vti4 xfrm4 || return 2
|
632 | 811 | trace "${ns_a}" veth_a "${ns_b}" veth_b \
|
|
0 commit comments