Developing lightweight computation at the DSG edge

Commit 1ff5c11a authored by Roger Pueyo Centelles's avatar Roger Pueyo Centelles
Browse files

[qmp-system] Get wifi devices for qmp_get_wifi_devices() also from ubus.

Continues 7c75474e,
cb7fd04423ce05fa64b96efb6667421b33bf100c,
6c5212f1 and
b45499e1

.

Fixes #481.
Signed-off-by: default avatarRoger Pueyo Centelles <roger.pueyo@guifi.net>
parent 7c75474e
......@@ -162,8 +162,11 @@ qmp_debug() {
# Returns the names of the wifi devices from the system
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
sys_class_net=""
for i in $(ls /sys/class/net/); do
[ -e /sys/class/net/${i}/phy80211 ] && sys_class_net="${sys_class_net} ${i}"
......@@ -174,6 +177,14 @@ qmp_get_wifi_devices() {
for i in $sys_class_net; do
! qmp_is_in $i $proc_net_wireless && echo $i
done
# Actual fix for #481, using ubus
ubus_network_wireless=$(ubus call network.wireless status | jsonfilter -e '@.*.interfaces.*.section')
for i in $ubus_network_wireless; do
! qmp_is_in $i $proc_net_wireless && ! qmp_is_in $i $sys_class_net && echo $i
done
}
# Returns the MAC address of the wifi devices
......
......@@ -118,6 +118,7 @@ qmp_get_virtual_iface() {
qmp_log "LOG: 5"
qmp_log "Viface: $viface"
qmp_log $device $viface
qmp_log $(qmp_get_wifi_devices)
echo $viface
return
fi
......
......@@ -349,13 +349,14 @@ qmp_configure_mesh() {
qmp_uci_test qmp.networks.mesh_protocol_vids; then
for dev in $(qmp_get_devices mesh); do
echo "Configuring "$dev" for meshing"
echo "Configuring ${dev} for meshing"
# Check if the current device is configured as no-vlan
local use_vlan=1
for no_vlan_int in $(qmp_uci_get interfaces.no_vlan_devices 2>/dev/null); do
[ "$no_vlan_int" == "$dev" ] && use_vlan=0
done
echo " -> Using VLAN: $use_vlan"
local protocol_vids="$(qmp_uci_get networks.mesh_protocol_vids 2>/dev/null)"
[ -z "$protocol_vids" ] && protocol_vids="bmx6:12"
......@@ -368,9 +369,11 @@ qmp_configure_mesh() {
# if no vlan is specified do not use vlan
[ -z "$vid" ] && vid=1 && use_vlan=0
# virtual interface
# virtual interface
echo " -> Getting virtual interface for ${dev}"
local viface=$(qmp_get_virtual_iface $dev)
echo "device $dev is in viface $viface"
echo " -> Device ${dev} is in viface ${viface}"
# put typical IPv6 prefix (2002::), otherwise ipv6 calc assumes mapped or embedded ipv4 address
local ip6_suffix="2002::${counter}${vid}"
......
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