summaryrefslogtreecommitdiffhomepage
path: root/modules/niu/luasrc/niulib.lua
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2009-11-23 15:37:54 +0000
committerSteven Barth <steven@midlink.org>2009-11-23 15:37:54 +0000
commit8b80a623c3526fa40d215f28f0a3cd1312edebea (patch)
tree10410da416fe3db862e5a1754384dbb28830bc7d /modules/niu/luasrc/niulib.lua
parentedb5427181412a69be73b7ccda199841d1e0092b (diff)
NIU: Allow automatic unbridging of LAN ethernet for WAN use
Diffstat (limited to 'modules/niu/luasrc/niulib.lua')
-rw-r--r--modules/niu/luasrc/niulib.lua18
1 files changed, 17 insertions, 1 deletions
diff --git a/modules/niu/luasrc/niulib.lua b/modules/niu/luasrc/niulib.lua
index aef542aa6e..dc3df5ed43 100644
--- a/modules/niu/luasrc/niulib.lua
+++ b/modules/niu/luasrc/niulib.lua
@@ -15,7 +15,9 @@ $Id$
local ipairs, pairs, require = ipairs, pairs, require
local os = require "os"
-local cursor = require "luci.model.uci".inst
+local uci = require "luci.model.uci"
+local cursor = uci.inst
+local state = uci.inst_state
module "luci.niulib"
@@ -36,6 +38,20 @@ function eth_get_available(except)
return ifs
end
+function eth_get_bridged(except)
+ local devs = state:get("network", except, "device")
+
+ local ifs = {}
+ local cnt = 0
+ for x in devs:gmatch("[^ ]+") do
+ cnt = cnt + 1
+ if x:find("eth") == 1 then
+ ifs[#ifs+1] = x
+ end
+ end
+ return cnt > 1 and ifs or {}
+end
+
function wifi_get_available(except)
cursor:unload("wireless")