From 8a19a18c45454b33c1e87d01c119c833593ca089 Mon Sep 17 00:00:00 2001 From: Dirk Brenken Date: Mon, 30 Jul 2018 13:58:40 +0200 Subject: [PATCH] travelmate[18.06]: backport release 1.2.1 to 18.06 branch Tested with latest 18.06 branch (OpenWrt 18.06-SNAPSHOT, r7175+5-ca0c649a38) Signed-off-by: Dirk Brenken --- net/travelmate/Makefile | 2 +- net/travelmate/files/README.md | 16 ++++----- net/travelmate/files/travelmate.sh | 56 ++++++++++++++++++++---------- 3 files changed, 47 insertions(+), 27 deletions(-) diff --git a/net/travelmate/Makefile b/net/travelmate/Makefile index 2e2ddec170..fcf69ab78b 100644 --- a/net/travelmate/Makefile +++ b/net/travelmate/Makefile @@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=travelmate -PKG_VERSION:=1.2.0 +PKG_VERSION:=1.2.1 PKG_RELEASE:=1 PKG_LICENSE:=GPL-3.0+ PKG_MAINTAINER:=Dirk Brenken diff --git a/net/travelmate/files/README.md b/net/travelmate/files/README.md index 6745c515fe..4fd64ede19 100644 --- a/net/travelmate/files/README.md +++ b/net/travelmate/files/README.md @@ -56,13 +56,13 @@ To avoid these kind of deadlocks, travelmate set all station interfaces in an "a

 ~# /etc/init.d/travelmate status
 ::: travelmate runtime information
-  + travelmate_status  : connected (net ok/37)
-  + travelmate_version : 1.2.0
-  + station_id         : blackhole/01:02:03:04:05:06
+  + travelmate_status  : connected (net ok/78)
+  + travelmate_version : 1.2.1
+  + station_id         : radio1/blackhole/01:02:03:04:05:06
   + station_interface  : trm_wwan
-  + station_radio      : radio0
-  + last_rundate       : 04.04.2018 13:00:24
-  + system             : GL.iNet GL-AR750, OpenWrt SNAPSHOT r6588-16efb0c1c6
+  + faulty_stations    : 
+  + last_rundate       : 28.07.2018 21:17:45
+  + system             : TP-LINK RE450, OpenWrt SNAPSHOT r7540+5-20c4819c7b
 
