From a178d40633c3cdd64b20f09174ec5ecac88985ed Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Thu, 29 Aug 2024 13:20:01 -0400 Subject: [PATCH] update_nics: Combine post-`update` host loops --- ddclient.in | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/ddclient.in b/ddclient.in index 4ac3927..15e508a 100755 --- a/ddclient.in +++ b/ddclient.in @@ -1460,17 +1460,14 @@ sub update_nics { $config{$h}{'wantip'} = $config{$h}{'wantipv4'} // $config{$h}{'wantipv6'}; } &$update(@hosts); - for my $h (@hosts) { - delete($config{$h}{$_}) for qw(wantip wantipv4 wantipv6); - } - - # Backwards compatibility: Legacy protocol implementations read `wantip` and set `ip` - # and `status`. Modern protocol implementations read `wantipv4` and `wantipv6` and set - # `ipv4`, `ipv6`, `status-ipv4`, and `status-ipv6`. Make legacy implementations look - # like modern implementations by moving `ip` and `status` to the modern - # version-specific equivalents. for my $h (@hosts) { local $_l = pushlogctx($h); + delete($config{$h}{$_}) for qw(wantip wantipv4 wantipv6); + # Backwards compatibility: Legacy protocol implementations read `wantip` and set + # `ip` and `status`. Modern protocol implementations read `wantipv4` and + # `wantipv6` and set `ipv4`, `ipv6`, `status-ipv4`, and `status-ipv6`. Make legacy + # implementations look like modern implementations by moving `ip` and `status` to + # the modern version-specific equivalents. my $status = delete($config{$h}{'status'}) or next; my $ip = $config{$h}{'ip'}; my $ipv = is_ipv4($ip) ? '4' : is_ipv6($ip) ? '6' : undef;