summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-olsr
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2015-01-22 15:12:56 +0100
committerJo-Philipp Wich <jow@openwrt.org>2015-01-22 15:12:56 +0100
commitb48386be67bc5530fe11499183fa9ef9f15f0829 (patch)
tree3de92483bb754945d0837db819dd19b583d0ebdf /applications/luci-app-olsr
parent0e90bf98dfd25f47c21534949eafa0e6d4fea979 (diff)
luci-app-olsr: use luci.ip.routes() to find default gw
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
Diffstat (limited to 'applications/luci-app-olsr')
-rw-r--r--applications/luci-app-olsr/luasrc/controller/olsr.lua12
1 files changed, 3 insertions, 9 deletions
diff --git a/applications/luci-app-olsr/luasrc/controller/olsr.lua b/applications/luci-app-olsr/luasrc/controller/olsr.lua
index 3615372909..80f99addc6 100644
--- a/applications/luci-app-olsr/luasrc/controller/olsr.lua
+++ b/applications/luci-app-olsr/luasrc/controller/olsr.lua
@@ -108,16 +108,10 @@ function action_neigh(json)
local assoclist = {}
--local neightbl = require "neightbl"
local ipc = require "luci.ip"
+ local defaultgw
- luci.sys.net.routes(function(r)
- if r.dest:prefix() == 0 then
- defaultgw = r.gateway:string()
- end
- end)
-
- if not defaultgw then
- defaultgw = luci.util.exec("ip route list exact 0.0.0.0/0 table all"):match(" via (%S+)")
- end
+ ipc.routes({ family = 4, type = 1, dest_exact = "0.0.0.0/0" },
+ function(rt) defaultgw = rt.gw end)
local function compare(a,b)
if a.proto == b.proto then