From: <abe...@us...> - 2017-04-22 17:20:48
|
Revision: 8271 http://sourceforge.net/p/astlinux/code/8271 Author: abelbeck Date: 2017-04-22 17:20:46 +0000 (Sat, 22 Apr 2017) Log Message: ----------- ddclient, add upstream features by David Kerr Ref: https://github.com/astlinux-project/ddclient-curl/compare/bdb05a876fb0...549bcb66f2c3 Added Paths: ----------- branches/1.0/package/ddclient/ddclient-0001-upstream-4da69be-549bcb6.patch Added: branches/1.0/package/ddclient/ddclient-0001-upstream-4da69be-549bcb6.patch =================================================================== --- branches/1.0/package/ddclient/ddclient-0001-upstream-4da69be-549bcb6.patch (rev 0) +++ branches/1.0/package/ddclient/ddclient-0001-upstream-4da69be-549bcb6.patch 2017-04-22 17:20:46 UTC (rev 8271) @@ -0,0 +1,232 @@ +From 4da69be41f1d5bf64b8e3d1fad66c9da86fac837 Mon Sep 17 00:00:00 2001 +From: David Kerr <da...@ke...> +Date: Sat, 22 Apr 2017 10:20:43 -0400 +Subject: [PATCH 1/2] Record update status of IPv6 separate from IPv4 (ie, + don't use same variable for both). + +--- + ddclient | 18 ++++++++++-------- + 1 file changed, 10 insertions(+), 8 deletions(-) + +diff --git a/ddclient b/ddclient +index cfd6f6a..443b4e9 100755 +--- a/ddclient ++++ b/ddclient +@@ -416,6 +416,7 @@ my %variables = ( + 'mtime' => setv(T_NUMBER, 0, 1, 0, 0, undef), + 'atime' => setv(T_NUMBER, 0, 1, 0, 0, undef), + 'status' => setv(T_ANY, 0, 1, 0, '', undef), ++ 'status-ipv6' => setv(T_ANY, 0, 1, 0, '', undef), + 'min-interval' => setv(T_DELAY, 0, 0, 1, interval('30s'), 0), + 'max-interval' => setv(T_DELAY, 0, 0, 1, interval('25d'), 0), + 'min-error-interval' => setv(T_DELAY, 0, 0, 1, interval('5m'), 0), +@@ -2478,7 +2479,7 @@ sub nic_updateable { + + } elsif ((defined($config{$host}{'usev6'}) && ($config{$host}{'usev6'} ne 'no') ) && + ((!exists($cache{$host}{'ipv6'})) || ("$cache{$host}{'ipv6'}" ne "$ipv6"))) { +- if (($cache{$host}{'status'} eq 'good') && ++ if (($cache{$host}{'status-ipv6'} eq 'good') && + !interval_expired($host, 'mtime', 'min-interval')) { + warning("skipping update of %s from %s to %s.\nlast updated %s.\nWait at least %s between update attempts.", + $host, +@@ -2490,7 +2491,7 @@ sub nic_updateable { + if opt('verbose') || !define($cache{$host}{'warned-min-interval'}, 0); + $cache{$host}{'warned-min-interval'} = $now; + +- } elsif (($cache{$host}{'status'} ne 'good') && !interval_expired($host, 'atime', 'min-error-interval')) { ++ } elsif (($cache{$host}{'status-ipv6'} ne 'good') && !interval_expired($host, 'atime', 'min-error-interval')) { + warning("skipping update of %s from %s to %s.\nlast updated %s but last attempt on %s failed.\nWait at least %s between update attempts.", + $host, + ($cache{$host}{'ipv6'} ? $cache{$host}{'ipv6'} : '<nothing>'), +@@ -2530,6 +2531,7 @@ sub nic_updateable { + } + } + $config{$host}{'status'} = define($cache{$host}{'status'},''); ++ $config{$host}{'status-ipv6'} = define($cache{$host}{'status-ipv6'},''); + $config{$host}{'update'} = $update; + if ($update) { + $config{$host}{'status'} = 'noconnect'; +@@ -3855,7 +3857,7 @@ sub nic_freedns_update { + if($ipv6 eq $freedns_hosts_ipv6{$h}->[1]) { + $config{$h}{'ipv6'} = $ipv6; + $config{$h}{'mtime'} = $now; +- $config{$h}{'status'} = 'good'; ++ $config{$h}{'status-ipv6'} = 'good'; + success("update not necessary %s: good: IPv6 address already set to %s", $h, $ipv6); + } else { + debug("Update: %s", $freedns_hosts_ipv6{$h}->[2]."&address=".$ipv6); +@@ -3868,10 +3870,10 @@ sub nic_freedns_update { + if($reply =~ /Updated.*$h.*to.*$ipv6/) { + $config{$h}{'ipv6'} = $ipv6; + $config{$h}{'mtime'} = $now; +- $config{$h}{'status'} = 'good'; ++ $config{$h}{'status-ipv6'} = 'good'; + success("updating %s: good: IPv6 address set to %s", $h, $ipv6); + } else { +- $config{$h}{'status'} = 'failed'; ++ $config{$h}{'status-ipv6'} = 'failed'; + warning("SENT: %s", $freedns_hosts_ipv6{$h}->[2]) unless opt('verbose'); + warning("REPLIED: %s", $reply); + failed("updating %s: Invalid reply.", $h); +@@ -4441,7 +4443,7 @@ sub nic_cloudflare_update { + # Cache + $config{$key}{'ipv6'} = $ipv6; + $config{$key}{'mtime'} = $now; +- $config{$key}{'status'} = 'good'; ++ $config{$key}{'status-ipv6'} = 'good'; + } + } + } +@@ -4654,7 +4656,7 @@ sub nic_he_update { + foreach my $line (@reply) { + my ($status, $ipv6_ignore) = split / /, lc $line; + +- $config{$host}{'status'} = $status; ++ $config{$host}{'status-ipv6'} = $status; + if ($status eq 'good') { + success("updating %s: IPv6 address set to %s", $host, $ipv6); + $config{$host}{'ipv6'} = $ipv6; +@@ -4665,7 +4667,7 @@ sub nic_he_update { + warning("updating %s: No DNS 'AAAA' record update required; %s", $host, $errors{$status}); + $config{$host}{'ipv6'} = $ipv6; + $config{$host}{'mtime'} = $now; +- $config{$host}{'status'} = 'good'; ++ $config{$host}{'status-ipv6'} = 'good'; + + } else { + failed("updating %s: %s: %s", $host, $status, $errors{$status}); + +From 549bcb66f2c3eb9f3a52445f6d11d0c37e0e55dd Mon Sep 17 00:00:00 2001 +From: David Kerr <da...@ke...> +Date: Sat, 22 Apr 2017 10:22:44 -0400 +Subject: [PATCH 2/2] Add command line option "-max-warn" to configure the + maximum number of times a warning message should be logged. When in daemon + mode and an IP address is not found for some reason (e.g. using a cmd to + query a host and that host has gone offline) ddclient would fill up syslog + with the same warning every couple of minutes. We now default to logging the + message only once but you can specify number of times you would like it + logged with e.g. "-max-warn 9" which would log the warning 9 times (you can + specify any number). + +--- + ddclient | 65 ++++++++++++++++++++++++++++++++++++++++++---------------------- + 1 file changed, 43 insertions(+), 22 deletions(-) + +diff --git a/ddclient b/ddclient +index 443b4e9..ea1d50d 100755 +--- a/ddclient ++++ b/ddclient +@@ -734,6 +734,7 @@ my @opt = ( + [ "retry", "!", "-{no}retry : retry failed updates." ], + [ "force", "!", "-{no}force : force an update even if the update may be unnecessary" ], + [ "timeout", "=i", "-timeout max : wait at most 'max' seconds for the host to respond" ], ++ [ "max-warn", "=i", "-max-warn max : maximum nubmer of warning messages for undefined IP address" ], + + [ "syslog", "!", "-{no}syslog : log messages to syslog" ], + [ "facility", "=s", "-facility {type} : log messages to syslog to facility {type}" ], +@@ -763,6 +764,8 @@ my ($result, %config, %globals, %cache); + my $saved_cache = ''; + my %saved_opt = %opt; + $result = 'OK'; ++my (%warned_ipv4, %warned_ipv6); ++my $inv_ip_warn_count = define(opt('max-warn'),1); + + test_geturl(opt('geturl')) if opt('geturl'); + +@@ -2415,6 +2418,14 @@ sub nic_updateable { + my $ip = $config{$host}{'wantip'}; + my $ipv6 = $config{$host}{'wantipv6'}; + ++ if (defined($config{$host}{'use'}) && ($config{$host}{'use'} ne 'no') && define($ipv6,0) && define($warned_ipv6{$host},0) ) { ++ $warned_ipv6{$host} = 0; ++ warning("IPv6 address for %s valid: %s. Reset warning count", $host, $ipv6); ++ } ++ if (defined($config{$host}{'usev6'}) && ($config{$host}{'usev6'} ne 'no') && define($ip,0) && define($warned_ipv4{$host},0) ) { ++ $warned_ipv4{$host} = 0; ++ warning("IP address for %s valid: %s. Reset warning count", $host, $ip); ++ } + if ($config{$host}{'login'} eq '') { + warning("null login name specified for host %s.", $host); + +@@ -2462,16 +2473,21 @@ sub nic_updateable { + + } elsif (($cache{$host}{'status'} ne 'good') && !interval_expired($host, 'atime', 'min-error-interval')) { + +- warning("skipping update of %s from %s to %s.\nlast updated %s but last attempt on %s failed.\nWait at least %s between update attempts.", +- $host, +- ($cache{$host}{'ip'} ? $cache{$host}{'ip'} : '<nothing>'), +- $ip, +- ($cache{$host}{'mtime'} ? prettytime($cache{$host}{'mtime'}) : '<never>'), +- ($cache{$host}{'atime'} ? prettytime($cache{$host}{'atime'}) : '<never>'), +- prettyinterval($config{$host}{'min-error-interval'}) +- ) +- if opt('verbose') || !define($cache{$host}{'warned-min-error-interval'}, 0); +- $cache{$host}{'warned-min-error-interval'} = $now; ++ if (opt('verbose') || (!define($cache{$host}{'warned-min-error-interval'}, 0) && (define($warned_ipv4{$host}, 0) < $inv_ip_warn_count) )) { ++ warning("skipping update of %s from %s to %s.\nlast updated %s but last attempt on %s failed.\nWait at least %s between update attempts.", ++ $host, ++ ($cache{$host}{'ip'} ? $cache{$host}{'ip'} : '<nothing>'), ++ $ip, ++ ($cache{$host}{'mtime'} ? prettytime($cache{$host}{'mtime'}) : '<never>'), ++ ($cache{$host}{'atime'} ? prettytime($cache{$host}{'atime'}) : '<never>'), ++ prettyinterval($config{$host}{'min-error-interval'}) ++ ); ++ if (!define($ip,0) && !opt('verbose')) { ++ $warned_ipv4{$host} = define($warned_ipv4{$host}, 0) + 1; ++ warning ("IP address for %s undefined. Warned %s times, suppressing further warnings", $host, $inv_ip_warn_count) if ($warned_ipv4{$host} >= $inv_ip_warn_count); ++ } ++ } ++ $cache{$host}{'warned-min-error-interval'} = $now; + + } else { + $update = 1; +@@ -2492,16 +2508,21 @@ sub nic_updateable { + $cache{$host}{'warned-min-interval'} = $now; + + } elsif (($cache{$host}{'status-ipv6'} ne 'good') && !interval_expired($host, 'atime', 'min-error-interval')) { +- warning("skipping update of %s from %s to %s.\nlast updated %s but last attempt on %s failed.\nWait at least %s between update attempts.", +- $host, +- ($cache{$host}{'ipv6'} ? $cache{$host}{'ipv6'} : '<nothing>'), +- $ipv6, +- ($cache{$host}{'mtime'} ? prettytime($cache{$host}{'mtime'}) : '<never>'), +- ($cache{$host}{'atime'} ? prettytime($cache{$host}{'atime'}) : '<never>'), +- prettyinterval($config{$host}{'min-error-interval'}) +- ) +- if opt('verbose') || !define($cache{$host}{'warned-min-error-interval'}, 0); +- $cache{$host}{'warned-min-error-interval'} = $now; ++ if (opt('verbose') || (!define($cache{$host}{'warned-min-error-interval'}, 0) && (define($warned_ipv6{$host}, 0) < $inv_ip_warn_count) )) { ++ warning("skipping update of %s from %s to %s.\nlast updated %s but last attempt on %s failed.\nWait at least %s between update attempts.", ++ $host, ++ ($cache{$host}{'ipv6'} ? $cache{$host}{'ipv6'} : '<nothing>'), ++ $ipv6, ++ ($cache{$host}{'mtime'} ? prettytime($cache{$host}{'mtime'}) : '<never>'), ++ ($cache{$host}{'atime'} ? prettytime($cache{$host}{'atime'}) : '<never>'), ++ prettyinterval($config{$host}{'min-error-interval'}) ++ ); ++ if (!define($ipv6,0) && !opt('verbose')) { ++ $warned_ipv6{$host} = define($warned_ipv6{$host}, 0) + 1; ++ warning ("IPv6 address for %s undefined. Warned %s times, suppressing further warnings", $host, $inv_ip_warn_count) if ($warned_ipv6{$host} >= $inv_ip_warn_count); ++ } ++ } ++ $cache{$host}{'warned-min-error-interval'} = $now; + + } else { + $update = 1; +@@ -3825,7 +3846,7 @@ sub nic_freedns_update { + $config{$h}{'ip'} = $ip; + $config{$h}{'mtime'} = $now; + $config{$h}{'status'} = 'good'; +- success("update not necessary %s: good: IPv4 address already set to %s", $h, $ip); ++ success("update not necessary %s: good: IPv4 address already set to %s", $h, $ip) if (!$daemon || opt('verbose')); + } else { + debug("Update: %s", $freedns_hosts{$h}->[2]."&address=".$ip); + my $reply = geturl(opt('proxy'), $freedns_hosts{$h}->[2]."&address=".$ip); +@@ -3858,7 +3879,7 @@ sub nic_freedns_update { + $config{$h}{'ipv6'} = $ipv6; + $config{$h}{'mtime'} = $now; + $config{$h}{'status-ipv6'} = 'good'; +- success("update not necessary %s: good: IPv6 address already set to %s", $h, $ipv6); ++ success("update not necessary %s: good: IPv6 address already set to %s", $h, $ipv6) if (!$daemon || opt('verbose')); + } else { + debug("Update: %s", $freedns_hosts_ipv6{$h}->[2]."&address=".$ipv6); + my $reply = geturl(opt('proxy'), $freedns_hosts_ipv6{$h}->[2]."&address=".$ipv6); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |