From dec5d8099edb09d44713544e4a823cdd19f1b616 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sun, 21 Mar 2021 00:50:27 +0100 Subject: [PATCH] luci-mod-network: fix handling of peerdns/dns/dns_search options The previous change didn't take dynamic dependency mangling into account. Fixes: 2bfd4908a9 ("luci-mod-network: restore DNS option semantics for proto static") Signed-off-by: Jo-Philipp Wich (cherry picked from commit 9a92f9c7615f710a7934cccc8ac23902247c154b) --- .../resources/view/network/interfaces.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js index 3ea7788af1..e8c0c29594 100644 --- a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js +++ b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js @@ -679,17 +679,19 @@ return view.extend({ o = nettools.replaceOption(s, 'advanced', form.Flag, 'defaultroute', _('Use default gateway'), _('If unchecked, no default route is configured')); o.default = o.enabled; - o = nettools.replaceOption(s, 'advanced', form.Flag, 'peerdns', _('Use DNS servers advertised by peer'), _('If unchecked, the advertised DNS server addresses are ignored')); - o.depends({ 'proto': 'static', '!reverse': true }); - o.default = o.enabled; + if (protoval != 'static') { + o = nettools.replaceOption(s, 'advanced', form.Flag, 'peerdns', _('Use DNS servers advertised by peer'), _('If unchecked, the advertised DNS server addresses are ignored')); + o.default = o.enabled; + } o = nettools.replaceOption(s, 'advanced', form.DynamicList, 'dns', _('Use custom DNS servers')); - o.depends('proto', 'static'); - o.depends('peerdns', '0'); + if (protoval != 'static') + o.depends('peerdns', '0'); o.datatype = 'ipaddr'; o = nettools.replaceOption(s, 'advanced', form.DynamicList, 'dns_search', _('DNS search domains')); - o.depends('peerdns', '0'); + if (protoval != 'static') + o.depends('peerdns', '0'); o.datatype = 'hostname'; o = nettools.replaceOption(s, 'advanced', form.Value, 'dns_metric', _('DNS weight'), _('The DNS server entries in the local resolv.conf are primarily sorted by the weight specified here')); -- 2.30.2