get_ip: Log message improvements
This commit is contained in:
parent
b9d372c12d
commit
2530adb39e
1 changed files with 12 additions and 13 deletions
25
ddclient.in
25
ddclient.in
|
@ -2769,7 +2769,7 @@ sub get_ip {
|
||||||
if ($use eq 'ip') {
|
if ($use eq 'ip') {
|
||||||
$ip = opt('ip', $h);
|
$ip = opt('ip', $h);
|
||||||
if (!is_ipv4($ip) && !is_ipv6($ip)) {
|
if (!is_ipv4($ip) && !is_ipv6($ip)) {
|
||||||
warning("'%s' is not a valid IPv4 or IPv6 address", $ip // '');
|
warning('not a valid IPv4 or IPv6 address: ' . ($ip // '<undefined>'));
|
||||||
$ip = undef;
|
$ip = undef;
|
||||||
}
|
}
|
||||||
} elsif ($use eq 'if') {
|
} elsif ($use eq 'if') {
|
||||||
|
@ -2822,7 +2822,7 @@ sub get_ip {
|
||||||
) // '';
|
) // '';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
warning("ignoring unsupported '--use=$use'");
|
warning("ignoring unsupported '--use' strategy: $use");
|
||||||
}
|
}
|
||||||
if (!defined $reply) {
|
if (!defined $reply) {
|
||||||
$reply = '';
|
$reply = '';
|
||||||
|
@ -2832,12 +2832,11 @@ sub get_ip {
|
||||||
$reply =~ s/^.*?${skip}//is;
|
$reply =~ s/^.*?${skip}//is;
|
||||||
}
|
}
|
||||||
$ip //= extract_ipv4($reply) // extract_ipv6($reply);
|
$ip //= extract_ipv4($reply) // extract_ipv6($reply);
|
||||||
warning("found neither IPv4 nor IPv6 address") if !defined($ip);
|
|
||||||
if ($use ne 'ip' && ($ip // '') eq '0.0.0.0') {
|
if ($use ne 'ip' && ($ip // '') eq '0.0.0.0') {
|
||||||
$ip = undef;
|
$ip = undef;
|
||||||
}
|
}
|
||||||
|
warning('did not find an IPv4 or IPv6 address') if !defined($ip);
|
||||||
debug("get_ip: using %s, %s reports %s", $use, $arg // '<undefined>', $ip // '<undefined>');
|
debug("get_ip: using %s, %s reports %s", $use, $arg // '<undefined>', $ip) if $ip;
|
||||||
return $ip;
|
return $ip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3158,7 +3157,7 @@ sub get_ipv4 {
|
||||||
## Static IPv4 address is provided in "ipv4=<address>"
|
## Static IPv4 address is provided in "ipv4=<address>"
|
||||||
$ipv4 = $arg;
|
$ipv4 = $arg;
|
||||||
if (!is_ipv4($ipv4)) {
|
if (!is_ipv4($ipv4)) {
|
||||||
warning("'%s' is not a valid IPv4", $ipv4 // '');
|
warning('not a valid IPv4 address: ' . ($ipv4 // '<undefined>'));
|
||||||
$ipv4 = undef;
|
$ipv4 = undef;
|
||||||
}
|
}
|
||||||
} elsif ($usev4 eq 'ifv4') {
|
} elsif ($usev4 eq 'ifv4') {
|
||||||
|
@ -3221,7 +3220,7 @@ sub get_ipv4 {
|
||||||
) // '';
|
) // '';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
warning("ignoring unsupported '--usev4=$usev4'");
|
warning("ignoring unsupported '--usev4' strategy: $usev4");
|
||||||
}
|
}
|
||||||
|
|
||||||
## Set to loopback address if no text set yet
|
## Set to loopback address if no text set yet
|
||||||
|
@ -3234,8 +3233,8 @@ sub get_ipv4 {
|
||||||
$ipv4 //= extract_ipv4($reply);
|
$ipv4 //= extract_ipv4($reply);
|
||||||
## Return undef for loopback address unless statically assigned by "ipv4=0.0.0.0"
|
## Return undef for loopback address unless statically assigned by "ipv4=0.0.0.0"
|
||||||
$ipv4 = undef if (($usev4 ne 'ipv4') && (($ipv4 // '') eq '0.0.0.0'));
|
$ipv4 = undef if (($usev4 ne 'ipv4') && (($ipv4 // '') eq '0.0.0.0'));
|
||||||
debug("get_ipv4: using (%s, %s) reports %s",
|
warning('did not find an IPv4 address') if !defined($ipv4);
|
||||||
$usev4, $arg // "<undefined>", $ipv4 // "<undefined>");
|
debug("get_ipv4: using (%s, %s) reports %s", $usev4, $arg // "<undefined>", $ipv4) if $ipv4;
|
||||||
return $ipv4;
|
return $ipv4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3260,7 +3259,7 @@ sub get_ipv6 {
|
||||||
}
|
}
|
||||||
$ipv6 = $arg;
|
$ipv6 = $arg;
|
||||||
if (!is_ipv6($ipv6)) {
|
if (!is_ipv6($ipv6)) {
|
||||||
warning("'%s' is not a valid IPv6", $ipv6 // '');
|
warning('not a valid IPv6 address: ' . ($ipv6 // ''));
|
||||||
$ipv6 = undef;
|
$ipv6 = undef;
|
||||||
}
|
}
|
||||||
} elsif ($usev6 eq 'ifv6' || $usev6 eq 'if') {
|
} elsif ($usev6 eq 'ifv6' || $usev6 eq 'if') {
|
||||||
|
@ -3316,7 +3315,7 @@ sub get_ipv6 {
|
||||||
warning("'--usev6=%s' is not implemented and does nothing", $usev6);
|
warning("'--usev6=%s' is not implemented and does nothing", $usev6);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
warning("ignoring unsupported '--usev6=$usev6'");
|
warning("ignoring unsupported '--usev6' strategy: $usev6");
|
||||||
}
|
}
|
||||||
|
|
||||||
## Set to loopback address if no text set yet
|
## Set to loopback address if no text set yet
|
||||||
|
@ -3329,8 +3328,8 @@ sub get_ipv6 {
|
||||||
$ipv6 //= extract_ipv6($reply);
|
$ipv6 //= extract_ipv6($reply);
|
||||||
## Return undef for loopback address unless statically assigned by "ipv6=::"
|
## Return undef for loopback address unless statically assigned by "ipv6=::"
|
||||||
$ipv6 = undef if (($usev6 ne 'ipv6') && ($usev6 ne 'ip') && (($ipv6 // '') eq '::'));
|
$ipv6 = undef if (($usev6 ne 'ipv6') && ($usev6 ne 'ip') && (($ipv6 // '') eq '::'));
|
||||||
debug("get_ipv6: using (%s, %s) reports %s",
|
warning('did not find an IPv6 address') if !defined($ipv6);
|
||||||
$usev6, $arg // '<undefined>', $ipv6 // '<undefined>');
|
debug("get_ipv6: using (%s, %s) reports %s", $usev6, $arg // '<undefined>', $ipv6) if $ipv6;
|
||||||
return $ipv6;
|
return $ipv6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue