add ipv6 support
This commit is contained in:
parent
027fa03895
commit
dc01f09224
2 changed files with 95 additions and 65 deletions
|
@ -42,8 +42,9 @@ REQUIREMENTS:
|
||||||
- one or more accounts from one of the dynamic DNS services
|
- one or more accounts from one of the dynamic DNS services
|
||||||
|
|
||||||
- Perl 5.014 or later
|
- Perl 5.014 or later
|
||||||
(you need the IO::Socket::SSL perl library for ssl-support
|
(you need the IO::Socket::SSL perl library for ssl-support,
|
||||||
and JSON::Any perl library for JSON support)
|
JSON::Any perl library for JSON support and
|
||||||
|
IO::Socket:INET6 perl library for ipv6-support)
|
||||||
|
|
||||||
- Linux or probably any common Unix system
|
- Linux or probably any common Unix system
|
||||||
|
|
||||||
|
|
35
ddclient
35
ddclient
|
@ -345,7 +345,7 @@ my %variables = (
|
||||||
'retry' => setv(T_BOOL, 0, 0, 0, 0, undef),
|
'retry' => setv(T_BOOL, 0, 0, 0, 0, undef),
|
||||||
'force' => setv(T_BOOL, 0, 0, 0, 0, undef),
|
'force' => setv(T_BOOL, 0, 0, 0, 0, undef),
|
||||||
'ssl' => setv(T_BOOL, 0, 0, 0, 0, undef),
|
'ssl' => setv(T_BOOL, 0, 0, 0, 0, undef),
|
||||||
|
'ipv6' => setv(T_BOOL, 0, 0, 0, 0, undef),
|
||||||
'syslog' => setv(T_BOOL, 0, 0, 1, 0, undef),
|
'syslog' => setv(T_BOOL, 0, 0, 1, 0, undef),
|
||||||
'facility' => setv(T_STRING,0, 0, 1, 'daemon', undef),
|
'facility' => setv(T_STRING,0, 0, 1, 'daemon', undef),
|
||||||
'priority' => setv(T_STRING,0, 0, 1, 'notice', undef),
|
'priority' => setv(T_STRING,0, 0, 1, 'notice', undef),
|
||||||
|
@ -380,7 +380,7 @@ my %variables = (
|
||||||
'fw-password' => setv(T_PASSWD,0, 0, 1, '', undef),
|
'fw-password' => setv(T_PASSWD,0, 0, 1, '', undef),
|
||||||
'cmd' => setv(T_PROG, 0, 0, 1, '', undef),
|
'cmd' => setv(T_PROG, 0, 0, 1, '', undef),
|
||||||
'cmd-skip' => setv(T_STRING,0, 0, 1, '', undef),
|
'cmd-skip' => setv(T_STRING,0, 0, 1, '', undef),
|
||||||
|
'ipv6' => setv(T_BOOL, 0, 0, 0, 0, undef),
|
||||||
'ip' => setv(T_IP, 0, 1, 0, undef, undef),
|
'ip' => setv(T_IP, 0, 1, 0, undef, undef),
|
||||||
'wtime' => setv(T_DELAY, 0, 1, 1, 0, interval('30s')),
|
'wtime' => setv(T_DELAY, 0, 1, 1, 0, interval('30s')),
|
||||||
'mtime' => setv(T_NUMBER, 0, 1, 0, 0, undef),
|
'mtime' => setv(T_NUMBER, 0, 1, 0, 0, undef),
|
||||||
|
@ -729,6 +729,7 @@ my @opt = (
|
||||||
[ "debug", "!", "-{no}debug : print {no} debugging information" ],
|
[ "debug", "!", "-{no}debug : print {no} debugging information" ],
|
||||||
[ "verbose", "!", "-{no}verbose : print {no} verbose information" ],
|
[ "verbose", "!", "-{no}verbose : print {no} verbose information" ],
|
||||||
[ "quiet", "!", "-{no}quiet : print {no} messages for unnecessary updates" ],
|
[ "quiet", "!", "-{no}quiet : print {no} messages for unnecessary updates" ],
|
||||||
|
[ "ipv6", "!", "-{no}ipv6 : use ipv6" ],
|
||||||
[ "help", "", "-help : this message" ],
|
[ "help", "", "-help : this message" ],
|
||||||
[ "postscript", "", "-postscript : script to run after updating ddclient, has new IP as param" ],
|
[ "postscript", "", "-postscript : script to run after updating ddclient, has new IP as param" ],
|
||||||
|
|
||||||
|
@ -1048,7 +1049,7 @@ sub parse_assignment {
|
||||||
my ($c, $name, $value);
|
my ($c, $name, $value);
|
||||||
my ($escape, $quote) = (0, '');
|
my ($escape, $quote) = (0, '');
|
||||||
|
|
||||||
if ($rest =~ /^\s*([a-z][a-z_-]*)=(.*)/i) {
|
if ($rest =~ /^\s*([a-z][0-9a-z_-]*)=(.*)/i) {
|
||||||
($name, $rest, $value) = ($1, $2, '');
|
($name, $rest, $value) = ($1, $2, '');
|
||||||
|
|
||||||
while (length($c = substr($rest,0,1))) {
|
while (length($c = substr($rest,0,1))) {
|
||||||
|
@ -1893,6 +1894,24 @@ EOM
|
||||||
import IO::Socket::SSL;
|
import IO::Socket::SSL;
|
||||||
{ no warnings; $IO::Socket::SSL::DEBUG = 0; }
|
{ no warnings; $IO::Socket::SSL::DEBUG = 0; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
## load_ipv6_support
|
||||||
|
######################################################################
|
||||||
|
sub load_ipv6_support {
|
||||||
|
my $ipv6_loaded = eval {require IO::Socket::INET6};
|
||||||
|
unless ($ipv6_loaded) {
|
||||||
|
fatal(<<"EOM");
|
||||||
|
Error loading the Perl module IO::Socket::INET6 needed for ipv6 connect.
|
||||||
|
On Debian, the package libio-socket-ssl-perl must be installed.
|
||||||
|
On Red Hat, the package perl-IO-Socket-SSL must be installed.
|
||||||
|
On Alpine, the package perl-io-socket-ssl must be installed.
|
||||||
|
EOM
|
||||||
|
}
|
||||||
|
import IO::Socket::INET6;
|
||||||
|
{ no warnings; $IO::Socket::INET6::DEBUG = 0; }
|
||||||
|
}
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
## load_sha1_support
|
## load_sha1_support
|
||||||
######################################################################
|
######################################################################
|
||||||
|
@ -1999,6 +2018,16 @@ sub geturl {
|
||||||
Timeout => opt('timeout'),
|
Timeout => opt('timeout'),
|
||||||
);
|
);
|
||||||
defined $sd or warning("cannot connect to $peer:$port socket: $@ " . IO::Socket::SSL::errstr());
|
defined $sd or warning("cannot connect to $peer:$port socket: $@ " . IO::Socket::SSL::errstr());
|
||||||
|
} elsif ($globals{'ipv6'}) {
|
||||||
|
load_ipv6_support;
|
||||||
|
$sd = IO::Socket::INET6->new(
|
||||||
|
PeerAddr => $peer,
|
||||||
|
PeerPort => $port,
|
||||||
|
Proto => 'tcp',
|
||||||
|
MultiHomed => 1,
|
||||||
|
Timeout => opt('timeout'),
|
||||||
|
);
|
||||||
|
defined $sd or warning("cannot connect to $peer:$port socket: $@");
|
||||||
} else {
|
} else {
|
||||||
$sd = IO::Socket::INET->new(
|
$sd = IO::Socket::INET->new(
|
||||||
PeerAddr => $peer,
|
PeerAddr => $peer,
|
||||||
|
|
Loading…
Reference in a new issue