4 'require tools.widgets as widgets';
6 network
.registerPatternVirtual(/^ds-.+$/);
7 network
.registerErrorCode('AFTR_DNS_FAIL', _('Unable to resolve AFTR host name'));
9 return network
.registerProtocol('dslite', {
11 return _('Dual-Stack Lite (RFC6333)');
14 getIfname: function() {
15 return this._ubus('l3_device') || 'ds-%s'.format(this.sid
);
18 getOpkgPackage: function() {
22 isFloating: function() {
26 isVirtual: function() {
30 getDevices: function() {
34 containsDevice: function(ifname
) {
35 return (network
.getIfnameOf(ifname
) == this.getIfname());
38 renderFormOptions: function(s
) {
41 o
= s
.taboption('general', form
.Value
, 'peeraddr', _('DS-Lite AFTR address'));
43 o
.datatype
= 'or(hostname,ip6addr("nomask"))';
45 o
= s
.taboption('general', form
.Value
, 'ip6addr', _('Local IPv6 address'), _('Leave empty to use the current WAN address'));
46 o
.datatype
= 'ip6addr("nomask")';
47 o
.load = function(section_id
) {
48 return network
.getWAN6Networks().then(L
.bind(function(nets
) {
49 if (Array
.isArray(nets
) && nets
.length
)
50 this.placeholder
= nets
[0].getIP6Addr();
51 return form
.Value
.prototype.load
.apply(this, [section_id
]);
55 o
= s
.taboption('advanced', widgets
.NetworkSelect
, 'tunlink', _('Tunnel Link'));
57 o
.exclude
= s
.section
;
59 o
= s
.taboption('advanced', form
.ListValue
, 'encaplimit', _('Encapsulation limit'));
62 o
.datatype
= 'or("ignore",range(0,255))';
63 o
.value('ignore', _('ignore'));
64 for (var i
= 0; i
< 256; i
++)
67 o
= s
.taboption('advanced', form
.Value
, 'mtu', _('Use MTU on tunnel interface'));
68 o
.placeholder
= '1280';
69 o
.datatype
= 'max(9200)';