From feb69a79f799a757f8506e6e0e12be1d6d031c14 Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Thu, 29 May 2008 14:10:28 +0000 Subject: find ptp gateway earlier --- lib/network/tools.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/network/tools.pm b/lib/network/tools.pm index 1b49572..adddf0e 100644 --- a/lib/network/tools.pm +++ b/lib/network/tools.pm @@ -189,8 +189,7 @@ sub get_interface_status { my ($intf) = @_; $intf = get_real_interface($intf); my $routes = get_routes(); - return $routes->{$intf}{network}, - $routes->{$intf}{network} eq '0.0.0.0' && ($routes->{$intf}{gateway} || get_interface_ptp_address($intf)); + return $routes->{$intf}{network}, $routes->{$intf}{network} eq '0.0.0.0' && $routes->{$intf}{gateway}; } #- returns (gateway_interface, interface is up, gateway address, dns server address) @@ -268,6 +267,7 @@ sub get_routes() { if (defined $4) { $routes{$1}{metric} = $4 } } } + $routes{$_}{gateway} ||= get_interface_ptp_address($_) foreach keys %routes; #- TODO: handle IPv6 with /proc/net/ipv6_route \%routes; } -- cgit v1.2.1