Developing lightweight computation at the DSG edge

Commit 5b34aa3e authored by Roger Pueyo Centelles's avatar Roger Pueyo Centelles
Browse files

Merge changes for qMp 3.1 into Kalimotxo

parents 50befced 3ee0b751
# This is a feeds.conf template used by qMpFW (http://qmp.cat/projects/qmpfw)
src-link packages PATH/packages
src-link qmp_packages PATH/qmp/packages
src-link qmp PATH/qmp/packages
src-git luci https://github.com/openwrt/luci.git
src-git openwrt_routing https://github.com/openwrt-routing/packages.git
src-git oldpackages http://git.openwrt.org/packages.git
src-git libremap_agent https://github.com/libremap/libremap-agent-openwrt.git
src-git b6m_packages git://qmp.cat/b6m.git;openwrt
src-git b6m git://qmp.cat/b6m.git;openwrt
src-git nc git://qmp.cat/ncr.git
......@@ -25,10 +25,13 @@ include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=bmx6-mdns
PKG_VERSION:=0.1
PKG_RELEASE:=1
PKG_LICENSE:=GPL-2.0+
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
QMP_CODENAME:=Kalimotxo
QMP_RELEASE:=4.0
QMP_CODENAME:=Clearance
QMP_RELEASE:=3.1-rc1
QMP_BUILDDATE:=$(shell date +%Y%m%d_%H%M)
include $(INCLUDE_DIR)/package.mk
......
......@@ -26,8 +26,8 @@ include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=qmp-big-node
PKG_VERSION:=4.0
PKG_RELEASE:=1
PKG_VERSION:=3.1
PKG_RELEASE:=rc1
PKG_LICENSE:=GPL-2.0+
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
......
......@@ -26,8 +26,8 @@ include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=qmp-small-node
PKG_VERSION:=4.0
PKG_RELEASE:=1
PKG_VERSION:=3.1
PKG_RELEASE:=rc1
PGK_LICENSE:=GPL-2.0+
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
......
......@@ -26,8 +26,8 @@ include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=qmp-system
PKG_VERSION:=4.0
PKG_RELEASE:=1
PKG_VERSION:=3.1
PKG_RELEASE:=rc1
PKG_LICENSE:=GPL-2.0+
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
......
......@@ -63,7 +63,7 @@ config 'qmp' 'services'
# -----------------------------
config 'qmp' 'update'
# Remote URL where the firmware images are placed.
option url 'http://fw.qmp.cat/trunk'
option url 'http://fw.qmp.cat/master'
# Special remote file which contains a list of firmware:md5hash.
option images 'IMAGES'
......
......@@ -32,6 +32,7 @@ reset_wifi() {
configure_wifi() {
qmp_configure_wifi_initial
qmp_configure_wifi
configure_network
/etc/init.d/network reload
if /etc/init.d/gwck enabled
then
......
......@@ -16,6 +16,7 @@ fi
[ -z "$SOURCE_NET" ] && . $QMP_PATH/qmp_network.sh
[ -z "$SOURCE_SYS" ] && . $QMP_PATH/qmp_system.sh
[ -z "$SOURCE_WIRELESS" ] && . $QMP_PATH/qmp_wireless.sh
[ -z "$SOURCE_COMMON" ] && . $QMP_PATH/qmp_common.sh
qmp_get_llocal_for_dev() {
local dev=$1
......@@ -69,45 +70,52 @@ qmp_get_virtual_iface() {
fi
fi
# is lan?
if [ "$device" == "br-lan" ]; then
viface="lan"
echo $viface
return
fi
# is lan?
if [ "$device" == "br-lan" ]; then
viface="lan"
if [ ! -e "/sys/class/net/$device/phy80211" ]; then
echo $viface
return
fi
fi
for l in $(qmp_get_devices lan); do
if [ "$l" == "$device" ]; then
viface="lan"
if [ ! -e "/sys/class/net/$device/phy80211" ]; then
echo $viface
return
fi
fi
done
for l in $(qmp_get_devices lan); do
if [ "$l" == "$device" ]; then
viface="lan"
echo $viface
return
fi
done
[ ! -e "/sys/class/net/$device/phy80211" ] && [ -n "$viface" ] && { echo $viface; return; }
[ -n "$viface" ] && { echo $viface; return; }
# id is the first char and the numbers of the device [e]th[0] [w]lan[1]
local id_num=$(echo $device | tr -d "[A-z]" | tr - _ | tr . _)
local id_char=$(echo $device | cut -c 1)
# id is the first and char and the numbers of the device [e]th[0] [w]lan[1]
local id_num=$(echo $device | tr -d "[A-z]" | tr - _ | tr . _)
local id_char=$(echo $device | cut -c 1)
# is wan?
for w in $(qmp_get_devices wan); do
if [ "$w" == "$device" ]; then
viface="wan_${id_char}${id_num}"
echo $viface
return
fi
done
# is wan
for w in $(qmp_get_devices wan); do
if [ "$w" == "$device" ]; then
viface="wan_${id_char}${id_num}"
echo $viface
return
fi
done
qmp_log "LOG: 5"
qmp_log "Viface: $viface"
# is mesh
for w in $(qmp_get_devices mesh); do
if [ "$w" == "$device" ]; then
viface="mesh_${id_char}${id_num}"
break
fi
done
# is mesh?
for w in $(qmp_get_devices mesh); do
if [ "$w" == "$device" ]; then
viface="mesh_${id_char}${id_num}"
break
fi
done
echo "$viface"
echo "$viface"
}
# arg1=<mesh|lan|wan>, returns the devices which have to be configured in such mode
......@@ -118,11 +126,11 @@ qmp_get_devices() {
local brlan_enabled=0
for dev in $(uci get qmp.interfaces.mesh_devices 2>/dev/null); do
# Lookging if device is defined as LAN, in such case dev=br-lan, but only once
# Looking if device is defined as LAN, in such case dev=br-lan, but only once
# except eth1 for RouterStation Pro
if ! ( [[ "$dev" == "eth1" ]] && qmp_is_routerstationpro ) ; then
for landev in $(uci get qmp.interfaces.lan_devices 2>/dev/null); do
if [ "$landev" == "$dev" ]; then
if [ "$landev" == "$dev" ] && [ ! -e "/sys/class/net/$dev/phy80211" ] ; then
if [ $brlan_enabled -eq 0 ]; then
dev="br-lan"
brlan_enabled=1
......@@ -770,6 +778,10 @@ qmp_configure_bmx6() {
local vid="$(echo $protocol_vid | awk -F':' '{print $2}')"
[ -z "$vid" -o $vid -lt 1 ] && use_vlan=0
# Check if the protocol has VLAN tag configured
local vid="$(echo $protocol_vid | awk -F':' '{print $2}')"
[ -z "$vid" -o $vid -lt 1 ] && use_vlan=0
# If vlan tagging
if [ $use_vlan -eq 1 ]; then
local ifname="$dev.$vid"
......
......@@ -350,6 +350,9 @@ qmp_configure_mesh() {
# if no vlan is specified do not use vlan
[ -z "$vid" ] && vid=1 && use_vlan=0
# if no vlan is specified do not use vlan
[ -z "$vid" ] && vid=1 && use_vlan=0
# virtual interface
local viface=$(qmp_get_virtual_iface $dev)
......
......@@ -65,12 +65,12 @@ qmp_set_maps() {
[ $(qmp_uci_get services.libremap) -eq 1 ] && {
qmp_uci_get_raw libremap.location && {
local lat="$(qmp_uci_get node.latitude)"
local lon="$(qmp_uci_get node.latitude)"
local lon="$(qmp_uci_get node.longitude)"
local elev="$(qmp_uci_get node.elevation)"
[ -n "$lat" ] && [ -n "$lon" ] && {
elev=${elev:-0}
qmp_uci_set_raw libremap.location.latitude="$lat"
qmp_uci_set_raw libremap.location.latitude="$lon"
qmp_uci_set_raw libremap.location.longitude="$lon"
qmp_uci_set_raw libremap.location.elev="$elev"
}
}
......
......@@ -34,7 +34,7 @@ qmp_prepare_wireless_iface() {
###################################
# First parameter: device
# Second parameter: channel
# Third parameter: mode (adhoc, ap, adhoc_ap)
# Third parameter: mode (adhoc, ap, adhoc_ap, aplan, client, clientwan, none)
# It returns the same channel if it is right, and the new one fixet if not
qmp_check_channel() {
......@@ -116,9 +116,68 @@ qmp_configure_wifi_device() {
local id=$1
local device="$(qmp_uci_get @wireless[$id].device)"
# checking if device is configured as "none"
# Remove the wireless device in $device from the previous lan/wan/mesh groups
# and put it in the appropriate ones according to the selected mode
#
# The possible modes are:
# adhoc_ap ==> Ad hoc (mesh) + access point (LAN)
# adhoc =====> Ad hoc (mesh)
# ap ========> Access point (mesh)
# aplan =====> Access point (LAN)
# client ====> Client (mesh)
# clientwan => Client (WAN)
local mode="$(qmp_uci_get @wireless[$id].mode)"
[ "$mode" == "none" ] && { echo "Interface $device is not managed by the qMp system"; return; }
# Remove $device and also unneeded white spaces
local allmeshdevs="$(qmp_uci_get interfaces.mesh_devices)"
local meshdevs="$(echo $allmeshdevs | sed -e s/$device//g -e 's/^[ \t]*//' -e 's/ \+/ /g' -e 's/[ \t]*$//')"
local allwandevs="$(qmp_uci_get interfaces.wan_devices)"
local wandevs="$(echo $allwandevs | sed -e s/$device//g -e 's/^[ \t]*//' -e 's/ \+/ /g' -e 's/[ \t]*$//')"
local alllandevs="$(qmp_uci_get interfaces.lan_devices)"
local landevs="$(echo $alllandevs | sed -e s/$device//g -e 's/^[ \t]*//' -e 's/ \+/ /g' -e 's/[ \t]*$//')"
case $mode in
adhoc_ap)
qmp_uci_set interfaces.mesh_devices "$meshdevs $device"
qmp_uci_set interfaces.lan_devices "$landevs $device"
qmp_uci_set interfaces.wan_devices "$wandevs"
;;
adhoc)
qmp_uci_set interfaces.mesh_devices "$meshdevs $device"
qmp_uci_set interfaces.lan_devices "$landevs"
qmp_uci_set interfaces.wan_devices "$wandevs"
;;
ap)
qmp_uci_set interfaces.mesh_devices "$meshdevs $device"
qmp_uci_set interfaces.lan_devices "$landevs"
qmp_uci_set interfaces.wan_devices "$wandevs"
;;
aplan)
qmp_uci_set interfaces.lan_devices "$landevs $device"
qmp_uci_set interfaces.mesh_devices "$meshdevs"
qmp_uci_set interfaces.wan_devices "$wandevs"
;;
client)
qmp_uci_set interfaces.mesh_devices "$meshdevs $device"
qmp_uci_set interfaces.lan_devices "$landevs"
qmp_uci_set interfaces.wan_devices "$wandevs"
;;
clientwan)
qmp_uci_set interfaces.mesh_devices "$meshdevs"
qmp_uci_set interfaces.lan_devices "$landevs"
qmp_uci_set interfaces.wan_devices "$wandevs $device"
;;
none)
qmp_uci_set interfaces.mesh_devices "$meshdevs"
qmp_uci_set interfaces.lan_devices "$landevs"
qmp_uci_set interfaces.wan_devices "$wandevs"
echo "Interface $device is not managed by the qMp system"
return
;;
esac
# spliting channel in channel number and ht40 mode
local channel_raw="$(qmp_uci_get @wireless[$id].channel)"
......@@ -219,6 +278,9 @@ qmp_configure_wifi_device() {
qmp_prepare_wireless_iface $device
echo "Mode is $mode"
echo "Network is $network"
cat $iface_template | grep -v ^# | sed \
-e s/"#QMP_RADIO"/"$radio"/ \
-e s/"#QMP_DEVICE"/"$device"/ \
......@@ -287,15 +349,15 @@ qmp_configure_wifi() {
# This function returns the default values
# - first parameter: is always what are you asking for (mode, channel, name,...)
# - second parameter: is device name, only needed by mode and channel
# - third parameter: is configured mode, only needed by chanel
# - third parameter: is configured mode, only needed by channel
qmp_wifi_get_default() {
local what="$1"
local device="$2"
# MODE
# default mode depens on several things:
# if only 1 device = adhoc
# default mode depends on several things:
# if only 1 device = adhoc_ap
# if only 1 bg device = ap
# else depending on index
......
wireless.#QMP_DEVICE.device=#QMP_RADIO
wireless.#QMP_DEVICE.mode=ap
wireless.#QMP_DEVICE.ssid=#QMP_SSID
wireless.#QMP_DEVICE.network=lan
wireless.#QMP_DEVICE.encryption=#QMP_ENC
wireless.#QMP_DEVICE.key=#QMP_KEY
wireless.#QMP_DEVICE.ifname=#QMP_IFNAME
......@@ -2,7 +2,6 @@ wireless.#QMP_DEVICE.device=#QMP_RADIO
wireless.#QMP_DEVICE.mode=sta
wireless.#QMP_DEVICE.ssid=#QMP_SSID
wireless.#QMP_DEVICE.network=#QMP_NETWORK
wireless.#QMP_DEVICE.encryption=#QMP_ENC
wireless.#QMP_DEVICE.key=#QMP_KEY
wireless.#QMP_DEVICE.ifname=#QMP_IFNAME
wireless.#QMP_DEVICE.encryption=#QMP_ENC
wireless.#QMP_DEVICE.key=#QMP_KEY
wireless.#QMP_DEVICE.ifname=#QMP_IFNAME
\ No newline at end of file
wireless.#QMP_DEVICE.device=#QMP_RADIO
wireless.#QMP_DEVICE.mode=sta
wireless.#QMP_DEVICE.ssid=#QMP_SSID
wireless.#QMP_DEVICE.network=#QMP_NETWORK
wireless.#QMP_DEVICE.encryption=#QMP_ENC
wireless.#QMP_DEVICE.key=#QMP_KEY
wireless.#QMP_DEVICE.ifname=#QMP_IFNAME
\ No newline at end of file
driver mac80211
country UZ
country US
bssid 02:CA:FF:EE:BA:BE
name qMp
txpower 17
......
......@@ -4,7 +4,7 @@ cat /etc/qmp/qmp.banner >> /etc/banner
echo " ---------------------------------------------------" >> /etc/banner
echo " $COD ($REL, $BRANCH rev.$REV-$DATE)" >> /etc/banner
echo " ---------------------------------------------------" >> /etc/banner
echo " * Recipe: http://en.wikipedia.org/wiki/Kalimotxo" >> /etc/banner
echo " * Takeoff clearance: http://en.wikipedia.org/wiki/Air_traffic_control" >> /etc/banner
echo "" >> /etc/banner
echo " http://qmp.cat/projects/qmp/repository/show?branch=$BRANCH&rev=$REV" >> /etc/banner
echo " ---------------------------------------------------" >> /etc/banner
......
......@@ -4,8 +4,8 @@
uci set qmp.wireless.country=US
}
[ "$(uci get qmp.update.url)" == "http://fw.qmp.cat/testing" ] && {
uci set qmp.update.url="http://fw.qmp.cat/kalimotxo"
[ "$(uci get qmp.update.url)" == "http://fw.qmp.cat/trunk" ] && {
uci set qmp.update.url="http://fw.qmp.cat/trunk"
}
uci -q get qmp.networks.disable_mesh_dhcp || uci set qmp.networks.disable_mesh_dhcp=1
......
......@@ -70,10 +70,10 @@ 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")
if rip == nil or #rip < 7 then
if rip == nil or #rip < 7 then
rip = ""
end
end
end
nodeip_roaming.default=rip
nodeip_roaming.datatype="ip4prefix"
......@@ -157,38 +157,39 @@ for i,v in ipairs(devices.eth) do
nodedevs_eth[i] = {v,tmp}
end
-- MeshAll option for wired devices
meshall = m:field(Flag, "_meshall", translate("Use mesh in all wired devices"),translate("If this option is enabled, all the node's wired network devices will be used for meshing (recommended)"))
meshall.default = "1"
-- Wireless devices
nodedevs_wifi = {}
for i,v in ipairs(devices.wifi) do
tmp = m:field(ListValue, "_" .. v, translatef("Wireless interface <strong>%s</strong>",v))
tmp:value("Mesh")
tmp:value("AP")
tmp.default = ""
if is_a(v,"lan_devices") then
-- If the device is in lan_devices, it is AP mode
tmp.default = "AP"
else
-- Check if the device is adhoc_ap mode, then Mode=AP MeshAll=1
uciout:foreach("qmp","wireless", function (s)
if s.device == v then
if s.mode == "adhoc_ap" then
tmp.default = "AP"
end
tmp = m:field(ListValue, "_" .. v, translatef("Wireless interface <strong>%s</strong>",v))
tmp:value("adhoc_ap","Ad hoc (mesh) + access point (LAN)")
tmp:value("adhoc","Ad hoc (mesh)")
tmp:value("ap","Access point (mesh)")
tmp:value("aplan","Access point (LAN)")
tmp:value("client","Client (mesh)")
tmp:value("clientwan","Client (WAN)")
tmp:value("none","Disabled")
tmp.default = "adhoc_ap"
-- Check if the device is adhoc_ap mode, then Mode=AP MeshAll=1
uciout:foreach("qmp","wireless", function (s)
if s.device == v then
if s.mode ~= nil then
tmp.default = s.mode
end
end)
-- If it is not adhoc_ap it is only mesh
if tmp.default == "" then tmp.default = "Mesh" end
end
end
end)
nodedevs_wifi[i] = {v,tmp}
end
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)
local name = nodename:formvalue(section)
......@@ -196,7 +197,7 @@ function netmode.write(self, section, value)
local nodeip = nodeip:formvalue(section)
local nodemask = nodemask:formvalue(section)
local nodeip_roaming = nodeip_roaming:formvalue(section)
if mode == "community" then
uciout:set("qmp","roaming","ignore","1")
uciout:set("qmp","networks","publish_lan","1")
......@@ -253,12 +254,7 @@ function netmode.write(self, section, value)
function setmode(s)
if s.device == devname then
if devmode == "AP" and meshall == "1" then
uciout:set("qmp",s['.name'],"mode","adhoc_ap")
elseif devmode == "AP" then
uciout:set("qmp",s['.name'],"mode","ap")
else
uciout:set("qmp",s['.name'],"mode","adhoc") end
uciout:set("qmp",s['.name'],"mode",devmode)
end
end
uciout:foreach("qmp","wireless",setmode)
......
......@@ -56,8 +56,8 @@ cc = s_wireless_main:option(ListValue, "country", translate("Country Code"), tra
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
end
-- else
-- s_wireless_main:option(Value, "country", translate("Country Code"), translate("Use ISO/IEC 3166 alpha2 country codes2."))
end
......@@ -90,10 +90,12 @@ for _,wdev in ipairs(wdevs) do
-- Mode
mode = s_wireless:option(ListValue,"mode","Mode")
mode:value("adhoc_ap","AdHoc (mesh) + Acess point (LAN)")
mode:value("adhoc","AdHoc (mesh)")
mode:value("ap","Master (mesh, no DHCP)")
mode:value("client","Client")
mode:value("adhoc_ap","Ad hoc (mesh) + access point (LAN)")
mode:value("adhoc","Ad hoc (mesh)")
mode:value("ap","Access point (mesh)")
mode:value("aplan","Access point (LAN)")
mode:value("client","Client (mesh)")
mode:value("clientwan","Client (WAN)")
mode:value("none","Disabled")
-- Name
......@@ -117,11 +119,14 @@ for _,wdev in ipairs(wdevs) do
end
-- WPA key
local key=s_wireless:option(Value,"key","WPA2 key",
translate("WPA2 key for AP (8 chars or more).<br/>Leave blank for make it OPEN (recomended)"))
local key=s_wireless:option(Value,"key","WPA2 key",
translate("WPA2 key for AP mode. The minimum lenght is 8 characters.<br/>Leave blank to make it OPEN (recommended)"))
key.default = ""
key:depends("mode","ap")
key:depends("mode","ap")
key:depends("mode","aplan")
key:depends("mode","adhoc_ap")
key:depends("mode","client")
key:depends("mode","clientwan")
-- Txpower
txpower = s_wireless:option(ListValue,"txpower",translate("Transmission power (dBm)"),translate("Radio power in dBm. Each 3 dB increment doubles the power."))
......
......@@ -26,8 +26,8 @@ include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=qmp-tiny-node
PKG_VERSION:=4.0
PKG_RELEASE:=1
PKG_VERSION:=3.1
PKG_RELEASE:=rc1
PKG_LICENSE:=GPL-2.0+
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment