-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
luci-proto-ipv6: Add support for IPIP6(RFC2473) tunnel
Add Generic Packet Tunneling in IPv6 Specification (RFC 2473) support. Signed-off-by: Arayuki Mago <[email protected]>
- Loading branch information
1 parent
e7049d3
commit 7e0ae5e
Showing
5 changed files
with
106 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
-- Copyright 2011 Jo-Philipp Wich <[email protected]> | ||
-- Copyright 2013 Steven Barth <[email protected]> | ||
-- Copyright 2024 Arayuki Mago <[email protected]> | ||
-- Licensed to the public under the Apache License 2.0. | ||
|
||
local netmod = luci.model.network | ||
|
@@ -12,6 +13,8 @@ for _, p in ipairs({"dslite", "map", "464xlat"}) do | |
function proto.get_i18n(self) | ||
if p == "dslite" then | ||
return luci.i18n.translate("Dual-Stack Lite (RFC6333)") | ||
elseif p == "ipip6" then | ||
return luci.i18n.translate("IPv4 over IPv6 (RFC2473-IPIPv6)") | ||
elseif p == "map" then | ||
return luci.i18n.translate("MAP / LW4over6") | ||
elseif p == "464xlat" then | ||
|
@@ -24,7 +27,7 @@ for _, p in ipairs({"dslite", "map", "464xlat"}) do | |
end | ||
|
||
function proto.opkg_package(self) | ||
if p == "dslite" then | ||
if p == "dslite" or p == "ipip6" then | ||
return "ds-lite" | ||
elseif p == "map" then | ||
return "map-t" | ||
|
@@ -56,6 +59,7 @@ end | |
|
||
netmod:register_pattern_virtual("^464%-%w") | ||
netmod:register_pattern_virtual("^ds%-%w") | ||
netmod:register_pattern_virtual("^ipip6%-%w") | ||
netmod:register_pattern_virtual("^map%-%w") | ||
|
||
netmod:register_error_code("AFTR_DNS_FAIL", luci.i18n.translate("Unable to resolve AFTR host name")) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
protocols/luci-proto-ipv6/htdocs/luci-static/resources/protocol/ipip6.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
'use strict'; | ||
'require form'; | ||
'require network'; | ||
'require tools.widgets as widgets'; | ||
|
||
network.registerPatternVirtual(/^ipip6-.+$/); | ||
|
||
return network.registerProtocol('ipip6', { | ||
getI18n: function () { | ||
return _('IPv4 over IPv6 (RFC2473-IPIPv6)'); | ||
}, | ||
|
||
getIfname: function () { | ||
return this._ubus('l3_device') || 'ipip6-%s'.format(this.sid); | ||
}, | ||
|
||
getOpkgPackage: function () { | ||
return 'ds-lite'; | ||
}, | ||
|
||
isFloating: function () { | ||
return true; | ||
}, | ||
|
||
isVirtual: function () { | ||
return true; | ||
}, | ||
|
||
getDevices: function () { | ||
return null; | ||
}, | ||
|
||
containsDevice: function (ifname) { | ||
return (network.getIfnameOf(ifname) == this.getIfname()); | ||
}, | ||
|
||
renderFormOptions: function (s) { | ||
var o; | ||
|
||
o = s.taboption('general', form.Value, 'peeraddr', _('Remote IPv6 address or FQDN')); | ||
o.rmempty = false; | ||
o.datatype = 'or(hostname,ip6addr("nomask"))'; | ||
|
||
o = s.taboption('general', form.Value, 'ip4ifaddr', _('Local IPv4 address')); | ||
o.rmempty = false; | ||
o.datatype = 'ip4addr("nomask")'; | ||
|
||
o = s.taboption('general', form.Value, 'ip6addr', _('Local IPv6 address'), _('Leave empty to use the current WAN address')); | ||
o.datatype = 'ip6addr("nomask")'; | ||
o.load = function (section_id) { | ||
return network.getWAN6Networks().then(L.bind(function (nets) { | ||
if (Array.isArray(nets) && nets.length) | ||
this.placeholder = nets[0].getIP6Addr(); | ||
return form.Value.prototype.load.apply(this, [section_id]); | ||
}, this)); | ||
}; | ||
|
||
o = s.taboption('advanced', widgets.NetworkSelect, 'tunlink', _('Tunnel Link')); | ||
o.nocreate = true; | ||
o.exclude = s.section; | ||
|
||
o = s.taboption('advanced', form.ListValue, 'encaplimit', _('Encapsulation limit')); | ||
o.rmempty = false; | ||
o.default = 'ignore'; | ||
o.datatype = 'or("ignore",range(0,255))'; | ||
o.value('ignore', _('ignore')); | ||
for (var i = 0; i < 256; i++) | ||
o.value(i); | ||
|
||
o = s.taboption('advanced', form.Flag, 'defaultroute', _('Default gateway'), _('If unchecked, no default route is configured')); | ||
o.default = o.enabled; | ||
|
||
o = s.taboption('advanced', form.Value, 'metric', _('Use gateway metric')); | ||
o.placeholder = '0'; | ||
o.datatype = 'uinteger'; | ||
o.depends('defaultroute', '1'); | ||
|
||
o = s.taboption('advanced', form.Value, 'mtu', _('Use MTU on tunnel interface')); | ||
o.placeholder = '1280'; | ||
o.datatype = 'max(9200)'; | ||
} | ||
}); |