libs/core: network model fixes
This commit is contained in:
parent
0f7d2d2525
commit
b304373297
1 changed files with 11 additions and 21 deletions
|
@ -275,26 +275,14 @@ end
|
||||||
function del_network(self, n)
|
function del_network(self, n)
|
||||||
local r = uci_r:delete("network", n)
|
local r = uci_r:delete("network", n)
|
||||||
if r then
|
if r then
|
||||||
uci_r:foreach("network", "alias",
|
uci_r:delete_all("network", "alias",
|
||||||
function(s)
|
function(s) return (s.interface == n) end)
|
||||||
if s.interface == n then
|
|
||||||
uci_r:delete("network", s['.name'])
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
uci_r:foreach("network", "route",
|
uci_r:delete_all("network", "route",
|
||||||
function(s)
|
function(s) return (s.interface == n) end)
|
||||||
if s.interface == n then
|
|
||||||
uci_r:delete("network", s['.name'])
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
uci_r:foreach("network", "route6",
|
uci_r:delete_all("network", "route6",
|
||||||
function(s)
|
function(s) return (s.interface == n) end)
|
||||||
if s.interface == n then
|
|
||||||
uci_r:delete("network", s['.name'])
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
uci_r:foreach("wireless", "wifi-iface",
|
uci_r:foreach("wireless", "wifi-iface",
|
||||||
function(s)
|
function(s)
|
||||||
|
@ -302,8 +290,6 @@ function del_network(self, n)
|
||||||
uci_r:delete("wireless", s['.name'], "network")
|
uci_r:delete("wireless", s['.name'], "network")
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
uci_r:delete("network", n)
|
|
||||||
end
|
end
|
||||||
return r
|
return r
|
||||||
end
|
end
|
||||||
|
@ -990,7 +976,11 @@ function wifinet.name(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
function wifinet.ifname(self)
|
function wifinet.ifname(self)
|
||||||
return self.iwinfo.ifname or self.wdev
|
local ifname = self.iwinfo.ifname
|
||||||
|
if not ifname or ifname:match("^wifi%d") or ifname:match("^radio%d") then
|
||||||
|
ifname = self.wdev
|
||||||
|
end
|
||||||
|
return ifname
|
||||||
end
|
end
|
||||||
|
|
||||||
function wifinet.get_device(self)
|
function wifinet.get_device(self)
|
||||||
|
|
Loading…
Reference in a new issue