projects
/
project
/
luci.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0f9f2a4
)
libs/core: fix some issues in network model
author
Jo-Philipp Wich
<jow@openwrt.org>
Fri, 24 Dec 2010 21:39:44 +0000
(21:39 +0000)
committer
Jo-Philipp Wich
<jow@openwrt.org>
Fri, 24 Dec 2010 21:39:44 +0000
(21:39 +0000)
libs/core/luasrc/model/network.lua
patch
|
blob
|
history
diff --git
a/libs/core/luasrc/model/network.lua
b/libs/core/luasrc/model/network.lua
index
18c84b6
..
17e0745
100644
(file)
--- a/
libs/core/luasrc/model/network.lua
+++ b/
libs/core/luasrc/model/network.lua
@@
-482,10
+482,11
@@
function network.ifname(self)
return p .. "-" .. self.sid
else
local num = { }
return p .. "-" .. self.sid
else
local num = { }
- local dev =
self:_get(
"ifname") or
- uci_
r
:get("network", self.sid, "ifname")
+ local dev =
uci_r:get("network", self.sid,
"ifname") or
+ uci_
s
:get("network", self.sid, "ifname")
- dev = dev and dev:match("%S+")
+ dev = (type(dev) == "table") and dev[1] or dev
+ dev = (dev ~= nil) and dev:match("%S+")
if not dev then
uci_r:foreach("wireless", "wifi-iface",
if not dev then
uci_r:foreach("wireless", "wifi-iface",
@@
-507,10
+508,18
@@
function network.ifname(self)
end
function network.device(self)
end
function network.device(self)
- local dev = self:_get("device")
+ local dev = uci_r:get("network", self.sid, "device") or
+ uci_s:get("network", self.sid, "device")
+
+ dev = (type(dev) == "table") and dev[1] or dev
+
if not dev or dev:match("[^%w%-%.%s]") then
if not dev or dev:match("[^%w%-%.%s]") then
- dev = uci_r:get("network", self.sid, "ifname")
+ dev = uci_r:get("network", self.sid, "ifname") or
+ uci_s:get("network", self.sid, "ifname")
+
+ dev = (type(dev) == "table") and dev[1] or dev
end
end
+
return dev
end
return dev
end