applications/luci-olsr: Prepare for the switch to olsrd-0.6.x
authorManuel Munz <freifunk@somakoma.de>
Tue, 30 Nov 2010 21:57:25 +0000 (21:57 +0000)
committerManuel Munz <freifunk@somakoma.de>
Tue, 30 Nov 2010 21:57:25 +0000 (21:57 +0000)
applications/luci-olsr/luasrc/model/cbi/olsr/olsrd.lua
applications/luci-olsr/luasrc/model/cbi/olsr/olsrdplugins.lua

index 113ab01..4ce891d 100644 (file)
@@ -14,92 +14,149 @@ $Id$
 
 require("luci.tools.webadmin")
 
-m = Map("olsrd", translate("OLSR Daemon"))
+m = Map("olsrd", translate("OLSR Daemon"),
+        translate("The OLSR daemon is an implementation of the Optimized Link State Routing protocol. "..
+       "As such it allows mesh routing for any network equipment. "..
+       "It runs on any wifi card that supports ad-hoc mode and of course on any ethernet device. "..
+       "Visit <a href='http://www.olsr.org'>olsrd.org</a> for help and documentation."))
 
 s = m:section(TypedSection, "olsrd", translate("General settings"))
 s.dynamic = true
 s.anonymous = true
 
-debug = s:option(ListValue, "DebugLevel", translate("Debugmode"))
+ipv = s:option(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")
+
+debug = s:option(ListValue, "DebugLevel", translate("Debugmode"), translate("Debug level to use. This should usually stay at 0."))
 for i=0, 9 do
        debug:value(i)
 end
 debug.optional = true
 
-ipv = s:option(ListValue, "IpVersion", translate("Internet protocol"))
-ipv:value("4", "IPv4")
-ipv:value("6", "IPv6")
+clrscr = s:option(Flag, "ClearScreen", translate ("Clear screen"),
+       translate("Clear the screen each time the internal state changes. Default is \"yes\"."))
+clrscr.default = "yes"
+clrscr.enabled = "yes"
+clrscr.disabled = "no"
+clrscr.optional = true
 
-noint = s:option(Flag, "AllowNoInt", translate("Start without network"))
+noint = s:option(Flag, "AllowNoInt", translate("Start without network"),
+       translate("If this is set to \"yes\" then olsrd also starts when no network devices are found."))
+noint.default = "yes"
 noint.enabled = "yes"
 noint.disabled = "no"
 noint.optional = true
 
-s:option(Value, "Pollrate", translate("Pollrate")).optional = true
+s:option(Value, "Pollrate", translate("Pollrate"),
+       translate("Polling rate for OLSR sockets in seconds. Default is 0.05.")).optional = true
 
-tcr = s:option(ListValue, "TcRedundancy", translate("TC redundancy"))
-tcr:value("0", translate("MPR selectors"))
-tcr:value("1", translate("MPR selectors and MPR"))
-tcr:value("2", translate("all neighbours"))
-tcr.optional = true
+s:option(Value, "NicChgsPollInt", translate("Nic changes poll interval"),
+       translate("Interval to poll network interfaces for configuration changes (in seconds). Default is \"2.5\".")).optional = true
 
-s:option(Value, "MprCoverage", translate("MPR coverage")).optional = true
+s:option(Value, "TosValue", translate("TOS value"),
+       translate("Type of service value for the IP header of control traffic. Default is \"16\".")).optional = true
 
-lql = s:option(ListValue, "LinkQualityLevel", translate("LQ level"))
-lql:value("0", translate("disable"))
-lql:value("1", translate("MPR selection"))
-lql:value("2", translate("MPR selection and routing"))
-lql.optional = true
+fib = s:option(ListValue, "FIBMetric", translate("FIB metric"),
+       translate ("FIBMetric controls the metric value of the host-routes OLSRd sets. "..
+       "\"flat\" means that the metric value is always 2. This is the preferred value "..
+       "because it helps the linux kernel routing to clean up older routes. "..
+       "\"correct\" uses the hopcount as the metric value. "..
+       "\"approx\" use the hopcount as the metric value too, but does only update the hopcount if the nexthop changes too. "..
+       "Default is \"flat\"."))
+fib.optional = true
+fib:value("flat")
+fib:value("correct")
+fib:value("approx")
+fib.optional = true
 
-s:option(Value, "LinkQualityAging", translate("LQ aging")).optional = true
+lql = s:option(ListValue, "LinkQualityLevel", translate("LQ level"),
+       translate("Link quality level switch between hopcount and cost-based (mostly ETX) routing.<br />"..
+       "<b>0</b> = do not use link quality<br />"..
+       "<b>2</b> = use link quality for MPR selection and routing<br />"..
+       "Default is \"2\""))
+lql:value("2")
+lql:value("0")
+lql.optional = true
 
-lqa = s:option(ListValue, "LinkQualityAlgorithm", translate("LQ algorithm"))
+lqage = s:option(Value, "LinkQualityAging", translate("LQ aging"),
+       translate("Link quality aging factor (only for lq level 2). Tuning parameter for etx_float and etx_fpm, smaller values "..
+       "mean slower changes of ETX value. (allowed values are between 0.01 and 1.0)"))
+lqage.optional = true
+lqage:depends("LinkQualityLevel", "2")
+
+lqa = s:option(ListValue, "LinkQualityAlgorithm", translate("LQ algorithm"),
+       translate("Link quality algorithm (only for lq level 2).<br />"..
+       "<b>etx_float</b>: floating point ETX with exponential aging<br />"..
+       "<b>etx_fpm</b>  : same as ext_float, but with integer arithmetic<br />"..
+       "<b>etx_ff</b>   : ETX freifunk, an etx variant which use all OLSR traffic (instead of only hellos) for ETX calculation<br />"..
+       "<b>etx_ffeth</b>: incompatible variant of etx_ff that allows ethernet links with ETX 0.1.<br />"..
+       "Defaults to \"etx_ff\""))
 lqa.optional = true
-lqa:value("etx_fpm", translate("fixed point math"))
-lqa:value("etx_float", translate("floating point"))
-lqa:value("etx_ff", translate("Freifunk"))
+lqa:value("etx_ff") 
+lqa:value("etx_fpm")
+lqa:value("etx_float")
+lqa:value("etx_ffeth")
+lqa:depends("LinkQualityLevel", "2")
 lqa.optional = true
 
-lqfish = s:option(Flag, "LinkQualityFishEye", translate("LQ fisheye"))
+lqfish = s:option(Flag, "LinkQualityFishEye", translate("LQ fisheye"),
+       translate("Fisheye mechanism for TCs (checked means on). Default is \"on\""))
+lqfish.default = "1"
 lqfish.optional = true
 
-s:option(Value, "LinkQualityWinSize", translate("LQ window size")).optional = true
-
-s:option(Value, "LinkQualityDijkstraLimit", translate("LQ Dijkstra limit")).optional = true
-
-hyst = s:option(Flag, "UseHysteresis", translate("Use hysteresis"))
+hyst = s:option(Flag, "UseHysteresis", translate("Use hysteresis"),
+       translate("Hysteresis for link sensing (only for hopcount metric). Hysteresis adds more robustness to the link sensing "..
+       "but delays neighbor registration. Defaults is \"yes\""))
+hyst.default = "yes"
 hyst.enabled = "yes"
 hyst.disabled = "no"
+hyst:depends("LinkQualityLevel", "0")
 hyst.optional = true
 
-fib = s:option(ListValue, "FIBMetric", translate("FIB metric"))
-fib.optional = true
-fib:value("flat")
-fib:value("correct")
-fib:value("approx")
-fib.optional = true
+port = s:option(Value, "OlsrPort", translate("Port"),
+        translate("The port OLSR uses. This should usually stay at the IANA assigned port 698. It can have a value between 1 and 65535."))
+port.optional = true
+port.default = "698"
+port.rmempty = true
 
-clrscr = s:option(Flag, "ClearScreen", translate ("Clear screen"))
-clrscr.enabled = "yes"
-clrscr.disabled = "no"
-clrscr.optional = true
+mainip = s:option(Value, "MainIp", translate("Main IP"),
+        translate("Sets the main IP (originator ip) of the router. This IP will NEVER change during the uptime of olsrd. "..
+       "Default is 0.0.0.0, which triggers usage of the IP of the first interface."))
+mainip.optional = true
+mainip.rmempty = true
 
-willingness = s:option(ListValue, "Willingness", translate("Willingness"))
+willingness = s:option(ListValue, "Willingness", translate("Willingness"),
+               translate("The fixed willingness to use. If not set willingness will be calculated dynamically based on battery/power status. Default is \"3\"."))
 for i=0,7 do
        willingness:value(i)
 end
 willingness.optional = true
 
-natthr = s:option(Value, "NatThreshold", translate("NAT threshold"))
+natthr = s:option(Value, "NatThreshold", translate("NAT threshold"),
+       translate("If the route to the current gateway is to be changed, the ETX value of this gateway is ".. 
+       "multiplied with this value before it is compared to the new one. "..
+       "The parameter can be a value between 0.1 and 1.0, but should be close to 1.0 if changed.<br />"..
+       "<b>WARNING:</b> This parameter should not be used together with the etx_ffeth metric!<br />"..
+       "Defaults to \"1.0\"."))
+for i=1,0.1,-0.1 do
+        natthr:value(i)
+end
+natthr:depends("LinkQualityAlgorithm", "etx_ff")
+natthr:depends("LinkQualityAlgorithm", "etx_float")
+natthr:depends("LinkQualityAlgorithm", "etx_fpm")
+natthr.default = 1
 natthr.optional = true
 
-
 i = m:section(TypedSection, "Interface", translate("Interfaces"))
 i.anonymous = true
 i.addremove = true
 i.dynamic = true
 
-ign = i:option(Flag, "ignore", translate("Enable"))
+ign = i:option(Flag, "ignore", translate("Enable"),
+       translate("Enable this interface."))
 ign.enabled  = "0"
 ign.disabled = "1"
 ign.rmempty = false
@@ -107,18 +164,33 @@ function ign.cfgvalue(self, section)
        return Flag.cfgvalue(self, section) or "0"
 end
 
-network = i:option(ListValue, "interface", translate("Network"))
+network = i:option(ListValue, "interface", translate("Network"),
+       translate("The interface where OLSRd should run. If \"Default\" is selected then the settings made "..
+       "here are used for all other interfaces unless overwritten."))
 luci.tools.webadmin.cbi_add_networks(network)
+network:value("Default")
 
-i:option(Value, "Ip4Broadcast", translate("IPv4 broadcast")).optional = true
+mode = i:option(ListValue, "Mode", translate("Mode"),
+       translate("Interface Mode is used to prevent unnecessary packet forwarding on switched ethernet interfaces. "..
+       "valid Modes are \"mesh\" and \"ether\". Default is \"mesh\"."))
+mode:value("mesh")  
+mode:value("ether")
+mode.optional = true
+mode.rmempty = true
 
-ip6t = i:option(ListValue, "Ip6AddrType", translate("IPv6 address type"))
-ip6t:value("", translate("-- Please choose --"))
-ip6t:value("auto")
-ip6t:value("site-local")
-ip6t:value("unique-local")
-ip6t:value("global")
-ip6t.optional = true
+i:option(Value, "Ip4Broadcast", translate("IPv4 broadcast"),
+       translate("IPv4 broadcast address for outgoing OLSR packets. One useful example would be 255.255.255.255. "..
+       "Default is \"0.0.0.0\", which triggers the usage of the interface broadcast IP.")).optional = true
+
+i:option(Value, "IPv6Multicast", translate("IPv6 multicast"),
+       translate("IPv6 multicast address. Default is \"FF02::6D\", the manet-router linklocal multicast.")).optional = true
+
+i:option(Value, "IPv4Src", translate("IPv4 source"),
+       translate("IPv4 src address for outgoing OLSR packages. Default is \"0.0.0.0\", which triggers usage of the interface IP.")).optional = true
+
+i:option(Value, "IPv6Src", translate("IPv6 source"),
+       translate("IPv6 src prefix. OLSRd will choose one of the interface IPs which matches the prefix of this parameter. "..
+       "Default is \"0::/0\", which triggers the usage of a not-linklocal interface IP.")).optional = true
 
 i:option(Value, "HelloInterval", translate("Hello interval")).optional = true
 i:option(Value, "HelloValidityTime", translate("Hello validity time")).optional = true
@@ -129,23 +201,20 @@ i:option(Value, "MidValidityTime", translate("MID validity time")).optional = tr
 i:option(Value, "HnaInterval", translate("HNA interval")).optional = true
 i:option(Value, "HnaValidityTime", translate("HNA validity time")).optional = true
 
-adc = i:option(Flag, "AutoDetectChanges", translate("Autodetect changes"))
-adc.enabled  = "yes"
-adc.disabled = "no"
-adc.optional = true
-
---[[
-ipc = m:section(TypedSection, "IpcConnect")
-ipc.anonymous = true
-
-conns = ipc:option(Value, "MaxConnections")
-conns.isInteger = true
-
-nets  = ipc:option(Value, "Net")
-nets.optional = true
-
-hosts = ipc:option(Value, "Host")
-hosts.optional = true
-]]
+i:option(Value, "Weight", translate("Weight"),
+       translate("When multiple links exist between hosts the weight of interface is used to determine the link to use. "..
+       "Normally the weight is automatically calculated by olsrd based on the characteristics of the interface, "..
+       "but here you can specify a fixed value. Olsrd will choose links with the lowest value.<br />"..
+       "<b>Note:</b> Interface weight is used only when LinkQualityLevel is set to 0. "..
+       "For any other value of LinkQualityLevel, the interface ETX value is used instead.")).optional = true
+
+lqmult = i:option(DynamicList, "LinkQualityMult", translate("LinkQuality Multiplicator"),
+       translate("Multiply routes with the factor given here. Allowed values are between 0.01 and 1. "..
+       "It is only used when LQ-Level is greater than 0. Examples:<br />"..
+       "reduce LQ to 192.168.0.1 by half: 192.168.0.1 0.5<br />"..
+       "reduce LQ to all nodes on this interface by 20%: default 0.8"))
+lqmult.optional = true
+lqmult.rmempty = true
+lqmult.cast = "table"
 
 return m
index 044032c..2cfccdd 100644 (file)
@@ -74,45 +74,51 @@ if arg[1] then
 
        local knownPlParams = {
                ["olsrd_bmf.so.1.5.3"] = {
-                       { Value,                "BmfInterface",                 "bmf0" },
-                       { Value,                "BmfInterfaceIp",               "10.10.10.234/24" },
-                       { Flag,                 "DoLocalBroadcast",             "no" },
-                       { Flag,                 "CapturePacketsOnOlsrInterfaces", "yes" },
+                       { Value,        "BmfInterface",                 "bmf0" },
+                       { Value,        "BmfInterfaceIp",               "10.10.10.234/24" },
+                       { Flag,         "DoLocalBroadcast",             "no" },
+                       { Flag,         "CapturePacketsOnOlsrInterfaces", "yes" },
                        { ListValue,    "BmfMechanism",                 { "UnicastPromiscuous", "Broadcast" } },
-                       { Value,                "BroadcastRetransmitCount",     "2" },
-                       { Value,                "FanOutLimit",                  "4" },
+                       { Value,        "BroadcastRetransmitCount",     "2" },
+                       { Value,        "FanOutLimit",                  "4" },
                        { DynamicList,  "NonOlsrIf",                    "br-lan" }
                },
 
                ["olsrd_dyn_gw.so.0.4"] = {
-                       { Value,                "Interval",                             "40" },
-                       { DynamicList,  "Ping",                                 "141.1.1.1" },
-                       { DynamicList,  "HNA",                                  "192.168.80.0/24", IpMask2Cidr, Cidr2IpMask }
+                       { Value,        "Interval",                     "40" },
+                       { DynamicList,  "Ping",                         "141.1.1.1" },
+                       { DynamicList,  "HNA",                          "192.168.80.0/24", IpMask2Cidr, Cidr2IpMask }
                },
 
                ["olsrd_httpinfo.so.0.1"] = {
-                       { Value,                "port",                                 "80" },
-                       { DynamicList,  "Host",                                 "163.24.87.3" },
-                       { DynamicList,  "Net",                                  "0.0.0.0/0", IpMask2Cidr, Cidr2IpMask }
+                       { Value,        "port",                         "80" },
+                       { DynamicList,  "Host",                         "163.24.87.3" },
+--                     { DynamicList,  "Net",                          "0.0.0.0/0", IpMask2Cidr, Cidr2IpMask }
+                       { DynamicList,  "Net",                          "0.0.0.0/0", Cidr2IpMask }
                },
 
                ["olsrd_nameservice.so.0.3"] = {
-                       { DynamicList,  "name",                                 "my-name.mesh" },
-                       { DynamicList,  "hosts",                                "1.2.3.4 name-for-other-interface.mesh" },
-                       { Value,                "suffix",                               ".olsr" },
-                       { Value,                "hosts_file",                   "/path/to/hosts_file" },
-                       { Value,                "add_hosts",                    "/path/to/file" },
-                       { Value,                "dns_server",                   "141.1.1.1" },
-                       { Value,                "resolv_file",                  "/path/to/resolv.conf" },
-                       { Value,                "interval",                             "120" },
-                       { Value,                "timeout",                              "240" },
-                       { Value,                "lat",                                  "12.123" },
-                       { Value,                "lon",                                  "12.123" },
-                       { Value,                "latlon_file",                  "/var/run/latlon.js" },
-                       { Value,                "latlon_infile",                "/var/run/gps.txt" },
-                       { Value,                "sighup_pid_file",              "/var/run/dnsmasq.pid" },
-                       { Value,                "name_change_script",   "/usr/local/bin/announce_new_hosts.sh" },
-                       { Value,                "services_change_script",       "/usr/local/bin/announce_new_services.sh" }
+                       { DynamicList,  "name",                         "my-name.mesh" },
+                       { DynamicList,  "hosts",                        "1.2.3.4 name-for-other-interface.mesh" },
+                       { Value,        "suffix",                       ".olsr" },
+                       { Value,        "hosts_file",                   "/path/to/hosts_file" },
+                       { Value,        "add_hosts",                    "/path/to/file" },
+                       { Value,        "dns_server",                   "141.1.1.1" },
+                       { Value,        "resolv_file",                  "/path/to/resolv.conf" },
+                       { Value,        "interval",                     "120" },
+                       { Value,        "timeout",                      "240" },
+                       { Value,        "lat",                          "12.123" },
+                       { Value,        "lon",                          "12.123" },
+                       { Value,        "latlon_file",                  "/var/run/latlon.js" },
+                       { Value,        "latlon_infile",                "/var/run/gps.txt" },
+                       { Value,        "sighup_pid_file",              "/var/run/dnsmasq.pid" },
+                       { Value,        "name_change_script",           "/usr/local/bin/announce_new_hosts.sh" },
+                       { DynamicList,  "service",                      "http://me.olsr:80|tcp|my little homepage" },
+                       { Value,        "services_file",                "/var/run/services_olsr" },
+                       { Value,        "services_change_script",       "/usr/local/bin/announce_new_services.sh" },
+                        { DynamicList, "mac",                          "xx:xx:xx:xx:xx:xx[,0-255]" },
+                       { Value,        "macs_file",                    "/path/to/macs_file" },
+                       { Value,        "macs_change_script",           "/path/to/script" }
                },
 
                ["olsrd_quagga.so.0.2.2"] = {
@@ -121,21 +127,21 @@ if arg[1] then
                                "ospf6", "isis", "bgp", "hsls"
                        } },
                        { ListValue,    "ExportRoutes",                 { "only", "both" } },
-                       { Flag,                 "LocalPref",                    "true" },
-                       { Value,                "Distance",                             Range(0,255) }
+                       { Flag,         "LocalPref",                    "true" },
+                       { Value,        "Distance",                     Range(0,255) }
                },
 
                ["olsrd_secure.so.0.5"] = {
-                       { Value,                "Keyfile",                              "/etc/private-olsr.key" }
+                       { Value,        "Keyfile",                      "/etc/private-olsr.key" }
                },
 
                ["olsrd_txtinfo.so.0.1"] = {
-                       { Value,                "accept",                               "10.247.200.4" }
+                       { Value,        "accept",                       "10.247.200.4" }
                },
 
                ["olsrd_watchdog.so.0.1"] = {
-                       { Value,                "file",                                 "/var/run/olsrd.watchdog" },
-                       { Value,                "interval",                             "30" }
+                       { Value,        "file",                         "/var/run/olsrd.watchdog" },
+                       { Value,        "interval",                     "30" }
                },
 
                ["olsrd_mdns.so.1.0.0"] = {