summaryrefslogtreecommitdiffhomepage
path: root/libs/sys/luasrc/sys.lua
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2008-11-26 22:59:11 +0000
committerJo-Philipp Wich <jow@openwrt.org>2008-11-26 22:59:11 +0000
commit3793244fcbd6a989e1eee183727b13b554c0f21c (patch)
tree851dd5aa18fdeaf372771fb4ce8c692d6fa760e9 /libs/sys/luasrc/sys.lua
parent950825d323964b40dc53d7386e2d337e655ed33e (diff)
libs/sys: whitespaces fixes
Diffstat (limited to 'libs/sys/luasrc/sys.lua')
-rw-r--r--libs/sys/luasrc/sys.lua73
1 files changed, 36 insertions, 37 deletions
diff --git a/libs/sys/luasrc/sys.lua b/libs/sys/luasrc/sys.lua
index b4b6f6805..4cd012bcc 100644
--- a/libs/sys/luasrc/sys.lua
+++ b/libs/sys/luasrc/sys.lua
@@ -367,43 +367,42 @@ end
-- { "src_ip", "src_prefix", "dst_ip", "dst_prefix", "nexthop_ip",
-- "metric", "refcount", "usecount", "flags", "device" }
function net.routes6()
- local routes = { }
-
- for line in io.lines("/proc/net/ipv6_route") do
-
- local dst_ip, dst_prefix, src_ip, src_prefix, nexthop,
- 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]+) " ..
- "(%d+) (%d+) ([^%s]+) +([^%s]+)"
- )
-
- src_ip = luci.ip.Hex(
- src_ip, tonumber(src_prefix, 16),
- luci.ip.FAMILY_INET6, false
- )
-
- dst_ip = luci.ip.Hex(
- dst_ip, tonumber(dst_prefix, 16),
- luci.ip.FAMILY_INET6, false
- )
-
- nexthop = luci.ip.Hex( nexthop, 128, luci.ip.FAMILY_INET6, false )
-
- routes[#routes+1] = {
- src_ip = src_ip:host():string(),
- src_prefix = src_ip:prefix(),
- dst_ip = dst_ip:host():string(),
- dst_prefix = dst_ip:prefix(),
- nexthop_ip = nexthop:string(),
- metric = tonumber(metric, 16),
- refcount = tonumber(refcnt),
- usecount = tonumber(usecnt),
- flags = tonumber(flags), -- hex?
- device = dev
- }
- end
+ local routes = { }
+
+ for line in io.lines("/proc/net/ipv6_route") do
+
+ local dst_ip, dst_prefix, src_ip, src_prefix, nexthop,
+ 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]+) " ..
+ "(%d+) (%d+) ([^%s]+) +([^%s]+)"
+ )
+ src_ip = luci.ip.Hex(
+ src_ip, tonumber(src_prefix, 16),
+ luci.ip.FAMILY_INET6, false
+ )
+
+ dst_ip = luci.ip.Hex(
+ dst_ip, tonumber(dst_prefix, 16),
+ luci.ip.FAMILY_INET6, false
+ )
+
+ nexthop = luci.ip.Hex( nexthop, 128, luci.ip.FAMILY_INET6, false )
+
+ routes[#routes+1] = {
+ src_ip = src_ip:host():string(),
+ src_prefix = src_ip:prefix(),
+ dst_ip = dst_ip:host():string(),
+ dst_prefix = dst_ip:prefix(),
+ nexthop_ip = nexthop:string(),
+ metric = tonumber(metric, 16),
+ refcount = tonumber(refcnt),
+ usecount = tonumber(usecnt),
+ flags = tonumber(flags), -- hex?
+ device = dev
+ }
+ end
return routes
end