1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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)';
}
});
|