diff options
author | Kim <kim.sidney@gmail.com> | 2021-08-09 16:06:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-09 16:06:18 +0200 |
commit | 2cec760601a6e85ca8e0b6a30c173196a97a777a (patch) | |
tree | ef8f0f69f8b3be4b3601f76d95f9b023b73138b5 | |
parent | 18811dcb780892d04a7a571a9357ba2b61b0693c (diff) | |
download | vyatta-cfg-vpn-2cec760601a6e85ca8e0b6a30c173196a97a777a.tar.gz vyatta-cfg-vpn-2cec760601a6e85ca8e0b6a30c173196a97a777a.zip |
VTI: T1501: VPN Commit Errors (#45)
Add a loop to check for the dhcp ip address so the commit will not fail if
the interface was configured in the same config session as the vti interface.
-rwxr-xr-x | scripts/vyatta-vti-config.pl | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/scripts/vyatta-vti-config.pl b/scripts/vyatta-vti-config.pl index 00685d5..3dcaa63 100755 --- a/scripts/vyatta-vti-config.pl +++ b/scripts/vyatta-vti-config.pl @@ -48,6 +48,8 @@ my $intfName=""; my $conn_name=""; my $action=""; my $checkref=""; +my $dhcp_wait_attempts = 3; +my $dhcp_wait_sleep = 1; GetOptions( "updown" => \$updown, @@ -355,6 +357,13 @@ sub get_dhcp_addr { if (!(Vyatta::Misc::is_dhcp_enabled($dhcp_iface,0))); my @dhcp_addr = Vyatta::Misc::getIP($dhcp_iface,4); my $addr = pop(@dhcp_addr); + my $count = 0; + while (!defined($addr) and $count < $dhcp_wait_attempts){ + @dhcp_addr = Vyatta::Misc::getIP($dhcp_iface,4); + $addr = pop(@dhcp_addr); + $count++; + sleep($dhcp_wait_sleep); + } if (!defined($addr)){ $addr = ''; return $addr; |