Make static IPv6-configuration more usable
[project/luci.git] / protocols / core / luasrc / model / cbi / admin_network / proto_static.lua
index 3c9b14b..338c0b7 100644 (file)
@@ -14,7 +14,7 @@ local map, section, net = ...
 local ifc = net:get_interface()
 
 local ipaddr, netmask, gateway, broadcast, dns, accept_ra, send_rs, ip6addr, ip6gw
-local macaddr, mtu, metric
+local mtu, metric
 
 
 ipaddr = section:taboption("general", Value, "ipaddr", translate("IPv4 address"))
@@ -42,39 +42,45 @@ dns = section:taboption("general", DynamicList, "dns",
        translate("Use custom DNS servers"))
 
 dns.datatype = "ipaddr"
+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)"
 
+       local ip6hint = section:taboption("general", Value, "ip6hint", translate("IPv6 assignment hint"),
+               translate("Assign prefix parts using this hexadecimal subprefix ID for this interface."))
+       for i=33,64 do ip6hint:depends("ip6assign", i) end
 
        ip6addr = section:taboption("general", Value, "ip6addr", translate("IPv6 address"))
        ip6addr.datatype = "ip6addr"
-       ip6addr:depends("accept_ra", "")
+       ip6addr:depends("ip6assign", "")
 
 
        ip6gw = section:taboption("general", Value, "ip6gw", translate("IPv6 gateway"))
        ip6gw.datatype = "ip6addr"
-       ip6gw:depends("accept_ra", "")
+       ip6gw:depends("ip6assign", "")
+
+
+       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"
+       ip6prefix:depends("ip6assign", "")
 
 end
 
 
-macaddr = section:taboption("advanced", Value, "macaddr", translate("Override MAC address"))
-macaddr.placeholder = ifc and ifc:mac() or "00:00:00:00:00:00"
-macaddr.datatype    = "macaddr"
+luci.tools.proto.opt_macaddr(section, ifc, translate("Override MAC address"))
 
 
 mtu = section:taboption("advanced", Value, "mtu", translate("Override MTU"))
 mtu.placeholder = "1500"
-mtu.datatype    = "max(1500)"
+mtu.datatype    = "max(9200)"
 
 
 metric = section:taboption("advanced", Value, "metric",