From 99a60995c47348ea3281cf992f1605712b1c7598 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Tue, 16 Jun 2020 22:59:51 -0400 Subject: [PATCH] Fix `use=ip` when `ip` is set to an IPv4 address Before, with `use=ip,ip=1.2.3.4`, `get_ip` would return `undef` and print a warning: WARNING: found neither ipv4 nor ipv6 address --- ChangeLog.md | 2 ++ ddclient | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog.md b/ChangeLog.md index bcedbcf..854c9b7 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -11,6 +11,8 @@ repository history](https://github.com/ddclient/ddclient/commits/master). ### Bug fixes + * Fixed a regression introduced in v3.9.0 that caused + `use=ip,ip=` to fail. * "true" is now accepted as a boolean value. ### Compatibility and dependency changes diff --git a/ddclient b/ddclient index 6b8294b..cdc98b0 100755 --- a/ddclient +++ b/ddclient @@ -2287,7 +2287,9 @@ sub get_ip { $skip =~ s/ /\\s/is; $reply =~ s/^.*?${skip}//is; } - if ($reply =~ /^.*?\b(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\b.*/is) { + if (defined($ip)) { + # no need to parse $reply + } elsif ($reply =~ /^.*?\b(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\b.*/is) { $ip = $1; $ip = un_zero_pad($ip); $ip = filter_local($ip) if opt('fw-banlocal', $h);