5 network.registerPatternVirtual(/^6to4-.+$/);
7 return network.registerProtocol('6to4', {
9 return _('IPv6-over-IPv4 (6to4)');
12 getIfname: function() {
13 return this._ubus('l3_device') || '6to4-%s'.format(this.sid);
16 getOpkgPackage: function() {
20 isFloating: function() {
24 isVirtual: function() {
28 getDevices: function() {
32 containsDevice: function(ifname) {
33 return (network.getIfnameOf(ifname) == this.getIfname());
36 renderFormOptions: function(s) {
39 o = s.taboption('general', form.Value, 'ipaddr', _('Local IPv4 address'), _('Leave empty to use the current WAN address'));
40 o.datatype = 'ip4addr("nomask")';
41 o.load = function(section_id) {
42 return network.getWANNetworks().then(L.bind(function(nets) {
44 this.placeholder = nets[0].getIPAddr();
45 return form.Value.prototype.load.apply(this, [section_id]);
49 o = s.taboption('advanced', form.Flag, 'defaultroute', _('Default gateway'), _('If unchecked, no default route is configured'));
50 o.default = o.enabled;
52 o = s.taboption('advanced', form.Value, 'metric', _('Use gateway metric'));
54 o.datatype = 'uinteger';
55 o.depends('defaultroute', '1');
57 o = s.taboption('advanced', form.Value, 'ttl', _('Use TTL on tunnel interface'));
59 o.datatype = 'range(1,255)';
61 o = s.taboption('advanced', form.Value, 'mtu', _('Use MTU on tunnel interface'));
62 o.placeholder = '1280';
63 o.datatype = 'max(9200)';