
config mesh11sd 'setup'
	###########################################################################################
	# debuglevel (optional)
	# Sets the debuglevel
	# Default: 1 (Notification)
	# Options are 0, silent, 1 notification, 2 info and 3 debug
	#
	#option debuglevel '2'

	###########################################################################################
	# enabled (optional)
	# Enables or disables the mesh11sd daemon
	# Default: 1 (enabled)
	#
	# Set to 0 to disable
	#
	#option enabled '1'

	###########################################################################################
	# checkinterval (optional)
	# Sets the dynamic configuration checkinterval in seconds
	# Default: 10 (seconds)
	#
	#option checkinterval '15'

	###########################################################################################
	# portal_detect (optional)
	# Ignored if auto_config is disabled.
	#
	# Default 1
	#
	# Possible values:
	#  0  - Force ipv4 nat routed Portal mode regardless of an upstream connection.
	#
	#  1  - Detect if the meshnode is a portal, meaning it has an upstream wan link.
	# 	If the upstream link is active, the router hosting the meshnode will serve ipv4 dhcp into the mesh network.
	# 	If the upstream link is not connected, dhcp will be disabled and the meshnode will function as a layer 2 bridge on the mesh network.
	#
	#  2  - Deprecated - no longer used - replaced by mode 5.
	#
	#  3  - Force CPE mode (Customer Premises Equipment)
	#  	This is a peer mode but treats the mesh backhaul as an upstream wan connection.
	#  	A nat routed ipv4 lan is created with its own ipv4 subnet.
	#       If selected, option vtun_enable is forced to 0
	#
	#  4  - Force Bridge vxlan trunk portal node
	#	This mode should be used if a bridged connection to the upstream ISP router is required (ie bridged/no-nat ipv4 ).
	#	Functions in a similar way to 0, but forces BRIDGED rather than routed portal mode, ADDING the wan ethernet port to the vxtunnel bridge (default br-tun69)
	#	The wan port will be an ethernet end point into the vxtunnel, supporting vlans if required.
	#	The wan port and lan port(s) form independent layer 2 networks carried by the mesh backhaul to all peer meshnodes.
	#	the vxlan tunnel can be treated as a separate virtual ethernet tunnel to all mesh nodes.
	#	ie the wan port on a mode 4 portal is the end point of a virtual vlan supporting ethernet network connecting
	#	to the wan ports of all mode 5 bridge vxlantrunk peer nodes.
	#	In normal use, BOTH the wan and a lan port could be patched to the upstream router or an intermediate switch.
	#
	#  5  - Bridge vxlan trunk peer node
	#	Compatible with portal nodes configured with portal_detect 0, 1 or 4.
	#	Functions in a similar way to 0, but FORCES peer mode and adds wan ethernet port to the vxtunnel bridge (default br-tun69)
	#	The wan port will be an ethernet end point into the vxtunnel, supporting vlans if required.
	#	The lan port(s) will be ethernet end points into the mesh backhaul and will NOT support vlans.
	#
	#
	# Has no effect if auto_config is disabled.
	#
	#option portal_detect '0'

	###########################################################################################
	# portal_channel (optional) Applies to 2.4 GHz band only
	#
	# If portal_detect is disabled (0), portal_channel can be set to:
	# 1. auto - a channel is auto selected
	# 2. default - the channel defined in /etc/config/wireless is used
	# 3. A valid 2.4 GHz channel (1 to 13, depending on the country setting)
	#
	# Default: default
	#
	# All mesh peer and mesh gate nodes will autonomously track the mesh portal channel
	# regardless of the configured auto_mesh_band
	# 
	#option portal_channel 'auto'
	# or
	#option portal_channel '4'

	###########################################################################################
	# portal_use_default_ipv4 (optional)
	# Effective only if node is a portal
	#
	# Default 0
	#
	# When set to 1, the default ipv4 address found in /etc/config/network is used
	# When set to 0 or not set, an ip subnet address is calulated based on the label mac address
	#
	#option portal_use_default_ipv4 '1'

	###########################################################################################
	# channel_tracking_checkinterval (optional)
	#
	# The minimum interval in seconds after which channel tracking begins on peer nodes
	# Values less than checkinterval are ignored
	#
	# Default: 30 seconds
	#
	# Example:
	#option channel_tracking_checkinterval '60'

	###########################################################################################
	# portal_detect_threshold (optional)
	#
	# This is the portal detect watchdog.
	#
	# The number of checkintervals before the portal detect watchdog begins actions to (re)establish a reconnection to a portal.
	#
	# Default 10 (watchdog is triggered after 10 iterations)
	# If set to 0, the watchdog is never triggered
	# Ignored if auto_config is disabled.
	#
	# Each time the peer node fails to detect the portal, a counter is incremented.
	# If the threshold is reached, the node will take various actions in an attempt to find the portal.
	# If the portal is still not detected, the watchdog will reboot the peer node.
	#
	# Example - Set threshold to 10 chekintervals:
	#option portal_detect_threshold '10'

	###########################################################################################
	# mesh_path_cost (optional)
	#
	# sets the STP cost of the mesh network
	# Default: 10
	# Can be set to any value from 0 to 65534
	# Setting to 0 disables STP
	#
	# Example:
	#option mesh_path_cost '100'

	###########################################################################################
	# interface_timeout (optional)
	#
	# Sets the interface timeout interval in seconds
	# Default: 10 (seconds)
	#
	#option interface_timeout '10'

	###########################################################################################
	# auto_config (optional)
	#
	# Enables autonomous dynamic mesh configuration.
	# Auto configure mesh interfaces in the wireless configuration.
	# Default 0 (disabled). Set to 1 to enable.
	#
	# When set to 0, the mesh11sd daemon will check for an existing mesh configuration.
	#
	# Warning: If an existing mesh configuration is found, it will be honoured even if it is incorrect.
	#	Manually configuring a mesh can soft brick the router if incorrectly done.
	#
	# Auto config can be tested using the command line function 'mesh11sd auto_config test'
	#	See the documentation for further information (Hint: try 'mesh11sd --help')
	#
	#option auto_config '1'

	###########################################################################################
	# auto_mesh_id (optional)
	#
	# Configure the mesh_id of the wireless interface(s) when auto_config is enabled
	# Default --__
	#
	# This string will be hashed to produce a secure mesh id
	# If set, it must also be set to the same value on every mesh node
	#
	#option auto_mesh_id 'MyMeshID'

	###########################################################################################
	# auto_mesh_band (optional)
	#
	# Configure the band to use for the mesh network
	# Valid values: 2g, 2g40, 5g, 6g, 60g
	# Default 2g40
	#
	# If set, it must also be set to the same value on every mesh node
	#
	# All mesh peer and mesh gate nodes will autonomously track the mesh portal channel
	# regardless of the configured auto_mesh_band
	#
	#option auto_mesh_band '5g'

	###########################################################################################
	# mesh_phy_index (optional)
	#
	# Force use of a particular radio for the mesh interface
	# Must be an integer value corresponding to the physical radio hardware (eg. phy0, phy1 etc.).
	# Default - Not Set
	#
	# Useful for devices with more than one phy on a particular band
	# allowing use of a particular radio to be forced
	#
	# If not set, the first phy in the configured auto_mesh_band that the daemon encounters
	# will be used for the mesh interface.
	#
	# Example - Use the second 5GHz radio (phy2) of a three radio device:
	#option mesh_phy_index '2'

	###########################################################################################
	# country (optional)
	#
	# Set a valid country code for all radios
	# Defaults to DFS-ETSI if not explicitly set in wireless config
	#
	# If set here, will overide any setting in wireless config
	#
	# Example set to country code US:
	#option country 'US'

	###########################################################################################
	# auto_mesh_key (optional)
	#
	# Defaults to a sha256 key to be automatically used on all members of this mesh when auto_config is enabled
	# Generates a secure sha256 key from the string value set in this option.
	#
	# If set, it must also be set to the same value on every mesh node
	#
	#option auto_mesh_key 'MySecretKey'

	###########################################################################################
	# auto_mesh_network - (optional) - specifies the firewall zone used for the mesh.
	#	Typical values "lan", "guest" etc.
	#
	#	This can be set differently on each meshnode as required.
	#
	#	Firewall zone "wan" is not valid.
	#
	#	Default lan

	###########################################################################################
	# mesh_basename (optional)
	# The first 4 characters after non alphanumerics are removed are used as the mesh_basename
	# The mesh_basename is used to construct a unique mesh interface name of the form m-xxxx-n
	# Default: 11s
	# Results in ifname=m-11s-0 for the first mesh interface
	# Example: link
	# Results in ifname=m-link-0
	#
	#option mesh_basename 'link'

	###########################################################################################
	# mesh_gate_base_ssid
	#
	# Sets the mesh gate base ssid string
	#	If ssid_suffix_enable is set to 0, must be a maximum of 30 characters in length
	#	If ssid_suffix_enable is set to 1, must be a maximum of 22 characters in length
	#	Excess characters will be truncated
	#
	# Default - uses the ssid string set in the wireless config
	#
	#
	# When set, overrides the ssid string set in the wireless config
	#
	# Example:
	#option mesh_gate_base_ssid 'OfficeNetwork'

	###########################################################################################
	# mesh_gate_encryption (optional)
	# Determines whether this node's gate (Access Point) will be a encrypted
	#
	# Default: 0 (disabled)
	# Set to 0 (none/owe-transition), 1 (sae, aka wpa3), 2 (sae-mixed, aka wpa2/wpa3), 3 (psk2, aka wpa2)
	# or 4 (Opportunistic Wireless Encryption - owe)
	#
	# Example - enable psk2 encryption
	#option mesh_gate_encryption '3'

	###########################################################################################
	# mesh_gate_key (optional)
	# Determines the encryption key for this node's gate.
	#
	# Default: not set (encryption disabled)
	# Set to a secret string value to use for encrypting the node's gate
	# Ignored if mesh_gate_encryption is set to 0 or 4
	#
	# Example - set a key string
	#option mesh_gate_key 'mysecretencryptionkey'

	###########################################################################################
	# ssid_suffix_enable (optional)
	# Add a 4 digit suffix to the ssid
	# The 4 digits are the last 4 digits of the mac address of the mesh interface
	# Default 1 (enabled)
	#
	#option ssid_suffix_enable '0'

	###########################################################################################
	# vtun_enable (optional)
	#
	# Note: All vtun options require the ip-full and vxlan packages to be installed, otherwise the options will be ignored
	#
	# Enables point to multi-point vxlan tunneling from portal to all compatible nodes
	#
	# Default: 1 (enabled) unless portal_detect is set to 3 (cpe mode), in which case the default is 0 (disabled)
	#
	# To disable, set to zero:
	#option vtun_enable '0'

	###########################################################################################
	# tun_id (optional)
	#
	# Note: All vtun options require the ip-full and vxlan packages to be installed, otherwise the options will be ignored
	#
	# Sets the vxtunnel id, a decimal number between 1 and 16777216 (24 bits)
	#
	# Default: 69
	#
	#option tun_id '42069'

	###########################################################################################
	# vtun_ip (optional)
	#
	# Note: All vtun options require the ip-full and vxlan packages to be installed, otherwise the options will be ignored
	#
	# Sets the vxtunnel ipv4 gateway address to be used in the vxtunnel.
	# Becomes active if the node becomes a portal (portal_detect 0 or 1).
	#
	# Default: 192.168.168.1
	#
	#option vtun_ip '10.69.1.1'

	###########################################################################################
	# vtun_mask (optional)
	#
	# Note: All vtun options require the ip-full and vxlan packages to be installed, otherwise the options will be ignored
	#
	# Sets the vxtunnel ipv4 address mask to be used in the vxtunnel.
	# Becomes active if the node becomes a portal (portal_detect 0 or 1).
	#
	# Default: 255.255.255.0
	#
	#option vtun_mask '255.255.0.0'

	###########################################################################################
	# vtun_gate_encryption (optional)
	#
	# Note: All vtun options require the ip-full and vxlan packages to be installed, otherwise the options will be ignored
	#
	# Sets the vxtunnel gate encryption to be used on node gates (access points) connected to the vxtunnel.
	#	Valid values are: 0 (none/owe_transition), 1 (sae, aka wpa3), 2 (sae-mixed, aka wpa2/wpa3), 3 (psk2, aka wpa2) or 4 (owe)"
	#
	# Default: 0 (none/owe transition)
	#
	#option vtun_gate_encryption '3'

	###########################################################################################
	# vtun_gate_key (optional)
	#
	# Note: All vtun options require the ip-full and vxlan packages to be installed, otherwise the options will be ignored
	#
	# Sets the vxtunnel gate encryption key to be used on node gates (access points) connected to the vxtunnel.
	#	Must be a minimum of 8 characters in length
	#
	# Default: not set
	#
	#option vtun_gate_key 'mysecretkey'

	###########################################################################################
	# vtun_base_ssid (optional)
	#
	# Note: All vtun options require the ip-full and vxlan packages to be installed, otherwise the options will be ignored
	#
	# Sets the vxtunnel base ssid string
	#	If ssid_suffix_enable is set to 0, must be a maximum of 30 characters in length
	#	If ssid_suffix_enable is set to 1, must be a maximum of 22 characters in length
	#	Excess characters will be truncated
	#
	# Default: Guest
	#
	#option vtun_base_ssid 'CustomerNetwork'

	###########################################################################################
	# vtun_path_cost (optional)
	#
	# Note: All vtun options require the ip-full and vxlan packages to be installed, otherwise the options will be ignored
	#
	# sets the STP cost of the vxtunnel network
	# Default: 10
	# Can be set to any value from 0 to 65534
	# Setting to 0 disables STP
	#
	# Example:
	#option vtun_path_cost '100'

	###########################################################################################
	# mesh_gate_enable (optional)
	# Determines whether this node will be a gate
	#
	# Default: 1 (enabled)
	# Set to 0 to disable (turns off the node's gate interface ie its access point and SSID)
	#
	#option mesh_gate_enable '0'

	###########################################################################################
	# mesh_leechmode_enable (optional)
	# Determines whether this node will be a gate only leech node
	# A gate only leech node acts as an access point with a mesh backhaul connection, but does not contribute to the mesh
	#
	# This is useful when a node is well within the coverage of 2 or more peer nodes,
	# as otherwise it could create unstable multi hop paths within the backhaul.
	#
	# Can also be set dynamically using the command line option 'mesh11sd mesh_leechmode [enable/disable]'
	#	See the documentation for further information (Hint: try 'mesh11sd --help')
	#
	# Default: 0 (disabled)
	# Set to 1 to enable (turns off the node's mesh forwarding and active HWMP mac-routing)
	#
	# Example - enable leach mode
	#option mesh_leechmode_enable '1'

	###########################################################################################
	# txpower (optional)
	# Set the mesh radio transmit power in dBm.

	# Default - use driver default or value set in wireless config
	# Values outside the limits defined by the regulatory domain will be ignored
	#
	# Example - Set tx power to 15 dBm:
	#option txpower '15'

	###########################################################################################
	# watchdog_nonvolatile_log (optional - FOR DEBUGGING PURPOSES ONLY)
	#
	# This enables logging of the portal detect watchdog actions in non-volatile storage.
	# The log file /mesh11sd_log/mesh11sd.log is created
	#
	# ##########WARNING##########
	# THIS OPTION IS FOR PORTAL DETECT WATCHDOG DEBUGGING PURPOSES ONLY
	# IF LEFT ENABLED FOR A LENGTH OF TIME IT MAY CAUSE NONE REPAIRABLE FLASH MEMORY WEAR AND USE UP FREE STORAGE SPACE
	# DISABLE IMMEDIATELY AFTER DEBUGGING OPERATIONS ARE COMPLETE
	# ##########WARNING##########

	###########################################################################################
	# mesh_path_stabilisation (optional)
	#
	# This enables mesh path stabilisation, preventing multi hop path changes due to multipath signal strength jitter
	#
	# Default: 1 (enabled)
	#
	# To disable, set to zero:
	#option mesh_path_stabilisation '0'

	###########################################################################################
	# reactive_path_stabilisation_threshold (optional)
	#
	# If an unstable path to an immediate neighbour node is detected, a counter is incremented each checkinterval while the unstable condition continues.
	# 	Mesh path stabilisation is activated once the counter exceeds the threshold.
	#
	# Default: 10 checkinterval periods.
	#
	#option reactive_path_stabilisation_threshold '5'

	###########################################################################################
	# mesh_mac_forced_forwarding (optional)
	#
	# This enables mac forced forwarding on the mesh interface
	#
	# Default: 1 (enabled)
	#
	# To disable, set to zero:
	#option mesh_mac_forced_forwarding '0'

	###########################################################################################
	# gateway_proxy_arp (optional)
	#
	# This enables proxy arp on the gateway bridge interface
	#
	# Default: 1 (enabled)
	#
	# To disable, set to zero:
	#option gateway_proxy_arp '0'

	###########################################################################################
	# stop_on_error (optional)
	#
	# If the watchdog detects a failure of ipv4 communication with a portal, the daemon will go into idle mode
	# This is useful if the meshnode does not have a reset button and a critical error occurs, blocking access
	#
	# Default: 0 (disabled)
	#
	# To enable, set to 1. This setting will overide the reboot_on_error setting
	#option stop_on_error '0'

	###########################################################################################
	# reboot_on_error (optional)
	#
	# If the watchdog detects a failure of ipv4 communication with a portal, the daemon will reboot the node
	#
	# Default: 1 (enabled)
	#
	# To disable, set to zero:
	#option reboot_on_error '0'

	###########################################################################################
	# apmond_enable (optional)
	#
	# Enables the access point monitoring daemon
	# 	Assumes the uhttpd and px5g-mbedtls packages are installed.
	#	But other portal based https web servers can be used.
	# Default: 1 (enabled)
	#
	# Data is collected from access point interfaces on this node and sent to the portal node
	#
	# Example:
	#option apmond_enable '0'

	###########################################################################################
	# apmond_cgi_dir (optional)
	#
	# Sets the apmond cgi directory
	#	Takes effect when this node becomes a portal (portal detect 0, 1 and 4)
	# Default: /www/cgi-bin
	#
	# Example:
	#option apmond_cgi_dir '/webroot/cgi'

	###########################################################################################
	# mesh_backhaul_led (optional)
	#
	# Enables the mesh backhaul heartbeat led indicator
	#	The led indicator will be on when the mesh interface is up, changing to the Linux heartbeat signal when peer nodes are connected
	# Default: auto
	#	By default, the power or system led will be used if present.
	#
	#	Other leds can be found listed in /sys/class/leds with the format "color:function"
	# Disable this option by setting its value to "none"
	#
	# Example, enable the "blue:run" led:
	#option mesh_backhaul_led 'blue:run'
	#
	# Example, disable the mesh backhaul led:
	#option mesh_backhaul_led 'none'

	###########################################################################################
	# manage_opennds_startup (optional)
	#
	# Enables management of opennds startup
	#	If opennds is installed, mesh11sd will manage its startup.
	# Default: 1 Enabled
	#
	# Synchronizes nft rulesets of opennds and mesh11sd
	# Disabling may cause crash loops because the opennds gatewayinterface may not be up as mesh11sd starts.
	#
	#option manage_opennds_startup '0'

config mesh11sd 'mesh_params'
	# A minimum set of parameters is automatically set for initial startup and do not have to be configured here
	#
	# Any mesh parameter supported by the wireless driver can be specified here
	# and will be dynamically set and continuously checked every "checkinterval"
	# 
	# Examples:
	#option mesh_rssi_threshold '-70'
	#option mesh_max_peer_links '20'

	#
	# The command: "mesh11sd status" gives a full list of supported parameters.

