From 78be40fe2c91b4e97434cbe6d6ecc466803d2b5c Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Sat, 24 Aug 2024 23:29:46 -0400 Subject: [PATCH] update_nics: Remove unnecessary assertions These just add cold code paths and impair readability and maintainability. --- ddclient.in | 9 --------- 1 file changed, 9 deletions(-) diff --git a/ddclient.in b/ddclient.in index 9ce8077..5fdf82d 100755 --- a/ddclient.in +++ b/ddclient.in @@ -1470,11 +1470,6 @@ sub update_nics { my $status = delete($config{$h}{'status'}) || next; my $ip = $config{$h}{'ip'}; my $ipv = is_ipv4($ip) ? '4' : is_ipv6($ip) ? '6' : undef; - if (!defined($ipv)) { - warning("ddclient bug: legacy protocol set 'status' but did not set 'ip' " . - "to an IPv4 or IPv6 address: " . ($ip // '')); - next; - } # TODO: Currently $config{$h}{'ip'} is used for two distinct purposes: it holds the # value of the --ip option, and it is updated by legacy protocols to hold the new # IP address after an update. Fortunately, the --ip option is not used very often, @@ -1486,10 +1481,6 @@ sub update_nics { my $ip_option = opt('use', $h) eq 'ip' || opt('usev6', $h) eq 'ip'; delete($config{$h}{'ip'}) if !$ip_option; debug("legacy protocol; moving status to status-ipv$ipv and ip to ipv$ipv"); - if (defined(my $vstatus = $config{$h}{"status-ipv$ipv"})) { - warning("ddclient bug: legacy protocol set both 'status' (to '$status') " . - "and 'status-ipv$ipv' (to '$vstatus')"); - } $config{$h}{"status-ipv$ipv"} = $status; # TODO: See above comment for $ip_option. This is the same situation, but for # 'ipv4' and 'ipv6'.