summaryrefslogtreecommitdiffhomepage
path: root/protocols/luci-proto-batman-adv/htdocs/luci-static/resources/protocol/batadv_hardif.js
diff options
context:
space:
mode:
authorMarc Ahlgrim <marc@onemarcfifty.com>2022-04-14 15:08:09 +0200
committerMarc Ahlgrim <marc@onemarcfifty.com>2022-04-14 15:08:09 +0200
commit0a762fd6711d4e3b1ff8de56ea533f2e331bcaa9 (patch)
treea0a29c661f07e829035107b3fd4f200fc9d11116 /protocols/luci-proto-batman-adv/htdocs/luci-static/resources/protocol/batadv_hardif.js
parent5be8c4b7303e5c9cf35b9ab87fb379d24dadd454 (diff)
luci-proto-batman-adv: add luci-proto-batman-adv
This commit adds support for the batadv and the batadv_hardif protocols to LuCI Signed-off-by: Marc Ahlgrim <marc@onemarcfifty.com>
Diffstat (limited to 'protocols/luci-proto-batman-adv/htdocs/luci-static/resources/protocol/batadv_hardif.js')
-rw-r--r--protocols/luci-proto-batman-adv/htdocs/luci-static/resources/protocol/batadv_hardif.js58
1 files changed, 58 insertions, 0 deletions
diff --git a/protocols/luci-proto-batman-adv/htdocs/luci-static/resources/protocol/batadv_hardif.js b/protocols/luci-proto-batman-adv/htdocs/luci-static/resources/protocol/batadv_hardif.js
new file mode 100644
index 0000000000..b8b1263b97
--- /dev/null
+++ b/protocols/luci-proto-batman-adv/htdocs/luci-static/resources/protocol/batadv_hardif.js
@@ -0,0 +1,58 @@
+'use strict';
+'require uci';
+'require form';
+'require network';
+
+network.registerPatternVirtual(/^bat.+$/);
+
+return network.registerProtocol('batadv_hardif', {
+ getI18n: function() {
+ return _('Batman Interface');
+ },
+
+ getIfname: function() {
+ return this._ubus('l3_device') || this.sid;
+ },
+
+ getOpkgPackage: function() {
+ return 'kmod-batman-adv';
+ },
+
+ isFloating: function() {
+ return false;
+ },
+
+ isVirtual: function() {
+ return false;
+ },
+
+ getDevices: function() {
+ return null;
+ },
+
+ containsDevice: function(ifname) {
+ return (network.getIfnameOf(ifname) == this.getIfname());
+ },
+
+ renderFormOptions: function(s) {
+ var dev = this.getL3Device() || this.getDevice(),
+ o;
+
+ o = s.taboption('general', form.ListValue, 'master', _('Batman Device'),
+ _('This is the batman-adv device where you want to link the physical Device from above to. If this list is empty, then you need to create one first. If you want to route mesh traffic over a wired network device, then please select it from the above Device selector. If you want to assign the batman-adv interface to a Wi-fi mesh then do not select a Device in the Device selector but rather go to the Wireless settings and select this Interface as a network from there.'));
+ var uciInterfaces = uci.sections('network', 'interface');
+
+ for (var i = 0; i < uciInterfaces.length; i++)
+ {
+ if (uciInterfaces[i].proto == 'batadv')
+ {
+ var x=uciInterfaces[i]['.name'];
+ o.value(x);
+ }
+ }
+
+ o = s.taboption('general', form.Value, 'mtu', _('Override MTU'));
+ o.placeholder = dev ? (dev.getMTU() || '1536') : '1536';
+ o.datatype = 'max(9200)';
+ }
+});