|
112 | 112 | # - cleanup_ipv6_exception
|
113 | 113 | # Same as above, but use IPv6 transport from A to B
|
114 | 114 | #
|
| 115 | +# - list_flush_ipv4_exception |
| 116 | +# Using the same topology as in pmtu_ipv4, create exceptions, and check |
| 117 | +# they are shown when listing exception caches, gone after flushing them |
| 118 | +# |
115 | 119 | # - list_flush_ipv6_exception
|
116 | 120 | # Using the same topology as in pmtu_ipv6, create exceptions, and check
|
117 | 121 | # they are shown when listing exception caches, gone after flushing them
|
@@ -156,6 +160,7 @@ tests="
|
156 | 160 | pmtu_vti6_link_change_mtu vti6: MTU changes on link changes 0
|
157 | 161 | cleanup_ipv4_exception ipv4: cleanup of cached exceptions 1
|
158 | 162 | cleanup_ipv6_exception ipv6: cleanup of cached exceptions 1
|
| 163 | + list_flush_ipv4_exception ipv4: list and flush cached exceptions 1 |
159 | 164 | list_flush_ipv6_exception ipv6: list and flush cached exceptions 1"
|
160 | 165 |
|
161 | 166 | NS_A="ns-A"
|
@@ -1207,6 +1212,61 @@ run_test_nh() {
|
1207 | 1212 | USE_NH=no
|
1208 | 1213 | }
|
1209 | 1214 |
|
| 1215 | +test_list_flush_ipv4_exception() { |
| 1216 | + setup namespaces routing || return 2 |
| 1217 | + trace "${ns_a}" veth_A-R1 "${ns_r1}" veth_R1-A \ |
| 1218 | + "${ns_r1}" veth_R1-B "${ns_b}" veth_B-R1 \ |
| 1219 | + "${ns_a}" veth_A-R2 "${ns_r2}" veth_R2-A \ |
| 1220 | + "${ns_r2}" veth_R2-B "${ns_b}" veth_B-R2 |
| 1221 | + |
| 1222 | + dst_prefix1="${prefix4}.${b_r1}." |
| 1223 | + dst2="${prefix4}.${b_r2}.1" |
| 1224 | + |
| 1225 | + # Set up initial MTU values |
| 1226 | + mtu "${ns_a}" veth_A-R1 2000 |
| 1227 | + mtu "${ns_r1}" veth_R1-A 2000 |
| 1228 | + mtu "${ns_r1}" veth_R1-B 1500 |
| 1229 | + mtu "${ns_b}" veth_B-R1 1500 |
| 1230 | + |
| 1231 | + mtu "${ns_a}" veth_A-R2 2000 |
| 1232 | + mtu "${ns_r2}" veth_R2-A 2000 |
| 1233 | + mtu "${ns_r2}" veth_R2-B 1500 |
| 1234 | + mtu "${ns_b}" veth_B-R2 1500 |
| 1235 | + |
| 1236 | + fail=0 |
| 1237 | + |
| 1238 | + # Add 100 addresses for veth endpoint on B reached by default A route |
| 1239 | + for i in $(seq 100 199); do |
| 1240 | + run_cmd ${ns_b} ip addr add "${dst_prefix1}${i}" dev veth_B-R1 |
| 1241 | + done |
| 1242 | + |
| 1243 | + # Create 100 cached route exceptions for path via R1, one via R2. Note |
| 1244 | + # that with IPv4 we need to actually cause a route lookup that matches |
| 1245 | + # the exception caused by ICMP, in order to actually have a cached |
| 1246 | + # route, so we need to ping each destination twice |
| 1247 | + for i in $(seq 100 199); do |
| 1248 | + run_cmd ${ns_a} ping -q -M want -i 0.1 -c 2 -s 1800 "${dst_prefix1}${i}" |
| 1249 | + done |
| 1250 | + run_cmd ${ns_a} ping -q -M want -i 0.1 -c 2 -s 1800 "${dst2}" |
| 1251 | + |
| 1252 | + # Each exception is printed as two lines |
| 1253 | + if [ "$(${ns_a} ip route list cache | wc -l)" -ne 202 ]; then |
| 1254 | + err " can't list cached exceptions" |
| 1255 | + fail=1 |
| 1256 | + fi |
| 1257 | + |
| 1258 | + run_cmd ${ns_a} ip route flush cache |
| 1259 | + pmtu1="$(route_get_dst_pmtu_from_exception "${ns_a}" ${dst_prefix}1)" |
| 1260 | + pmtu2="$(route_get_dst_pmtu_from_exception "${ns_a}" ${dst_prefix}2)" |
| 1261 | + if [ -n "${pmtu1}" ] || [ -n "${pmtu2}" ] || \ |
| 1262 | + [ -n "$(${ns_a} ip route list cache)" ]; then |
| 1263 | + err " can't flush cached exceptions" |
| 1264 | + fail=1 |
| 1265 | + fi |
| 1266 | + |
| 1267 | + return ${fail} |
| 1268 | +} |
| 1269 | + |
1210 | 1270 | test_list_flush_ipv6_exception() {
|
1211 | 1271 | setup namespaces routing || return 2
|
1212 | 1272 | trace "${ns_a}" veth_A-R1 "${ns_r1}" veth_R1-A \
|
|
0 commit comments