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() {
if [ ! -e "/sys/class/net/$device/phy80211" ] && ! qmp_is_in "$device" $(qmp_get_wifi_devices); then
qmp_log "LOG: 5"
qmp_log "Viface: $viface"
qmp_log $device $viface
qmp_log $(qmp_get_wifi_devices)
qmp_log "$device $viface"
qmp_log "$(qmp_get_wifi_devices)"
echo $viface
return
fi
......@@ -127,13 +127,13 @@ qmp_get_virtual_iface() {
qmp_log "LOG: 6"
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" ] && {
echo $viface;
qmp_log "LOG: 7"
qmp_log "Viface: $viface"
qmp_log $device $viface
qmp_log "$device $viface"
echo "$viface"
return;
}
......@@ -151,7 +151,7 @@ qmp_get_virtual_iface() {
viface="wan_${id_char}${id_num}"
qmp_log "LOG: 8"
qmp_log "Viface: $viface"
qmp_log $device $viface
qmp_log "$device $viface"
echo $viface
return
fi
......@@ -163,7 +163,7 @@ qmp_get_virtual_iface() {
viface="mesh_${id_char}${id_num}${id_extra}"
qmp_log "LOG: 8"
qmp_log "Viface: $viface"
qmp_log $device $viface
qmp_log "$device $viface"
echo "$viface"
return
fi
......@@ -740,7 +740,7 @@ qmp_add_qmp_bmx6_tunnels()
[ "$ignore" = "1" ] && return
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"
if [ "$type" == "offer" ]
......
......@@ -269,12 +269,12 @@ qmp_configure_lan() {
[ $(qmp_uci_get roaming.ignore) -eq 0 ] && {
lan_addr="172.30.22.1"
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_mask="255.255.255.0"
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_netmask $lan_mask
......@@ -311,10 +311,10 @@ qmp_configure_lan() {
echo " -> LAN device $device"
qmp_log "Current wifi devices (with qmp_get_wifi_devices()):"
for ldev in $(qmp_get_wifi_devices); do
qmp_log ${ldev}
qmp_log "${ldev}"
done
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
# Do not attach to br-lan wireless devices, they do it themselves
# somewhere else via /etc/config/wireless
......
......@@ -113,7 +113,7 @@ qmp_set_maps() {
# -----------------------------------
qmp_enable_netserver() {
qmp_log Enabling service netserver
qmp_log "Enabling service netserver"
qmp_disable_service netserver
killall -9 netserver 2>/dev/null
netserver -6 -p 12865
......@@ -121,21 +121,21 @@ qmp_enable_netserver() {
}
qmp_disable_netserver() {
qmp_log Disabling service netserver
qmp_log "Disabling service netserver"
qmp_disable_service netserver
killall -9 netserver 2>/dev/null
return 0
}
qmp_enable_service() {
qmp_log Enabling service $1
qmp_log "Enabling service $1"
/etc/init.d/$1 start
/etc/init.d/$1 enable
return 0
}
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 disable
return 0
......
......@@ -657,7 +657,7 @@ qmp_configure_wifi_initial() {
else
newchan="$(qmp_check_channel $device $channel $mode)"
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
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