applications/luci-olsr: Save RAM while getting the default route, very good hint...
authorManuel Munz <freifunk@somakoma.de>
Sun, 2 Jan 2011 16:20:25 +0000 (16:20 +0000)
committerManuel Munz <freifunk@somakoma.de>
Sun, 2 Jan 2011 16:20:25 +0000 (16:20 +0000)
applications/luci-olsr/luasrc/controller/olsr.lua

index 688e4918d7c63e4472d4cffa460157c882e248fe..f4d52c42d4963e9c8d456898b176bd38029664d4 100644 (file)
@@ -240,11 +240,7 @@ function fetch_txtinfo(otable)
 
                if otable == "links" then
                        local route = {}
-                       for i, route in ipairs(luci.sys.net.routes()) do
-                               if route.dest:prefix() == 0 then
-                                       defaultgw = route.gateway:string()
-                               end
-                       end
+                       luci.sys.net.routes(function(r) if r.dest:prefix() == 0 then defaultgw = r.gateway:string() end end)
                end
 
                for i, tbl in ipairs(tables) do