4 'require tools.widgets as widgets';
6 network
.registerPatternVirtual(/^ipip-.+$/);
8 return network
.registerProtocol('ipip', {
10 return _('IPv4-in-IPv4 (RFC2003)');
13 getIfname: function() {
14 return this._ubus('l3_device') || 'ipip-%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
, 'peeraddr', _('Remote IPv4 address or FQDN'), _('The IPv4 address or the fully-qualified domain name of the remote tunnel end.'));
42 o
.datatype
= 'or(hostname,ip4addr("nomask"))';
44 o
= s
.taboption('general', form
.Value
, 'ipaddr', _('Local IPv4 address'), _('The local IPv4 address over which the tunnel is created (optional).'));
46 o
.datatype
= 'ip4addr("nomask")';
48 o
= s
.taboption('general', widgets
.NetworkSelect
, 'tunlink', _('Bind interface'), _('Bind the tunnel to this interface (optional).'));
49 o
.exclude
= s
.section
;
53 o
= s
.taboption('advanced', form
.Value
, 'mtu', _('Override MTU'), _('Specify an MTU (Maximum Transmission Unit) other than the default (1280 bytes).'));
56 o
.datatype
= 'range(68, 9200)';
58 o
= s
.taboption('advanced', form
.Value
, 'ttl', _('Override TTL'), _('Specify a TTL (Time to Live) for the encapsulating packet other than the default (64).'));
61 o
.datatype
= 'min(1)';
63 o
= s
.taboption('advanced', form
.Value
, 'tos', _('Override TOS'), _('Specify a TOS (Type of Service).'));
65 o
.datatype
= 'range(0, 255)';
67 s
.taboption('advanced', form
.Flag
, 'df', _("Don't Fragment"), _("Enable the DF (Don't Fragment) flag of the encapsulating packets."));