diff --git a/ddclient.in b/ddclient.in index 9739190..8a52ae0 100755 --- a/ddclient.in +++ b/ddclient.in @@ -85,9 +85,13 @@ sub T_FILE { 'file name' } sub T_FQDNP { 'fully qualified host name and optional port number' } sub T_PROTO { 'protocol' } sub T_USE { 'ip strategy' } +sub T_USEV4 { 'ipv4 strategy' } +sub T_USEV6 { 'ipv6 strategy' } sub T_IF { 'interface' } sub T_PROG { 'program name' } sub T_IP { 'ip' } +sub T_IPV4 { 'ipv4' } +sub T_IPV6 { 'ipv6' } sub T_POSTS { 'postscript' } ## strategies for obtaining an ip address. @@ -317,20 +321,56 @@ my %builtinfw = ( ); my %ip_strategies = ( - 'ip' => ": obtain IP from -ip {address}", - 'web' => ": obtain IP from an IP discovery page on the web", - 'fw' => ": obtain IP from the firewall specified by -fw {type|address}", - 'if' => ": obtain IP from the -if {interface}", - 'cmd' => ": obtain IP from the -cmd {external-command}", - 'cisco' => ": obtain IP from Cisco FW at the -fw {address}", - 'cisco-asa' => ": obtain IP from Cisco ASA at the -fw {address}", - map { $_ => sprintf ": obtain IP from %s at the -fw {address}", $builtinfw{$_}->{'name'} } keys %builtinfw, + 'no' => ": deprecated, see 'usev4' and 'usev6'", + 'ip' => ": deprecated, see 'usev4' and 'usev6'", + 'web' => ": deprecated, see 'usev4' and 'usev6'", + 'fw' => ": deprecated, see 'usev4' and 'usev6'", + 'if' => ": deprecated, see 'usev4' and 'usev6'", + 'cmd' => ": deprecated, see 'usev4' and 'usev6'", + 'cisco' => ": deprecated, see 'usev4' and 'usev6'", + 'cisco-asa' => ": deprecated, see 'usev4' and 'usev6'", + map { $_ => sprintf ": Built-in firewall %s deprecated, see 'usev4' and 'usev6'", $builtinfw{$_}->{'name'} } keys %builtinfw, ); sub ip_strategies_usage { return map { sprintf(" -use=%-22s %s.", $_, $ip_strategies{$_}) } sort keys %ip_strategies; } +my %ipv4_strategies = ( + 'disabled' => ": do not obtain an IPv4 address for this host", + 'ipv4' => ": obtain IPv4 from -ipv4 {address}", + 'webv4' => ": obtain IPv4 from an IP discovery page on the web", + 'ifv4' => ": obtain IPv4 from the -ifv4 {interface}", + 'cmdv4' => ": obtain IPv4 from the -cmdv4 {external-command}", + 'fwv4' => ": obtain IPv4 from the firewall specified by -fwv4 {type|address}", + 'ciscov4' => ": obtain IPv4 from Cisco FW at the -fwv4 {address}", + 'cisco-asav4' => ": obtain IPv4 from Cisco ASA at the -fwv4 {address}", + map { $_ => sprintf ": obtain IPv4 from %s at the -fwv4 {address}", $builtinfw{$_}->{'name'} } keys %builtinfw, +); +sub ipv4_strategies_usage { + return map { sprintf(" -usev4=%-22s %s.", $_, $ipv4_strategies{$_}) } sort keys %ipv4_strategies; +} + +my %ipv6_strategies = ( + 'no' => ": deprecated, use 'disabled'", + 'disabled' => ": do not obtain an IPv6 address for this host", + 'ip' => ": deprecated, use 'ipv6'", + 'ipv6' => ": obtain IPv6 from -ipv6 {address}", + 'web' => ": deprecated, use 'webv6'", + 'webv6' => ": obtain IPv6 from an IP discovery page on the web", + 'if' => ": deprecated, use 'ifv6'", + 'ifv6' => ": obtain IPv6 from the -if {interface}", + 'cmd' => ": deprecated, use 'cmdv6'", + 'cmdv6' => ": obtain IPv6 from the -cmdv6 {external-command}", + 'fwv6' => ": obtain IPv6 from the firewall specified by -fwv6 {type|address}", + 'ciscov6' => ": obtain IPv6 from Cisco FW at the -fwv6 {address}", + 'cisco-asav6' => ": obtain IPv6 from Cisco ASA at the -fwv6 {address}", + map { $_ => sprintf ": obtain IPv6 from %s at the -fwv6 {address}", $builtinfw{$_}->{'name'} } keys %builtinfw, +); +sub ipv6_strategies_usage { + return map { sprintf(" -usev6=%-22s %s.", $_, $ipv6_strategies{$_}) } sort keys %ipv6_strategies; +} + sub setv { return { 'type' => shift, @@ -342,77 +382,109 @@ sub setv { } my %variables = ( 'global-defaults' => { - 'daemon' => setv(T_DELAY, 0, 0, $daemon_default, interval('60s')), - 'foreground' => setv(T_BOOL, 0, 0, 0, undef), - 'file' => setv(T_FILE, 0, 0, "$etc/$program.conf", undef), - 'cache' => setv(T_FILE, 0, 0, "$cachedir/$program.cache", undef), - 'pid' => setv(T_FILE, 0, 0, "", undef), - 'proxy' => setv(T_FQDNP, 0, 0, '', undef), - 'protocol' => setv(T_PROTO, 0, 0, 'dyndns2', undef), + 'daemon' => setv(T_DELAY, 0, 0, 1, $daemon_default, interval('60s')), + 'foreground' => setv(T_BOOL, 0, 0, 1, 0, undef), + 'file' => setv(T_FILE, 0, 0, 1, "$etc$program.conf", undef), + 'cache' => setv(T_FILE, 0, 0, 1, "$cachedir$program.cache", undef), + 'pid' => setv(T_FILE, 0, 0, 1, "", undef), + 'proxy' => setv(T_FQDNP, 0, 0, 1, '', undef), + 'protocol' => setv(T_PROTO, 0, 0, 1, 'dyndns2', undef), - 'use' => setv(T_USE, 0, 0, 'ip', undef), - 'ip' => setv(T_IP, 0, 0, undef, undef), - 'if' => setv(T_IF, 0, 0, 'ppp0', undef), - 'if-skip' => setv(T_STRING,1, 0, '', undef), - 'web' => setv(T_STRING,0, 0, 'dyndns', undef), - 'web-skip' => setv(T_STRING,1, 0, '', undef), - 'fw' => setv(T_ANY, 0, 0, '', undef), - 'fw-skip' => setv(T_STRING,1, 0, '', undef), - 'fw-login' => setv(T_LOGIN, 1, 0, '', undef), - 'fw-password' => setv(T_PASSWD,1, 0, '', undef), - 'cmd' => setv(T_PROG, 0, 0, '', undef), - 'cmd-skip' => setv(T_STRING,1, 0, '', undef), + 'use' => setv(T_USE, 0, 0, 1, 'ip', undef), + 'usev4' => setv(T_USEV4, 0, 0, 1, undef, undef), + 'usev6' => setv(T_USEV6, 0, 0, 1, undef, undef), + 'ip' => setv(T_IP, 0, 0, 1, undef, undef), + 'ipv4' => setv(T_IPV4, 0, 0, 1, undef, undef), + 'ipv6' => setv(T_IPV6, 0, 0, 1, undef, undef), + 'if' => setv(T_IF, 0, 0, 1, 'ppp0', undef), + 'ifv4' => setv(T_IF, 0, 0, 1, undef, undef), + 'ifv6' => setv(T_IF, 0, 0, 1, undef, undef), + 'if-skip' => setv(T_STRING,1, 0, 1, '', undef), + 'web' => setv(T_STRING,0, 0, 1, 'dyndns', undef), + 'web-skip' => setv(T_STRING,1, 0, 1, '', undef), + 'webv4' => setv(T_STRING,0, 0, 1, '', undef), + 'webv4-skip' => setv(T_STRING,1, 0, 1, '', undef), + 'webv6' => setv(T_STRING,0, 0, 1, '', undef), + 'webv6-skip' => setv(T_STRING,1, 0, 1, '', undef), + 'fw' => setv(T_ANY, 0, 0, 1, '', undef), + 'fw-skip' => setv(T_STRING,1, 0, 1, '', undef), + 'fwv4' => setv(T_ANY, 0, 0, 1, '', undef), + 'fwv4-skip' => setv(T_STRING,1, 0, 1, '', undef), + 'fwv6' => setv(T_ANY, 0, 0, 1, '', undef), + 'fwv6-skip' => setv(T_STRING,1, 0, 1, '', undef), + 'fw-login' => setv(T_LOGIN, 1, 0, 1, '', undef), + 'fw-password' => setv(T_PASSWD,1, 0, 1, '', undef), + 'cmd' => setv(T_PROG, 0, 0, 1, '', undef), + 'cmd-skip' => setv(T_STRING,1, 0, 1, '', undef), + 'cmdv4' => setv(T_PROG, 0, 0, 1, '', undef), + 'cmdv6' => setv(T_PROG, 0, 0, 1, '', undef), - 'timeout' => setv(T_DELAY, 0, 0, interval('120s'), interval('120s')), - 'retry' => setv(T_BOOL, 0, 0, 0, undef), - 'force' => setv(T_BOOL, 0, 0, 0, undef), - 'ssl' => setv(T_BOOL, 0, 0, 0, undef), - 'ipv6' => setv(T_BOOL, 0, 0, 0, undef), - 'syslog' => setv(T_BOOL, 0, 0, 0, undef), - 'facility' => setv(T_STRING,0, 0, 'daemon', undef), - 'priority' => setv(T_STRING,0, 0, 'notice', undef), - 'mail' => setv(T_EMAIL, 0, 0, '', undef), - 'mail-failure' => setv(T_EMAIL, 0, 0, '', undef), + 'timeout' => setv(T_DELAY, 0, 0, 1, interval('120s'), interval('120s')), + 'retry' => 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), + 'syslog' => setv(T_BOOL, 0, 0, 1, 0, undef), + 'facility' => setv(T_STRING,0, 0, 1, 'daemon', undef), + 'priority' => setv(T_STRING,0, 0, 1, 'notice', undef), + 'mail' => setv(T_EMAIL, 0, 0, 1, '', undef), + 'mail-failure' => setv(T_EMAIL, 0, 0, 1, '', undef), - 'exec' => setv(T_BOOL, 0, 0, 1, undef), - 'debug' => setv(T_BOOL, 0, 0, 0, undef), - 'verbose' => setv(T_BOOL, 0, 0, 0, undef), - 'quiet' => setv(T_BOOL, 0, 0, 0, undef), - 'help' => setv(T_BOOL, 0, 0, 0, undef), - 'test' => setv(T_BOOL, 0, 0, 0, undef), - 'geturl' => setv(T_STRING,0, 0, '', undef), + 'exec' => setv(T_BOOL, 0, 0, 1, 1, undef), + 'debug' => setv(T_BOOL, 0, 0, 1, 0, undef), + 'verbose' => setv(T_BOOL, 0, 0, 1, 0, undef), + 'quiet' => setv(T_BOOL, 0, 0, 1, 0, undef), + 'help' => setv(T_BOOL, 0, 0, 1, 0, undef), + 'test' => setv(T_BOOL, 0, 0, 1, 0, undef), + 'geturl' => setv(T_STRING,0, 0, 0, '', undef), - 'postscript' => setv(T_POSTS, 0, 0, '', undef), + 'postscript' => setv(T_POSTS, 0, 0, 1, '', undef), }, 'service-common-defaults' => { - 'server' => setv(T_FQDNP, 1, 0, 'members.dyndns.org', undef), - 'login' => setv(T_LOGIN, 1, 0, '', undef), - 'password' => setv(T_PASSWD,1, 0, '', undef), - 'host' => setv(T_STRING,1, 1, '', undef), + 'server' => setv(T_FQDNP, 1, 0, 1, 'members.dyndns.org', undef), + 'login' => setv(T_LOGIN, 1, 0, 1, '', undef), + 'password' => setv(T_PASSWD,1, 0, 1, '', undef), + 'host' => setv(T_STRING,1, 1, 1, '', undef), - 'use' => setv(T_USE, 0, 0, 'ip', undef), - 'if' => setv(T_IF, 0, 0, 'ppp0', undef), - 'if-skip' => setv(T_STRING,0, 0, '', undef), - 'web' => setv(T_STRING,0, 0, 'dyndns', undef), - 'web-skip' => setv(T_STRING,0, 0, '', undef), - 'fw' => setv(T_ANY, 0, 0, '', undef), - 'fw-skip' => setv(T_STRING,0, 0, '', undef), - 'fw-login' => setv(T_LOGIN, 0, 0, '', undef), - 'fw-password' => setv(T_PASSWD,0, 0, '', undef), - 'cmd' => setv(T_PROG, 0, 0, '', undef), - 'cmd-skip' => setv(T_STRING,0, 0, '', undef), - 'ipv6' => setv(T_BOOL, 0, 0, 0, undef), - 'ip' => setv(T_IP, 0, 1, undef, undef), - 'wtime' => setv(T_DELAY, 0, 1, 0, interval('30s')), - 'mtime' => setv(T_NUMBER,0, 1, 0, undef), - 'atime' => setv(T_NUMBER,0, 1, 0, undef), - 'status' => setv(T_ANY, 0, 1, '', undef), - 'min-interval' => setv(T_DELAY, 0, 0, interval('30s'), 0), - 'max-interval' => setv(T_DELAY, 0, 0, interval('25d'), 0), - 'min-error-interval' => setv(T_DELAY, 0, 0, interval('5m'), 0), + 'use' => setv(T_USE, 0, 0, 1, 'ip', undef), + 'usev4' => setv(T_USEV4, 0, 0, 1, undef, undef), + 'usev6' => setv(T_USEV6, 0, 0, 1, undef, undef), + 'if' => setv(T_IF, 0, 0, 1, 'ppp0', undef), + 'ifv4' => setv(T_IF, 0, 0, 1, undef, undef), + 'ifv6' => setv(T_IF, 0, 0, 1, undef, undef), + 'if-skip' => setv(T_STRING,0, 0, 1, '', undef), + 'web' => setv(T_STRING,0, 0, 1, 'dyndns', undef), + 'web-skip' => setv(T_STRING,0, 0, 1, '', undef), + 'webv4' => setv(T_STRING,0, 0, 1, undef, undef), + 'webv4-skip' => setv(T_STRING,0, 0, 1, '', undef), + 'webv6' => setv(T_STRING,0, 0, 1, undef, undef), + 'webv6-skip' => setv(T_STRING,0, 0, 1, '', undef), + 'fw' => setv(T_ANY, 0, 0, 1, '', undef), + 'fw-skip' => setv(T_STRING,0, 0, 1, '', undef), + 'fwv4' => setv(T_ANY, 0, 0, 1, '', undef), + 'fwv4-skip' => setv(T_STRING,0, 0, 1, '', undef), + 'fwv6' => setv(T_ANY, 0, 0, 1, '', undef), + 'fwv6-skip' => setv(T_STRING,0, 0, 1, '', undef), + 'fw-login' => setv(T_LOGIN, 0, 0, 1, '', undef), + 'fw-password' => setv(T_PASSWD,0, 0, 1, '', undef), + 'cmd' => setv(T_PROG, 0, 0, 1, '', undef), + 'cmd-skip' => setv(T_STRING,0, 0, 1, '', undef), + 'cmdv4' => setv(T_PROG, 0, 0, 1, '', undef), + 'cmdv6' => setv(T_PROG, 0, 0, 1, '', undef), + 'ip' => setv(T_IP, 0, 1, 0, undef, undef), + 'ipv4' => setv(T_IPV4, 0, 1, 0, undef, undef), + 'ipv6' => setv(T_IPV6, 0, 1, 0, undef, undef), + 'wtime' => setv(T_DELAY, 0, 1, 1, 0, interval('30s')), + '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-ipv4' => 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), - 'warned-min-interval' => setv(T_ANY, 0, 1, 0, undef), - 'warned-min-error-interval' => setv(T_ANY, 0, 1, 0, undef), + 'warned-min-interval' => setv(T_ANY, 0, 1, 0, 0, undef), + 'warned-min-error-interval' => setv(T_ANY, 0, 1, 0, 0, undef), }, 'dyndns-common-defaults' => { 'static' => setv(T_BOOL, 0, 1, 0, undef), @@ -428,7 +500,7 @@ my %variables = ( 'noip-common-defaults' => { 'static' => setv(T_BOOL, 0, 1, 0, undef), }, - 'noip-service-common-defaults' => { + 'noip-service-common-defaults' => { ## TODO IPv6 (because 'ip' specified below) 'server' => setv(T_FQDNP, 1, 0, 'dynupdate.no-ip.com',undef), 'login' => setv(T_LOGIN, 1, 0, '', undef), 'password' => setv(T_PASSWD,1, 0, '', undef), @@ -485,7 +557,7 @@ my %variables = ( 'custom' => setv(T_BOOL, 0, 1, 0, undef), 'script' => setv(T_STRING,1, 1, '/nic/update', undef), }, - 'woima-service-common-defaults' => { + 'woima-service-common-defaults' => { ## TODO IPv6 (because 'ip' specified below) 'server' => setv(T_FQDNP, 1, 0, 'dyn.woima.fi', undef), 'login' => setv(T_LOGIN, 1, 0, '', undef), 'password' => setv(T_PASSWD,1, 0, '', undef), @@ -782,24 +854,42 @@ my @opt = ( [ "cache", "=s", "-cache path : record address used in 'path'" ], [ "pid", "=s", "-pid path : record process id in 'path' if daemonized" ], "", - [ "use", "=s", "-use which : how the should IP address be obtained." ], + [ "use", "=s", "-use which : deprecated, see 'usev4' and 'usev6'" ], &ip_strategies_usage(), + [ "usev4", "=s", "-usev4 which : how the should IPv4 address be obtained." ], + &ipv4_strategies_usage(), + [ "usev6", "=s", "-usev6 which : how the should IPv6 address be obtained." ], + &ipv6_strategies_usage(), "", - [ "ip", "=s", "-ip address : set the IP address to 'address'" ], + [ "ip", "=s", "-ip address : deprecated, use 'ipv4' or 'ipv6'" ], + [ "ipv4", "=s", "-ipv4 address : set the IPv4 address to 'address'" ], + [ "ipv6", "=s", "-ipv6 address : set the IPv6 address to 'address'" ], "", - [ "if", "=s", "-if interface : obtain IP address from 'interface'" ], - [ "if-skip", "=s", "-if-skip pattern : skip any IP addresses before 'pattern' in the output of 'ip address show dev {if}' (or 'ifconfig {if}')" ], + [ "if", "=s", "-if interface : deprecated, use 'ifv4' or 'ifv6'" ], + [ "ifv4", "=s", "-ifv4 interface : obtain IPv4 address from 'interface'" ], + [ "ifv6", "=s", "-ifv6 interface : obtain IPv6 address from 'interface'" ], + [ "if-skip", "=s", "-if-skip pattern : deprecated, not required" ], "", - [ "web", "=s", "-web provider|url : obtain IP address from provider's IP checking page" ], - [ "web-skip", "=s", "-web-skip pattern : skip any IP addresses before 'pattern' on the web provider|url" ], + [ "web", "=s", "-web provider|url : deprecated, use 'webv4' or 'webv6'" ], + [ "web-skip", "=s", "-web-skip pattern : deprecated, use 'webv4-skip' or 'webv6-skip'" ], + [ "webv4", "=s", "-webv4 provider|url : obtain IPv4 address from provider's IP checking page" ], + [ "webv4-skip", "=s", "-webv4-skip pattern : skip any IPv4 addresses before 'pattern' on the web provider|url" ], + [ "webv6", "=s", "-webv6 provider|url : obtain IPv6 address from provider's IP checking page" ], + [ "webv6-skip", "=s", "-webv6-skip pattern : skip any IPv6 addresses before 'pattern' on the web provider|url" ], "", - [ "fw", "=s", "-fw address|url : obtain IP address from firewall at 'address'" ], - [ "fw-skip", "=s", "-fw-skip pattern : skip any IP addresses before 'pattern' on the firewall address|url" ], + [ "fw", "=s", "-fw address|url : deprecated, use 'fwv4' or 'fwv6'" ], + [ "fw-skip", "=s", "-fw-skip pattern : deprecated, use 'fwv4-skip' or 'fwv6-skip'" ], + [ "fwv4", "=s", "-fwv4 address|url : obtain IPv4 address from firewall at 'address' or 'url'" ], + [ "fwv4-skip", "=s", "-fwv4-skip pattern : skip any IPv4 addresses before 'pattern' on the firewall address|url" ], + [ "fwv6", "=s", "-fwv6 address|url : obtain IPv6 address from firewall at 'address' or 'url'" ], + [ "fwv6-skip", "=s", "-fwv6-skip pattern : skip any IPv6 addresses before 'pattern' on the firewall address|url" ], [ "fw-login", "=s", "-fw-login login : use 'login' when getting IP from fw" ], [ "fw-password", "=s", "-fw-password secret : use password 'secret' when getting IP from fw" ], "", - [ "cmd", "=s", "-cmd program : obtain IP address from by calling {program}" ], - [ "cmd-skip", "=s", "-cmd-skip pattern : skip any IP addresses before 'pattern' in the output of {cmd}" ], + [ "cmd", "=s", "-cmd program : deprecated, use 'cmdv4' or 'cmdv6'" ], + [ "cmd-skip", "=s", "-cmd-skip pattern : deprecated, filter in program wrapper script" ], + [ "cmdv4", "=s", "-cmdv4 program : obtain IPv6 address from by calling {program}" ], + [ "cmdv6", "=s", "-cmdv6 program : obtain IPv6 address from by calling {program}" ], "", [ "login", "=s", "-login user : login as 'user'" ], [ "password", "=s", "-password secret : use password 'secret'" ], @@ -821,7 +911,6 @@ my @opt = ( [ "debug", "!", "-{no}debug : print {no} debugging information" ], [ "verbose", "!", "-{no}verbose : print {no} verbose information" ], [ "quiet", "!", "-{no}quiet : print {no} messages for unnecessary updates" ], - [ "ipv6", "!", "-{no}ipv6 : use ipv6" ], [ "help", "", "-help : this message" ], [ "postscript", "", "-postscript : script to run after updating ddclient, has new IP as param" ],