Browse Source

travelmate: update 1.2.1

* no longer rename faulty uplinks in /etc/config/wireless, but save
uplink state in json runtime information. To reset the saved state
simply restart travelmate processing.

Signed-off-by: Dirk Brenken <dev@brenken.org>
lilik-openwrt-22.03
Dirk Brenken 6 years ago
parent
commit
bfe8850ee5
3 changed files with 47 additions and 27 deletions
  1. +1
    -1
      net/travelmate/Makefile
  2. +8
    -8
      net/travelmate/files/README.md
  3. +38
    -18
      net/travelmate/files/travelmate.sh

+ 1
- 1
net/travelmate/Makefile View File

@ -6,7 +6,7 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=travelmate PKG_NAME:=travelmate
PKG_VERSION:=1.2.0
PKG_VERSION:=1.2.1
PKG_RELEASE:=1 PKG_RELEASE:=1
PKG_LICENSE:=GPL-3.0+ PKG_LICENSE:=GPL-3.0+
PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org> PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>


+ 8
- 8
net/travelmate/files/README.md View File

@ -56,13 +56,13 @@ To avoid these kind of deadlocks, travelmate set all station interfaces in an "a
<pre><code> <pre><code>
~# /etc/init.d/travelmate status ~# /etc/init.d/travelmate status
::: travelmate runtime information ::: 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_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
</code></pre> </code></pre>
## Manual Setup ## Manual Setup
@ -123,8 +123,8 @@ edit /etc/config/travelmate and set 'trm_enabled' to '1'
</code></pre> </code></pre>
## FAQ ## 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? **Q:** How to connect to hidden uplinks?
**A:** See 'example\_hidden' STA configuration above, option 'SSID' and 'BSSID' must be specified for successful connections. **A:** See 'example\_hidden' STA configuration above, option 'SSID' and 'BSSID' must be specified for successful connections.


+ 38
- 18
net/travelmate/files/travelmate.sh View File

@ -10,7 +10,7 @@
# #
LC_ALL=C LC_ALL=C
PATH="/usr/sbin:/usr/bin:/sbin:/bin" PATH="/usr/sbin:/usr/bin:/sbin:/bin"
trm_ver="1.2.0"
trm_ver="1.2.1"
trm_sysver="unknown" trm_sysver="unknown"
trm_enabled=0 trm_enabled=0
trm_debug=0 trm_debug=0
@ -219,7 +219,7 @@ f_check()
# #
f_jsnup() 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" ] if [ "${status}" = "true" ]
then then
@ -245,18 +245,24 @@ f_jsnup()
fi fi
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_status" "${status}"
json_add_string "travelmate_version" "${trm_ver}" 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_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 "last_rundate" "$(/bin/date "+%d.%m.%Y %H:%M:%S")"
json_add_string "system" "${trm_sysver}" json_add_string "system" "${trm_sysver}"
json_close_object
json_dump > "${trm_rtfile}" 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 # write to syslog
@ -283,7 +289,7 @@ f_log()
# #
f_main() 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" f_check "initial"
if [ "${trm_ifstatus}" != "true" ] if [ "${trm_ifstatus}" != "true" ]
@ -292,7 +298,11 @@ f_main()
config_foreach f_prep wifi-iface config_foreach f_prep wifi-iface
uci_commit wireless uci_commit wireless
f_check "dev" "running" 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} for dev in ${trm_devlist}
do do
if [ -z "$(printf "%s" "${trm_stalist}" | grep -Fo "_${dev}")" ] if [ -z "$(printf "%s" "${trm_stalist}" | grep -Fo "_${dev}")" ]
@ -313,6 +323,10 @@ f_main()
sta_essid="$(uci_get wireless "${config}" ssid)" sta_essid="$(uci_get wireless "${config}" ssid)"
sta_bssid="$(uci_get wireless "${config}" bssid)" sta_bssid="$(uci_get wireless "${config}" bssid)"
sta_iface="$(uci_get wireless "${config}" network)" 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="," IFS=","
for scan in ${scan_list} for scan in ${scan_list}
do do
@ -344,19 +358,14 @@ f_main()
elif [ ${cnt} -eq ${trm_maxretry} ] elif [ ${cnt} -eq ${trm_maxretry} ]
then then
uci_set wireless "${config}" disabled 1 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 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_log "info" "can't connect to uplink '${sta_essid:-"-"}/${sta_bssid:-"-"}', uplink disabled (${trm_sysver})"
f_check "rev" f_check "rev"
else else
uci -q revert wireless uci -q revert wireless
f_jsnup
f_log "info" "can't connect to uplink '${sta_essid:-"-"}/${sta_bssid:-"-"}' (${trm_sysver})" f_log "info" "can't connect to uplink '${sta_essid:-"-"}/${sta_bssid:-"-"}' (${trm_sysver})"
f_check "rev" f_check "rev"
fi fi
@ -395,6 +404,17 @@ else
f_log "err" "system libraries not found" f_log "err" "system libraries not found"
fi 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 # control travelmate actions
# #
while true while true


Loading…
Cancel
Save