summaryrefslogtreecommitdiffhomepage
path: root/protocols/luci-proto-xfrm/htdocs/luci-static/resources/protocol/xfrm.js
blob: b630f3818bbf8b5ab297ad435d666047fba572aa (plain)
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
'use strict';
'require uci';
'require form';
'require network';
'require tools.widgets as widgets';

return network.registerProtocol('xfrm', {
	getI18n: function() {
		return _('IPsec XFRM');
	},

	getIfname: function() {
		return this._ubus('l3_device') || this.sid;
	},

	getOpkgPackage: function() {
		return 'xfrm';
	},

	isFloating: function() {
		return true;
	},

	isVirtual: function() {
		return true;
	},

	getDevice: function() {
		return null;
	},

	containsDevice: function(ifname) {
		return (network.getIfnameOf(ifname) == this.getIfname());
	},

	renderFormOptions: function(s) {
		var o, ss;

		o = s.taboption('general', form.Value, 'ifid', _('Interface ID'), _('Required. XFRM interface ID to be used for SA.'));
		o.datatype = 'integer';

		o = s.taboption('general', widgets.NetworkSelect, 'tunlink', _('Required. Underlying interface.'));
		o.exclude = s.section;
		o.nocreate = true;

		o = s.taboption('general', form.Value, 'mtu', _('MTU'), _('Optional. Maximum Transmission Unit of the XFRM interface.'));
		o.datatype = 'range(68,65535)';
		o.placeholder = '1280';
		o.optional = true;
	}
});