aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorDirk Brenken <dev@brenken.org>2016-11-13 19:32:40 +0100
committerDirk Brenken <dev@brenken.org>2016-11-13 19:32:40 +0100
commit70c08bfc225e217fbf309387bb9581a166ef24ce (patch)
treeb86cc0c504c6d07c2130b5ddbac4f73a3494b04c /net
parent32fb90fd689721012e6750e2810490b054b36810 (diff)
travelmate: bugfix 0.2.6
* fix two potential race conditions in ap/sta handling Signed-off-by: Dirk Brenken <dev@brenken.org>
Diffstat (limited to 'net')
-rw-r--r--net/travelmate/Makefile2
-rw-r--r--net/travelmate/files/README.md12
-rwxr-xr-xnet/travelmate/files/travelmate.sh24
3 files changed, 31 insertions, 7 deletions
diff --git a/net/travelmate/Makefile b/net/travelmate/Makefile
index 4724e7307..afe8ee6d3 100644
--- a/net/travelmate/Makefile
+++ b/net/travelmate/Makefile
@@ -6,7 +6,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=travelmate
-PKG_VERSION:=0.2.5
+PKG_VERSION:=0.2.6
PKG_RELEASE:=1
PKG_LICENSE:=GPL-3.0+
PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>
diff --git a/net/travelmate/files/README.md b/net/travelmate/files/README.md
index 652feeab1..2f8084a2e 100644
--- a/net/travelmate/files/README.md
+++ b/net/travelmate/files/README.md
@@ -69,11 +69,21 @@ config zone
[...]
</code></pre>
-**3. add required wwan stations to your wireless configuration in etc/config/wireless:**
+**3. add required ap and wwan stations to your wireless configuration in etc/config/wireless:**
<pre><code>
[...]
config wifi-iface
option device 'radio0'
+ option network 'lan'
+ option ifname 'wlan0'
+ option mode 'ap'
+ option ssid 'example_ap'
+ option encryption 'psk2+ccmp'
+ option key 'abc'
+ option disabled '0'
+[...]
+config wifi-iface
+ option device 'radio0'
option network 'wwan'
option mode 'sta'
option ssid 'example_01'
diff --git a/net/travelmate/files/travelmate.sh b/net/travelmate/files/travelmate.sh
index ada67d8b2..7987309b3 100755
--- a/net/travelmate/files/travelmate.sh
+++ b/net/travelmate/files/travelmate.sh
@@ -11,7 +11,7 @@
LC_ALL=C
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
trm_pid="${$}"
-trm_ver="0.2.5"
+trm_ver="0.2.6"
trm_debug=0
trm_loop=30
trm_maxretry=3
@@ -29,7 +29,7 @@ trm_prepare()
local ifname="$(uci -q get wireless."${config}".ifname)"
local disabled="$(uci -q get wireless."${config}".disabled)"
- if [ "${mode}" = "ap" ] &&
+ if [ "${mode}" = "ap" ] && [ -n "${network}" ] && [ -n "${ifname}" ] &&
([ -z "${trm_device}" ] || [ "${trm_device}" = "${device}" ])
then
trm_aplist="${trm_aplist} ${ifname}"
@@ -37,7 +37,7 @@ trm_prepare()
then
trm_set "none" "${config}" "${network}" "up"
fi
- elif [ "${mode}" = "sta" ]
+ elif [ "${mode}" = "sta" ] && [ -n "${network}" ]
then
trm_stalist="${trm_stalist} ${config}_${network}"
if [ -z "${disabled}" ] || [ "${disabled}" = "0" ]
@@ -181,7 +181,7 @@ fi
if [ -z "${trm_scanner}" ]
then
trm_log "error" "no wireless tool for wlan scanning found, please install 'iw' or 'iwinfo'"
- exit 255
+ exit 1
fi
# infinitive loop to establish and track STA uplink connections
@@ -195,6 +195,11 @@ do
config_load wireless
config_foreach trm_prepare wifi-iface
trm_set "commit"
+ if [ -z "${trm_aplist}" ]
+ then
+ trm_log "error" "no usable AP configuration found, please add an 'ifname' entry in '/etc/config/wireless'"
+ exit 1
+ fi
for ap in ${trm_aplist}
do
ubus -t 10 wait_for hostapd."${ap}"
@@ -204,15 +209,24 @@ do
else
trm_ssidlist="$(${trm_scanner} "${ap}" scan | awk '/ESSID: ".*"/{ORS=" ";if (!seen[$0]++) for(i=2; i<=NF; i++) print $i}')"
fi
- trm_log "debug" "main ::: scan-tool: ${trm_scanner}, ssidlist: ${trm_ssidlist}"
+ trm_log "debug" "main ::: scan-tool: ${trm_scanner}, aplist: ${trm_aplist}, ssidlist: ${trm_ssidlist}"
if [ -n "${trm_ssidlist}" ]
then
+ if [ -z "${trm_stalist}" ]
+ then
+ trm_log "error" "no usable STA configuration found, please add a 'network' entry in '/etc/config/wireless'"
+ exit 1
+ fi
for sta in ${trm_stalist}
do
trm_config="${sta%%_*}"
trm_network="${sta##*_}"
trm_ifname="$(uci -q get wireless."${trm_config}".ifname)"
trm_ssid="\"$(uci -q get wireless."${trm_config}".ssid)\""
+ if [ -z "${trm_ifname}" ]
+ then
+ trm_ifname="${trm_network}"
+ fi
if [ $((trm_count_${trm_config})) -lt $((trm_maxretry)) ] || [ $((trm_maxretry)) -eq 0 ]
then
if [ -n "$(printf "${trm_ssidlist}" | grep -Fo "${trm_ssid}")" ]