From a423fd57bbe8997196fec78ff6d6079b534573ad Mon Sep 17 00:00:00 2001 From: Dirk Brenken Date: Fri, 22 Feb 2019 11:59:14 +0100 Subject: [PATCH] travelmate: update 1.3.6 * 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 --- net/travelmate/Makefile | 2 +- net/travelmate/files/README.md | 8 -------- net/travelmate/files/travelmate.sh | 33 ++++++++++++++++++++---------- 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/net/travelmate/Makefile b/net/travelmate/Makefile index 766f7f4b1..f552c6ce5 100644 --- a/net/travelmate/Makefile +++ b/net/travelmate/Makefile @@ -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 diff --git a/net/travelmate/files/README.md b/net/travelmate/files/README.md index 2c657b48a..422eb7ad3 100644 --- a/net/travelmate/files/README.md +++ b/net/travelmate/files/README.md @@ -124,14 +124,6 @@ edit /etc/config/travelmate and set 'trm_enabled' to '1' /etc/init.d/travelmate restart -## 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) diff --git a/net/travelmate/files/travelmate.sh b/net/travelmate/files/travelmate.sh index 545a0b2f7..71bb6712b 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.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