diff --git a/README.md b/README.md index 8fa84d5..fe6583c 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ Dynamic DNS services currently supported include: CloudFlare - See https://www.cloudflare.com/ for details Google - See http://www.google.com/domains for details Duckdns - See https://duckdns.org/ for details + Freemyip - See https://freemyip.com for details woima.fi - See https://woima.fi/ for details DDclient now supports many of cable/dsl broadband routers. @@ -43,7 +44,7 @@ REQUIREMENTS: - Perl 5.014 or later (you need the IO::Socket::SSL perl library for ssl-support, - JSON::Any perl library for JSON support and + JSON::PP perl library for JSON support and IO::Socket:INET6 perl library for ipv6-support) - Linux or probably any common Unix system diff --git a/README.ssl b/README.ssl index 1d0e2f1..ed8d19b 100644 --- a/README.ssl +++ b/README.ssl @@ -8,3 +8,4 @@ On alpine, you need perl-io-socket-ssl to have IO::Socket::SSL ssl support is tested on folowing dynamic dns providers: - dyndns.com +- freemyip.com diff --git a/ddclient b/ddclient index 949595c..524a00b 100755 --- a/ddclient +++ b/ddclient @@ -487,6 +487,10 @@ my %variables = ( 'server' => setv(T_FQDNP, 1, 0, 1, 'www.duckdns.org', undef), 'login' => setv(T_LOGIN, 0, 0, 0, 'unused', undef), }, + 'freemyip-common-defaults' => { + 'server' => setv(T_FQDNP, 1, 0, 1, 'freemyip.com', undef), + 'login' => setv(T_LOGIN, 0, 0, 0, 'unused', undef), + }, 'woima-common-defaults' => { 'static' => setv(T_BOOL, 0, 1, 1, 0, undef), 'wildcard' => setv(T_BOOL, 0, 1, 1, 0, undef), @@ -694,6 +698,15 @@ my %services = ( $variables{'service-common-defaults'}, ), }, + 'freemyip' => { + 'updateable' => undef, + 'update' => \&nic_freemyip_update, + 'examples' => \&nic_freemyip_examples, + 'variables' => merge( + $variables{'freemyip-common-defaults'}, + $variables{'service-common-defaults'}, + ), + }, 'woima' => { 'updateable' => undef, 'update' => \&nic_woima_update, @@ -2036,13 +2049,13 @@ EOM ## load_json_support ###################################################################### sub load_json_support { - my $json_loaded = eval {require JSON::Any}; + my $json_loaded = eval {require JSON::PP}; unless ($json_loaded) { fatal(<<"EOM"); -Error loading the Perl module JSON::Any needed for cloudflare update. +Error loading the Perl module JSON::PP needed for cloudflare update. EOM } - import JSON::Any; + import JSON::PP (qw/decode_json/); } ###################################################################### ## geturl @@ -3983,7 +3996,10 @@ EoEXAMPLE ## ###################################################################### sub nic_freedns_update { + + debug("\nnic_freedns_update -------------------"); + ## First get the list of updatable hosts my $url; # note, use '&v=2' in $url in order to pull IPv6 AAAA records as well as IPv4 A records @@ -4022,9 +4038,9 @@ sub nic_freedns_update { my $ip = delete $config{$h}{'wantip'}; my $ipv6 = delete $config{$h}{'wantipv6'}; - info("%s: setting IP address(s) to %s / %s", $h, define($ip, ""), define($ipv6, "")); + info("%s: setting IP address(s) to %s / %s", $h, define($ip, ""), define($ipv6, "")); - if (defined($freedns_hosts{$h}) && defined($ip)) { + if (defined($freedns_hosts{$h}) && defined($ip)) { if($ip eq $freedns_hosts{$h}->[1]) { $config{$h}{'ip'} = $ip; $config{$h}{'mtime'} = $now; @@ -4561,9 +4577,9 @@ sub nic_cloudflare_update { # Strip header $reply =~ s/^.*?\n\n//s; - my $response = JSON::Any->jsonToObj($reply); - if ($response->{result} eq 'error') { - failed ("%s", $response->{msg}); + my $response = eval {decode_json($reply)}; + if (!defined $response || !defined $response->{result}) { + failed ("invalid json or result."); next; } @@ -4588,9 +4604,9 @@ sub nic_cloudflare_update { # Strip header $reply =~ s/^.*?\n\n//s; - $response = JSON::Any->jsonToObj($reply); - if ($response->{result} eq 'error') { - failed ("%s", $response->{msg}); + $response = eval {decode_json($reply)}; + if (!defined $response || !defined $response->{result}) { + failed ("invalid json or result."); next; } @@ -4614,9 +4630,9 @@ sub nic_cloudflare_update { # Strip header $reply =~ s/^.*?\n\n//s; - $response = JSON::Any->jsonToObj($reply); - if ($response->{result} eq 'error') { - failed ("%s", $response->{msg}); + $response = eval {decode_json($reply)}; + if (!defined $response || !defined $response->{result}) { + failed ("invalid json or result."); } else { success ("%s -- Updated Successfully to %s", $domain, $ip); @@ -4710,6 +4726,80 @@ sub nic_duckdns_update { } } +###################################################################### +## nic_freemyip_examples +###################################################################### +sub nic_freemyip_examples { + return <' \ + http://169.254.1.1:49000/upnp/control/WANCommonIFC1 | \ + sed -n -e 's#^.*\(.*\).*$#\1#p'