summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2018-11-27 15:43:30 +0100
committerGitHub <noreply@github.com>2018-11-27 15:43:30 +0100
commit4cc8f2d4bb9c72f662d5d453e6ac954e64cb7a16 (patch)
tree6d0a4bfad250aafcf5d104db45b46447f034d69c
parentc03bf343285b0c79cba59df90139e491e29057b2 (diff)
parent8f4b8917d23b42d15b7f48eb3f814a56cc5a4343 (diff)
downloadvyatta-cfg-system-4cc8f2d4bb9c72f662d5d453e6ac954e64cb7a16.tar.gz
vyatta-cfg-system-4cc8f2d4bb9c72f662d5d453e6ac954e64cb7a16.zip
Merge pull request #86 from runborg/T1045
T1045: static route dhcp-interface: check for ip in response
-rw-r--r--scripts/vyatta-dhcp-helper.pl5
1 files changed, 4 insertions, 1 deletions
diff --git a/scripts/vyatta-dhcp-helper.pl b/scripts/vyatta-dhcp-helper.pl
index 6febbaf9..4b236503 100644
--- a/scripts/vyatta-dhcp-helper.pl
+++ b/scripts/vyatta-dhcp-helper.pl
@@ -22,9 +22,12 @@ sub get_dhcp_router {
my $router = `grep new_routers= $lease | cut -d"'" -f2`;
my @r = split(/,/, $router);
$router = $r[0];
- if ($router eq "") {
+ # Make sure the result looks like a IP
+ if ($router !~ /\d+\.\d+\.\d+\.\d+/) {
return "127.0.0.1";
}
+ # Remove trailing newlines
+ $router =~ s/\n$//;
return $router;
}