6 network
.registerPatternVirtual(/^6in4-.+$/);
8 return network
.registerProtocol('6in4', {
10 return _('IPv6-in-IPv4 (RFC4213)');
13 getIfname: function() {
14 return this._ubus('l3_device') || '6in4-%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
) {
40 o
= s
.taboption('general', form
.Value
, 'ipaddr', _('Local IPv4 address'), _('Leave empty to use the current WAN address'));
41 o
.datatype
= 'ip4addr("nomask")';
42 o
.load = function(section_id
) {
43 return network
.getWANNetworks().then(L
.bind(function(nets
) {
45 this.placeholder
= nets
[0].getIPAddr();
46 return form
.Value
.prototype.load
.apply(this, [section_id
]);
50 o
= s
.taboption('general', form
.Value
, 'peeraddr', _('Remote IPv4 address'), _('This is usually the address of the nearest PoP operated by the tunnel broker'));
52 o
.datatype
= 'ip4addr("nomask")';
54 o
= s
.taboption('general', form
.Value
, 'ip6addr', _('Local IPv6 address'), _('This is the local endpoint address assigned by the tunnel broker, it usually ends with <code>...:2/64</code>'));
57 o
= s
.taboption('general', form
.DynamicList
, 'ip6prefix', _('IPv6 routed prefix'), _('This is the prefix routed to you by the tunnel broker for use by clients'));
60 o
= s
.taboption('general', form
.Flag
, '_update', _('Dynamic tunnel'), _('Enable HE.net dynamic endpoint update'));
63 o
.write = function() {};
64 o
.remove = function() {};
65 o
.cfgvalue = function(section_id
) {
66 return !isNaN(+uci
.get('network', section_id
, 'tunnelid')) ? this.enabled
: this.disabled
;
69 o
= s
.taboption('general', form
.Value
, 'tunnelid', _('Tunnel ID'));
70 o
.datatype
= 'uinteger';
71 o
.depends('_update', '1');
73 o
= s
.taboption('general', form
.Value
, 'username', _('HE.net username'), _('This is the plain username for logging into the account'));
74 o
.depends('_update', '1');
75 o
.validate = function(section_id
, value
) {
76 if (/^[a-fA-F0-9]{32}$/.test(value
))
77 return _('The HE.net endpoint update configuration changed, you must now use the plain username instead of the user ID!');
81 o
= s
.taboption('general', form
.Value
, 'password', _('HE.net password'), _('This is either the "Update Key" configured for the tunnel or the account password if no update key has been configured'));
83 o
.depends('_update', '1');
85 o
= s
.taboption('advanced', form
.Value
, 'ttl', _('Use TTL on tunnel interface'));
87 o
.datatype
= 'range(1,255)';
89 o
= s
.taboption('advanced', form
.Value
, 'mtu', _('Use MTU on tunnel interface'));
90 o
.placeholder
= '1280';
91 o
.datatype
= 'max(9200)';