diff options
author | Steven Barth <steven@midlink.org> | 2008-12-10 21:45:29 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2008-12-10 21:45:29 +0000 |
commit | 5412893954dd557c17d38971e010baf1f7528ce4 (patch) | |
tree | 7f2a578abb54a0f00715149c337bc43d0dfa9c91 /modules/admin-full/luasrc | |
parent | 8e62419bcbdc8d61de6baca241dd1d559c3a6735 (diff) |
Fixed an overflow error with IPv6 route metric
Diffstat (limited to 'modules/admin-full/luasrc')
-rw-r--r-- | modules/admin-full/luasrc/model/cbi/admin_network/routes.lua | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/admin-full/luasrc/model/cbi/admin_network/routes.lua b/modules/admin-full/luasrc/model/cbi/admin_network/routes.lua index be6629774f..4767e07d5d 100644 --- a/modules/admin-full/luasrc/model/cbi/admin_network/routes.lua +++ b/modules/admin-full/luasrc/model/cbi/admin_network/routes.lua @@ -15,6 +15,7 @@ require("luci.tools.webadmin") m = Map("network", translate("a_n_routes"), translate("a_n_routes1")) local routes6 = luci.sys.net.routes6() +local bit = require "bit" if not arg or not arg[1] then local routes = luci.sys.net.routes() @@ -68,7 +69,10 @@ if not arg or not arg[1] then metric = v:option(DummyValue, "metric", translate("metric")) function metric.cfgvalue(self, section) - return string.format( "%08X", routes6[section].metric ) + local metr = routes6[section].metric + local lower = bit.band(metr, 0xffff) + local higher = bit.rshift(bit.band(metr, 0xffff0000), 16) + return "%04X%04X" % {higher, lower} end end end |