## Manual Setup @@ -123,8 +123,8 @@ edit /etc/config/travelmate and set 'trm_enabled' to '1' ## FAQ -**Q:** What happen with misconfigured uplinks, e.g. due to outdated wlan passwords? -**A:** Travelmate tries n times (default 3) to connect, then the respective uplink SSID will be marked / renamed to '_SSID_\_err' and travelmate no longer attends this uplink. In this case use the builtin wireless station manager to update your wireless credentials. +**Q:** What happen with misconfigured, faulty uplinks, e.g. due to outdated wlan passwords? +**A:** Travelmate tries n times (default 3) to connect, then the respective uplink will be marked as "faulty" in the JSON runtime file and hereafter ignored. To reset the JSON runtime file, simply restart travelmate. **Q:** How to connect to hidden uplinks? **A:** See 'example\_hidden' STA configuration above, option 'SSID' and 'BSSID' must be specified for successful connections. diff --git a/net/travelmate/files/travelmate.sh b/net/travelmate/files/travelmate.sh index 3bba1eb7ed..b9a96a26ea 100755 --- a/net/travelmate/files/travelmate.sh +++ b/net/travelmate/files/travelmate.sh @@ -10,7 +10,7 @@ # LC_ALL=C PATH="/usr/sbin:/usr/bin:/sbin:/bin" -trm_ver="1.2.0" +trm_ver="1.2.1" trm_sysver="unknown" trm_enabled=0 trm_debug=0 @@ -219,7 +219,7 @@ f_check() # f_jsnup() { - local config sta_iface sta_radio sta_essid sta_bssid dev_status status="${trm_ifstatus}" + local config sta_iface sta_radio sta_essid sta_bssid dev_status status="${trm_ifstatus}" faulty_list faulty_station="${1}" if [ "${status}" = "true" ] then @@ -245,18 +245,24 @@ f_jsnup() fi fi - json_init - json_add_object "data" + json_get_var faulty_list "faulty_stations" + if [ -n "${faulty_station}" ] + then + if [ -z "$(printf "%s" "${faulty_list}" | grep -Fo "${faulty_station}")" ] + then + faulty_list="${faulty_list} ${faulty_station}" + fi + fi json_add_string "travelmate_status" "${status}" json_add_string "travelmate_version" "${trm_ver}" - json_add_string "station_id" "${sta_essid:-"-"}/${sta_bssid:-"-"}" + json_add_string "station_id" "${sta_radio:-"-"}/${sta_essid:-"-"}/${sta_bssid:-"-"}" json_add_string "station_interface" "${sta_iface:-"-"}" - json_add_string "station_radio" "${sta_radio:-"-"}" + json_add_string "faulty_stations" "${faulty_list}" json_add_string "last_rundate" "$(/bin/date "+%d.%m.%Y %H:%M:%S")" json_add_string "system" "${trm_sysver}" - json_close_object json_dump > "${trm_rtfile}" - f_log "debug" "f_jsnup::: config: ${config:-"-"}, status: ${status:-"-"}, sta_iface: ${sta_iface:-"-"}, sta_radio: ${sta_radio:-"-"}, sta_essid: ${sta_essid:-"-"}, sta_bssid: ${sta_bssid:-"-"}" + + f_log "debug" "f_jsnup::: config: ${config:-"-"}, status: ${status:-"-"}, sta_iface: ${sta_iface:-"-"}, sta_radio: ${sta_radio:-"-"}, sta_essid: ${sta_essid:-"-"}, sta_bssid: ${sta_bssid:-"-"}, faulty_list: ${faulty_list:-"-"}" } # write to syslog @@ -283,7 +289,7 @@ f_log() # f_main() { - local cnt dev config scan scan_list scan_essid scan_bssid scan_quality sta sta_essid sta_bssid sta_radio sta_iface IFS=" " + local cnt dev config scan scan_list scan_essid scan_bssid scan_quality sta sta_essid sta_bssid sta_radio sta_iface IFS=" " faulty_list f_check "initial" if [ "${trm_ifstatus}" != "true" ] @@ -292,7 +298,11 @@ f_main() config_foreach f_prep wifi-iface uci_commit wireless f_check "dev" "running" - f_log "debug" "f_main ::: iwinfo: ${trm_iwinfo}, dev_list: ${trm_devlist}, sta_list: ${trm_stalist:0:800}" + if [ -s "${trm_rtfile}" ] + then + json_get_var faulty_list "faulty_stations" + fi + f_log "debug" "f_main ::: iwinfo: ${trm_iwinfo}, dev_list: ${trm_devlist}, sta_list: ${trm_stalist:0:800}, faulty_list: ${faulty_list:-"-"}" for dev in ${trm_devlist} do if [ -z "$(printf "%s" "${trm_stalist}" | grep -Fo "_${dev}")" ] @@ -313,6 +323,10 @@ f_main() sta_essid="$(uci_get wireless "${config}" ssid)" sta_bssid="$(uci_get wireless "${config}" bssid)" sta_iface="$(uci_get wireless "${config}" network)" + if [ -n "$(printf "%s" "${faulty_list}" | grep -Fo "${sta_radio}/${sta_essid}/${sta_bssid}")" ] + then + continue + fi IFS="," for scan in ${scan_list} do @@ -344,19 +358,14 @@ f_main() elif [ ${cnt} -eq ${trm_maxretry} ] then uci_set wireless "${config}" disabled 1 - if [ -n "${sta_essid}" ] - then - uci_set wireless "${config}" ssid "${sta_essid}_err" - fi - if [ -n "${sta_bssid}" ] - then - uci_set wireless "${config}" bssid "${sta_bssid}_err" - fi uci_commit wireless + faulty_station="${sta_radio}/${sta_essid}/${sta_bssid}" + f_jsnup "${faulty_station}" f_log "info" "can't connect to uplink '${sta_essid:-"-"}/${sta_bssid:-"-"}', uplink disabled (${trm_sysver})" f_check "rev" else uci -q revert wireless + f_jsnup f_log "info" "can't connect to uplink '${sta_essid:-"-"}/${sta_bssid:-"-"}' (${trm_sysver})" f_check "rev" fi @@ -395,6 +404,17 @@ else f_log "err" "system libraries not found" fi +# initialize json runtime file +# +if [ ! -s "${trm_rtfile}" ] +then + json_init + json_add_object "data" +else + json_load_file "${trm_rtfile}" + json_select data +fi + # control travelmate actions # while true -- 2.30.2