Developing lightweight computation at the DSG edge

Commit 79367b0f authored by Roger Pueyo Centelles's avatar Roger Pueyo Centelles
Browse files

Merge branch 'master' into testing


Signed-off-by: default avatarRoger Pueyo Centelles <roger.pueyo@guifi.net>
parents da5ae334 5f0bebe4
...@@ -54,7 +54,12 @@ define Package/qmp-big-node ...@@ -54,7 +54,12 @@ define Package/qmp-big-node
DEPENDS:= +qmp-small-node \ DEPENDS:= +qmp-small-node \
+qmp-tinyproxy +tinymce \ +qmp-tinyproxy +tinymce \
+openssl-util +luci-ssl \ +openssl-util +luci-ssl \
+lsof +wget +bmon +bwm-ng +ebtables +pv +tcpdump-mini \
+lsof +wget +bmon +bwm-ng +ebtables +pv \
+ipip +kmod-ipip +kmod-gre \
+luci-lib-libremap-system +luci-lib-libremap-location \
+luci-lib-libremap-bmx6 +luci-lib-libremap-qmp \
+luci-lib-libremap-contact +luci-lib-libremap-wireless
endef endef
define Package/qmp-big-node/description define Package/qmp-big-node/description
......
...@@ -52,11 +52,9 @@ define Package/qmp-small-node ...@@ -52,11 +52,9 @@ define Package/qmp-small-node
CATEGORY:=qMp CATEGORY:=qMp
URL:=https://qmp.cat URL:=https://qmp.cat
DEPENDS:= +qmp-tiny-node \ DEPENDS:= +qmp-tiny-node \
+tcpdump-mini +mtr +netperf +luci-mod-admin-full \ +mtr +netperf +luci-mod-admin-full \
+munin-mesh +mini_snmpd +cgi-bin-zero +ipip +kmod-ipip +kmod-gre \ +munin-mesh +mini_snmpd +cgi-bin-zero \
+libremap-agent +luci-lib-libremap-contact +luci-lib-libremap-wireless \ +libremap-agent +luci +bmx6-mdns
+luci +luci-lib-libremap-system +luci-lib-libremap-location \
+luci-lib-libremap-bmx6 +luci-lib-libremap-qmp +bmx6-mdns
endef endef
define Package/qmp-small-node/description define Package/qmp-small-node/description
...@@ -64,10 +62,8 @@ define Package/qmp-small-node/description ...@@ -64,10 +62,8 @@ define Package/qmp-small-node/description
- qMp system configuration files and scripts - qMp system configuration files and scripts
- BMX6 routing protocol - BMX6 routing protocol
- Full LuCI web interface - Full LuCI web interface
- IP/TCP utils - LibreMap (agent)
- LibreMap
- SNMP and Munin - SNMP and Munin
- IP over IP tunneling support
It is intended to be used on devices with 8 MB of flash or more. It is intended to be used on devices with 8 MB of flash or more.
endef endef
......
...@@ -8,16 +8,16 @@ ...@@ -8,16 +8,16 @@
config 'qmp' 'interfaces' config 'qmp' 'interfaces'
# Devices for LAN (bridged in br-lan and dhcp-server will be enabled). # Devices for LAN (bridged in br-lan and dhcp-server will be enabled).
option lan_devices '' option lan_devices ''
# Devices for WAN (dhcp-client will be enabled). # Devices for WAN (dhcp-client will be enabled).
option wan_devices '' option wan_devices ''
# Devices used for Meshing, by default they will be extended with VLAN tag. # Devices used for Meshing, by default they will be extended with VLAN tag.
option mesh_devices '' option mesh_devices ''
# Devices that will be excluded of the VLAN tagging. # Devices that will be excluded of the VLAN tagging.
option no_vlan_devices '' option no_vlan_devices ''
# Devices that will be ignored (to manage them manually). # Devices that will be ignored (to manage them manually).
option ignore_devices '' option ignore_devices ''
...@@ -27,19 +27,19 @@ config 'qmp' 'interfaces' ...@@ -27,19 +27,19 @@ config 'qmp' 'interfaces'
config 'qmp' 'node' config 'qmp' 'node'
# The MAC address of the primary device will be used for calculate ID. # The MAC address of the primary device will be used for calculate ID.
option primary_device 'eth0' option primary_device 'eth0'
# The node name (human readable). # The node name (human readable).
option device_name 'qMp' option device_name 'qMp'
# The node id (2 hex digits). Leave blank to use crc16 from MAC address. # The node id (2 hex digits). Leave blank to use crc16 from MAC address.
option device_id '' option device_id ''
# Append device_id to device_name in the device hostname # Append device_id to device_name in the device hostname
option append_id '1' option append_id '1'
# Prepend mesh_name to device_name in the device hostname, # Prepend mesh_name to device_name in the device hostname,
option prepend_cnm '1' option prepend_cnm '1'
# Temporay key file for session (autogenerated in each boot). # Temporay key file for session (autogenerated in each boot).
option key '/tmp/qmp_key' option key '/tmp/qmp_key'
...@@ -58,8 +58,8 @@ config 'qmp' 'services' ...@@ -58,8 +58,8 @@ config 'qmp' 'services'
option vpn 0 option vpn 0
option captive_portal 0 option captive_portal 0
option b6m 0 option b6m 0
option libremap 1 option libremap 0
option gwck 1 option gwck 0
option auto_upgrade 0 option auto_upgrade 0
option mesh_dns 1 option mesh_dns 1
option bwtest 1 option bwtest 1
...@@ -70,16 +70,16 @@ config 'qmp' 'services' ...@@ -70,16 +70,16 @@ config 'qmp' 'services'
config 'qmp' 'update' config 'qmp' 'update'
# Remote URL where the firmware images are placed. # Remote URL where the firmware images are placed.
option url 'http://fw.qmp.cat/stable' option url 'http://fw.qmp.cat/stable'
# Special remote file which contains a list of firmware:md5hash. # Special remote file which contains a list of firmware:md5hash.
option images 'IMAGES' option images 'IMAGES'
# Special remote file which contains a list of device:hash. # Special remote file which contains a list of device:hash.
option devices 'DEVICES' option devices 'DEVICES'
# Filter to look for specific firmware images. # Filter to look for specific firmware images.
option filter 'sysupgrade' option filter 'sysupgrade'
# List of files which are gonna be saved between upgrades. # List of files which are gonna be saved between upgrades.
option preserve '/etc/config/qmp /etc/shadow /etc/passwd /etc/rc.local /etc/firewall.user /etc/dropbear /etc/config/b6m-spread /etc/qmp/.birth /etc/config/gateways /etc/config/mini_snmpd' option preserve '/etc/config/qmp /etc/shadow /etc/passwd /etc/rc.local /etc/firewall.user /etc/dropbear /etc/config/b6m-spread /etc/qmp/.birth /etc/config/gateways /etc/config/mini_snmpd'
...@@ -89,10 +89,10 @@ config 'qmp' 'update' ...@@ -89,10 +89,10 @@ config 'qmp' 'update'
config 'qmp' 'roaming' config 'qmp' 'roaming'
# Enable/disable roaming mode. # Enable/disable roaming mode.
option ignore '0' option ignore '0'
# DHCP offset for the dhcp server. # DHCP offset for the dhcp server.
option dhcp_offset '2' option dhcp_offset '2'
# Leasetime for dhcp server. # Leasetime for dhcp server.
option qmp_leasetime '1h' option qmp_leasetime '1h'
...@@ -102,40 +102,40 @@ config 'qmp' 'roaming' ...@@ -102,40 +102,40 @@ config 'qmp' 'roaming'
config 'qmp' 'networks' config 'qmp' 'networks'
# DNS servers which will be configured. # DNS servers which will be configured.
option dns '208.67.222.222 77.109.148.136 109.69.8.34' option dns '208.67.222.222 77.109.148.136 109.69.8.34'
# LAN address and netmask (will be assigned to br-lan). # LAN address and netmask (will be assigned to br-lan).
option lan_address '172.30.22.1' option lan_address '172.30.22.1'
option lan_netmask '255.255.0.0' option lan_netmask '255.255.0.0'
option disable_lan_dhcp '0' option disable_lan_dhcp '0'
option disable_mesh_dhcp '1' option disable_mesh_dhcp '1'
# Rescue IPv4 network prefix (/16 bits). # Rescue IPv4 network prefix (/16 bits).
# Missing 16 bits are taken from primary device MAC. # Missing 16 bits are taken from primary device MAC.
option rescue_prefix24 '169.254' option rescue_prefix24 '169.254'
# IPv4 main IP address for the mesh cloud (if blank it will be autogenerated). # IPv4 main IP address for the mesh cloud (if blank it will be autogenerated).
# In community mode it may be the same assigned to LAN (network prefix can be specified). # In community mode it may be the same assigned to LAN (network prefix can be specified).
option bmx6_ipv4_address '' option bmx6_ipv4_address ''
# IPv4 autogeneration main prefix (used if bmx6_ipv4_address not specified). # IPv4 autogeneration main prefix (used if bmx6_ipv4_address not specified).
option bmx6_ipv4_prefix24 '10.202.0' option bmx6_ipv4_prefix24 '10.202.0'
# Routing protocols and VLAN. Use <proto-name>[:VLAN-ID]. If VLAN-ID not specified, VLAN tags are not used. # Routing protocols and VLAN. Use <proto-name>[:VLAN-ID]. If VLAN-ID not specified, VLAN tags are not used.
option mesh_protocol_vids 'bmx6:12' option mesh_protocol_vids 'bmx6:12'
# IPv6 prefix (48bits) for internal mesh usage (ULA recommended). # IPv6 prefix (48bits) for internal mesh usage (ULA recommended).
option bmx6_mesh_prefix48 'fd02:0:0' option bmx6_mesh_prefix48 'fd02:0:0'
# IPv6 LAN prefix (48bits) (ULA recommended). It will be announced as a bmx6 tunnel/gateway in the Mesh. # IPv6 LAN prefix (48bits) (ULA recommended). It will be announced as a bmx6 tunnel/gateway in the Mesh.
option lan_ula_prefix48 'fd00:1714:1714' option lan_ula_prefix48 'fd00:1714:1714'
option publish_lan '1' option publish_lan '1'
# IPv6 prefix for public internet (48 bits). # IPv6 prefix for public internet (48 bits).
# Suffix is autoconfigured based on primary device MAC. # Suffix is autoconfigured based on primary device MAC.
option bmx6_ripe_prefix48 '2012:0:0' option bmx6_ripe_prefix48 '2012:0:0'
# Metric for WAN interfaces (dhcp client). # Metric for WAN interfaces (dhcp client).
# option wan_metric '2048' # option wan_metric '2048'
# ----------------------------- # -----------------------------
# Wireless general configuration # Wireless general configuration
......
...@@ -160,22 +160,36 @@ qmp_debug() { ...@@ -160,22 +160,36 @@ qmp_debug() {
# Networking and Wifi related commands # Networking and Wifi related commands
####################################### #######################################
# Returns the names of the wifi devices from the system # Returns the names of the wifi devices in the system, one per line
qmp_get_wifi_devices() { qmp_get_wifi_devices() {
# Legacy code, sometimes not reporting all the interfaces as they take some time to appear there
proc_net_wireless=$(awk 'NR>2 { gsub(/:$/,"",$1); print $1 }' /proc/net/wireless | grep -v -e "wlan[0-9]-[0-9]" | sort -u)
# Initial fix for #481, but some devices would still fail # Legacy code, sometimes not reporting all the interfaces as they take some time to appear there
sys_class_net="" local proc_net_wireless=$(awk 'NR>2 { gsub(/:$/,"",$1); print $1 }' /proc/net/wireless | grep -v -e "wlan[0-9]-[0-9]" | sort -u)
# Initial fix for #481, but some devices would still fail. Gather devices from /sys/class/net
local sys_class_net
for i in $(ls /sys/class/net/); do for i in $(ls /sys/class/net/); do
[ -e /sys/class/net/${i}/phy80211 ] && sys_class_net="${sys_class_net} ${i}" [ -e /sys/class/net/${i}/phy80211 ] && sys_class_net="${sys_class_net} ${i}"
done done
# Actual fix for #481, using ubus
local ubus_network_wireless=$(ubus call network.wireless status | jsonfilter -e '@.*.interfaces.*.ifname')
# Last, fetch those devices in /etc/config/wireless
local uci_show_wireless=$(uci show wireless | grep wireless\..*\.ifname | cut -d '=' -f 2 | tr -d "'")
echo $proc_net_wireless # Print the devices gotten from /proc/net/wireless
for i in $proc_net_wireless; do
echo $i
done
# Print the remaining devices gotten from /sys/class/net
for i in $sys_class_net; do for i in $sys_class_net; do
! qmp_is_in $i $proc_net_wireless && echo $i ! qmp_is_in $i $proc_net_wireless && echo "$i"
done
# Print the remaining devices gotten from ubus
for i in $ubus_network_wireless; do
! qmp_is_in $i $proc_net_wireless && ! qmp_is_in $i $sys_class_net && echo "$i"
done
# Print the remaining devices gotten from /etc/configc/wireless
for i in $uci_show_wireless; do
! qmp_is_in $i $proc_net_wireless && ! qmp_is_in $i $sys_class_net && ! qmp_is_in $i $ubus_network_wireless && echo "$i"
done done
...@@ -187,6 +201,7 @@ qmp_get_wifi_devices() { ...@@ -187,6 +201,7 @@ qmp_get_wifi_devices() {
done done
} }
# Returns the MAC address of the wifi devices # Returns the MAC address of the wifi devices
# (get MAC addres of the physical wifi device, if exists) # (get MAC addres of the physical wifi device, if exists)
qmp_get_wifi_mac_devices() { qmp_get_wifi_mac_devices() {
......
...@@ -34,7 +34,7 @@ qmp_set_mss_clamping_and_masq() { ...@@ -34,7 +34,7 @@ qmp_set_mss_clamping_and_masq() {
# Prepare config files # Prepare config files
qmp_configure_prepare_network() { qmp_configure_prepare_network() {
local toRemove="$(uci show network | egrep "network.(lan|wan|mesh_).*=(interface|device)" | cut -d. -f2 | cut -d= -f1)" local toRemove="$(uci show network | egrep "network.(lan|wan|mesh_).*=(interface|device)" | cut -d. -f2 | cut -d= -f1 | egrep -v ".?an_eth.?*_dev")"
qmp_log "Removing current network configuration" qmp_log "Removing current network configuration"
for i in $toRemove; do for i in $toRemove; do
uci del network.$i uci del network.$i
......
...@@ -96,7 +96,7 @@ qmp_set_maps() { ...@@ -96,7 +96,7 @@ qmp_set_maps() {
qmp_uci_set_raw libremap.location.latitude="$lat" qmp_uci_set_raw libremap.location.latitude="$lat"
qmp_uci_set_raw libremap.location.longitude="$lon" qmp_uci_set_raw libremap.location.longitude="$lon"
qmp_uci_set_raw libremap.location.elev="$elev" qmp_uci_set_raw libremap.location.elev="$elev"
uci set libremap.qmp.enabled=1 uci set libremap.qmp.enabled=1
uci set libremap.bmx6.enabled=1 uci set libremap.bmx6.enabled=1
uci set libremap.wireless.enabled=1 uci set libremap.wireless.enabled=1
......
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