Debugged version of routing backout

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@4760 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2006-10-29 17:56:03 +00:00
parent ae1b699546
commit 74ff08780f
2 changed files with 16 additions and 10 deletions

View File

@ -1314,8 +1314,8 @@ undo_routing() {
# #
# Restore the rest of the routing table # Restore the rest of the routing table
# #
if [ -f ${VARDIR}/undo_routing; then if [ -f ${VARDIR}/undo_routing ]; then
. undo_routing . ${VARDIR}/undo_routing
progress_message "Shorewall-generated routing tables and routing rules removed" progress_message "Shorewall-generated routing tables and routing rules removed"
rm -f ${VARDIR}/undo_routing rm -f ${VARDIR}/undo_routing
fi fi

View File

@ -123,7 +123,9 @@ __EOF__
save_command "qt ip route flush table $number" save_command "qt ip route flush table $number"
echo "qt ip route flush table $number" >> ${VARDIR}/undo_routing indent >&3 << __EOF__
echo "qt ip route flush table $number" >> \${VARDIR}/undo_routing
__EOF__
if [ "x${duplicate:=-}" != x- ]; then if [ "x${duplicate:=-}" != x- ]; then
if [ "x${copy:=-}" != "x-" ]; then if [ "x${copy:=-}" != "x-" ]; then
@ -174,9 +176,11 @@ __EOF__
eval ${table}_mark=$mark eval ${table}_mark=$mark
save_command "qt ip rule del fwmark $mark" indent >&3 << __EOF__
save_command "run_ip rule add fwmark $mark pref $((10000 + $mark)) table $number" qt ip rule del fwmark $mark
echo "qt ip rule del fwmark $mark" >> ${VARDIR}/undo_routing run_ip rule add fwmark $mark pref $((10000 + $mark)) table $number
echo "qt ip rule del fwmark $mark" >> \${VARDIR}/undo_routing
__EOF__
fi fi
loose= loose=
@ -221,6 +225,7 @@ rulenum=0
find_interface_addresses $interface | while read address; do find_interface_addresses $interface | while read address; do
qt ip rule del from \$address qt ip rule del from \$address
run_ip rule add from \$address pref \$(( $rulebase + \$rulenum )) table $number run_ip rule add from \$address pref \$(( $rulebase + \$rulenum )) table $number
echo "qt ip rule del from \$address" >> \${VARDIR}/undo_routing
rulenum=\$((\$rulenum + 1)) rulenum=\$((\$rulenum + 1))
done done
__EOF__ __EOF__
@ -300,8 +305,9 @@ __EOF__
save_command "qt ip rule del $source $dest $priority" save_command "qt ip rule del $source $dest $priority"
save_command "run_ip rule add $source $dest $priority table $provider" save_command "run_ip rule add $source $dest $priority table $provider"
echo "qt ip rule del $source $dest $priority" >> ${VARDIR}/undo_routing indent >&3 << __EOF__
echo "qt ip rule del $source $dest $priority" >> \${VARDIR}/undo_routing
__EOF__
progress_message "Routing rule \"$rule\" $DONE" progress_message "Routing rule \"$rule\" $DONE"
} }
# #
@ -322,8 +328,8 @@ __EOF__
# Undo any changes made the last time that we [re]started # Undo any changes made the last time that we [re]started
# #
undo_routing undo_routing
echo "cp /etc/iproute2/rt_tables \${VARDIR}/" cp /etc/iproute2/rt_tables \${VARDIR}/
ip route ls | grep -E '^\s*(default |nexthop )' > ${VARDIR}default_route ip route ls | grep -E '^\s*(default |nexthop )' > \${VARDIR}/default_route
> \${VARDIR}/undo_routing > \${VARDIR}/undo_routing
__EOF__ __EOF__
save_progress_message "Adding Providers..." save_progress_message "Adding Providers..."