X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=modules%2Fluci-base%2Fluasrc%2Fmodel%2Fnetwork.lua;h=0f58c16848630faec67b477b671cefc50d6807b6;hp=9ea8e369daf735d58806dd231008b9524d8bdca6;hb=72fe5dd70335a6bbbe5db8ecc1885a68d368eb3a;hpb=09ea6dbd33cc46df3ca17c640ffcb3d148a4639a diff --git a/modules/luci-base/luasrc/model/network.lua b/modules/luci-base/luasrc/model/network.lua index 9ea8e369d..0f58c1684 100644 --- a/modules/luci-base/luasrc/model/network.lua +++ b/modules/luci-base/luasrc/model/network.lua @@ -330,7 +330,7 @@ function init(cursor) if i.family == "packet" then _interfaces[name].flags = i.flags _interfaces[name].stats = i.data - _interfaces[name].macaddr = i.addr + _interfaces[name].macaddr = ipc.checkmac(i.addr) elseif i.family == "inet" then _interfaces[name].ipaddrs[#_interfaces[name].ipaddrs+1] = ipc.IPv4(i.addr, i.netmask) elseif i.family == "inet6" then @@ -543,6 +543,9 @@ end function del_network(self, n) local r = _uci:delete("network", n) if r then + _uci:delete_all("luci", "ifstate", + function(s) return (s.interface == n) end) + _uci:delete_all("network", "alias", function(s) return (s.interface == n) end) @@ -626,7 +629,7 @@ function get_interface(self, i) if _interfaces[i] or _wifi_iface(i) then return interface(i) else - local netid = _wifi_netid_by_netname(i) + local netid = _wifi_netid_by_sid(i) return netid and interface(netid) end end @@ -998,7 +1001,10 @@ function protocol.ip6addrs(self) if type(addrs) == "table" then for n, addr in ipairs(addrs) do - if type(addr["local-address"]) == "table" then + if type(addr["local-address"]) == "table" and + type(addr["local-address"].mask) == "number" and + type(addr["local-address"].address) == "string" + then rv[#rv+1] = "%s/%d" %{ addr["local-address"].address, addr["local-address"].mask @@ -1227,8 +1233,7 @@ function interface.name(self) end function interface.mac(self) - local mac = self:_ubus("macaddr") - return mac and mac:upper() + return ipc.checkmac(self:_ubus("macaddr")) end function interface.ipaddrs(self) @@ -1423,7 +1428,7 @@ function wifidev.hwmodes(self) end function wifidev.get_i18n(self) - local t = "Generic" + local t = self.iwinfo.hardware_name or "Generic" if self.iwinfo.type == "wl" then t = "Broadcom" end