summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorCarl Byington <carl@five-ten-sg.com>2015-04-22 11:12:34 -0700
committerDaniil Baturin <daniil@baturin.org>2015-05-03 19:16:23 +0200
commit37ddd5f9f2fb584e467374b59ad89e49f0ff1b6f (patch)
treea498621d508bdd8ad6ee6cf6b1867e91f1f1a465 /scripts
parent43776581a00bfa18d690b10be6ac4dbc2e0d2a96 (diff)
downloadvyatta-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-xscripts/vyatta-static-dhcp.pl9
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");
}