diff --git a/Shorewall/lib.base b/Shorewall/lib.base index 54ce6d425..043958141 100644 --- a/Shorewall/lib.base +++ b/Shorewall/lib.base @@ -1314,8 +1314,8 @@ undo_routing() { # # Restore the rest of the routing table # - if [ -f ${VARDIR}/undo_routing; then - . undo_routing + if [ -f ${VARDIR}/undo_routing ]; then + . ${VARDIR}/undo_routing progress_message "Shorewall-generated routing tables and routing rules removed" rm -f ${VARDIR}/undo_routing fi diff --git a/Shorewall/lib.providers b/Shorewall/lib.providers index 013299d7f..28f922143 100644 --- a/Shorewall/lib.providers +++ b/Shorewall/lib.providers @@ -123,7 +123,9 @@ __EOF__ 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${copy:=-}" != "x-" ]; then @@ -174,9 +176,11 @@ __EOF__ eval ${table}_mark=$mark - save_command "qt ip rule del fwmark $mark" - save_command "run_ip rule add fwmark $mark pref $((10000 + $mark)) table $number" - echo "qt ip rule del fwmark $mark" >> ${VARDIR}/undo_routing + indent >&3 << __EOF__ +qt ip rule del fwmark $mark +run_ip rule add fwmark $mark pref $((10000 + $mark)) table $number +echo "qt ip rule del fwmark $mark" >> \${VARDIR}/undo_routing +__EOF__ fi loose= @@ -221,6 +225,7 @@ rulenum=0 find_interface_addresses $interface | while read address; do qt ip rule del from \$address run_ip rule add from \$address pref \$(( $rulebase + \$rulenum )) table $number + echo "qt ip rule del from \$address" >> \${VARDIR}/undo_routing rulenum=\$((\$rulenum + 1)) done __EOF__ @@ -300,8 +305,9 @@ __EOF__ save_command "qt ip rule del $source $dest $priority" 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" } # @@ -322,8 +328,8 @@ __EOF__ # Undo any changes made the last time that we [re]started # undo_routing -echo "cp /etc/iproute2/rt_tables \${VARDIR}/" -ip route ls | grep -E '^\s*(default |nexthop )' > ${VARDIR}default_route +cp /etc/iproute2/rt_tables \${VARDIR}/ +ip route ls | grep -E '^\s*(default |nexthop )' > \${VARDIR}/default_route > \${VARDIR}/undo_routing __EOF__ save_progress_message "Adding Providers..."