Developing lightweight computation at the DSG edge

Commit 16b6cde3 authored by Roger Pueyo Centelles's avatar Roger Pueyo Centelles
Browse files

[qmp-system] Ensure qmp_log calls always have an argument



The qmp_log function blocks if no argument is sent. For instance,
qmp_log $(qmp_get_wifi_devices) would block if qmp_get_wifi_devices
would return empty.

Putting it into quotes does the trick: qmp_log "$(qmp_get_wifi_devices)"

Fixes #492
Signed-off-by: default avatarRoger Pueyo Centelles <roger.pueyo@guifi.net>
parent 1cd23dc9
...@@ -117,8 +117,8 @@ qmp_get_virtual_iface() { ...@@ -117,8 +117,8 @@ qmp_get_virtual_iface() {
if [ ! -e "/sys/class/net/$device/phy80211" ] && ! qmp_is_in "$device" $(qmp_get_wifi_devices); then if [ ! -e "/sys/class/net/$device/phy80211" ] && ! qmp_is_in "$device" $(qmp_get_wifi_devices); then
qmp_log "LOG: 5" qmp_log "LOG: 5"
qmp_log "Viface: $viface" qmp_log "Viface: $viface"
qmp_log $device $viface qmp_log "$device $viface"
qmp_log $(qmp_get_wifi_devices) qmp_log "$(qmp_get_wifi_devices)"
echo $viface echo $viface
return return
fi fi
...@@ -127,13 +127,13 @@ qmp_get_virtual_iface() { ...@@ -127,13 +127,13 @@ qmp_get_virtual_iface() {
qmp_log "LOG: 6" qmp_log "LOG: 6"
qmp_log "Viface: $viface" qmp_log "Viface: $viface"
qmp_log $device $viface qmp_log "$device $viface"
[ ! -e "/sys/class/net/$device/phy80211" ] && ! qmp_is_in "$device" $(qmp_get_wifi_devices) && [ -n "$viface" ] && { [ ! -e "/sys/class/net/$device/phy80211" ] && ! qmp_is_in "$device" $(qmp_get_wifi_devices) && [ -n "$viface" ] && {
echo $viface; echo $viface;
qmp_log "LOG: 7" qmp_log "LOG: 7"
qmp_log "Viface: $viface" qmp_log "Viface: $viface"
qmp_log $device $viface qmp_log "$device $viface"
echo "$viface" echo "$viface"
return; return;
} }
...@@ -151,7 +151,7 @@ qmp_get_virtual_iface() { ...@@ -151,7 +151,7 @@ qmp_get_virtual_iface() {
viface="wan_${id_char}${id_num}" viface="wan_${id_char}${id_num}"
qmp_log "LOG: 8" qmp_log "LOG: 8"
qmp_log "Viface: $viface" qmp_log "Viface: $viface"
qmp_log $device $viface qmp_log "$device $viface"
echo $viface echo $viface
return return
fi fi
...@@ -163,7 +163,7 @@ qmp_get_virtual_iface() { ...@@ -163,7 +163,7 @@ qmp_get_virtual_iface() {
viface="mesh_${id_char}${id_num}${id_extra}" viface="mesh_${id_char}${id_num}${id_extra}"
qmp_log "LOG: 8" qmp_log "LOG: 8"
qmp_log "Viface: $viface" qmp_log "Viface: $viface"
qmp_log $device $viface qmp_log "$device $viface"
echo "$viface" echo "$viface"
return return
fi fi
...@@ -740,7 +740,7 @@ qmp_add_qmp_bmx6_tunnels() ...@@ -740,7 +740,7 @@ qmp_add_qmp_bmx6_tunnels()
[ "$ignore" = "1" ] && return [ "$ignore" = "1" ] && return
local type="$(qmp_uci_get_raw gateways.$name.type)" local type="$(qmp_uci_get_raw gateways.$name.type)"
qmp_log Configuring gateway $name of type $type qmp_log "Configuring gateway $name of type $type"
[ -z "$name" ] && name="qmp_$gateway" || name="qmp_$name" [ -z "$name" ] && name="qmp_$gateway" || name="qmp_$name"
if [ "$type" == "offer" ] if [ "$type" == "offer" ]
......
...@@ -269,12 +269,12 @@ qmp_configure_lan() { ...@@ -269,12 +269,12 @@ qmp_configure_lan() {
[ $(qmp_uci_get roaming.ignore) -eq 0 ] && { [ $(qmp_uci_get roaming.ignore) -eq 0 ] && {
lan_addr="172.30.22.1" lan_addr="172.30.22.1"
lan_mask="255.255.0.0" lan_mask="255.255.0.0"
qmp_log No LAN ip address configured, roaming mode enabled, autoconfiguring $lan_addr/$lan_mask qmp_log "No LAN IP address configured, roaming mode enabled, autoconfiguring $lan_addr/$lan_mask"
} || { } || {
lan_addr="10.$(qmp_get_id_ip 1).$(qmp_get_id_ip 2).1" lan_addr="10.$(qmp_get_id_ip 1).$(qmp_get_id_ip 2).1"
lan_mask="255.255.255.0" lan_mask="255.255.255.0"
qmp_uci_set networks.bmx6_ipv4_address $lan_addr/24 qmp_uci_set networks.bmx6_ipv4_address $lan_addr/24
qmp_log No LAN ip address configured, community mode enabled, autoconfiguring $lan_addr/$lan_mask qmp_log "No LAN IP address configured, community mode enabled, autoconfiguring $lan_addr/$lan_mask"
} }
qmp_uci_set networks.lan_address $lan_addr qmp_uci_set networks.lan_address $lan_addr
qmp_uci_set networks.lan_netmask $lan_mask qmp_uci_set networks.lan_netmask $lan_mask
...@@ -311,10 +311,10 @@ qmp_configure_lan() { ...@@ -311,10 +311,10 @@ qmp_configure_lan() {
echo " -> LAN device $device" echo " -> LAN device $device"
qmp_log "Current wifi devices (with qmp_get_wifi_devices()):" qmp_log "Current wifi devices (with qmp_get_wifi_devices()):"
for ldev in $(qmp_get_wifi_devices); do for ldev in $(qmp_get_wifi_devices); do
qmp_log ${ldev} qmp_log "${ldev}"
done done
qmp_log "Current network devices (with ls /sys/class/net):" qmp_log "Current network devices (with ls /sys/class/net):"
qmp_log $(ls /sys/class/net) qmp_log "$(ls /sys/class/net)"
if qmp_is_in "$device" $(qmp_get_wifi_devices) || [ -e "/sys/class/net/$device/phy80211" ] ; then if qmp_is_in "$device" $(qmp_get_wifi_devices) || [ -e "/sys/class/net/$device/phy80211" ] ; then
# Do not attach to br-lan wireless devices, they do it themselves # Do not attach to br-lan wireless devices, they do it themselves
# somewhere else via /etc/config/wireless # somewhere else via /etc/config/wireless
......
...@@ -113,7 +113,7 @@ qmp_set_maps() { ...@@ -113,7 +113,7 @@ qmp_set_maps() {
# ----------------------------------- # -----------------------------------
qmp_enable_netserver() { qmp_enable_netserver() {
qmp_log Enabling service netserver qmp_log "Enabling service netserver"
qmp_disable_service netserver qmp_disable_service netserver
killall -9 netserver 2>/dev/null killall -9 netserver 2>/dev/null
netserver -6 -p 12865 netserver -6 -p 12865
...@@ -121,21 +121,21 @@ qmp_enable_netserver() { ...@@ -121,21 +121,21 @@ qmp_enable_netserver() {
} }
qmp_disable_netserver() { qmp_disable_netserver() {
qmp_log Disabling service netserver qmp_log "Disabling service netserver"
qmp_disable_service netserver qmp_disable_service netserver
killall -9 netserver 2>/dev/null killall -9 netserver 2>/dev/null
return 0 return 0
} }
qmp_enable_service() { qmp_enable_service() {
qmp_log Enabling service $1 qmp_log "Enabling service $1"
/etc/init.d/$1 start /etc/init.d/$1 start
/etc/init.d/$1 enable /etc/init.d/$1 enable
return 0 return 0
} }
qmp_disable_service() { qmp_disable_service() {
qmp_log Disabling service $1 qmp_log "Disabling service $1"
/etc/init.d/$1 stop 2>/dev/null /etc/init.d/$1 stop 2>/dev/null
/etc/init.d/$1 disable /etc/init.d/$1 disable
return 0 return 0
......
...@@ -657,7 +657,7 @@ qmp_configure_wifi_initial() { ...@@ -657,7 +657,7 @@ qmp_configure_wifi_initial() {
else else
newchan="$(qmp_check_channel $device $channel $mode)" newchan="$(qmp_check_channel $device $channel $mode)"
if [ "$newchan" != "$channel" ]; then if [ "$newchan" != "$channel" ]; then
qmp_log Warning: "Channel $channel for device $device in mode $mode is not right, using default one" qmp_log "Warning: Channel $channel for device $device in mode $mode is not right, using default one"
qmp_uci_set @wireless[$j].channel $newchan qmp_uci_set @wireless[$j].channel $newchan
fi fi
fi fi
......
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