From: opensides Date: Fri, 4 Sep 2009 22:21:57 +0000 (+0000) Subject: - Added other part of bug 673 patch for linux vserver X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=88dabea136b599a537f8bcfa4b90ab479b23d6b9;p=gosa.git - Added other part of bug 673 patch for linux vserver - Tested on my box and seems to work git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14216 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-si/modules/GosaSupportDaemon.pm b/gosa-si/modules/GosaSupportDaemon.pm index b3a431677..1301f6605 100644 --- a/gosa-si/modules/GosaSupportDaemon.pm +++ b/gosa-si/modules/GosaSupportDaemon.pm @@ -664,17 +664,36 @@ sub get_local_ip_for_remote_ip { # Eat header line shift @ifs; chomp @ifs; + my $iffallback = ''; + + # linux-vserver might have * as Iface due to hidden interfaces, set a default + foreach my $line(@ifs) { + my ($Iface,$Destination,$Gateway,$Flags,$RefCnt,$Use,$Metric,$Mask,$MTU,$Window,$IRTT)=split(/\s/, $line); + if ($Iface =~ m/^[^\*]+$/) { + $iffallback = $Iface; + } + } + foreach my $line(@ifs) { my ($Iface,$Destination,$Gateway,$Flags,$RefCnt,$Use,$Metric,$Mask,$MTU,$Window,$IRTT)=split(/\s/, $line); my $destination; my $mask; my ($d,$c,$b,$a)=unpack('a2 a2 a2 a2', $Destination); + if ($Iface =~ m/^[^\*]+$/) { + $iffallback = $Iface; + } $destination= sprintf("%d.%d.%d.%d", hex($a), hex($b), hex($c), hex($d)); ($d,$c,$b,$a)=unpack('a2 a2 a2 a2', $Mask); $mask= sprintf("%d.%d.%d.%d", hex($a), hex($b), hex($c), hex($d)); if(new NetAddr::IP($remote_ip)->within(new NetAddr::IP($destination, $mask))) { # destination matches route, save mac and exit - $result= &get_ip($Iface); + #$result= &get_ip($Iface); + + if ($Iface =~ m/^\*$/ ) { + $result= &get_ip($iffallback); + } else { + $result= &get_ip($Iface); + } last; } }