Skip to content

Commit

Permalink
luci-proto-ipv6: Integrate ds-lite and ipip6
Browse files Browse the repository at this point in the history
ds-lite and ipip6 now use the same backend ipip6.sh

Signed-off-by: Arayuki Mago <[email protected]>
  • Loading branch information
missing233 committed Feb 1, 2024
1 parent d012a38 commit 729cea8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 20 deletions.
6 changes: 2 additions & 4 deletions modules/luci-compat/luasrc/model/network/proto_4x6.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,12 @@ for _, p in ipairs({"dslite", "map", "464xlat", "ipip6"}) do
end

function proto.opkg_package(self)
if p == "dslite" then
return "ds-lite"
if p == "dslite" or p == "ipip6" then
return "ipip6"
elseif p == "map" then
return "map-t"
elseif p == "464xlat" then
return "464xlat"
elseif p == "ipip6" then
return "ipip6"
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,45 +7,45 @@ network.registerPatternVirtual(/^ds-.+$/);
network.registerErrorCode('AFTR_DNS_FAIL', _('Unable to resolve AFTR host name'));

return network.registerProtocol('dslite', {
getI18n: function() {
getI18n: function () {
return _('Dual-Stack Lite (RFC6333)');
},

getIfname: function() {
getIfname: function () {
return this._ubus('l3_device') || 'ds-%s'.format(this.sid);
},

getOpkgPackage: function() {
return 'ds-lite';
getOpkgPackage: function () {
return 'ipip6';
},

isFloating: function() {
isFloating: function () {
return true;
},

isVirtual: function() {
isVirtual: function () {
return true;
},

getDevices: function() {
getDevices: function () {
return null;
},

containsDevice: function(ifname) {
containsDevice: function (ifname) {
return (network.getIfnameOf(ifname) == this.getIfname());
},

renderFormOptions: function(s) {
renderFormOptions: function (s) {
var o;

o = s.taboption('general', form.Value, 'peeraddr', _('DS-Lite AFTR address'));
o.rmempty = false;
o.rmempty = false;
o.datatype = 'or(hostname,ip6addr("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) {
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]);
Expand All @@ -54,18 +54,18 @@ return network.registerProtocol('dslite', {

o = s.taboption('advanced', widgets.NetworkSelect, 'tunlink', _('Tunnel Link'));
o.nocreate = true;
o.exclude = s.section;
o.exclude = s.section;

o = s.taboption('advanced', form.ListValue, 'encaplimit', _('Encapsulation limit'));
o.rmempty = false;
o.default = 'ignore';
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.Value, 'mtu', _('Use MTU on tunnel interface'));
o.placeholder = '1280';
o.datatype = 'max(9200)';
o.datatype = 'max(9200)';
}
});

0 comments on commit 729cea8

Please sign in to comment.