travelmate: update 1.3.6 8275/head
authorDirk Brenken <dev@brenken.org>
Fri, 22 Feb 2019 10:59:14 +0000 (11:59 +0100)
committerDirk Brenken <dev@brenken.org>
Fri, 22 Feb 2019 11:04:37 +0000 (12:04 +0100)
* add captive portal domains automatically to the related
  domain whitelist (dhcp option 'rebind_domain'),
  if rebind protection/RFC1918 is enabled

Signed-off-by: Dirk Brenken <dev@brenken.org>
net/travelmate/Makefile
net/travelmate/files/README.md
net/travelmate/files/travelmate.sh

index 766f7f4b1d66eb9474207488e06010aa8ea0c6ac..f552c6ce529ce95c322cf8d9c9b4d66df84f8216 100644 (file)
@@ -6,7 +6,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=travelmate
-PKG_VERSION:=1.3.5
+PKG_VERSION:=1.3.6
 PKG_RELEASE:=1
 PKG_LICENSE:=GPL-3.0+
 PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>
index 2c657b48a2e43710a449bb6d88e15fde624ad322..422eb7ad3782e2a9533585dadea6dedde3679ba9 100644 (file)
@@ -124,14 +124,6 @@ edit /etc/config/travelmate and set 'trm_enabled' to '1'
 /etc/init.d/travelmate restart
 </code></pre>
 
-## FAQ
-**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.  
-**Q:** Any recommendations regarding suitable DNS settings to easily connect to captive portals?  
-**A:** Use a simple DNS forwarder like dnsmasq and disable the option 'rebind_protection'.  
-
 ## Support
 Please join the travelmate discussion in this [forum thread](https://forum.lede-project.org/t/travelmate-support-thread/5155) or contact me by [mail](mailto:dev@brenken.org)  
 
index 545a0b2f79ca7069d7307423f7f53203060f3cf2..71bb6712bbdc974af8eccf2b8f1d3e27a9da4988 100755 (executable)
@@ -10,7 +10,7 @@
 #
 LC_ALL=C
 PATH="/usr/sbin:/usr/bin:/sbin:/bin"
-trm_ver="1.3.5"
+trm_ver="1.3.6"
 trm_sysver="unknown"
 trm_enabled=0
 trm_debug=0
@@ -47,6 +47,10 @@ f_envload()
 {
        local sys_call sys_desc sys_model
 
+       # (re-)initialize global list variables
+       #
+       unset trm_devlist trm_stalist trm_radiolist trm_active_sta
+
        # get system information
        #
        sys_call="$(ubus -S call system board 2>/dev/null)"
@@ -57,9 +61,10 @@ f_envload()
                trm_sysver="${sys_model}, ${sys_desc}"
        fi
 
-       # (re-)initialize global list variables
+       # get eap capabilities and rebind setting
        #
-       unset trm_devlist trm_stalist trm_radiolist trm_active_sta
+       trm_eap="$("${trm_wpa}" -veap >/dev/null 2>&1; printf "%u" ${?})"
+       trm_rebind="$(uci_get dhcp "@dnsmasq[0]" rebind_protection)"
 
        # load config and check 'enabled' option
        #
@@ -101,7 +106,7 @@ f_envload()
 #
 f_prep()
 {
-       local eap_rc=1 config="${1}" proactive="${2}"
+       local config="${1}" proactive="${2}"
        local mode="$(uci_get wireless "${config}" mode)"
        local network="$(uci_get wireless "${config}" network)"
        local radio="$(uci_get wireless "${config}" device)"
@@ -127,24 +132,20 @@ f_prep()
                        then
                                trm_active_sta="${config}"
                        fi
-                       if [ -n "${eaptype}" ]
-                       then
-                               eap_rc="$("${trm_wpa}" -veap >/dev/null 2>&1; printf "%u" ${?})"
-                       fi
-                       if [ -z "${eaptype}" ] || [ ${eap_rc} -eq 0 ]
+                       if [ -z "${eaptype}" ] || ([ -n "${eaptype}" ] && [ ${trm_eap} -eq 0 ])
                        then
                                trm_stalist="$(f_trim "${trm_stalist} ${config}-${radio}")"
                        fi
                fi
        fi
-       f_log "debug" "f_prep ::: config: ${config}, mode: ${mode}, network: ${network}, eap_rc: ${eap_rc}, radio: ${radio}, trm_radio: ${trm_radio:-"-"}, trm_active_sta: ${trm_active_sta:-"-"}, proactive: ${proactive}, disabled: ${disabled}"
+       f_log "debug" "f_prep ::: config: ${config}, mode: ${mode}, network: ${network}, radio: ${radio}, trm_radio: ${trm_radio:-"-"}, trm_active_sta: ${trm_active_sta:-"-"}, proactive: ${proactive}, trm_eap: ${trm_eap}, trm_rebind: ${trm_rebind}, disabled: ${disabled}"
 }
 
 # check interface status
 #
 f_check()
 {
-       local IFS ifname radio dev_status config sta_essid sta_bssid result wait=1 mode="${1}" status="${2:-"false"}"
+       local IFS ifname radio dev_status config sta_essid sta_bssid result cp_domain wait=1 mode="${1}" status="${2:-"false"}"
 
        trm_ifquality=0
        if [ "${mode}" = "initial" ]
@@ -219,6 +220,16 @@ f_check()
                                                awk '/^Redirected/{printf "%s" "net cp \047"$NF"\047";exit}/^Download completed/{printf "%s" "net ok";exit}/^Failed|^Connection error/{printf "%s" "net nok";exit}')"
                                        if [ -n "${result}" ] && ([ -z "${trm_connection}" ] || [ "${result}" != "${trm_connection%/*}" ])
                                        then
+                                               cp_domain="$(printf "%s" "${result}" | awk -F "['| ]" '/^net cp/{printf "%s" $4}')"
+                                               if [ -x "/etc/init.d/dnsmasq" ] && [ -n "${cp_domain}" ]
+                                               then
+                                                       if [ -z "$(uci_get dhcp "@dnsmasq[0]" rebind_domain | grep -Fo "${cp_domain}")" ]
+                                                       then
+                                                               uci -q add_list dhcp.@dnsmasq[0].rebind_domain="${cp_domain}"
+                                                               uci_commit dhcp
+                                                               /etc/init.d/dnsmasq reload
+                                                       fi
+                                               fi
                                                trm_connection="${result}/${trm_ifquality}"
                                                f_jsnup
                                        fi