6 network
.registerPatternVirtual(/^l2tp-.+$/);
8 return network
.registerProtocol('l2tp', {
13 getIfname: function() {
14 return this._ubus('l3_device') || 'l2tp-%s'.format(this.sid
);
17 getOpkgPackage: function() {
21 isFloating: function() {
25 isVirtual: function() {
29 getDevices: function() {
33 containsDevice: function(ifname
) {
34 return (network
.getIfnameOf(ifname
) == this.getIfname());
37 renderFormOptions: function(s
) {
38 var dev
= this.getL3Device() || this.getDevice(), o
;
40 o
= s
.taboption('general', form
.Value
, 'server', _('L2TP Server'));
41 o
.datatype
= 'or(host(1), hostport(1))';
43 s
.taboption('general', form
.Value
, 'username', _('PAP/CHAP username'));
45 o
= s
.taboption('general', form
.Value
, 'password', _('PAP/CHAP password'));
48 if (L
.hasSystemFeature('ipv6')) {
49 o
= s
.taboption('advanced', form
.ListValue
, 'ipv6', _('Obtain IPv6-Address'), _('Enable IPv6 negotiation on the PPP link'));
50 o
.value('auto', _('Automatic'));
51 o
.value('0', _('Disabled'));
52 o
.value('1', _('Manual'));
56 o
= s
.taboption('advanced', form
.Value
, 'mtu', _('Override MTU'));
57 o
.placeholder
= dev
? (dev
.getMTU() || '1500') : '1500';
58 o
.datatype
= 'max(9200)';