## Main Features
* STA interfaces operating in an "always off" mode, to make sure that the AP is always accessible
* easy setup within normal OpenWrt/LEDE environment
+* strong LuCI-Support to simplify the interface setup
* fast uplink connections
* manual / automatic mode support, the latter one checks the existing uplink connection regardless of ifdown event trigger every n seconds
* support of devices with multiple radios
## Prerequisites
* [LEDE](https://www.lede-project.org) 17.01 or latest snapshot
-* iw (default) or iwinfo for wlan scanning
+* iw for wlan scanning
## LEDE trunk Installation & Usage
* download the package [here](https://downloads.lede-project.org/snapshots/packages/x86_64/packages)
* install 'travelmate' (_opkg install travelmate_)
-* configure your network to support (multiple) wlan uplinks and set travelmate config options (see below)
-* set 'trm\_enabled' option in travelmate config to '1'
-* travelmate starts automatically during boot and will be triggered by procd interface triggers
+* configure your network:
+ * automatic: use the LuCI frontend with automatic interface setup, that's the recommended way
+ * manual: see detailed configure steps below
## LuCI travelmate companion package
* download the package [here](https://downloads.lede-project.org/snapshots/packages/x86_64/luci)
* trm\_maxwait => how long (in seconds) should travelmate wait for a successful wlan interface reload action (default: '30')
* trm\_maxretry => how many times should travelmate try to find an uplink after a trigger event (default: '3')
* trm\_timeout => timeout in seconds for "automatic mode" (default: '60')
- * trm\_iw => set this option to '0' to use iwinfo for wlan scanning (default: '1', use iw)
* trm\_radio => limit travelmate to a dedicated radio, e.g. 'radio0' (default: not set, use all radios)
- * trm\_iface => restrict the procd interface trigger to a (list of) certain wan interface(s) or disable it at all (default: wwan)
- * trm\_triggerdelay => additional trigger delay in seconds before travelmate processing starts (default: '2')
+ * trm\_iface => restrict the procd interface trigger to a (list of) certain wan interface(s) or disable it at all (default: trm_wwan)
+ * trm\_triggerdelay => additional trigger delay in seconds before travelmate processing starts (default: '1')
## Runtime information
**receive travelmate runtime information:**
<pre><code>
-root@adb2go:/tmp# /etc/init.d/travelmate status
+root@adb2go:~# /etc/init.d/travelmate status
::: travelmate runtime information
- travelmate_version : 0.7.0
+ travelmate_version : 0.7.2
station_connection : true
station_ssid : blackhole
- station_interface : wwan
+ station_interface : trm_wwan
station_radio : radio1
- last_rundate : 20.04.2017 08:54:48
- system : LEDE Reboot SNAPSHOT r3974-56457dbcb7
+ last_rundate : 06.05.2017 06:58:22
+ system : LEDE Reboot SNAPSHOT r4051-3ddc1914ba
</code></pre>
## Setup
-**1. configure a wwan interface in /etc/config/network:**
+**1. configure the travelmate wwan interface in /etc/config/network:**
<pre><code>
[...]
-config interface 'wwan'
+config interface 'trm_wwan'
option proto 'dhcp'
[...]
</code></pre>
[...]
config zone
option name 'wan'
- option network 'wan wan6 wwan'
+ option network 'wan wan6 trm_wwan'
[...]
</code></pre>
[...]
config wifi-iface
option device 'radio0'
- option network 'wwan'
+ option network 'trm_wwan'
option mode 'sta'
option ssid 'example_01'
option encryption 'psk2+ccmp'
option disabled '1'
config wifi-iface
option device 'radio0'
- option network 'wwan'
+ option network 'trm_wwan'
option mode 'sta'
option ssid 'example_02'
option encryption 'psk2+ccmp'
option disabled '1'
config wifi-iface
option device 'radio0'
- option network 'wwan'
+ option network 'trm_wwan'
option mode 'sta'
option ssid 'example_03'
option encryption 'none'
#
LC_ALL=C
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
-trm_ver="0.7.1"
+trm_ver="0.7.2"
trm_sysver="$(ubus -S call system board | jsonfilter -e '@.release.description')"
trm_enabled=0
trm_debug=0
trm_maxretry=3
trm_maxwait=30
trm_timeout=60
-trm_iw=1
+trm_iw="$(command -v iw)"
trm_rtfile="/tmp/trm_runtime.json"
# source required system library
exit 0
fi
- # check for preferred wireless tool
+ # check for wireless tool
#
- if [ ${trm_iw} -eq 1 ]
+ if [ -z "${trm_iw}" ]
then
- trm_scanner="$(which iw)"
- else
- trm_scanner="$(which iwinfo)"
- fi
- if [ -z "${trm_scanner}" ]
- then
- f_log "error" "no wireless tool for wlan scanning found, please install 'iw' or 'iwinfo'"
+ f_log "error" "no wireless tool found, please install package 'iw'"
fi
}
json_get_keys keylist
for key in ${keylist}
do
- json_get_var value ${key}
+ json_get_var value "${key}"
printf " %-18s : %s\n" "${key}" "${value}"
done
fi
cnt=1
ap_radio="${ap##*_}"
ap="${ap%%_*}"
- if [ -z "$(printf "${trm_stalist}" | grep -Fo "_${ap_radio}")" ]
+ if [ -z "$(printf "%s" "${trm_stalist}" | grep -Fo "_${ap_radio}")" ]
then
continue
fi
while [ ${cnt} -le ${trm_maxretry} ]
do
- if [ ${trm_iw} -eq 1 ]
- then
- ssid_list="$(${trm_scanner} dev "${ap}" scan 2>/dev/null | \
- awk '/SSID: /{if(!seen[$0]++){printf "\"";for(i=2; i<=NF; i++)if(i==2)printf $i;else printf " "$i;printf "\" "}}')"
- else
- ssid_list="$(${trm_scanner} "${ap}" scan | \
- awk '/ESSID: ".*"/{ORS=" ";if (!seen[$0]++) for(i=2; i<=NF; i++) print $i}')"
- fi
- f_log "debug" "scanner: ${trm_scanner}, ap: ${ap}, ssids: ${ssid_list}"
+ ssid_list="$(${trm_iw} dev "${ap}" scan 2>/dev/null | \
+ awk '/SSID: /{if(!seen[$0]++){printf "\"";for(i=2; i<=NF; i++)if(i==2)printf $i;else printf " "$i;printf "\" "}}')"
+ f_log "debug" "iw: ${trm_iw}, ap: ${ap}, ssids: ${ssid_list}"
if [ -n "${ssid_list}" ]
then
for sta in ${trm_stalist}
sta_radio="${sta##*_}"
sta_ssid="$(uci -q get wireless."${config}".ssid)"
sta_iface="$(uci -q get wireless."${config}".network)"
- if [ -n "$(printf "${ssid_list}" | grep -Fo "\"${sta_ssid}\"")" ] && [ "${ap_radio}" = "${sta_radio}" ]
+ if [ -n "$(printf "%s" "${ssid_list}" | grep -Fo "\"${sta_ssid}\"")" ] && [ "${ap_radio}" = "${sta_radio}" ]
then
uci -q set wireless."${config}".disabled=0
ubus call network reload