Developing lightweight computation at the DSG edge

Commit 561ca717 authored by Roger Pueyo Centelles's avatar Roger Pueyo Centelles
Browse files

Merge new menus into testing

parents 055a596a e76afdf8
......@@ -23,16 +23,13 @@ uci add network switch_vlan > /dev/null
uci set network.@switch[0]=switch
uci set network.@switch[0].name=switch0
uci set network.@switch[0].reset=1
uci set network.@switch[0].enable_vlan=0
# The following lines have to be commented, otherwise the VLAN inteface
# switch0.1 appears as a regular interface in the configuration wizard
#uci set network.@switch_vlan[0]=switch_vlan
#uci set network.@switch_vlan[0].device=switch0
#uci set network.@switch_vlan[0].vlan=1
#uci set network.@switch_vlan[0].vid=1
#uci set network.@switch_vlan[0].ports="0 1 2 3 4"
uci set network.@switch[0].enable_vlan=1
uci set network.@switch_vlan[0]=switch_vlan
uci set network.@switch_vlan[0].device=switch0
uci set network.@switch_vlan[0].vlan=1
uci set network.@switch_vlan[0].vid=1
uci set network.@switch_vlan[0].ports="0 1 2 3 4"
uci commit network
}
......@@ -53,9 +53,9 @@ qmp_configure_system() {
[ -z "$community_id" ] && community_id="qmp" && qmp_uci_set node.community_id $community_id
# set hostname
uci set system.@system[0].hostname=${community_id}${community_node_id}
uci set system.@system[0].hostname="${community_id}-${community_node_id}"
uci commit system
echo "${community_id}${community_node_id}" > /proc/sys/kernel/hostname
echo "${community_id}-${community_node_id}" > /proc/sys/kernel/hostname
uci set uhttpd.main.listen_http="80"
uci set uhttpd.main.listen_https="443"
......
......@@ -37,19 +37,19 @@ function index()
-- Rest of entries
entry({"qmp","status"}, template("admin_status/index"), "Status", 2).dependent=false
entry({"qmp","configuration"}, cbi("qmp/wizard"), "Configuration", 4).dependent=false
entry({"qmp","configuration","wizard"}, cbi("qmp/wizard"), "Wizard", 1).dependent=false
entry({"qmp","configuration","node"}, cbi("qmp/node"), "Node", 2).dependent=false
entry({"qmp","configuration","network"}, cbi("qmp/network"), "Network", 3).dependent=false
entry({"qmp","configuration","network","advanced"}, cbi("qmp/network_adv"), "Advanced networking", 1).dependent=false
entry({"qmp","configuration","wifi"}, cbi("qmp/wireless"), "WiFi", 4).dependent=false
entry({"qmp","configuration","services"}, cbi("qmp/services"), "Services", 5).dependent=false
entry({"qmp","configuration","gateways"}, cbi("qmp/gateways"), "Gateways", 6).dependent=false
entry({"qmp","configuration"}, cbi("qmp/easy_setup"), "Node configuration", 4).dependent=false
entry({"qmp","configuration","easy_setup"}, cbi("qmp/easy_setup"), "qMp easy setup", 1).dependent=false
entry({"qmp","configuration","node"}, cbi("qmp/node"), "Basic settings", 2).dependent=false
entry({"qmp","configuration","network"}, cbi("qmp/network"), "Network settings", 3).dependent=false
entry({"qmp","configuration","network","advanced"}, cbi("qmp/network_adv"), "Advanced network settings", 1).dependent=false
entry({"qmp","configuration","wifi"}, cbi("qmp/wireless"), "Wireless settings", 4).dependent=false
entry({"qmp","configuration","services"}, cbi("qmp/services"), "qMp services", 5).dependent=false
entry({"qmp","configuration","gateways"}, cbi("qmp/gateways"), "qMp gateways", 6).dependent=false
entry({"qmp","tools"}, call("action_tools"), "Tools", 5).dependent=false
entry({"qmp","tools","tools"}, call("action_tools"), "Tools", 1).dependent=false
entry({"qmp","tools","splash"}, call("action_splash"), "Splash", 2).dependent=false
entry({"qmp","tools","map"}, call("action_map"), "Map", 3).dependent=false
entry({"qmp","tools","tools"}, call("action_tools"), "Network testing", 1).dependent=false
-- entry({"qmp","tools","splash"}, call("action_splash"), "Splash", 2).dependent=false
-- entry({"qmp","tools","map"}, call("action_map"), "Map", 3).dependent=false
entry({"qmp","about"}, call("action_status"), "About", 9).dependent=false
end
......
......@@ -29,23 +29,14 @@ local uciout = uci.cursor()
package.path = package.path .. ";/etc/qmp/?.lua"
qmpinfo = require "qmpinfo"
m = SimpleForm("qmp_tmp", translate("qMp Wizard"))
local roaming_help
roaming_help = m:field(DummyValue,"roaming_help")
roaming_help:depends("_netmode","roaming")
roaming_help.rawhtml = true
roaming_help.default = "Roaming for quick deployments. Connected devices cannot see each other among different Mesh stations. \
However the devices can change between Access Points without loosing connectivity"
local community_help
community_help = m:field(DummyValue,"community_help")
community_help:depends("_netmode","community")
community_help.rawhtml = true
community_help.default = "Community for static deployments (such as community networks). Connected devices have a static IP range and are able to see each others.\
However there is no roaming between stations."
netmode = m:field(ListValue, "_netmode",translate("Network mode"),translate("Roaming is used for quick deployments.<br/>Community for network communities"))
m = SimpleForm("qmp", translate("qMp easy setup"),translate("This page provides a fast and simple way to configure the basic settings of a qMp node.").." "..translate("Use the fields below to specify the network mode, the IP addressing and the interface modes."))
local mode_help
mode_help = m:field(DummyValue,"mode_help")
mode_help.rawhtml = true
mode_help.default = "<strong>"..translate("Network mode").."</strong>".."<br/> <br/>"..translate("qMp nodes can operate in two different modes, depending on the kind of network to deploy.").." "..translate("According to your needs, you can choose between")..":<br/> <br/> · "..translate("roaming mode, for quick, temporal deployments. User devices connected to the network can roam between Access Points without loosing connectivity. However, they can not see other devices connected to the Mesh.").."<br/> · "..translate("community mode for static, long-term deployments (such as community networks). User devices connected to the network get an IP address from a specific range and are accessible from the rest of the Mesh. However, roaming between stations is not possible.").."<br/> <br/>"
netmode = m:field(ListValue, "_netmode","<strong>"..translate(" ").."</strong>",translate("\"Roaming\" mode for quick, temporal network setups. \"Community\" mode for community networks and long-term deployments."))
netmode:value("community","community")
netmode:value("roaming","roaming")
......@@ -64,10 +55,18 @@ else
end
netmode.default=networkmode
nodeip_roaming = m:field(Value, "_nodeip_roaming", translate("IP address"),
translate("Main IPv4 address. This IP must be unique in the Mesh network. <br/>Leave blank for randomize."))
local roaming_ipaddress_help
roaming_ipaddress_help = m:field(DummyValue,"roaming_ipaddress_help")
roaming_ipaddress_help.rawhtml = true
roaming_ipaddress_help:depends("_netmode","roaming")
roaming_ipaddress_help.default = "<strong>"..translate("IP address").."</strong>".."<br/> <br/>"..translate("Specify here an IP address for this node.").." "..translate("In roaming mode, all qMp nodes in a mesh network need a unique IPv4 address.").." "..translate("If unsure about which one to select, leave the field blank and a random one will be assigned automatically.").."<br/> <br/>"
local nodeip_roaming = m:field(Value, "_nodeip_roaming", " ",
translate("Main IPv4 address for this node.").." "..translate("Leave it blank to get a random one."))
nodeip_roaming:depends("_netmode","roaming")
local rip = uciout:get("qmp","networks","bmx6_ipv4_address")
if rip == nil or #rip < 7 then
rip = uciout:get("bmx6","general","tun4Address")
......@@ -77,26 +76,48 @@ if rip == nil or #rip < 7 then
end
nodeip_roaming.default=rip
nodeip_roaming.datatype="ip4prefix"
nodename = m:field(Value, "_nodename", translate("Node name"),
translate("The name of this node. Two random hex-digits will be added at the end."))
local community_name_help
community_name_help = m:field(DummyValue,"community_name_help")
community_name_help.rawhtml = true
community_name_help:depends("_netmode","community")
community_name_help.default = "<strong>"..translate("Node name").."</strong>".."<br/> <br/>"..translate("Choose a name for this node. It will be used to identify the device in the network. Use only alphanumeric characters, spaces are not allowed.").."<br/> <br/>"
local nodename = m:field(Value, "_nodename", " ",
translate("The name of this node. Four hex numbers will be appended, according the the device's MAC address."))
nodename:depends("_netmode","community")
nodename.default="qMp"
nodename.datatype="hostname"
if uciout:get("qmp","node","community_id") ~= nil then
nodename.default=uciout:get("qmp","node","community_id")
end
nodeip = m:field(Value, "_nodeip", translate("IP address"),
translate("Main IPv4 address. This IP must be unique in the Mesh network. If will be used for LAN end users."))
local community_addressing_help
community_addressing_help = m:field(DummyValue,"community_addressing_help")
community_addressing_help.rawhtml = true
community_addressing_help:depends("_netmode","community")
community_addressing_help.default = "<strong>"..translate("IP address and network mask").."</strong>".."<br/> <br/>"..translate("Specify the IP address and the network mask for this node, according to the planification of your community or your network deployment.").." "..translate("End-user devices will get an IP address within the valid range determined by these two values.").."<br/> <br/>"
local nodeip = m:field(Value, "_nodeip", " ",
translate("Main IPv4 address for this node."))
nodeip:depends("_netmode","community")
nodeip.default = "10.30."..util.trim(util.exec("echo $((($(date +%M)*$(date +%S)%254)+1))"))..".1"
nodeip.datatype="ip4addr"
nodemask = m:field(Value, "_nodemask",translate("Network mask"),
translate("Netmask to use with the IPv4 address specified before. This mask will be used for LAN end users."))
local nodemask = m:field(Value, "_nodemask"," ",
translate("Network mask to be used with the IPv4 address above."))
nodemask:depends("_netmode","community")
nodemask.default = "255.255.255.0"
nodemask.datatype="ip4addr"
local interface_mode_help
interface_mode_help = m:field(DummyValue,"interface_mode_help")
interface_mode_help.rawhtml = true
interface_mode_help.default = "<strong>"..translate("Interface modes").."</strong>".."<br/> <br/>"..translate("Select the working mode of the network interfaces")..":<br/> <br/> · "..translate("LAN mode is used to provide connectivity to end-users (a DHCP server will be enabled to assign IP addresses to the devices connecting)").."<br/> · "..translate("WAN mode is used on interfaces connected to an Internet up-link or any other gateway connection").."<br/> · "..translate("Mesh mode is used on wireless interfaces to join the qMp mesh and, on wired interfaces, to link with other qMp nodes").."<br/> · "..translate("AP mode is used on wireless interfaces to act as an access point and provide connectivity to end-users").."<br/> <br/>"
if networkmode == "community" then
nodeip.default=uciout:get("qmp","networks","lan_address")
......@@ -120,7 +141,7 @@ local function is_a(dev, what)
end
for i,v in ipairs(devices.eth) do
tmp = m:field(ListValue, "_" .. v, v)
tmp = m:field(ListValue, "_" .. v, translatef("Wired interface <strong>%s</strong>",v))
tmp:value("Mesh")
tmp:value("Lan")
tmp:value("Wan")
......@@ -140,7 +161,7 @@ end
nodedevs_wifi = {}
for i,v in ipairs(devices.wifi) do
tmp = m:field(ListValue, "_" .. v, v)
tmp = m:field(ListValue, "_" .. v, translatef("Wireless interface <strong>%s</strong>",v))
tmp:value("Mesh")
tmp:value("AP")
tmp.default = ""
......@@ -166,7 +187,7 @@ for i,v in ipairs(devices.wifi) do
nodedevs_wifi[i] = {v,tmp}
end
meshall = m:field(Flag, "_meshall", translate("Use mesh in all devices"),translate("If this option is enabled all existing network devices will be used for meshing (recomended)"))
meshall = m:field(Flag, "_meshall", translate("Use mesh in all devices"),translate("If this option is enabled, all the node's network devices will be used for meshing (recommended)"))
meshall.default = "1"
function netmode.write(self, section, value)
......
......@@ -24,7 +24,7 @@ local http = require "luci.http"
local uci = luci.model.uci.cursor()
local sys = require("luci.sys")
m = Map("gateways", "Quick Mesh Project")
m = Map("gateways", "qMp gateway announcements")
-- GET GATEWAYS NAMES
gw_names = {}
......@@ -35,7 +35,7 @@ uci:foreach('gateways','gateway', function (s)
end
end)
gw_section = m:section(TypedSection, "gateway", translate("Gateways"),translate("Network announcements (i.e publish your home LAN) and network searches (i.e look for an Internet connection)."))
gw_section = m:section(TypedSection, "gateway", translate("qMp gateway announcements"),translate("Use this page to configure gateways and network announcements for your node (i.e. to publish your home LAN) and searches (i.e. look for an Internet gateway or a subnetwork announcement).").."<br/> <br/><strong>"..translate("Use with care!").."</strong> "..translate("Publising incorrect announcements might cause other nodes to lose Internet connection or render the mesh network inoperative."))
gw_section.addremove = true
gw_section.anonymous = false
......
......@@ -23,36 +23,42 @@ qmpinfo = require "qmpinfo"
require("luci.sys")
local http = require "luci.http"
m = Map("qmp", "Quick Mesh Project")
m = Map("qmp", "qMp network settings")
eth_section = m:section(NamedSection, "interfaces", "qmp", "Interfaces", "Interfaces")
eth_section = m:section(NamedSection, "interfaces", "qmp", translate("Network mode"), translate("Select the working mode of the wired network interfaces: <br/> · LAN mode is used to provide end-users connectivity and a DHCP will be enabled to assign IP addresses to the devices connecting.<br/> · WAN mode is used on interfaces connected to an Internet up-link or any other gateway connection.<br/> <br/>LAN and WAN modes are mutually exclusive. <strong>Do not set an interface in both LAN and WAN modes.</strong>"))
eth_section.addremove = False
mesh_section = m:section(NamedSection, "interfaces", "qmp", translate("Mesh interfaces"), translate("Select the devices that will be used in the mesh network. It is recommended to select them all."))
eth_section.addremove = False
special_section = m:section(NamedSection, "interfaces", "qmp", translate("Special settings"), translate("Use this section to disable VLAN tagging in certain interfaces or to exclude them from qMp."))
mesh_section.addremove = False
-- Getting the physical (real) interfaces
net_int = qmpinfo.get_devices().all
-- Option: lan_devices
lan = eth_section:option(MultiValue, "lan_devices", "LAN devices","These devices will be used for end-user connection (DHCP server)")
lan = eth_section:option(MultiValue, "lan_devices", translate("LAN mode"),translate("Interfaces used to provide end-user connectivity (DHCP server)"))
local i,l
for i,l in ipairs(net_int) do
lan:value(l,l)
end
-- Option wan_device
wan = eth_section:option(MultiValue, "wan_devices", "WAN devices","These devices will be used for internet or any other gateway connection (DHCP client)")
wan = eth_section:option(MultiValue, "wan_devices", "WAN mode","Interfaces connected to an Internet up-link or any other gateway (DHCP client)")
for i,l in ipairs(net_int) do
wan:value(l,l)
end
-- Option mesh_devices
mesh = eth_section:option(MultiValue, "mesh_devices", "MESH devices","These devices will be used for Mesh network")
mesh = mesh_section:option(MultiValue, "mesh_devices", "MESH devices","Devices used for meshing (it is recommended to check them all)")
for i,l in ipairs(net_int) do
mesh:value(l,l)
end
no_vlan = eth_section:option(Value, "no_vlan_devices", translate("No VLAN devices"),translate("Devices we want to use without VLAN tagging (not recommended)"))
no_vlan = special_section:option(Value, "no_vlan_devices", translate("VLAN-untagged devices"),translate("Devices that will not be used with VLAN tagging (it is recommended to leave it blank)"))
ignore_devs = eth_section:option(Value, "ignore_devices", translate("Ignored devices"),translate("Devices are not taken into account for qMp autoconfiguration"))
ignore_devs = special_section:option(Value, "ignore_devices", translate("Excluded devices"),translate("Devices that will not be used by qMp"))
function m.on_commit(self,map)
http.redirect("/luci-static/resources/qmp/wait_long.html")
......
......@@ -21,53 +21,46 @@
require("luci.sys")
local http = require "luci.http"
m = Map("qmp", "Quick Mesh Project")
m = Map("qmp", "qMp advanced network settings")
ethernet_interfaces = { 'eth', 'ath', 'wlan' }
wireless_interfaces = { 'ath', 'wlan' }
eth_section = m:section(NamedSection, "networks", "qmp", "Interfaces", "Interfaces")
eth_section = m:section(NamedSection, "networks", "qmp", translate("IP addressing"), translate("Use this section to modify the advanced network settings that are not displayed in the qMp easy setup page."))
eth_section.addremove = False
-- Option: DNS
eth_section:option(Value, "dns", "Nameservers",translate("Define the nameservers to use."))
eth_section:option(Value, "dns", "DNS nameservers",translate("Define the nameservers to use.").." "..translate("Separate them with a blank space"))
-- Option: lan addresses
eth_section:option(Value, "lan_address", "LAN address",translate("IPv4 address for LAN interfaces."))
eth_section:option(Value, "lan_address", "LAN IP address",translate("IPv4 address for the LAN interfaces."))
-- Option: lan addresses
eth_section:option(Value, "lan_netmask", "LAN netmask",translate("IPv4 netmask for LAN interfaces."))
eth_section:option(Value, "lan_netmask", "LAN netmask",translate("IPv4 netmask for the LAN interfaces."))
-- Option: publish lan
--eth_section:option(Flag, "publish_lan", "Publish LAN", "Publish LAN network through the mesh")
-- Option: disable dhcp
eth_section:option(Flag, "disable_lan_dhcp", "Disable DHCP from LAN",
eth_section:option(Flag, "disable_lan_dhcp", "Disable DHCP in LAN",
translate("Disable DHCP server in LAN network (not recommended)."))
-- Option bmx6_ipv4_address
eth_section:option(Value, "bmx6_ipv4_address", "Main IPv4 address",
translate("IPv4 address used for bmx6 (main address). Leave blank to randomize."))
translate("Main IPv4 address used in bmx6. Leave it blank to get a random one."))
-- Option: bmx6_ipv4_prefix24
eth_section:option(Value, "bmx6_ipv4_prefix24", "Random-IPv4 prefix 24",
translate("Used to calculate the IP if it is not defined in the field before (example: 10.40.50)."))
translate("Network prefix used to calculate a random IP address if the field above is left blank (example: 10.40.50)."))
-- Option: bmx6_ripe_prefix48
eth_section:option(Value, "bmx6_ripe_prefix48", "Main IPv6 prefix",
translate("If you have a global IPv6 48bits prefix, specify it here. Otherwise leave it blank."))
-- Option: netserver
nts = eth_section:option(ListValue, "netserver", "Permit bandwidth test",
translate("If enabled all nodes will be able to perform bandwidth tests with your node"))
nts:value("0","no")
nts:value("1","yes")
-- Option force_internet
fint = eth_section:option(ListValue, "force_internet", "Force internet",
translate("Usese it if you want force the system to share/unshare Internet (not recommended)"))
translate("Use it if you want force the system to share/unshare Internet (it is recommended to leave it as disabled)"))
fint:value("","disabled")
fint:value("1","yes")
fint:value("0","no")
......@@ -76,21 +69,19 @@ fint:value("0","no")
-- Non overlapping
---------------------------
overlapping_section = m:section(NamedSection, "roaming", "qmp",
translate("Roaming", "Layer3 Roaming"))
overlapping_section = m:section(NamedSection, "roaming", "qmp", translate("Roaming mode"))
overlapping_section.addremove = False
ignore = overlapping_section:option(ListValue, "ignore",
translate("Roaming","If yes, the roaming will be enabled. Each mesh node will give a different /24 to the LAN clients from the same /16."))
ignore = overlapping_section:option(ListValue, "ignore", translate("Roaming"),translate("If roaming mode is enabled, each node will provide its LAN clients with IP addresses from different /24 pools in the same /16 subnetwork.").." "..translate("Leave it disabled for community networks or long-term deployments."))
ignore:value("1","no")
ignore:value("0","yes")
-- Option: dhcp_offset
overlapping_section:option(Value, "dhcp_offset", "DHCP offset",
translate("Offset to calculate the first IP to give throw DHCP"))
translate("Offset to calculate the first IP to give via DHCP"))
-- Option: Leassetime
overlapping_section:option(Value, "qmp_leasetime", "DHCP leassetime",translate("Leassetime for DHCP"))
overlapping_section:option(Value, "qmp_leasetime", "DHCP leas etime",translate("Lease time for the DHCP server"))
--------------------------
......
......@@ -22,14 +22,17 @@
require("luci.sys")
local http = require "luci.http"
m = Map("qmp", "Quick Mesh Project")
m = Map("qmp", "qMp node basic settings")
node_section = m:section(NamedSection, "node", "qmp", translate("Node"), translate("Node configuration options"))
node_section = m:section(NamedSection, "node", "qmp", translate("Node identity"), translate("Use this page to define basic qMp settings, like the node\'s name."))
node_section.addremove = False
community_id = node_section:option(Value,"community_id", translate("Community id"), translate("Community identifier for node name (alphanumeric, no spaces)"))
--community_node_id = node_section:option(Value,"community_node_id", translate("Node id"), translate("Node identifier, two hexadecimal digits, leave blank to use last byte of primary MAC address."))
primary_device = node_section:option(Value,"primary_device", translate("Primary device"), translate("Network primary device which never will change"))
community_id = node_section:option(Value,"community_id", translate("Node name"), translate("The name for this node (use alphanumeric characters, without spaces)."))
community_id.default = "qMp"
community_id.datatype = "hostname"
primary_device = node_section:option(Value,"primary_device", translate("Primary network device"), translate("The name of the node's primary network device. The last four digits of this device's MAC address will be appended to the node name."))
primary_device.default = "eth0"
primary_device.datatype = "network"
function m.on_commit(self,map)
......
......@@ -22,49 +22,54 @@
require("luci.sys")
local http = require "luci.http"
local m = Map("qmp", "Quick Mesh Project")
local m = Map("qmp", "qMp node services")
local section = m:section(NamedSection, "services", "qmp", translate("Services"), translate("System services control"))
section.addremove = False
local basic_services = m:section(NamedSection, "services", "qmp", translate("Basic qMp services"),
translate("These are the basic qMp services running on this node.").." "..translate("It is recommended to enable them, since they play an important role for end-user connectiviy and mesh network administration."))
basic_services.addremove = False
local additional_services = m:section(NamedSection, "services", "qmp", translate("Additional qMp services"),
translate("These are the additional services provided by this qMp node.").." "..translate("You can safely enable or disable them according to your needs without affecting basic node features or end-user connectivity."))
additional_services.addremove = False
-- Option: VPN
local vpn = section:option(Flag, "vpn", translate("Management VPN"),
translate("The Management VPN is used to control the nodes in remote from a central point"))
local vpn = additional_services:option(Flag, "vpn", translate("Management VPN"),
translate("The Management VPN is used to control the nodes remotely from a central point"))
vpn.default=0
-- Option: Captive Portal
local cp = section:option(Flag, "captive_portal", translate("Captive Portal"),
translate("The captive portal is a small http proxy used to show a HTML page the first time someone connects to the node's Access Point"))
cp.default=0
-- local cp = additional_services:option(Flag, "captive_portal", translate("Captive Portal"),
-- translate("The captive portal is a small http proxy used to show an HTML page the first time someone connects to the node's Access Point"))
-- cp.default=0
-- Option: b6m
local b6m = section:option(Flag, "b6m", translate("BMX6 map"),
translate("The b6m is a real time descentralized geopositioning map based on OpenStreetMaps (Internet access only required for the OSM but not for the status/topology)"))
b6m.default=0
-- local b6m = additional_services:option(Flag, "b6m", translate("BMX6 map"),
-- translate("B6m is a decentralized, real-time geopositioning map based on OpenStreetMaps (Internet connection is only required for the OSM but not for the status/topology)"))
-- b6m.default=0
-- Option: libremap
local alt = section:option(Flag, "libremap", translate("LibreMap"),
translate("LibreMap is a centralized geopositioning map. Internet and the previous creation of the node in the map page are required (http://libremap.net)"))
local alt = additional_services:option(Flag, "libremap", translate("LibreMap"),
translate("LibreMap is a centralized geopositioning map (Internet connection is required, as well as registering the node in the map page (http://libremap.net)"))
alt.default=0
-- Option: gwck
local gwck = section:option(Flag, "gwck", translate("Gateway Checker"),
translate("GWCK is a tool automatic discover and publish Internet access among the Mesh network"))
gwck.default=0
local gwck = basic_services:option(Flag, "gwck", translate("Gateway Checker").." "..translate("(GWCK)"),
translate("GWCK is a tool to automatically discover and publish Internet gateways among the Mesh network"))
gwck.default=1
-- Option: bwtest
local bwt = section:option(Flag, "bwtest", translate("Bandwidth test"),
local bwt = basic_services:option(Flag, "bwtest", translate("Bandwidth test"),
translate("If enabled, the node will be available to perform bandwidth test from other locations"))
bwt.default=0
bwt.default=1
-- Option: mdns
local mdns = section:option(Flag, "mesh_dns", translate("Mesh distributed DNS"),
translate("A distributed DNS system to publish and get domain names (i.e myNode01.qmp)"))
mdns.default=0
local mdns = basic_services:option(Flag, "mesh_dns", translate("Mesh distributed DNS"),
translate("A distributed DNS system to publish and get domain names (example: myNode01.qmp)"))
mdns.default=1
-- Option: munin
local munin = section:option(Flag, "munin", translate("Munin agent"),
translate("Munin agent (listen on port 4949) for monitorization and statistics"))
local munin = additional_services:option(Flag, "munin", translate("Munin agent"),
translate("Munin agent (listening on port 4949) for monitorization and statistics purposes"))
munin.default=0
function m.on_commit(self,map)
......
......@@ -29,35 +29,43 @@ package.path = package.path .. ";/etc/qmp/?.lua"
qmpinfo = require "qmpinfo"
m = Map("qmp", "Quick Mesh Project")
m = Map("qmp", "qMp wireless interfaces settings")
local uci = luci.model.uci.cursor()
local wdevs = qmpinfo.get_wifi_index()
for _,wdev in ipairs(wdevs) do
mydev = uci:get("qmp",wdev,"device")
end
local iw = luci.sys.wifi.getiwinfo(mydev)
---------------------------
-- Section Wireless Main --
---------------------------
s_wireless_main = m:section(NamedSection, "wireless", "qmp", translate("Wireless general options"), "")
s_wireless_main.addremove = False
-- Driver selection (deprecated)
--driver = s_wireless_main:option(ListValue, "driver", translate("Driver"))
--driver:value("mac80211","mac80211")
--driver:value("madwifi","madwifi")
-- Country selection
country = s_wireless_main:option(Value,"country", translate("Country"))
local cl = iw and iw.countrylist
-- BSSID
bssid = s_wireless_main:option(Value,"bssid","BSSID")
if cl and #cl > 0 then
cc = s_wireless_main:option(ListValue, "country", translate("Country Code"), translate("Use ISO/IEC 3166 alpha2 country codes."))
cc.default = tostring(iw and iw.country or "00")
for _, s in ipairs(cl) do
cc:value(s.alpha2, "%s - %s" %{ s.alpha2, s.name })
end
-- else
-- s_wireless_main:option(Value, "country", translate("Country Code"), translate("Use ISO/IEC 3166 alpha2 country codes2."))
end
-- Button Rescan Wifi devices
confwifi = s_wireless_main:option(Button, "_confwifi", translate("Reconfigure"),
translate("Rescan and reconfigure all devices. <br/>Use it just in case you have added or changed a device."))
function confwifi.write(self, section)
luci.sys.call("qmpcontrol reset_wifi")
end
-- BSSID
bssid = s_wireless_main:option(Value,"bssid","BSSID")
-----------------------------
......@@ -67,7 +75,7 @@ for _,wdev in ipairs(wdevs) do
mydev = uci:get("qmp",wdev,"device")
s_wireless = m:section(NamedSection, wdev, "Wireless device", "Wi-Fi " .. mydev)
s_wireless = m:section(NamedSection, wdev, "Wireless device", "Wireless device " .. mydev)
s_wireless.addremove = False
-- Device
......@@ -92,7 +100,7 @@ for _,wdev in ipairs(wdevs) do
essid.maxlength = 32
-- Channel
channel = s_wireless:option(ListValue,"channel","Channel",translate("WiFi channel to be used in this device.<br/>Select +/- for 40MHz channel. Select b for 802.11b only"))
channel = s_wireless:option(ListValue,"channel","Channel",translate("WiFi channel to be used in this device.<br/>Selecting channels with + or - enables 40MHz bandwidth."))
mymode = m.uci:get("qmp",wdev,"mode")
for _,ch in ipairs(qmpinfo.get_channels(mydev)) do
......@@ -112,7 +120,7 @@ for _,wdev in ipairs(wdevs) do
key:depends("mode","adhoc_ap")
-- Txpower
txpower = s_wireless:option(ListValue,"txpower","Power",translate("Choose the transmit power (each 4, the power is doubled)"))
txpower = s_wireless:option(ListValue,"txpower",translate("Transmission power (dBm)"),translate("Radio power in dBm. Each 3 dB increment doubles the power."))
for _,t in ipairs(qmpinfo.get_txpower(mydev)) do
txpower:value(t,t)
end
......@@ -124,6 +132,19 @@ function m.on_commit(self,map)
luci.sys.call('(/etc/qmp/qmp_control.sh configure_wifi ; /etc/init.d/network reload; /etc/init.d/gwck enabled && /etc/init.d/gwck restart)&')
end
---------------------------
-- Section Wireless Main --
---------------------------
s_wireless_reconfigure = m:section(NamedSection, "wireless", "qmp", translate("Reconfigure wireless"), translate("Use this button to rescan and reconfigure all wireless interfaces. This is useful in case new interfaces are added. <br/> <br/><strong>All current wireless settings will be restored to the default ones.</strong> "))
s_wireless_main.addremove = False
-- Button Rescan Wifi devices