+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"
+
+sgw = s:taboption("smartgw", Flag, "SmartGateway", translate("Enable"), translate("Enable SmartGateway. If it is disabled, then " ..
+ "all other SmartGateway parameters are ignored. Default is \"no\"."))
+sgw.default="no"
+sgw.enabled="yes"
+sgw.disabled="no"
+sgw.rmempty = true
+
+sgwnat = s:taboption("smartgw", Flag, "SmartGatewayAllowNAT", translate("Allow gateways with NAT"), translate("Allow the selection of an outgoing ipv4 gateway with NAT"))
+sgwnat:depends("SmartGateway", "yes")
+sgwnat.default="yes"
+sgwnat.enabled="yes"
+sgwnat.disabled="no"
+sgwnat.optional = true
+sgwnat.rmempty = true
+
+sgwuplink = s:taboption("smartgw", ListValue, "SmartGatewayUplink", translate("Announce uplink"), translate("Which kind of uplink is exported to the other mesh nodes. " ..
+ "An uplink is detected by looking for a local HNA of 0.0.0.0/0, ::ffff:0:0/96 or 2000::/3. Default setting is \"both\"."))
+sgwuplink:value("none")
+sgwuplink:value("ipv4")
+sgwuplink:value("ipv6")
+sgwuplink:value("both")
+sgwuplink:depends("SmartGateway", "yes")
+sgwuplink.default="both"
+sgwuplink.optional = true
+sgwuplink.rmempty = true
+
+sgwulnat = s:taboption("smartgw", Flag, "SmartGatewayUplinkNAT", translate("Uplink uses NAT"), translate("If this Node uses NAT for connections to the internet. " ..
+ "Default is \"yes\"."))
+sgwulnat:depends("SmartGatewayUplink", "ipv4")
+sgwulnat:depends("SmartGatewayUplink", "both")
+sgwulnat.default="yes"
+sgwulnat.enabled="yes"
+sgwulnat.disabled="no"
+sgwnat.optional = true
+sgwnat.rmempty = true
+
+sgwspeed = s:taboption("smartgw", Value, "SmartGatewaySpeed", translate("Speed of the uplink"), translate("Specifies the speed of "..
+ "the uplink in kilobits/s. First parameter is upstream, second parameter is downstream. Default is \"128 1024\"."))
+sgwspeed:depends("SmartGatewayUplink", "ipv4")
+sgwspeed:depends("SmartGatewayUplink", "ipv6")
+sgwspeed:depends("SmartGatewayUplink", "both")
+sgwspeed.optional = true
+sgwspeed.rmempty = true
+
+sgwprefix = s:taboption("smartgw", Value, "SmartGatewayPrefix", translate("IPv6-Prefix of the uplink"), translate("This can be used " ..
+ "to signal the external IPv6 prefix of the uplink to the clients. This might allow a client to change it's local IPv6 address to " ..
+ "use the IPv6 gateway without any kind of address translation. The maximum prefix length is 64 bits. " ..
+ "Default is \"::/0\" (no prefix)."))
+sgwprefix:depends("SmartGatewayUplink", "ipv6")
+sgwprefix:depends("SmartGatewayUplink", "both")
+sgwprefix.optional = true
+sgwprefix.rmempty = true
+
+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)
+end
+willingness.optional = true
+willingness.default = "3"
+
+natthr = s:taboption("advanced", 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.0"
+natthr.optional = true
+natthr.write = write_float