libs/sys: whitespaces fixes
This commit is contained in:
parent
950825d323
commit
3793244fcb
1 changed files with 31 additions and 32 deletions
|
@ -367,43 +367,42 @@ end
|
||||||
-- { "src_ip", "src_prefix", "dst_ip", "dst_prefix", "nexthop_ip",
|
-- { "src_ip", "src_prefix", "dst_ip", "dst_prefix", "nexthop_ip",
|
||||||
-- "metric", "refcount", "usecount", "flags", "device" }
|
-- "metric", "refcount", "usecount", "flags", "device" }
|
||||||
function net.routes6()
|
function net.routes6()
|
||||||
local routes = { }
|
local routes = { }
|
||||||
|
|
||||||
for line in io.lines("/proc/net/ipv6_route") do
|
for line in io.lines("/proc/net/ipv6_route") do
|
||||||
|
|
||||||
local dst_ip, dst_prefix, src_ip, src_prefix, nexthop,
|
local dst_ip, dst_prefix, src_ip, src_prefix, nexthop,
|
||||||
metric, refcnt, usecnt, flags, dev = line:match(
|
metric, refcnt, usecnt, flags, dev = line:match(
|
||||||
"([a-f0-9]+) ([a-f0-9]+) " ..
|
"([a-f0-9]+) ([a-f0-9]+) " ..
|
||||||
"([a-f0-9]+) ([a-f0-9]+) " ..
|
"([a-f0-9]+) ([a-f0-9]+) " ..
|
||||||
"([a-f0-9]+) ([a-f0-9]+) " ..
|
"([a-f0-9]+) ([a-f0-9]+) " ..
|
||||||
"(%d+) (%d+) ([^%s]+) +([^%s]+)"
|
"(%d+) (%d+) ([^%s]+) +([^%s]+)"
|
||||||
)
|
)
|
||||||
|
src_ip = luci.ip.Hex(
|
||||||
src_ip = luci.ip.Hex(
|
src_ip, tonumber(src_prefix, 16),
|
||||||
src_ip, tonumber(src_prefix, 16),
|
luci.ip.FAMILY_INET6, false
|
||||||
luci.ip.FAMILY_INET6, false
|
)
|
||||||
)
|
|
||||||
|
|
||||||
dst_ip = luci.ip.Hex(
|
dst_ip = luci.ip.Hex(
|
||||||
dst_ip, tonumber(dst_prefix, 16),
|
dst_ip, tonumber(dst_prefix, 16),
|
||||||
luci.ip.FAMILY_INET6, false
|
luci.ip.FAMILY_INET6, false
|
||||||
)
|
)
|
||||||
|
|
||||||
nexthop = luci.ip.Hex( nexthop, 128, luci.ip.FAMILY_INET6, false )
|
nexthop = luci.ip.Hex( nexthop, 128, luci.ip.FAMILY_INET6, false )
|
||||||
|
|
||||||
routes[#routes+1] = {
|
routes[#routes+1] = {
|
||||||
src_ip = src_ip:host():string(),
|
src_ip = src_ip:host():string(),
|
||||||
src_prefix = src_ip:prefix(),
|
src_prefix = src_ip:prefix(),
|
||||||
dst_ip = dst_ip:host():string(),
|
dst_ip = dst_ip:host():string(),
|
||||||
dst_prefix = dst_ip:prefix(),
|
dst_prefix = dst_ip:prefix(),
|
||||||
nexthop_ip = nexthop:string(),
|
nexthop_ip = nexthop:string(),
|
||||||
metric = tonumber(metric, 16),
|
metric = tonumber(metric, 16),
|
||||||
refcount = tonumber(refcnt),
|
refcount = tonumber(refcnt),
|
||||||
usecount = tonumber(usecnt),
|
usecount = tonumber(usecnt),
|
||||||
flags = tonumber(flags), -- hex?
|
flags = tonumber(flags), -- hex?
|
||||||
device = dev
|
device = dev
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
return routes
|
return routes
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue