Skip to content

Commit

Permalink
luci-mod-network: handle default protocol for UCI interfaces
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Erik Karlsson authored and systemcrash committed Jan 22, 2025
1 parent ba1fb8e commit 070b2e5
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -515,13 +515,9 @@ return view.extend({
};

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

if (!protoval)
return;

return network.getNetwork(s.section).then(L.bind(function(ifc) {
var protocols = network.getProtocols();

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

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

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

if (protocols[i].getProtocol() != uci.get('network', s.section, 'proto'))
if (protocols[i].getProtocol() != protoval)
proto_switch.depends('proto', protocols[i].getProtocol());
}

Expand Down

0 comments on commit 070b2e5

Please sign in to comment.