-i = m:section(TypedSection, "Interface", translate("interfaces"))
-i.anonymous = true
-i.addremove = true
-i.dynamic = true
-
-network = i:option(ListValue, "Interface", translate("network"))
-luci.tools.webadmin.cbi_add_networks(network)
-
-i:option(Value, "Ip4Broadcast")
-i:option(Value, "HelloInterval")
-i:option(Value, "HelloValidityTime")
-i:option(Value, "TcInterval")
-i:option(Value, "TcValidityTime")
-i:option(Value, "MidInterval")
-i:option(Value, "MidValidityTime")
-i:option(Value, "HnaInterval")
-i:option(Value, "HnaValidityTime")
-
-
-p = m:section(TypedSection, "LoadPlugin")
-p.addremove = true
-p.dynamic = true
-
-lib = p:option(ListValue, "Library", translate("library"))
-lib:value("")
-for k, v in pairs(luci.fs.dir("/usr/lib")) do
- if v:sub(1, 6) == "olsrd_" then
- lib:value(v)
- end
+poll = s:taboption("advanced", Value, "Pollrate", translate("Pollrate"),
+ translate("Polling rate for OLSR sockets in seconds. Default is 0.05."))
+poll.optional = true
+poll.datatype = "ufloat"
+poll.placeholder = "0.05"
+
+nicc = s:taboption("advanced", Value, "NicChgsPollInt", translate("Nic changes poll interval"),
+ translate("Interval to poll network interfaces for configuration changes (in seconds). Default is \"2.5\"."))
+nicc.optional = true
+nicc.datatype = "ufloat"
+nicc.placeholder = "2.5"
+
+tos = s:taboption("advanced", Value, "TosValue", translate("TOS value"),
+ translate("Type of service value for the IP header of control traffic. Default is \"16\"."))
+tos.optional = true
+tos.datatype = "uinteger"
+tos.placeholder = "16"
+
+fib = s:taboption("general", 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:value("flat")
+fib:value("correct")
+fib:value("approx")
+
+lql = s:taboption("lquality", 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")
+
+lqage = s:taboption("lquality", 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:taboption("lquality", 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_ff")
+lqa:value("etx_fpm")
+lqa:value("etx_float")
+lqa:value("etx_ffeth")
+lqa:depends("LinkQualityLevel", "2")
+lqa.optional = true
+
+lqfish = s:taboption("lquality", Flag, "LinkQualityFishEye", translate("LQ fisheye"),
+ translate("Fisheye mechanism for TCs (checked means on). Default is \"on\""))
+lqfish.default = "1"
+lqfish.optional = true
+
+hyst = s:taboption("lquality", 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
+hyst.rmempty = true
+
+port = s:taboption("general", 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
+
+mainip = s:taboption("general", 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
+mainip.datatype = "ipaddr"
+mainip.placeholder = "0.0.0.0"
+
+willingness = s:taboption("advanced", 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)