Fixing bug #13: multiple fetch-ip but introducing a multiple ip bug

git-svn-id: svn+ssh://svn.code.sf.net/p/ddclient/code/trunk@121 3873ddee-7413-0410-b6c4-c2c57c1ab35a
This commit is contained in:
wimpunk 2010-10-13 20:29:16 +00:00
parent 4edbb7a3e9
commit e406318257

View file

@ -741,6 +741,7 @@ sub runpostscript {
###################################################################### ######################################################################
sub update_nics { sub update_nics {
my %examined = (); my %examined = ();
my %iplist = ();
foreach my $s (sort keys %services) { foreach my $s (sort keys %services) {
my (@hosts, %ips) = (); my (@hosts, %ips) = ();
@ -752,7 +753,15 @@ sub update_nics {
$examined{$h} = 1; $examined{$h} = 1;
my $use = $config{$h}{'use'} || opt('use'); my $use = $config{$h}{'use'} || opt('use');
local $opt{$use} = $config{$h}{$use} if $config{$h}{$use}; local $opt{$use} = $config{$h}{$use} if $config{$h}{$use};
my $ip = get_ip($use, $h); # bug #13: we should only do this once
# use isn't enough, we have to save the origin to.
# this will break the multiple ip stuff if use has
# been used twice for the same device.
my $ip = "";
if (defined $iplist{$use}) {
$ip = $iplist{$use};
} else {
$ip = get_ip($use, $h);
if (!defined $ip || !$ip) { if (!defined $ip || !$ip) {
warning("unable to determine IP address") warning("unable to determine IP address")
if !$daemon || opt('verbose'); if !$daemon || opt('verbose');
@ -762,6 +771,8 @@ sub update_nics {
warning("malformed IP address (%s)", $ip); warning("malformed IP address (%s)", $ip);
next; next;
} }
$iplist{$use} = $ip;
}
$config{$h}{'wantip'} = $ip; $config{$h}{'wantip'} = $ip;
next if !nic_updateable($h, $updateable); next if !nic_updateable($h, $updateable);
push @hosts, $h; push @hosts, $h;