diff options
author | Manuel Munz <freifunk@somakoma.de> | 2010-12-12 15:08:56 +0000 |
---|---|---|
committer | Manuel Munz <freifunk@somakoma.de> | 2010-12-12 15:08:56 +0000 |
commit | 725c424a759ca55017a50947fa871b44c7a8b8ef (patch) | |
tree | 3e277558cb0ce5ea141d77e0b145d8c608ab0a66 | |
parent | 99881d9cb66c49c0011360d54e8c9c14d271a859 (diff) |
applications/luci-olsr: If InterfaceDefaults are set for a value and it is unset in the interface section then show the value from InterfaceDefaults instead of the olsrd default value. This aims to fix #175
-rw-r--r-- | applications/luci-olsr/luasrc/model/cbi/olsr/olsrd.lua | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/applications/luci-olsr/luasrc/model/cbi/olsr/olsrd.lua b/applications/luci-olsr/luasrc/model/cbi/olsr/olsrd.lua index 9bc17c8959..f7b173cd6f 100644 --- a/applications/luci-olsr/luasrc/model/cbi/olsr/olsrd.lua +++ b/applications/luci-olsr/luasrc/model/cbi/olsr/olsrd.lua @@ -307,34 +307,34 @@ network.template = "cbi/network_netinfo" mode = ifs:option(DummyValue, "Mode", translate("Mode")) function mode.cfgvalue(...) - return Value.cfgvalue(...) or "mesh" + return Value.cfgvalue(...) or m.uci:get_first("olsrd", "InterfaceDefaults", "Mode", "mesh") end hello = ifs:option(DummyValue, "_hello", translate("Hello")) function hello.cfgvalue(self, section) - local i = tonumber(m.uci:get("olsrd", section, "HelloInterval")) or 5 - local v = tonumber(m.uci:get("olsrd", section, "HelloValidityTime")) or 40 + local i = tonumber(m.uci:get("olsrd", section, "HelloInterval")) or tonumber(m.uci:get_first("olsrd", "InterfaceDefaults", "HelloInterval", 5)) + local v = tonumber(m.uci:get("olsrd", section, "HelloValidityTime")) or tonumber(m.uci:get_first("olsrd", "InterfaceDefaults", "HelloValidityTime", 40)) return "%.01fs / %.01fs" %{ i, v } end tc = ifs:option(DummyValue, "_tc", translate("TC")) function tc.cfgvalue(self, section) - local i = tonumber(m.uci:get("olsrd", section, "TcInterval")) or 2 - local v = tonumber(m.uci:get("olsrd", section, "TcValidityTime")) or 256 + local i = tonumber(m.uci:get("olsrd", section, "TcInterval")) or tonumber(m.uci:get_first("olsrd", "InterfaceDefaults", "TcInterval", 2)) + local v = tonumber(m.uci:get("olsrd", section, "TcValidityTime")) or tonumber(m.uci:get_first("olsrd", "InterfaceDefaults", "TcValidityTime", 256)) return "%.01fs / %.01fs" %{ i, v } end mid = ifs:option(DummyValue, "_mid", translate("MID")) function mid.cfgvalue(self, section) - local i = tonumber(m.uci:get("olsrd", section, "MidInterval")) or 18 - local v = tonumber(m.uci:get("olsrd", section, "MidValidityTime")) or 324 + local i = tonumber(m.uci:get("olsrd", section, "MidInterval")) or tonumber(m.uci:get_first("olsrd", "InterfaceDefaults", "MidInterval", 18)) + local v = tonumber(m.uci:get("olsrd", section, "MidValidityTime")) or tonumber(m.uci:get_first("olsrd", "InterfaceDefaults", "MidValidityTime", 324)) return "%.01fs / %.01fs" %{ i, v } end hna = ifs:option(DummyValue, "_hna", translate("HNA")) function hna.cfgvalue(self, section) - local i = tonumber(m.uci:get("olsrd", section, "HnaInterval")) or 18 - local v = tonumber(m.uci:get("olsrd", section, "HnaValidityTime")) or 108 + local i = tonumber(m.uci:get("olsrd", section, "HnaInterval")) or tonumber(m.uci:get_first("olsrd", "InterfaceDefaults", "HnaInterval", 18)) + local v = tonumber(m.uci:get("olsrd", section, "HnaValidityTime")) or tonumber(m.uci:get_first("olsrd", "InterfaceDefaults", "HnaValidityTime", 108)) return "%.01fs / %.01fs" %{ i, v } end |