|
Lines 285-290
Link Here
|
| 285 |
local -a routes=( "${!x}" ) |
285 |
local -a routes=( "${!x}" ) |
| 286 |
local metric="metric_${ifvar}" |
286 |
local metric="metric_${ifvar}" |
| 287 |
|
287 |
|
|
|
288 |
x="rules_${ifvar}[@]" |
| 289 |
local -a rules=( "${!x}" ) |
| 290 |
|
| 288 |
# Test for old style ipaddr variable |
291 |
# Test for old style ipaddr variable |
| 289 |
if [[ -z ${routes} ]] ; then |
292 |
if [[ -z ${routes} ]] ; then |
| 290 |
t="iproute_${ifvar}[@]" |
293 |
t="iproute_${ifvar}[@]" |
|
Lines 323-328
Link Here
|
| 323 |
eoutdent |
326 |
eoutdent |
| 324 |
fi |
327 |
fi |
| 325 |
|
328 |
|
|
|
329 |
# Set rules with ip rule |
| 330 |
if [[ -n ${rules} ]] ; then |
| 331 |
einfo "Adding rules" |
| 332 |
eindent |
| 333 |
for x in "${rules[@]}"; do |
| 334 |
ebegin "${x}" |
| 335 |
# explicitly DON'T add the "dev ${iface}" as it can break rules |
| 336 |
ip rule add ${x} |
| 337 |
eend $? |
| 338 |
done |
| 339 |
eoutdent |
| 340 |
fi |
| 341 |
|
| 326 |
# Flush the route cache |
342 |
# Flush the route cache |
| 327 |
ip route flush cache dev "${iface}" |
343 |
ip route flush cache dev "${iface}" |
| 328 |
|
344 |
|
|
Lines 335-340
Link Here
|
| 335 |
|
351 |
|
| 336 |
iproute2_exists "${iface}" || return |
352 |
iproute2_exists "${iface}" || return |
| 337 |
|
353 |
|
|
|
354 |
# Delete rules - they don't disappear on iface shutdown |
| 355 |
local x="rules_${iface}[@]" |
| 356 |
local -a rules=( "${!x}" ) |
| 357 |
|
| 358 |
if [[ -n ${rules} ]] ; then |
| 359 |
einfo "Removing rules" |
| 360 |
eindent |
| 361 |
for x in "${rules[@]}"; do |
| 362 |
ebegin "${x}" |
| 363 |
ip rule del ${x} |
| 364 |
eend $? |
| 365 |
done |
| 366 |
eoutdent |
| 367 |
fi |
| 368 |
|
| 338 |
# Flush the route cache |
369 |
# Flush the route cache |
| 339 |
ip route flush cache dev "${iface}" |
370 |
ip route flush cache dev "${iface}" |
| 340 |
} |
371 |
} |