diff options
author | Christian Poessinger <christian@poessinger.com> | 2018-11-27 15:43:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-27 15:43:30 +0100 |
commit | 4cc8f2d4bb9c72f662d5d453e6ac954e64cb7a16 (patch) | |
tree | 6d0a4bfad250aafcf5d104db45b46447f034d69c | |
parent | c03bf343285b0c79cba59df90139e491e29057b2 (diff) | |
parent | 8f4b8917d23b42d15b7f48eb3f814a56cc5a4343 (diff) | |
download | vyatta-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.pl | 5 |
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; } |