summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-mod-admin-full
diff options
context:
space:
mode:
Diffstat (limited to 'modules/luci-mod-admin-full')
-rw-r--r--modules/luci-mod-admin-full/Makefile1
-rw-r--r--modules/luci-mod-admin-full/luasrc/controller/admin/status.lua14
-rw-r--r--modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/dhcp.lua10
-rw-r--r--modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/ifaces.lua2
-rw-r--r--modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/vlan.lua59
-rw-r--r--modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/wifi.lua12
6 files changed, 76 insertions, 22 deletions
diff --git a/modules/luci-mod-admin-full/Makefile b/modules/luci-mod-admin-full/Makefile
index 5fed2797ec..36ddf13f16 100644
--- a/modules/luci-mod-admin-full/Makefile
+++ b/modules/luci-mod-admin-full/Makefile
@@ -10,6 +10,7 @@ LUCI_TITLE:=LuCI Administration - full-featured for full control
LUCI_DEPENDS:=+luci-base
PKG_BUILD_DEPENDS:=iwinfo
+PKG_LICENSE:=Apache-2.0
include ../../luci.mk
diff --git a/modules/luci-mod-admin-full/luasrc/controller/admin/status.lua b/modules/luci-mod-admin-full/luasrc/controller/admin/status.lua
index ad575e0d26..22e1b7e173 100644
--- a/modules/luci-mod-admin-full/luasrc/controller/admin/status.lua
+++ b/modules/luci-mod-admin-full/luasrc/controller/admin/status.lua
@@ -139,14 +139,12 @@ function action_connections()
end
function action_nameinfo(...)
- local i
- local rv = { }
- for i = 1, select('#', ...) do
- local addr = select(i, ...)
- local fqdn = nixio.getnameinfo(addr)
- rv[addr] = fqdn or (addr:match(":") and "[%s]" % addr or addr)
- end
+ local util = require "luci.util"
luci.http.prepare_content("application/json")
- luci.http.write_json(rv)
+ luci.http.write_json(util.ubus("network.rrdns", "lookup", {
+ addrs = { ... },
+ timeout = 5000,
+ limit = 1000
+ }) or { })
end
diff --git a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/dhcp.lua b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/dhcp.lua
index f418ecb40f..c7d330e68d 100644
--- a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/dhcp.lua
+++ b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/dhcp.lua
@@ -276,6 +276,16 @@ name = s:option(Value, "name", translate("Hostname"))
name.datatype = "hostname"
name.rmempty = true
+function name.write(self, section, value)
+ Value.write(self, section, value)
+ m:set(section, "dns", "1")
+end
+
+function name.remove(self, section)
+ Value.remove(self, section)
+ m:del(section, "dns")
+end
+
mac = s:option(Value, "mac", translate("<abbr title=\"Media Access Control\">MAC</abbr>-Address"))
mac.datatype = "list(macaddr)"
mac.rmempty = true
diff --git a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/ifaces.lua b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/ifaces.lua
index 0318522281..4fc71cefab 100644
--- a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/ifaces.lua
+++ b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/ifaces.lua
@@ -445,7 +445,7 @@ if has_dnsmasq and net:proto() == "static" then
limit.datatype = "uinteger"
limit.default = "150"
- local ltime = s:taboption("general", Value, "leasetime", translate("Leasetime"),
+ local ltime = s:taboption("general", Value, "leasetime", translate("Lease time"),
translate("Expiry time of leased addresses, minimum is 2 minutes (<code>2m</code>)."))
ltime.rmempty = true
ltime.default = "12h"
diff --git a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/vlan.lua b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/vlan.lua
index 902767c903..89a73a5ca8 100644
--- a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/vlan.lua
+++ b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/vlan.lua
@@ -12,6 +12,35 @@ nw.init(m.uci)
local topologies = nw:get_switch_topologies() or {}
+local update_interfaces = function(old_ifname, new_ifname)
+ local info = { }
+
+ m.uci:foreach("network", "interface", function(section)
+ local old_ifnames = m.uci:get("network", section[".name"], "ifname")
+ local new_ifnames = { }
+ local cur_ifname
+ local changed = false
+ for cur_ifname in luci.util.imatch(old_ifnames) do
+ if cur_ifname == old_ifname then
+ new_ifnames[#new_ifnames+1] = new_ifname
+ changed = true
+ else
+ new_ifnames[#new_ifnames+1] = cur_ifname
+ end
+ end
+ if changed then
+ m.uci:set("network", section[".name"], "ifname", table.concat(new_ifnames, " "))
+
+ info[#info+1] = translatef("Interface %q device auto-migrated from %q to %q.",
+ section[".name"], old_ifname, new_ifname)
+ end
+ end)
+
+ if #info > 0 then
+ m.message = (m.message and m.message .. "\n" or "") .. table.concat(info, "\n")
+ end
+end
+
m.uci:foreach("network", "switch",
function(x)
local sid = x['.name']
@@ -259,17 +288,32 @@ m.uci:foreach("network", "switch",
-- When writing the "vid" or "vlan" option, serialize the port states
-- as well and write them as "ports" option to uci.
- vid.write = function(self, section, value)
+ vid.write = function(self, section, new_vid)
local o
local p = { }
-
for _, o in ipairs(port_opts) do
- local v = o:formvalue(section)
- if v == "t" then
- p[#p+1] = o.option .. v
- elseif v == "u" then
+ local new_tag = o:formvalue(section)
+ if new_tag == "t" then
+ p[#p+1] = o.option .. new_tag
+ elseif new_tag == "u" then
p[#p+1] = o.option
end
+
+ if o.info and o.info.device then
+ local old_tag = o:cfgvalue(section)
+ local old_vid = self:cfgvalue(section)
+ if old_tag ~= new_tag or old_vid ~= new_vid then
+ local old_ifname = (old_tag == "u") and o.info.device
+ or "%s.%s" %{ o.info.device, old_vid }
+
+ local new_ifname = (new_tag == "u") and o.info.device
+ or "%s.%s" %{ o.info.device, new_vid }
+
+ if old_ifname ~= new_ifname then
+ update_interfaces(old_ifname, new_ifname)
+ end
+ end
+ end
end
if enable_vlan4k then
@@ -277,7 +321,7 @@ m.uci:foreach("network", "switch",
end
m:set(section, "ports", table.concat(p, " "))
- return Value.write(self, section, value)
+ return Value.write(self, section, new_vid)
end
-- Fallback to "vlan" option if "vid" option is supported but unset.
@@ -301,6 +345,7 @@ m.uci:foreach("network", "switch",
po.cfgvalue = portvalue
po.validate = portvalidate
po.write = function() end
+ po.info = pt
port_opts[#port_opts+1] = po
end
diff --git a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/wifi.lua b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/wifi.lua
index 3a08d81d0a..e1e21bcb58 100644
--- a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/wifi.lua
+++ b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/wifi.lua
@@ -600,9 +600,9 @@ if hwtype == "mac80211" or hwtype == "prism2" then
local has_sta_eap = (os.execute("wpa_supplicant -veap >/dev/null 2>/dev/null") == 0)
if hostapd and supplicant then
- encr:value("psk", "WPA-PSK", {mode="ap"}, {mode="sta"}, {mode="ap-wds"}, {mode="sta-wds"})
- encr:value("psk2", "WPA2-PSK", {mode="ap"}, {mode="sta"}, {mode="ap-wds"}, {mode="sta-wds"})
- encr:value("psk-mixed", "WPA-PSK/WPA2-PSK Mixed Mode", {mode="ap"}, {mode="sta"}, {mode="ap-wds"}, {mode="sta-wds"})
+ encr:value("psk", "WPA-PSK", {mode="ap"}, {mode="sta"}, {mode="ap-wds"}, {mode="sta-wds"}, {mode="adhoc"})
+ encr:value("psk2", "WPA2-PSK", {mode="ap"}, {mode="sta"}, {mode="ap-wds"}, {mode="sta-wds"}, {mode="adhoc"})
+ encr:value("psk-mixed", "WPA-PSK/WPA2-PSK Mixed Mode", {mode="ap"}, {mode="sta"}, {mode="ap-wds"}, {mode="sta-wds"}, {mode="adhoc"})
if has_ap_eap and has_sta_eap then
encr:value("wpa", "WPA-EAP", {mode="ap"}, {mode="sta"}, {mode="ap-wds"}, {mode="sta-wds"})
encr:value("wpa2", "WPA2-EAP", {mode="ap"}, {mode="sta"}, {mode="ap-wds"}, {mode="sta-wds"})
@@ -620,9 +620,9 @@ if hwtype == "mac80211" or hwtype == "prism2" then
"and ad-hoc mode) to be installed."
)
elseif not hostapd and supplicant then
- encr:value("psk", "WPA-PSK", {mode="sta"}, {mode="sta-wds"})
- encr:value("psk2", "WPA2-PSK", {mode="sta"}, {mode="sta-wds"})
- encr:value("psk-mixed", "WPA-PSK/WPA2-PSK Mixed Mode", {mode="sta"}, {mode="sta-wds"})
+ encr:value("psk", "WPA-PSK", {mode="sta"}, {mode="sta-wds"}, {mode="adhoc"})
+ encr:value("psk2", "WPA2-PSK", {mode="sta"}, {mode="sta-wds"}, {mode="adhoc"})
+ encr:value("psk-mixed", "WPA-PSK/WPA2-PSK Mixed Mode", {mode="sta"}, {mode="sta-wds"}, {mode="adhoc"})
if has_sta_eap then
encr:value("wpa", "WPA-EAP", {mode="sta"}, {mode="sta-wds"})
encr:value("wpa2", "WPA2-EAP", {mode="sta"}, {mode="sta-wds"})