From 743994a651e76254f2f079e896efd5cf5f3a29b3 Mon Sep 17 00:00:00 2001 From: gnhb Date: Tue, 8 Jun 2010 18:46:56 +0700 Subject: Give more time for getting dhcp address and DNS lookup. --- etc/inc/interfaces.inc | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'etc/inc/interfaces.inc') diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index 6b75e7e..331b101 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -923,9 +923,9 @@ function interface_ppps_configure($interface) { // configure DHCP on the $port interface interface_dhcp_configure($port); // Wait for the IP address before proceeding. - for ($count = 0; $count < 15; $count++) { + for ($count = 0; $count < 30; $count++) { $localips[$pid] = find_interface_ip($port); - if(!empty($localips[$pid])) + if(is_ipaddr($localips[$pid])) break; sleep(1); } @@ -937,9 +937,16 @@ function interface_ppps_configure($interface) { escapeshellarg($localips[$pid] . "/" . $subnets[$pid]) . " up"); } /* configure the gateway (remote IP ) */ - if (!empty($gateways[$pid]) && is_hostname($gateways[$pid]) && !is_ipaddr($gateways[$pid])) { + if (!is_ipaddr($gateways[$pid]) && is_hostname($gateways[$pid])) { // do a DNS lookup for the gateway IP and store it in $gateways[$pid] - $gateways[$pid] = gethostbyname($gateways[$pid]); + for ($count = 0; $count < 30; $count++) { + $gateways[$pid] = gethostbyname($gateways[$pid]); + if(is_ipaddr($gateways[$pid])) + break; + sleep(1); + } + log_error("Could not get a PPtP/L2tP Remote IP address for {$port} using DNS in interfaces_ppps_configure"); + return 0; } if (0) // Logic for this? log_error("Could not bring up interface {$port} for {$interface} {$ppp['type']} link in interface_ppps_configure()."); -- cgit v1.1