[PATCH luci] luci-mod-network: drop support for *adding* legacy bridges

Rafał Miłecki zajec5 at gmail.com
Sun May 16 08:41:20 PDT 2021


From: Rafał Miłecki <rafal at milecki.pl>

The old way of defining bridge (L2) as part of interface (L3) is
deprecated. Don't support *adding* interfaces like that.

Support for *editing* legacy bridges is kept for now for compatibility
with existing legacy setups.

Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
---
 .../resources/view/network/interfaces.js      | 37 +++----------------
 1 file changed, 5 insertions(+), 32 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 580f2885dd..a707fcf954 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
@@ -831,7 +831,7 @@ return view.extend({
 			var m2 = new form.Map('network'),
 			    s2 = m2.section(form.NamedSection, '_new_'),
 			    protocols = network.getProtocols(),
-			    proto, name, bridge, ifname_single, ifname_multi;
+			    proto, name, ifname;
 
 			protocols.sort(function(a, b) {
 				return a.getProtocol() > b.getProtocol();
@@ -864,30 +864,12 @@ return view.extend({
 			proto = s2.option(form.ListValue, 'proto', _('Protocol'));
 			proto.validate = name.validate;
 
-			bridge = s2.option(form.Flag, 'type', _('Bridge interfaces'), _('Creates a bridge over specified interface(s)'));
-			bridge.modalonly = true;
-			bridge.disabled = '';
-			bridge.enabled = 'bridge';
-
-			ifname_single = s2.option(widgets.DeviceSelect, 'ifname_single', _('Interface'));
-			ifname_single.noaliases = false;
-			ifname_single.optional = false;
-
-			ifname_multi = s2.option(widgets.DeviceSelect, 'ifname_multi', _('Interface'));
-			ifname_multi.nobridges = true;
-			ifname_multi.noaliases = true;
-			ifname_multi.multiple = true;
-			ifname_multi.optional = true;
-			ifname_multi.display_size = 6;
+			ifname = s2.option(widgets.DeviceSelect, 'ifname', _('Interface'));
+			ifname.noaliases = false;
+			ifname.optional = false;
 
 			for (var i = 0; i < protocols.length; i++) {
 				proto.value(protocols[i].getProtocol(), protocols[i].getI18n());
-
-				if (!protocols[i].isVirtual()) {
-					bridge.depends({ proto: protocols[i].getProtocol() });
-					ifname_single.depends({ type: '', proto: protocols[i].getProtocol() });
-					ifname_multi.depends({ type: 'bridge', proto: protocols[i].getProtocol() });
-				}
 			}
 
 			m2.render().then(L.bind(function(nodes) {
@@ -920,16 +902,7 @@ return view.extend({
 										var section_id = uci.add('network', 'interface', nameval);
 
 										protoclass.set('proto', protoval);
-
-										if (ifname_single.isActive('_new_')) {
-											protoclass.addDevice(ifname_single.formvalue('_new_'));
-										}
-										else if (ifname_multi.isActive('_new_')) {
-											protoclass.set('type', 'bridge');
-											L.toArray(ifname_multi.formvalue('_new_')).map(function(dev) {
-												protoclass.addDevice(dev);
-											});
-										}
+										protoclass.addDevice(ifname.formvalue('_new_'));
 
 										m.children[0].addedSection = section_id;
 									}).then(L.bind(m.children[0].renderMoreOptionsModal, m.children[0], nameval));
-- 
2.26.2




More information about the openwrt-devel mailing list