summary refs log tree commit diff stats
path: root/patches/ddclient-noipv4.patch
blob: 09afd601465cc3dc04c8a9266ad26e3a0efb427d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
diff --git a/ddclient.in b/ddclient.in
index 5e4759e..dd2fb58 100755
--- a/ddclient.in
+++ b/ddclient.in
@@ -431,7 +431,8 @@ my %variables = (
         'proxy'               => setv(T_FQDNP, 0, 0, undef,                undef),
         'protocol'            => setv(T_PROTO, 0, 0, 'dyndns2',            undef),
 
-        'use'                 => setv(T_USE,   0, 0, 'ip',                 undef),
+        'use'                 => setv(T_USE,   0, 0, 'disabled',           undef),
+
         'usev4'               => setv(T_USEV4, 0, 0, 'disabled',           undef),
         'usev6'               => setv(T_USEV6, 0, 0, 'disabled',           undef),
         'ip'                  => setv(T_IP,    0, 0, undef,                undef),
@@ -489,7 +490,7 @@ my %variables = (
         'password'            => setv(T_PASSWD,1, 0, '',                   undef),
         'host'                => setv(T_STRING,1, 1, '',                   undef),
 
-        'use'                 => setv(T_USE,   0, 0, 'ip',                 undef),
+        'use'                 => setv(T_USE,   0, 0, 'disabled',           undef),
         'if'                  => setv(T_IF,    0, 0, 'ppp0',               undef),
         'web'                 => setv(T_STRING,0, 0, 'dyndns',             undef),
         'web-skip'            => setv(T_STRING,0, 0, '',                   undef),
@@ -1075,6 +1076,8 @@ sub main {
         read_cache(opt('cache'), \%cache);
         print_info() if opt('debug') && opt('verbose');
 
+        fatal("invalid argument '-use %s'; possible values are:\n%s", $opt{'use'}, join("\n", ip_strategies_usage()))
+            unless exists $ip_strategies{lc opt('use')};
         fatal("invalid argument '-use %s'; possible values are:\n%s", $opt{'use'}, join("\n", ip_strategies_usage()))
             unless exists $ip_strategies{lc opt('use')};
         if (defined($opt{'usev6'})) {
@@ -1154,11 +1157,9 @@ sub update_nics {
             next if $config{$h}{'protocol'} ne lc($s);
             $examined{$h} = 1;
             # we only do this once per 'use' and argument combination
-            my $use       = opt('use',   $h) // 'disabled';
-            my $usev4     = opt('usev4', $h) // 'disabled';
+            my $use       = 'disabled';
+            my $usev4     = 'disabled';
             my $usev6     = opt('usev6', $h) // 'disabled';
-            $use          = 'disabled' if ($use eq 'no'); # backward compatibility
-            $usev6        = 'disabled' if ($usev6 eq 'no'); # backward compatibility
             my $arg_ip    = opt('ip',    $h) // '';
             my $arg_ipv4  = opt('ipv4',  $h) // '';
             my $arg_ipv6  = opt('ipv6',  $h) // '';
@@ -1592,18 +1593,6 @@ sub init_config {
     ##
     $opt{'quiet'} = 0 if opt('verbose');
 
-    ## infer the IP strategy if possible
-    if (!$opt{'use'}) {
-        $opt{'use'} = 'web' if ($opt{'web'});
-        $opt{'use'} = 'if'  if ($opt{'if'});
-        $opt{'use'} = 'ip'  if ($opt{'ip'});
-    }
-    ## infer the IPv4 strategy if possible
-    if (!$opt{'usev4'}) {
-        $opt{'usev4'} = 'webv4' if ($opt{'webv4'});
-        $opt{'usev4'} = 'ifv4'  if ($opt{'ifv4'});
-        $opt{'usev4'} = 'ipv4'  if ($opt{'ipv4'});
-    }
     ## infer the IPv6 strategy if possible
     if (!$opt{'usev6'}) {
         $opt{'usev6'} = 'webv6' if ($opt{'webv6'});
@@ -5813,11 +5802,12 @@ sub nic_nsupdate_update {
         ## nsupdate requires a port number to be separated by whitepace, not colon
         $server =~ s/:/ /;
         my $zone       = $config{$h}{'zone'};
-        my $ip         = $config{$h}{'wantip'};
+        my $ip         = $config{$h}{'wantipv6'};
         my $recordtype = '';
         if (is_ipv6($ip)) {
             $recordtype = 'AAAA';
         } else {
+            next;
             $recordtype = 'A';
         }
         delete $config{$_}{'wantip'} foreach @hosts;