mirror of
https://github.com/novatiq/packages.git
synced 2026-04-30 15:38:40 +01:00
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 <dev@brenken.org>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user