diff options
author | Carl Byington <carl@five-ten-sg.com> | 2015-04-22 11:12:34 -0700 |
---|---|---|
committer | Daniil Baturin <daniil@baturin.org> | 2015-05-03 19:16:23 +0200 |
commit | 37ddd5f9f2fb584e467374b59ad89e49f0ff1b6f (patch) | |
tree | a498621d508bdd8ad6ee6cf6b1867e91f1f1a465 /scripts | |
parent | 43776581a00bfa18d690b10be6ac4dbc2e0d2a96 (diff) | |
download | vyatta-cfg-quagga-37ddd5f9f2fb584e467374b59ad89e49f0ff1b6f.tar.gz vyatta-cfg-quagga-37ddd5f9f2fb584e467374b59ad89e49f0ff1b6f.zip |
remove old routes when dhcp gateway changes, avoid routing thru 127.0.0.1
Signed-off-by: Daniil Baturin <daniil@baturin.org>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/vyatta-static-dhcp.pl | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/scripts/vyatta-static-dhcp.pl b/scripts/vyatta-static-dhcp.pl index 33afe3bb..fa4a7f62 100755 --- a/scripts/vyatta-static-dhcp.pl +++ b/scripts/vyatta-static-dhcp.pl @@ -24,14 +24,19 @@ else { $tab = "table $table"; } if ($orouters ne $nrouters) { - system("vtysh -c 'configure terminal' -c 'ip route $route $nrouters $tab' "); + if ($orouters ne "") { + system("vtysh -c 'configure terminal' -c 'no ip route $route $orouters $tab' "); + } + if (($nrouters ne "") && ($nrouters ne "127.0.0.1")) { + system("vtysh -c 'configure terminal' -c 'ip route $route $nrouters $tab' "); + } } if (($oip ne $nip) && ($table ne "main") && ($route eq "0.0.0.0/0")) { my $mark = 0x7fffffff + $table; if ($oip ne "") { system("sudo /sbin/iptables -t mangle -D OUTPUT -s $oip/32 -j MARK --set-mark $mark"); } - if ($nip ne "") { + if (($nip ne "") && ($nip ne "127.0.0.1")) { system("sudo /sbin/iptables -t mangle -D OUTPUT -s $nip/32 -j MARK --set-mark $mark"); system("sudo /sbin/iptables -t mangle -A OUTPUT -s $nip/32 -j MARK --set-mark $mark"); } |