New IPv6 integration
This commit is contained in:
parent
56ece5b644
commit
cd35191cbb
8 changed files with 162 additions and 84 deletions
|
@ -749,6 +749,8 @@ function protocol.get_i18n(self)
|
|||
return lng.translate("Static address")
|
||||
elseif p == "dhcp" then
|
||||
return lng.translate("DHCP client")
|
||||
elseif p == "dhcpv6" then
|
||||
return lng.translate("DHCPv6 client")
|
||||
else
|
||||
return lng.translate("Unknown")
|
||||
end
|
||||
|
@ -1546,8 +1548,15 @@ end
|
|||
-- setup base protocols
|
||||
_M:register_protocol("static")
|
||||
_M:register_protocol("dhcp")
|
||||
|
||||
local dhcpv6 = _M:register_protocol("dhcpv6")
|
||||
function dhcpv6.is_installed(self)
|
||||
return nfs.access("/lib/netifd/proto/dhcpv6.sh")
|
||||
end
|
||||
|
||||
_M:register_protocol("none")
|
||||
|
||||
|
||||
-- load protocol extensions
|
||||
local exts = nfs.dir(utl.libpath() .. "/model/network")
|
||||
if exts then
|
||||
|
|
|
@ -138,6 +138,13 @@ function index()
|
|||
page.order = 40
|
||||
end
|
||||
|
||||
if nixio.fs.access("/etc/config/6relayd") then
|
||||
page = node("admin", "network", "ipv6")
|
||||
page.target = cbi("admin_network/ipv6")
|
||||
page.title = _("IPv6 RA and DHCPv6")
|
||||
page.order = 45
|
||||
end
|
||||
|
||||
page = node("admin", "network", "routes")
|
||||
page.target = cbi("admin_network/routes")
|
||||
page.title = _("Static Routes")
|
||||
|
|
66
modules/admin-full/luasrc/model/cbi/admin_network/ipv6.lua
Normal file
66
modules/admin-full/luasrc/model/cbi/admin_network/ipv6.lua
Normal file
|
@ -0,0 +1,66 @@
|
|||
--[[
|
||||
LuCI - Lua Configuration Interface
|
||||
|
||||
Copyright 2013 Steven Barth <steven@midlink.org>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
$Id$
|
||||
]]--
|
||||
|
||||
local m = Map("6relayd", translate("IPv6 RA and DHCPv6"),
|
||||
translate("6relayd is a lightweight router advertisement daemon and provides " ..
|
||||
"stateless DHCPv6 service where size matters. It can also be used as a relay " ..
|
||||
"for the aforementioned services."))
|
||||
|
||||
local s = m:section(TypedSection, "server", translate("Server Settings"))
|
||||
s.addremove = true
|
||||
|
||||
|
||||
|
||||
local o = s:option(DynamicList, "network", translate("Service Interfaces"),
|
||||
translate("Interfaces to provide services on or to relay services to."))
|
||||
o.widget = "checkbox"
|
||||
o.template = "cbi/network_netlist"
|
||||
o.nocreate = true
|
||||
o.nobridges = true
|
||||
o.novirtual = true
|
||||
o.optional = false
|
||||
|
||||
o = s:option(ListValue, "rd", translate("Router Advertisement-Service"))
|
||||
o:value("", translate("disabled"))
|
||||
o:value("server", translate("server mode"))
|
||||
o:value("relay", translate("relay mode"))
|
||||
|
||||
o = s:option(ListValue, "dhcpv6", translate("DHCPv6-Service"))
|
||||
o:value("", translate("disabled"))
|
||||
o:value("server", translate("server mode"))
|
||||
o:value("relay", translate("relay mode"))
|
||||
|
||||
o = s:option(ListValue, "ndp", translate("NDP-Proxy"))
|
||||
o:value("", translate("disabled"))
|
||||
o:value("relay", translate("relay mode"))
|
||||
|
||||
o = s:option(MultiValue, "fallback_relay", translate("Fallback to relay"),
|
||||
translate("Relay services from master to server interfaces when there is no public prefix available."))
|
||||
o:value("rd", translate("Router Advertisement"))
|
||||
o:value("dhcpv6", translate("DHCPV6"))
|
||||
o:value("ndp", translate("NDP-Proxy"))
|
||||
|
||||
o = s:option(Value, "master", translate("Master Interface"),
|
||||
translate("Specifies the master interface for services that are relayed."))
|
||||
o.template = "cbi/network_netlist"
|
||||
o.nocreate = true
|
||||
|
||||
o = s:option(Flag, "always_rewrite_dns", translate("Always announce local DNS"),
|
||||
translate("Announce the local router as DNS server even in relay mode."))
|
||||
|
||||
o = s:option(Flag, "always_assume_default", translate("Always announce default router"),
|
||||
translate("Announce as default router even if no public prefix is available."))
|
||||
o:depends("rd", "server")
|
||||
|
||||
return m
|
|
@ -39,6 +39,13 @@ ip6addr.rmempty = false
|
|||
ip6addr.datatype = "ip6addr"
|
||||
|
||||
|
||||
local ip6prefix = s:taboption("general", Value, "ip6prefix",
|
||||
translate("IPv6 routed prefix"),
|
||||
translate("This is the prefix routed to you by the tunnel broker for use by clients"))
|
||||
|
||||
ip6prefix.datatype = "ip6addr"
|
||||
|
||||
|
||||
local update = section:taboption("general", Flag, "_update",
|
||||
translate("Dynamic tunnel"),
|
||||
translate("Enable HE.net dynamic endpoint update"))
|
||||
|
|
|
@ -12,8 +12,7 @@ You may obtain a copy of the License at
|
|||
|
||||
local map, section, net = ...
|
||||
|
||||
local ipaddr, adv_interface, adv_subnet
|
||||
local adv_valid_lifetime, adv_preferred_lifetime, defaultroute, metric, ttl, mtu
|
||||
local ipaddr, defaultroute, metric, ttl, mtu
|
||||
|
||||
|
||||
ipaddr = section:taboption("general", Value, "ipaddr",
|
||||
|
@ -22,67 +21,6 @@ ipaddr = section:taboption("general", Value, "ipaddr",
|
|||
|
||||
ipaddr.datatype = "ip4addr"
|
||||
|
||||
|
||||
adv_interface = section:taboption("general", Value, "adv_interface", translate("Advertise IPv6 on network"))
|
||||
adv_interface.widget = "checkbox"
|
||||
adv_interface.exclude = arg[1]
|
||||
adv_interface.default = "lan"
|
||||
adv_interface.template = "cbi/network_netlist"
|
||||
adv_interface.nocreate = true
|
||||
adv_interface.nobridges = true
|
||||
adv_interface.novirtual = true
|
||||
|
||||
function adv_interface.write(self, section, value)
|
||||
if type(value) == "table" then
|
||||
Value.write(self, section, table.concat(value, " "))
|
||||
else
|
||||
Value.write(self, section, value)
|
||||
end
|
||||
end
|
||||
|
||||
function adv_interface.remove(self, section)
|
||||
self:write(section, " ")
|
||||
end
|
||||
|
||||
adv_subnet = section:taboption("general", Value, "adv_subnet",
|
||||
translate("Advertised network ID"),
|
||||
translate("Allowed range is 1 to 65535"))
|
||||
|
||||
adv_subnet.placeholder = "1"
|
||||
adv_subnet.datatype = "range(1,65535)"
|
||||
|
||||
function adv_subnet.cfgvalue(self, section)
|
||||
local v = Value.cfgvalue(self, section)
|
||||
return v and tonumber(v, 16)
|
||||
end
|
||||
|
||||
function adv_subnet .write(self, section, value)
|
||||
value = tonumber(value) or 1
|
||||
|
||||
if value > 65535 then value = 65535
|
||||
elseif value < 1 then value = 1 end
|
||||
|
||||
Value.write(self, section, "%X" % value)
|
||||
end
|
||||
|
||||
|
||||
adv_valid_lifetime = section:taboption("advanced", Value, "adv_valid_lifetime",
|
||||
translate("Use valid lifetime"),
|
||||
translate("Specifies the advertised valid prefix lifetime in seconds"))
|
||||
|
||||
adv_valid_lifetime.placeholder = "300"
|
||||
adv_valid_lifetime.datatype = "uinteger"
|
||||
|
||||
|
||||
adv_preferred_lifetime = section:taboption("advanced", Value, "adv_preferred_lifetime",
|
||||
translate("Use preferred lifetime"),
|
||||
translate("Specifies the advertised preferred prefix lifetime in seconds"))
|
||||
|
||||
adv_preferred_lifetime.placeholder = "120"
|
||||
adv_preferred_lifetime.datatype = "uinteger"
|
||||
|
||||
|
||||
|
||||
defaultroute = section:taboption("advanced", Flag, "defaultroute",
|
||||
translate("Use default gateway"),
|
||||
translate("If unchecked, no default route is configured"))
|
||||
|
|
|
@ -24,18 +24,6 @@ hostname.placeholder = luci.sys.hostname()
|
|||
hostname.datatype = "hostname"
|
||||
|
||||
|
||||
if luci.model.network:has_ipv6() then
|
||||
|
||||
accept_ra = s:taboption("general", Flag, "accept_ra", translate("Accept router advertisements"))
|
||||
accept_ra.default = accept_ra.enabled
|
||||
|
||||
|
||||
send_rs = s:taboption("general", Flag, "send_rs", translate("Send router solicitations"))
|
||||
send_rs.default = send_rs.disabled
|
||||
send_rs:depends("accept_ra", "")
|
||||
|
||||
end
|
||||
|
||||
bcast = section:taboption("advanced", Flag, "broadcast",
|
||||
translate("Use broadcast flag"),
|
||||
translate("Required for certain ISPs, e.g. Charter with DOCSIS 3"))
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
--[[
|
||||
LuCI - Lua Configuration Interface
|
||||
|
||||
Copyright 2013 Steven Barth <steven@midlink.org>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
]]--
|
||||
|
||||
local map, section, net = ...
|
||||
|
||||
|
||||
local o = section:taboption("general", ListValue, "reqaddress",
|
||||
translate("Request IPv6-address"))
|
||||
o:value("try")
|
||||
o:value("force")
|
||||
o:value("none", "disabled")
|
||||
o.default = "try"
|
||||
|
||||
|
||||
o = section:taboption("general", Value, "reqprefix",
|
||||
translate("Request IPv6-prefix of length"))
|
||||
o:value("auto", translate("automatic"))
|
||||
o:value("no", translate("disabled"))
|
||||
o:value("48")
|
||||
o:value("52")
|
||||
o:value("56")
|
||||
o:value("60")
|
||||
o:value("64")
|
||||
o.default = "auto"
|
||||
|
||||
|
||||
o = section:taboption("advanced", Flag, "defaultroute",
|
||||
translate("Use default gateway"),
|
||||
translate("If unchecked, no default route is configured"))
|
||||
o.default = o.enabled
|
||||
|
||||
|
||||
o = section:taboption("advanced", Flag, "peerdns",
|
||||
translate("Use DNS servers advertised by peer"),
|
||||
translate("If unchecked, the advertised DNS server addresses are ignored"))
|
||||
o.default = o.enabled
|
||||
|
||||
|
||||
o = section:taboption("advanced", DynamicList, "dns",
|
||||
translate("Use custom DNS servers"))
|
||||
o:depends("peerdns", "")
|
||||
o.datatype = "list(ip6addr)"
|
||||
o.cast = "string"
|
||||
|
||||
|
||||
o = section:taboption("advanced", Value, "clientid",
|
||||
translate("Client ID to send when requesting DHCP"))
|
||||
|
||||
luci.tools.proto.opt_macaddr(section, ifc, translate("Override MAC address"))
|
||||
|
||||
o = section:taboption("advanced", Value, "mtu", translate("Override MTU"))
|
||||
o.placeholder = "1500"
|
||||
o.datatype = "max(1500)"
|
|
@ -47,23 +47,24 @@ dns.cast = "string"
|
|||
|
||||
if luci.model.network:has_ipv6() then
|
||||
|
||||
accept_ra = s:taboption("general", Flag, "accept_ra", translate("Accept router advertisements"))
|
||||
accept_ra.default = accept_ra.disabled
|
||||
|
||||
|
||||
send_rs = s:taboption("general", Flag, "send_rs", translate("Send router solicitations"))
|
||||
send_rs.default = send_rs.enabled
|
||||
send_rs:depends("accept_ra", "")
|
||||
local ip6assign = section:taboption("general", Value, "ip6assign", translate("IPv6 assignment length"),
|
||||
translate("Assign a part of given length of every public IPv6-prefix to this interface"))
|
||||
ip6assign:value("", translate("disabled"))
|
||||
ip6assign:value("64")
|
||||
ip6assign.datatype = "max(64)"
|
||||
|
||||
|
||||
ip6addr = section:taboption("general", Value, "ip6addr", translate("IPv6 address"))
|
||||
ip6addr.datatype = "ip6addr"
|
||||
ip6addr:depends("accept_ra", "")
|
||||
|
||||
|
||||
ip6gw = section:taboption("general", Value, "ip6gw", translate("IPv6 gateway"))
|
||||
ip6gw.datatype = "ip6addr"
|
||||
ip6gw:depends("accept_ra", "")
|
||||
|
||||
|
||||
local ip6prefix = s:taboption("general", Value, "ip6prefix", translate("IPv6 routed prefix"),
|
||||
translate("Public prefix routed to this device for distribution to clients."))
|
||||
ip6prefix.datatype = "ip6addr"
|
||||
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue