travelmate: release 1.0.0
authorDirk Brenken <redacted>
Fri, 15 Dec 2017 18:10:17 +0000 (19:10 +0100)
committerDirk Brenken <redacted>
Fri, 15 Dec 2017 18:10:17 +0000 (19:10 +0100)
* limit sta interface selection/handling
  to defined travelmate interface (trm_iface) only
* check eap capabilities and ignore enterprise uplinks
  as long as eap support is not available
* documentation update
* cosmetics
* LuCI: various cleanups

Signed-off-by: Dirk Brenken <redacted>
net/travelmate/Makefile
net/travelmate/files/README.md
net/travelmate/files/travelmate.sh

index dcaa4e9ac72cdf289012bf30991f120a5ec2f3a6..35867bbd5bf128e83eb414a1e4dd7e123532d91a 100644 (file)
@@ -6,7 +6,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=travelmate
-PKG_VERSION:=0.9.6
+PKG_VERSION:=1.0.0
 PKG_RELEASE:=1
 PKG_LICENSE:=GPL-3.0+
 PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>
index ad14024c6416ebeffec5a5764bc07d9bfd976c6f..486145b8cfc75d53cd0c63f398cf6d6ad0d3db9d 100644 (file)
@@ -11,7 +11,7 @@ To avoid these kind of deadlocks, travelmate set all station interfaces in an "a
 * 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
+* trigger- or automatic-mode support, the latter one is the default and 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
 * runtime information available via LuCI & via 'status' init command
@@ -51,13 +51,13 @@ To avoid these kind of deadlocks, travelmate set all station interfaces in an "a
 **receive travelmate runtime information:**
 <pre><code>
 ::: travelmate runtime information
- travelmate_version : 0.9.5
+ travelmate_version : 1.0.0
  station_connection : true
  station_id         : blackhole/04:F0:21:2F:B7:64
  station_interface  : trm_wwan
  station_radio      : radio1
- last_rundate       : 06.12.2017 16:47:56
- system             : LEDE Reboot SNAPSHOT r5422-9fe59abef8
+ last_rundate       : 15.12.2017 13:51:30
+ system             : TP-LINK RE450, OpenWrt SNAPSHOT r5422+84-9fe59abef8
 </code></pre>
 
 ## Manual Setup
@@ -117,8 +117,8 @@ edit /etc/config/travelmate and set 'trm_enabled' to '1'
 </code></pre>
 
 ## FAQ
-**Q:** What's about 'manual' and 'automatic' mode?  
-**A:** In "manual" mode travelmate will be triggered solely by procd interface down events, whenever an uplink disappears travelmate tries n times (default 3) to find a new uplink or reconnect to the old one. The 'automatic' mode keeps travelmate in an active state and checks every n seconds the connection status / the uplink availability regardless of procd event trigger.  
+**Q:** What's about 'trigger' and 'automatic' mode?  
+**A:** In "trigger" mode travelmate will be triggered solely by procd interface down events, whenever an uplink disappears travelmate tries n times (default 3) to find a new uplink or reconnect to the old one. The 'automatic' mode keeps travelmate in an active state and checks every n seconds the connection status / the uplink availability regardless of procd event trigger.  
 
 **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'. In this case use the builtin wireless station manager to update your wireless credentials. To disable this functionality at all set the Connection Limit ('trm\_maxretry') to '0', which means unlimited retries.  
index d4daa770ea4f86356b82acce5641163cf6203b1f..1ad5959edc96056bfe84ebaf036b1cf8f56095f4 100755 (executable)
@@ -10,7 +10,7 @@
 #
 LC_ALL=C
 PATH="/usr/sbin:/usr/bin:/sbin:/bin"
-trm_ver="0.9.6"
+trm_ver="1.0.0"
 trm_sysver="unknown"
 trm_enabled=0
 trm_debug=0
@@ -21,6 +21,7 @@ trm_timeout=60
 trm_iwinfo="$(command -v iwinfo)"
 trm_radio=""
 trm_rtfile="/tmp/trm_runtime.json"
+trm_wpa="$(command -v wpa_supplicant)"
 
 # f_envload: load travelmate environment
 #
@@ -64,6 +65,10 @@ f_envload()
         f_log "info " "travelmate is currently disabled, please set 'trm_enabled' to '1' to use this service"
         exit 0
     fi
+
+    # check eap capabilities
+    #
+    trm_eap="$("${trm_wpa}" -veap >/dev/null 2>&1; printf "%u" ${?})"
 }
 
 # f_prepare: gather radio information & bring down all STA interfaces
@@ -72,23 +77,28 @@ f_prepare()
 {
     local config="${1}"
     local mode="$(uci -q get wireless."${config}".mode)"
+    local network="$(uci -q get wireless."${config}".network)"
     local radio="$(uci -q get wireless."${config}".device)"
     local disabled="$(uci -q get wireless."${config}".disabled)"
+    local eaptype="$(uci -q get wireless."${config}".eap_type)"
 
     if ([ -z "${trm_radio}" ] || [ "${trm_radio}" = "${radio}" ]) && \
         [ -z "$(printf "%s" "${trm_radiolist}" | grep -Fo " ${radio}")" ]
     then
         trm_radiolist="${trm_radiolist} ${radio}"
     fi
-    if [ "${mode}" = "sta" ]
+    if [ "${mode}" = "sta" ] && [ "${network}" = "${trm_iface}" ]
     then
-        trm_stalist="${trm_stalist} ${config}_${radio}"
         if [ -z "${disabled}" ] || [ "${disabled}" = "0" ]
         then
             uci -q set wireless."${config}".disabled=1
         fi
+        if [ -z "${eaptype}" ] || [ ${trm_eap} -eq 0 ]
+        then
+            trm_stalist="${trm_stalist} ${config}_${radio}"
+        fi
     fi
-    f_log "debug" "prepare: ${mode}, radio: ${radio}, config: ${config}, disabled: ${disabled}"
+    f_log "debug" "prepare: ${config}, mode: ${mode}, network: ${network}, radio: ${radio}, eap: ${trm_eap}, disabled: ${disabled}"
 }
 
 # f_check: check interface status
@@ -223,7 +233,9 @@ f_main()
                 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}"
+                f_log "debug" "main: ${trm_iwinfo}, dev: ${dev}"
+                f_log "debug" "main: ${essid_list}"
+                f_log "debug" "main: ${bssid_list}"
                 if [ -n "${essid_list}" ] || [ -n "${bssid_list}" ]
                 then
                     for sta in ${trm_stalist}
git clone https://git.99rst.org/PROJECT