Skip to content

Commit 070b2e5

Browse files
Erik Karlssonsystemcrash
authored andcommitted
luci-mod-network: handle default protocol for UCI interfaces
The protocol defaults to 'none' in netifd if unspecified. Some previously unused and some now redundant code is also removed. Signed-off-by: Erik Karlsson <erik.karlsson@iopsys.eu>
1 parent ba1fb8e commit 070b2e5

File tree

1 file changed

+3
-6
lines changed
  • modules/luci-mod-network/htdocs/luci-static/resources/view/network

1 file changed

+3
-6
lines changed

modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -515,13 +515,9 @@ return view.extend({
515515
};
516516

517517
s.addModalOptions = function(s) {
518-
var protoval = uci.get('network', s.section, 'proto'),
519-
protoclass = protoval ? network.getProtocol(protoval) : null,
518+
var protoval = uci.get('network', s.section, 'proto') || 'none',
520519
o, proto_select, proto_switch, type, stp, igmp, ss, so;
521520

522-
if (!protoval)
523-
return;
524-
525521
return network.getNetwork(s.section).then(L.bind(function(ifc) {
526522
var protocols = network.getProtocols();
527523

@@ -544,6 +540,7 @@ return view.extend({
544540

545541
proto_select = s.taboption('general', form.ListValue, 'proto', _('Protocol'));
546542
proto_select.modalonly = true;
543+
proto_select.default = 'none';
547544

548545
proto_switch = s.taboption('general', form.Button, '_switch_proto');
549546
proto_switch.modalonly = true;
@@ -612,7 +609,7 @@ return view.extend({
612609
for (var i = 0; i < protocols.length; i++) {
613610
proto_select.value(protocols[i].getProtocol(), protocols[i].getI18n());
614611

615-
if (protocols[i].getProtocol() != uci.get('network', s.section, 'proto'))
612+
if (protocols[i].getProtocol() != protoval)
616613
proto_switch.depends('proto', protocols[i].getProtocol());
617614
}
618615

0 commit comments

Comments
 (0)