* easy setup within normal OpenWrt/LEDE environment
* strong LuCI-Support with builtin interface wizard and a wireless station manager
* fast uplink connections
+* support all kinds of uplinks, incl. hidden and enterprise uplinks
* manual / automatic mode support, the latter one checks the existing uplink connection regardless of ifdown event trigger actions every n seconds
* support of devices with multiple radios
* procd init and hotplug support
**receive travelmate runtime information:**
<pre><code>
-root@adb2go:~# /etc/init.d/travelmate status
::: travelmate runtime information
- travelmate_version : 0.9.1
+ travelmate_version : 0.9.5
station_connection : true
- station_ssid : blackhole.nl
+ station_id : blackhole/04:F0:21:2F:B7:64
station_interface : trm_wwan
station_radio : radio1
- last_rundate : 29.07.2017 18:02:01
- system : LEDE Reboot SNAPSHOT r4639-eb43a817f7
+ last_rundate : 06.12.2017 16:47:56
+ system : LEDE Reboot SNAPSHOT r5422-9fe59abef8
</code></pre>
## Manual Setup
#!/bin/sh /etc/rc.common
-START=90
+START=25
USE_PROCD=1
EXTRA_COMMANDS="status"
service_triggers()
{
- local auto="$(uci -q get travelmate.global.trm_automatic)"
+ local auto="$(uci_get travelmate.global.trm_automatic)"
if [ "${auto}" = "0" ]
then
- local iface="$(uci -q get travelmate.global.trm_iface)"
- local delay="$(uci -q get travelmate.global.trm_triggerdelay)"
+ local trigger="$(uci_get travelmate.global.trm_iface)"
+ local delay="$(uci_get travelmate.global.trm_triggerdelay)"
- PROCD_RELOAD_DELAY=$((${delay:=2} * 1000))
- procd_add_interface_trigger "interface.*.down" "${iface}" "${trm_init}" start
+ PROCD_RELOAD_DELAY=$((${delay:-2} * 1000))
+ procd_add_interface_trigger "interface.*.down" "${trigger}" "${trm_init}" start
fi
- PROCD_RELOAD_DELAY=1000
- procd_add_config_trigger "config.change" "travelmate" "${trm_init}" start
+ procd_add_reload_trigger "travelmate"
}
#
LC_ALL=C
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
-trm_ver="0.9.3"
+trm_ver="0.9.5"
trm_sysver="$(ubus -S call system board | jsonfilter -e '@.release.description')"
trm_enabled=0
trm_debug=0
#
f_jsnupdate()
{
- local iface="${1}" radio="${2}" ssid="${3}"
+ local iface="${1}" radio="${2}" essid="${3:-"n/a"}" bssid="${4:-"n/a"}"
json_init
json_add_object "data"
json_add_string "travelmate_version" "${trm_ver}"
json_add_string "station_connection" "${trm_ifstatus}"
- json_add_string "station_ssid" "${ssid}"
+ json_add_string "station_id" "${essid}/${bssid}"
json_add_string "station_interface" "${iface}"
json_add_string "station_radio" "${radio}"
json_add_string "last_rundate" "$(/bin/date "+%d.%m.%Y %H:%M:%S")"
#
f_main()
{
- local dev config ssid_list sta_ssid sta_radio sta_iface cnt=1
+ local dev config raw_scan essid_list bssid_list sta_essid sta_bssid sta_radio sta_iface cnt=1
f_check "initial"
if [ "${trm_ifstatus}" != "true" ]
fi
while [ ${trm_maxretry} -eq 0 ] || [ ${cnt} -le ${trm_maxretry} ]
do
- ssid_list="$(${trm_iwinfo} "${dev}" scan | awk '/ESSID: "/{ORS=" ";if (!seen[$0]++) for(i=2; i<=NF; i++) print $i}')"
- f_log "debug" "main: ${trm_iwinfo}, dev: ${dev}, ssids: ${ssid_list}"
- if [ -n "${ssid_list}" ]
+ raw_scan="$(${trm_iwinfo} "${dev}" scan)"
+ essid_list="$(printf "%s" "${raw_scan}" | awk '/ESSID: "/{ORS=" ";if (!seen[$0]++) for(i=2; i<=NF; i++) print $i}')"
+ bssid_list="$(printf "%s" "${raw_scan}" | awk '/Address: /{ORS=" ";if (!seen[$5]++) print $5}')"
+ f_log "debug" "main: ${trm_iwinfo}, dev: ${dev}, essid-list: ${essid_list}, bssid-list: ${bssid_list}"
+ if [ -n "${essid_list}" ] || [ -n "${bssid_list}" ]
then
for sta in ${trm_stalist}
do
config="${sta%%_*}"
sta_radio="${sta##*_}"
- sta_ssid="$(uci -q get wireless."${config}".ssid)"
+ sta_essid="$(uci -q get wireless."${config}".ssid)"
+ sta_bssid="$(uci -q get wireless."${config}".bssid)"
sta_iface="$(uci -q get wireless."${config}".network)"
- if [ -n "$(printf "%s" "${ssid_list}" | grep -Fo "\"${sta_ssid}\"")" ] && [ "${dev}" = "${sta_radio}" ]
+ if ([ -n "$(printf "%s" "${essid_list}" | grep -Fo "\"${sta_essid}\"")" ] ||\
+ [ -n "$(printf "%s" "${bssid_list}" | grep -Fo "${sta_bssid}")" ]) && [ "${dev}" = "${sta_radio}" ]
then
uci -q set wireless."${config}".disabled=0
f_check "sta"
if [ "${trm_ifstatus}" = "true" ]
then
uci -q commit wireless
- f_log "info " "interface '${sta_iface}' on '${sta_radio}' connected to uplink '${sta_ssid}' (${trm_sysver})"
- f_jsnupdate "${sta_iface}" "${sta_radio}" "${sta_ssid}"
+ f_log "info " "interface '${sta_iface}' on '${sta_radio}' connected to uplink '${sta_essid:-"-"}/${sta_bssid:-"-"}' (${trm_sysver})"
+ f_jsnupdate "${sta_iface}" "${sta_radio}" "${sta_essid}" "${sta_bssid}"
return 0
elif [ ${trm_maxretry} -ne 0 ] && [ ${cnt} -eq ${trm_maxretry} ]
then
uci -q set wireless."${config}".disabled=1
- uci -q set wireless."${config}".ssid="${sta_ssid}_err"
+ if [ -n "${sta_essid}" ]
+ then
+ uci -q set wireless."${config}".ssid="${sta_essid}_err"
+ fi
+ if [ -n "${sta_bssid}" ]
+ then
+ uci -q set wireless."${config}".bssid="${sta_bssid}_err"
+ fi
uci -q commit wireless
f_check "dev"
- f_log "info " "can't connect to uplink '${sta_ssid}' (${cnt}/${trm_maxretry}), uplink disabled (${trm_sysver})"
+ f_log "info " "can't connect to uplink '${sta_essid:-"-"}/${sta_bssid:-"-"}' (${cnt}/${trm_maxretry}), uplink disabled (${trm_sysver})"
else
if [ ${trm_maxretry} -eq 0 ]
then
fi
uci -q revert wireless
f_check "dev"
- f_log "info " "can't connect to uplink '${sta_ssid}' (${cnt}/${trm_maxretry}) (${trm_sysver})"
+ f_log "info " "can't connect to uplink '${sta_essid:-"-"}/${sta_bssid:-"-"}' (${cnt}/${trm_maxretry}) (${trm_sysver})"
fi
- f_jsnupdate "${sta_iface}" "${sta_radio}" "${sta_ssid}"
+ f_jsnupdate "${sta_iface}" "${sta_radio}" "${sta_essid}" "${sta_bssid}"
fi
done
fi
if [ ! -s "${trm_rtfile}" ]
then
trm_ifstatus="false"
- f_jsnupdate "n/a" "n/a" "n/a"
+ f_jsnupdate "n/a" "n/a" "n/a" "n/a"
fi
else
if [ ! -s "${trm_rtfile}" ]
then
config="$(ubus -S call network.wireless status | jsonfilter -l1 -e '@.*.interfaces[@.config.mode="sta"].section')"
sta_radio="$(uci -q get wireless."${config}".device)"
- sta_ssid="$(uci -q get wireless."${config}".ssid)"
+ sta_essid="$(uci -q get wireless."${config}".ssid)"
+ sta_bssid="$(uci -q get wireless."${config}".bssid)"
sta_iface="$(uci -q get wireless."${config}".network)"
- f_jsnupdate "${sta_iface}" "${sta_radio}" "${sta_ssid}"
+ f_jsnupdate "${sta_iface}" "${sta_radio}" "${sta_essid}" "${sta_bssid}"
fi
fi
}