4 'require tools.widgets as widgets';
6 network
.registerPatternVirtual(/^464-.+$/);
7 network
.registerErrorCode('CLAT_CONFIG_FAILED', _('CLAT configuration failed'));
9 return network
.registerProtocol('464xlat', {
11 return _('464XLAT (CLAT)');
14 getIfname: function() {
15 return this._ubus('l3_device') || '464-%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
, 'ip6prefix', _('NAT64 Prefix'), _('Leave empty to autodetect'));
44 o
= s
.taboption('advanced', widgets
.NetworkSelect
, 'tunlink', _('Tunnel Link'));
46 o
.exclude
= s
.section
;
48 o
= s
.taboption('advanced', form
.Flag
, 'defaultroute', _('Default gateway'), _('If unchecked, no default route is configured'));
49 o
.default = o
.enabled
;
51 o
= s
.taboption('advanced', form
.Value
, 'metric', _('Use gateway metric'));
53 o
.datatype
= 'uinteger';
54 o
.depends('defaultroute', '1');
56 o
= s
.taboption('advanced', form
.Value
, 'mtu', _('Use MTU on tunnel interface'));
57 o
.placeholder
= '1280';
58 o
.datatype
= 'max(9200)';