forked from extern/shorewall_code
Don't assume that all nexthop routes are default routes
This commit is contained in:
parent
a0b16e2803
commit
16276b9900
Shorewall/Perl
@ -730,7 +730,7 @@ sub start_providers() {
|
||||
emit ( '#',
|
||||
'# Capture the default route(s) if we don\'t have it (them) already.',
|
||||
'#',
|
||||
'[ -f ${VARDIR}/default_route ] || $IP -' . $family . ' route list | grep -E \'^\s*(default |nexthop )\' > ${VARDIR}/default_route',
|
||||
"[ -f \${VARDIR}/default_route ] || \$IP -$family route ls | save_default_route > \${VARDIR}/default_route",
|
||||
'#',
|
||||
'# Initialize the file that holds \'undo\' commands',
|
||||
'#',
|
||||
|
@ -504,6 +504,17 @@ undo_routing() {
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
# Save the default route
|
||||
#
|
||||
save_default_route() {
|
||||
awk \
|
||||
'BEGIN {default=0;}; \
|
||||
/^default / {default=1; print; next}; \
|
||||
/nexthop/ {if (default == 1 ) {print ; next} }; \
|
||||
{ default=0; };'
|
||||
}
|
||||
|
||||
#
|
||||
# Restore the default route that was in place before the initial 'shorewall start'
|
||||
#
|
||||
|
@ -492,6 +492,17 @@ undo_routing() {
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
# Save the default route
|
||||
#
|
||||
save_default_route() {
|
||||
awk \
|
||||
'BEGIN {default=0;}; \
|
||||
/^default / {default=1; print; next}; \
|
||||
/nexthop/ {if (default == 1 ) {print ; next} }; \
|
||||
{ default=0; };'
|
||||
}
|
||||
|
||||
#
|
||||
# Restore the default route that was in place before the initial 'shorewall start'
|
||||
#
|
||||
|
Loading…
Reference in New Issue
Block a user