luci-proto-batman-adv: add luci-proto-batman-adv
[project/luci.git] / protocols / luci-proto-batman-adv / htdocs / luci-static / resources / protocol / batadv.js
1 'use strict';
2 'require form';
3 'require network';
4
5
6 network.registerPatternVirtual(/^bat\d+/);
7
8 return network.registerProtocol('batadv', {
9 getI18n: function() {
10 return _('Batman Device');
11 },
12
13 getIfname: function() {
14 return this._ubus('l3_device') || this.sid;
15 },
16
17 getOpkgPackage: function() {
18 return 'kmod-batman-adv';
19 },
20
21 isFloating: function() {
22 return true;
23 },
24
25 isVirtual: function() {
26 return true;
27 },
28
29 getDevices: function() {
30 return null;
31 },
32
33 containsDevice: function(ifname) {
34 return (network.getIfnameOf(ifname) == this.getIfname());
35 },
36
37 renderFormOptions: function(s) {
38 var dev = this.getL3Device() || this.getDevice(),
39 o;
40
41 s.tab('mesh', _('Mesh Routing'), _('Mesh and routing related options'));
42
43 // @FIXME - the list of routing protocols should not be hard coded but come from batctl
44 o = s.taboption('mesh', form.ListValue, 'routing_algo', _('Routing Algorithm'),
45 _('The algorithm that is used to discover mesh routes'));
46 o.value('BATMAN_IV', 'BATMAN_IV');
47 o.value('BATMAN_V', 'BATMAN_V');
48 o.default = 'BATMAN_IV';
49
50 o = s.taboption('mesh', form.Flag, 'aggregated_ogms', _('Aggregate Originator Messages'),
51 _('reduces overhead by collecting and aggregating originator messages in a single packet rather than many small ones'));
52 o.ucioption = 'aggregated_ogms';
53 o.default = o.disabled;
54
55 o = s.taboption('mesh', form.Value, 'orig_interval', _('Originator Interval'),
56 _('The value specifies the interval (milliseconds) in which batman-adv floods the network with its protocol information.'));
57 o.placeholder = '1000';
58 o.datatype = 'min(1)';
59
60 o = s.taboption('mesh', form.Flag, 'ap_isolation', _('Access Point Isolation'),
61 _('Prevents one wireless client to talk to another. This setting only affects packets without any VLAN tag (untagged packets).'));
62 o.ucioption = 'ap_isolation';
63 o.default = o.disabled;
64
65 o = s.taboption('mesh', form.Flag, 'bonding', _('Bonding Mode'),
66 _('When running the mesh over multiple WiFi interfaces per node batman-adv is capable of optimizing the traffic flow to gain maximum performance.'));
67 o.ucioption = 'bonding';
68 o.default = o.disabled;
69
70 o = s.taboption('mesh', form.Flag, 'bridge_loop_avoidance', _('Avoid Bridge Loops'),
71 _('In bridged LAN setups it is advisable to enable the bridge loop avoidance in order to avoid broadcast loops that can bring the entire LAN to a standstill.'));
72 o.ucioption = 'bridge_loop_avoidance';
73 o.default = o.disabled;
74
75 o = s.taboption('mesh', form.Flag, 'distributed_arp_table', _('Distributed ARP Table'),
76 _('When enabled the distributed ARP table forms a mesh-wide ARP cache that helps non-mesh clients to get ARP responses much more reliably and without much delay.'));
77 o.ucioption = 'distributed_arp_table';
78 o.default = o.enabled;
79
80 o = s.taboption('mesh', form.Flag, 'fragmentation', _('Fragmentation'),
81 _('Batman-adv has a built-in layer 2 fragmentation for unicast data flowing through the mesh which will allow to run batman-adv over interfaces / connections that don\'t allow to increase the MTU beyond the standard Ethernet packet size of 1500 bytes. When the fragmentation is enabled batman-adv will automatically fragment over-sized packets and defragment them on the other end. Per default fragmentation is enabled and inactive if the packet fits but it is possible to deactivate the fragmentation entirely.'));
82 o.ucioption = 'fragmentation';
83 o.default = o.enabled;
84
85 o = s.taboption('mesh', form.ListValue, 'gw_mode', _('Gateway Mode'),
86 _('A batman-adv node can either run in server mode (sharing its internet connection with the mesh) or in client mode (searching for the most suitable internet connection in the mesh) or having the gateway support turned off entirely (which is the default setting).'));
87 o.value('off', _('Off'));
88 o.value('client', _('Client'));
89 o.value('server', _('Server'));
90 o.default = 'off';
91
92 o = s.taboption('mesh', form.Value, 'hop_penalty', _('Hop Penalty'),
93 _('The hop penalty setting allows to modify batman-adv\'s preference for multihop routes vs. short routes. The value is applied to the TQ of each forwarded OGM, thereby propagating the cost of an extra hop (the packet has to be received and retransmitted which costs airtime)'));
94 o.ucioption = 'hop_penalty';
95 o.datatype = 'min(1)';
96 o.placeholder = '30';
97 o.default = '30';
98
99 o = s.taboption('mesh', form.Flag, 'multicast_mode', _('Multicast Mode'),
100 _('Enables more efficient, group aware multicast forwarding infrastructure in batman-adv.'));
101 o.ucioption = 'multicast_mode';
102 o.default = o.enabled;
103
104 o = s.taboption('mesh', form.Flag, 'network_coding', _('Network Coding'),
105 _('When enabled network coding increases the WiFi throughput by combining multiple frames into a single frame, thus reducing the needed air time.'));
106 o.ucioption = 'network_coding';
107 o.default = o.enabled;
108 }
109 });