mirror of https://github.com/openwrt/luci.git
luci-app-coovachilli: switch to luci.ip route functions
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>pull/308/head
parent
feb576413b
commit
625a89a370
|
@ -2,8 +2,8 @@
|
||||||
-- Copyright 2008 Jo-Philipp Wich <jow@openwrt.org>
|
-- Copyright 2008 Jo-Philipp Wich <jow@openwrt.org>
|
||||||
-- Licensed to the public under the Apache License 2.0.
|
-- Licensed to the public under the Apache License 2.0.
|
||||||
|
|
||||||
require("luci.sys")
|
local sys = require"luci.sys"
|
||||||
require("luci.ip")
|
local ip = require "luci.ip"
|
||||||
|
|
||||||
m = Map("coovachilli")
|
m = Map("coovachilli")
|
||||||
|
|
||||||
|
@ -16,8 +16,8 @@ s1:option( Value, "tundev" ).optional = true
|
||||||
s1:option( Value, "txqlen" ).optional = true
|
s1:option( Value, "txqlen" ).optional = true
|
||||||
|
|
||||||
net = s1:option( Value, "net" )
|
net = s1:option( Value, "net" )
|
||||||
for _, route in ipairs(luci.sys.net.routes()) do
|
for _, route in ipairs(ip.routes({ family = 4, type = 1 })) do
|
||||||
if route.device ~= "lo" and route.dest:prefix() < 32 then
|
if route.dest:prefix() > 0 and route.dest:prefix() < 32 then
|
||||||
net:value( route.dest:string() )
|
net:value( route.dest:string() )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -41,7 +41,7 @@ s2 = m:section(TypedSection, "dhcp")
|
||||||
s2.anonymous = true
|
s2.anonymous = true
|
||||||
|
|
||||||
dif = s2:option( Value, "dhcpif" )
|
dif = s2:option( Value, "dhcpif" )
|
||||||
for _, nif in ipairs(luci.sys.net.devices()) do
|
for _, nif in ipairs(sys.net.devices()) do
|
||||||
if nif ~= "lo" then dif:value(nif) end
|
if nif ~= "lo" then dif:value(nif) end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue