summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Byington <carl@five-ten-sg.com>2015-02-28 09:45:35 -0800
committerDaniil Baturin <daniil@baturin.org>2015-05-03 19:16:23 +0200
commit43776581a00bfa18d690b10be6ac4dbc2e0d2a96 (patch)
treee1d94a1307ba061096215ca2143cdc8c1c6a2158
parenta6fa2832d278e9cbcce22436061464f883df1922 (diff)
downloadvyatta-cfg-quagga-43776581a00bfa18d690b10be6ac4dbc2e0d2a96.tar.gz
vyatta-cfg-quagga-43776581a00bfa18d690b10be6ac4dbc2e0d2a96.zip
allow dhcp-interface for the next-hop on static routes
Signed-off-by: Daniil Baturin <daniil@baturin.org>
-rwxr-xr-xscripts/vyatta-static-dhcp.pl11
1 files changed, 8 insertions, 3 deletions
diff --git a/scripts/vyatta-static-dhcp.pl b/scripts/vyatta-static-dhcp.pl
index cf72930c..33afe3bb 100755
--- a/scripts/vyatta-static-dhcp.pl
+++ b/scripts/vyatta-static-dhcp.pl
@@ -14,7 +14,7 @@ GetOptions("interface=s" => \$iface,
"reason=s" => \$reason);
# check if an update is needed
-exit(0) if (($iface ne $dhcp) || (($oip eq $nip) && ($orouters eq $nrouters)) || ($reason ne "BOUND"));
+exit(0) if (($iface ne $dhcp) || (($oip eq $nip) && ($orouters eq $nrouters)));
logger("DHCP address on $iface updated to $nip,$nrouters from $oip,$orouters: Updating static route $route in table $table.");
my $tab;
if ($table eq "main") {
@@ -28,8 +28,13 @@ if ($orouters ne $nrouters) {
}
if (($oip ne $nip) && ($table ne "main") && ($route eq "0.0.0.0/0")) {
my $mark = 0x7fffffff + $table;
- system("sudo /sbin/iptables -t mangle -D OUTPUT -s $oip/32 -j MARK --set-mark $mark");
- system("sudo /sbin/iptables -t mangle -A OUTPUT -s $nip/32 -j MARK --set-mark $mark");
+ if ($oip ne "") {
+ system("sudo /sbin/iptables -t mangle -D OUTPUT -s $oip/32 -j MARK --set-mark $mark");
+ }
+ if ($nip ne "") {
+ 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");
+ }
}
sub logger {