Commit de0f57806c09db7da4df9e79acf3040d2a74df59
1 parent
47a697d4
Made autodetect explicit for updates (no more implicit autodetect)
Changed the behaviour of the update command so that it would not just pick the remote address if no ip parameter was provided. To autodetect the IP address it is now mandatory to pass value auto (so ip=auto) for the ipv4addr or ipv6addr. This also allows to specify which address should be autodetected and have a static address passed for ipv4 and have the ipv6 address autodetected for multi-network systems (also closes #6)
Showing
1 changed file
with
8 additions
and
5 deletions
dyndns.pl
... | ... | @@ -221,11 +221,14 @@ sub handle_update($$$$$$) { |
221 | 221 | } else { |
222 | 222 | # Get ipv4, and ipv6 parameters |
223 | 223 | my $remote_addr = $cgi->remote_addr; |
224 | - my $ipv4addr = $cgi->param('ipv4addr') | |
225 | - || $cgi->param('ip') | |
226 | - || (is_ipv4($remote_addr) ? $remote_addr : undef); | |
227 | - my $ipv6addr = $cgi->param('ipv6addr') | |
228 | - || (! $ipv4addr and is_ipv6($remote_addr)) ? $remote_addr : undef; | |
224 | + my $ipv4addr = $cgi->param('ipv4addr') || $cgi->param('ip'); | |
225 | + if ($ipv4addr == 'auto') { | |
226 | + $ipv4addr = is_ipv4($remote_addr) ? $remote_addr : undef; | |
227 | + } | |
228 | + my $ipv6addr = $cgi->param('ipv6addr') || $cgi->param('ipv6'); | |
229 | + if ($ipv6addr == 'auto') { | |
230 | + $ipv6addr = is_ipv6($remote_addr) ? $remote_addr : undef; | |
231 | + } | |
229 | 232 | ($statuscode, $statusmessage) = |
230 | 233 | DNS_Update($dnsdomain, $dnshost, $ipv4addr, $ipv6addr, $signer, $key, $debug); |
231 | 234 | } |
... | ... |