X-Git-Url: http://git.archive.openwrt.org/?a=blobdiff_plain;ds=sidebyside;f=applications%2Fluci-olsr%2Fluasrc%2Fmodel%2Fcbi%2Folsr%2Folsrd.lua;h=46121747d456f8858a4685a496b90ec452ee2427;hb=9edd0e46c3f880727738ce8ca6ff1c8b85f99ef4;hp=82b772891589bbd8079b301217db12bb75cf5559;hpb=30e79c0ff3c32690aaca24b8d308bda041779767;p=project%2Fluci.git
diff --git a/applications/luci-olsr/luasrc/model/cbi/olsr/olsrd.lua b/applications/luci-olsr/luasrc/model/cbi/olsr/olsrd.lua
index 82b772891..46121747d 100644
--- a/applications/luci-olsr/luasrc/model/cbi/olsr/olsrd.lua
+++ b/applications/luci-olsr/luasrc/model/cbi/olsr/olsrd.lua
@@ -15,6 +15,8 @@ $Id$
require("luci.tools.webadmin")
local fs = require "nixio.fs"
+local util = require "luci.util"
+local ip = require "luci.ip"
local has_ipip = fs.glob("/etc/modules.d/[0-9]*-ipip")()
@@ -56,7 +58,6 @@ s:tab("advanced", translate("Advanced Settings"))
ipv = s:taboption("general", ListValue, "IpVersion", translate("Internet protocol"),
translate("IP-version to use. If 6and4 is selected then one olsrd instance is started for each protocol."))
ipv:value("4", "IPv4")
-ipv:value("6", "IPv6")
ipv:value("6and4", "6and4")
@@ -106,7 +107,7 @@ lqage:depends("LinkQualityLevel", "2")
lqa = s:taboption("lquality", ListValue, "LinkQualityAlgorithm", translate("LQ algorithm"),
translate("Link quality algorithm (only for lq level 2).
"..
"etx_float: floating point ETX with exponential aging
"..
- "etx_fpm : same as ext_float, but with integer arithmetic
"..
+ "etx_fpm : same as etx_float, but with integer arithmetic
"..
"etx_ff : ETX freifunk, an etx variant which use all OLSR traffic (instead of only hellos) for ETX calculation
"..
"etx_ffeth: incompatible variant of etx_ff that allows ethernet links with ETX 0.1.
"..
"Defaults to \"etx_ff\""))
@@ -253,7 +254,7 @@ weight.datatype = "uinteger"
weight.placeholder = "0"
lqmult = i:taboption("general", DynamicList, "LinkQualityMult", translate("LinkQuality Multiplicator"),
- translate("Multiply routes with the factor given here. Allowed values are between 0.01 and 1. "..
+ translate("Multiply routes with the factor given here. Allowed values are between 0.01 and 1.0. "..
"It is only used when LQ-Level is greater than 0. Examples:
"..
"reduce LQ to 192.168.0.1 by half: 192.168.0.1 0.5
"..
"reduce LQ to all nodes on this interface by 20%: default 0.8"))
@@ -262,6 +263,28 @@ lqmult.rmempty = true
lqmult.cast = "table"
lqmult.placeholder = "default 1.0"
+function lqmult.validate(self, value)
+ for _, v in pairs(value) do
+ if v ~= "" then
+ local val = util.split(v, " ")
+ local host = val[1]
+ local mult = val[2]
+ if not host or not mult then
+ return nil, translate("LQMult requires two values (IP address or 'default' and multiplicator) seperated by space.")
+ end
+ if not (host == "default" or ip.IPv4(host) or ip.IPv6(host)) then
+ return nil, translate("Can only be a valid IPv4 or IPv6 address or 'default'")
+ end
+ if not tonumber(mult) or tonumber(mult) > 1 or tonumber(mult) < 0.01 then
+ return nil, translate("Invalid Value for LQMult-Value. Must be between 0.01 and 1.0.")
+ end
+ if not mult:match("[0-1]%.[0-9]+") then
+ return nil, translate("Invalid Value for LQMult-Value. You must use a decimal number between 0.01 and 1.0 here.")
+ end
+ end
+ end
+ return value
+end
ip4b = i:taboption("addrs", Value, "Ip4Broadcast", translate("IPv4 broadcast"),
translate("IPv4 broadcast address for outgoing OLSR packets. One useful example would be 255.255.255.255. "..