summaryrefslogtreecommitdiffhomepage
path: root/modules/freifunk/luasrc/model/cbi
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-12-10 23:24:29 +0000
committerSteven Barth <steven@midlink.org>2008-12-10 23:24:29 +0000
commit1b48ae1188b829c71f9cdde4dc98ff1df41cfad0 (patch)
tree14396a4b3dddfb897c7aaf1489dd5876625dd855 /modules/freifunk/luasrc/model/cbi
parentf57759a08aa38e97dd03422cfe71da2b0a6c2452 (diff)
Fix display of v6 Routing metric on Freifunk status pages
Diffstat (limited to 'modules/freifunk/luasrc/model/cbi')
-rw-r--r--modules/freifunk/luasrc/model/cbi/freifunk/public_status.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/freifunk/luasrc/model/cbi/freifunk/public_status.lua b/modules/freifunk/luasrc/model/cbi/freifunk/public_status.lua
index 016a0b7f27..14e6d56649 100644
--- a/modules/freifunk/luasrc/model/cbi/freifunk/public_status.lua
+++ b/modules/freifunk/luasrc/model/cbi/freifunk/public_status.lua
@@ -1,6 +1,7 @@
require "luci.sys"
require "luci.tools.webadmin"
+local bit = require "bit"
local uci = luci.model.uci.cursor_state()
local ffzone = luci.tools.webadmin.firewall_find_zone("freifunk")
@@ -202,7 +203,10 @@ if #routes6 > 0 then
metric = v6:option(DummyValue, "metric", translate("metric"))
function metric.cfgvalue(self, section)
- return string.format("%X", 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