luci-mod-network: fix handling of optional RA/NDP options
authorHannu Nyman <hannu.nyman@iki.fi>
Tue, 20 Apr 2021 18:06:42 +0000 (21:06 +0300)
committerHannu Nyman <hannu.nyman@iki.fi>
Tue, 20 Apr 2021 18:06:42 +0000 (21:06 +0300)
Fix the handling of optional IPv6 RA and NDP options
that were exposed to LuCI with 504bdb23f

Commit 504bdb23f defined them optional but provided default values.
Those values might get unnecessarily written to /etc/config dhcp when
the the user modifies some other values. Remove the default values,
but provide placeholder for some of them.

Add the missing optional definition to 'ndproxy_routing'.
(It is a flag, so optional default values do not get written to
the config file.)

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js

index 4a2e94faf6ddae11b75fc90e033bb72ea6bc4aaf..580f2885dd8d88ecbe5e6a35212f09848384b6a7 100644 (file)
@@ -568,7 +568,7 @@ return view.extend({
                                        so = ss.taboption('ipv6', form.Value, 'ra_maxinterval', _('Max <abbr title="Router Advertisement">RA</abbr> interval'), _('Maximum time allowed \
                                                between sending unsolicited <abbr title="Router Advertisement, ICMPv6 Type 134">RA</abbr>. Default is 600 seconds (<code>600</code>).'));
                                        so.optional = true;
-                                       so.default = '600';
+                                       so.placeholder = '600';
                                        so.depends('ra', 'server');
                                        so.depends('ra', 'hybrid');
                                        so.depends('ra', 'relay');
@@ -577,7 +577,7 @@ return view.extend({
                                        so = ss.taboption('ipv6', form.Value, 'ra_mininterval', _('Min <abbr title="Router Advertisement">RA</abbr> interval'), _('Minimum time allowed \
                                                between sending unsolicited <abbr title="Router Advertisement, ICMPv6 Type 134">RA</abbr>. Default is 200 seconds (<code>200</code>).'));
                                        so.optional = true;
-                                       so.default = '200';
+                                       so.placeholder = '200';
                                        so.depends('ra', 'server');
                                        so.depends('ra', 'hybrid');
                                        so.depends('ra', 'relay');
@@ -586,7 +586,6 @@ return view.extend({
                                                in <abbr title="Router Advertisement, ICMPv6 Type 134">RA</abbr> messages. Default is 1800 seconds (<code>1800</code>). \
                                                Max 9000 seconds.'));
                                        so.optional = true;
-                                       so.default = '1800';
                                        so.depends('ra', 'server');
                                        so.depends('ra', 'hybrid');
                                        so.depends('ra', 'relay');
@@ -595,7 +594,6 @@ return view.extend({
                                                to be published in <abbr title="Router Advertisement, ICMPv6 Type 134">RA</abbr> messages. Default is 0 (<code>0</code>).\
                                                Min 1280.'));
                                        so.optional = true;
-                                       so.default = '0';
                                        so.depends('ra', 'server');
                                        so.depends('ra', 'hybrid');
                                        so.depends('ra', 'relay');
@@ -604,7 +602,6 @@ return view.extend({
                                                to be published in <abbr title="Router Advertisement">RA</abbr> messages.<br />Default is 0 (<code>0</code>), meaning unspecified.\
                                                Max 255.'));
                                        so.optional = true;
-                                       so.default = '0';
                                        so.depends('ra', 'server');
                                        so.depends('ra', 'hybrid');
                                        so.depends('ra', 'relay');
@@ -657,6 +654,7 @@ return view.extend({
 
                                        so = ss.taboption('ipv6', form.Flag, 'ndproxy_routing', _('Learn routes from NDP'), _('Default is on.'));
                                        so.default = '1';
+                                       so.optional = true;
 
                                        so = ss.taboption('ipv6', form.Flag, 'ndproxy_slave', _('NDP-Proxy slave'), _('Set interface as NDP-Proxy external slave. Default is off.'));