Browse Source

Merge pull request #10271 from dibdot/travelmate

travelmate: update 1.5.0
lilik-openwrt-22.03
Dirk Brenken 5 years ago
committed by GitHub
parent
commit
df5c52bcfe
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 62 additions and 23 deletions
  1. +2
    -2
      net/travelmate/Makefile
  2. +2
    -3
      net/travelmate/files/generic-user-pass.login
  3. +7
    -2
      net/travelmate/files/travelmate.init
  4. +51
    -16
      net/travelmate/files/travelmate.sh

+ 2
- 2
net/travelmate/Makefile View File

@ -6,8 +6,8 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=travelmate PKG_NAME:=travelmate
PKG_VERSION:=1.4.13
PKG_RELEASE:=2
PKG_VERSION:=1.5.0
PKG_RELEASE:=1
PKG_LICENSE:=GPL-3.0-or-later PKG_LICENSE:=GPL-3.0-or-later
PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org> PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>


+ 2
- 3
net/travelmate/files/generic-user-pass.login View File

@ -9,11 +9,10 @@ then
exit 1 exit 1
fi fi
response="$("${cmd}" $url -d "password=$2&pwd=$2&username=$1" \
response="$("${cmd}" $url -d "username=${1}&password=${2}" \
--header "Content-Type:application/x-www-form-urlencoded" -s)" --header "Content-Type:application/x-www-form-urlencoded" -s)"
if echo "${response}" | grep -q "${success_string}";
if [ -n "$(printf "%s" "${response}" | grep "${success_string}")" ]
then then
exit 0 exit 0
else else


+ 7
- 2
net/travelmate/files/travelmate.init View File

@ -52,7 +52,7 @@ stop_service()
rc_procd "${trm_script}" stop rc_procd "${trm_script}" stop
} }
status()
status_service()
{ {
local key keylist value rtfile="$(uci_get travelmate global trm_rtfile)" local key keylist value rtfile="$(uci_get travelmate global trm_rtfile)"
@ -79,7 +79,12 @@ service_triggers()
local delay="$(uci_get travelmate global trm_triggerdelay)" local delay="$(uci_get travelmate global trm_triggerdelay)"
PROCD_RELOAD_DELAY=$((${delay:-2} * 1000)) PROCD_RELOAD_DELAY=$((${delay:-2} * 1000))
procd_add_interface_trigger "interface.*.down" "${trigger:-"trm_wwan"}" "${trm_init}" reload
if [ -n "${trigger}" ]
then
procd_add_interface_trigger "interface.*.down" "${trigger}" "${trm_init}" reload
else
procd_add_raw_trigger "interface.*.down" ${PROCD_RELOAD_DELAY} "${trm_init}" reload
fi
procd_add_config_trigger "config.change" "wireless" "${trm_init}" reload procd_add_config_trigger "config.change" "wireless" "${trm_init}" reload
procd_add_config_trigger "config.change" "travelmate" "${trm_init}" restart procd_add_config_trigger "config.change" "travelmate" "${trm_init}" restart
} }

+ 51
- 16
net/travelmate/files/travelmate.sh View File

@ -13,7 +13,7 @@
# #
LC_ALL=C LC_ALL=C
PATH="/usr/sbin:/usr/bin:/sbin:/bin" PATH="/usr/sbin:/usr/bin:/sbin:/bin"
trm_ver="1.4.13"
trm_ver="1.5.0"
trm_enabled=0 trm_enabled=0
trm_debug=0 trm_debug=0
trm_iface="trm_wwan" trm_iface="trm_wwan"
@ -52,7 +52,7 @@ f_trim()
# #
f_envload() f_envload()
{ {
local IFS
local IFS check wpa_checks
# (re-)initialize global list variables # (re-)initialize global list variables
# #
@ -63,9 +63,18 @@ f_envload()
trm_sysver="$(ubus -S call system board 2>/dev/null | jsonfilter -e '@.model' -e '@.release.description' | \ trm_sysver="$(ubus -S call system board 2>/dev/null | jsonfilter -e '@.model' -e '@.release.description' | \
awk 'BEGIN{ORS=", "}{print $0}' | awk '{print substr($0,1,length($0)-2)}')" awk 'BEGIN{ORS=", "}{print $0}' | awk '{print substr($0,1,length($0)-2)}')"
# get eap capabilities
# get wpa_supplicant capabilities
# #
trm_eap="$("${trm_wpa}" -veap >/dev/null 2>&1; printf "%u" "${?}")"
wpa_checks="eap sae owe"
for check in ${wpa_checks}
do
if [ -x "${trm_wpa}" ]
then
eval "trm_${check}check=\"$("${trm_wpa}" -v${check} >/dev/null 2>&1; printf "%u" "${?}")\""
else
eval "trm_${check}check=\"1\""
fi
done
# load config and check 'enabled' option # load config and check 'enabled' option
# #
@ -133,13 +142,14 @@ f_envload()
# #
f_prep() f_prep()
{ {
local IFS mode network radio disabled eaptype config="${1}" proactive="${2}"
local IFS mode network radio encryption eaptype disabled config="${1}" proactive="${2}"
mode="$(uci_get "wireless" "${config}" "mode")" mode="$(uci_get "wireless" "${config}" "mode")"
network="$(uci_get "wireless" "${config}" "network")" network="$(uci_get "wireless" "${config}" "network")"
radio="$(uci_get "wireless" "${config}" "device")" radio="$(uci_get "wireless" "${config}" "device")"
disabled="$(uci_get "wireless" "${config}" "disabled")"
encryption="$(uci_get "wireless" "${config}" "encryption")"
eaptype="$(uci_get "wireless" "${config}" "eap_type")" eaptype="$(uci_get "wireless" "${config}" "eap_type")"
disabled="$(uci_get "wireless" "${config}" "disabled")"
if [ -n "${config}" ] && [ -n "${radio}" ] && [ -n "${mode}" ] && [ -n "${network}" ] if [ -n "${config}" ] && [ -n "${radio}" ] && [ -n "${mode}" ] && [ -n "${network}" ]
then then
@ -160,13 +170,18 @@ f_prep()
then then
trm_active_sta="${config}" trm_active_sta="${config}"
fi fi
if [ -z "${eaptype}" ] || { [ -n "${eaptype}" ] && [ "${trm_eap:-1}" -eq 0 ]; }
if [ -z "${eaptype}" ] || { [ -n "${eaptype}" ] && [ "${trm_eapcheck}" -eq 0 ]; }
then then
trm_stalist="$(f_trim "${trm_stalist} ${config}-${radio}")"
if { [ "${encryption%-*}" != "sae" ] && [ "${encryption%-*}" != "wpa3" ] && [ "${encryption}" != "owe" ]; } || \
{ { [ "${encryption%-*}" = "sae" ] || [ "${encryption%-*}" = "wpa3" ]; } && [ "${trm_saecheck}" -eq 0 ]; } || \
{ [ "${encryption}" = "owe" ] && [ "${trm_owecheck}" -eq 0 ]; }
then
trm_stalist="$(f_trim "${trm_stalist} ${config}-${radio}")"
fi
fi fi
fi fi
fi fi
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:-"-"}, 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_eapcheck: ${trm_eapcheck:-"-"}, trm_saecheck: ${trm_saecheck:-"-"}, trm_owecheck: ${trm_owecheck:-"-"}, disabled: ${disabled}"
} }
# check net status # check net status
@ -296,7 +311,7 @@ f_check()
login_command_args="$(uci_get "travelmate" "${uci_essid}${uci_bssid}" "command_args")" login_command_args="$(uci_get "travelmate" "${uci_essid}${uci_bssid}" "command_args")"
"${login_command}" ${login_command_args} >/dev/null 2>&1 "${login_command}" ${login_command_args} >/dev/null 2>&1
rc=${?} rc=${?}
f_log "info" "captive portal login '${login_command:0:40} ${login_command_args}' for '${cp_domain}' has been executed with rc '${rc}'"
f_log "info" "captive portal login '${login_command:0:40} ${login_command_args:0:20}' for '${cp_domain}' has been executed with rc '${rc}'"
if [ "${rc}" -eq 0 ] if [ "${rc}" -eq 0 ]
then then
result="$(f_net)" result="$(f_net)"
@ -352,7 +367,7 @@ f_check()
# #
f_jsnup() f_jsnup()
{ {
local IFS config d1 d2 d3 last_date last_station sta_iface sta_radio sta_essid sta_bssid last_status dev_status status="${trm_ifstatus}" faulty_list faulty_station="${1}"
local IFS config d1 d2 d3 last_date last_station sta_iface sta_radio sta_essid sta_bssid last_status dev_status wpa_status status="${trm_ifstatus}" faulty_list faulty_station="${1}"
dev_status="$(ubus -S call network.wireless status 2>/dev/null)" dev_status="$(ubus -S call network.wireless status 2>/dev/null)"
if [ -n "${dev_status}" ] if [ -n "${dev_status}" ]
@ -375,7 +390,7 @@ f_jsnup()
json_get_var last_status "travelmate_status" json_get_var last_status "travelmate_status"
if [ "${last_status}" = "running / not connected" ] || [ "${last_station}" != "${sta_radio:-"-"}/${sta_essid:-"-"}/${sta_bssid:-"-"}" ] if [ "${last_status}" = "running / not connected" ] || [ "${last_station}" != "${sta_radio:-"-"}/${sta_essid:-"-"}/${sta_bssid:-"-"}" ]
then then
last_date="$(/bin/date "+%Y.%m.%d-%H:%M:%S")"
last_date="$(date "+%Y.%m.%d-%H:%M:%S")"
fi fi
elif [ "${status}" = "error" ] elif [ "${status}" = "error" ]
then then
@ -387,14 +402,14 @@ f_jsnup()
fi fi
if [ -z "${last_date}" ] if [ -z "${last_date}" ]
then then
last_date="$(/bin/date "+%Y.%m.%d-%H:%M:%S")"
last_date="$(date "+%Y.%m.%d-%H:%M:%S")"
fi fi
json_get_var faulty_list "faulty_stations" json_get_var faulty_list "faulty_stations"
if [ -n "${faulty_list}" ] && [ "${trm_listexpiry}" -gt 0 ] if [ -n "${faulty_list}" ] && [ "${trm_listexpiry}" -gt 0 ]
then then
d1="$(/bin/date -d "${last_date}" "+%s")"
d2="$(/bin/date "+%s")"
d1="$(date -d "${last_date}" "+%s")"
d2="$(date "+%s")"
d3=$(((d2 - d1)/60)) d3=$(((d2 - d1)/60))
if [ "${d3}" -ge "${trm_listexpiry}" ] if [ "${d3}" -ge "${trm_listexpiry}" ]
then then
@ -407,14 +422,34 @@ f_jsnup()
if [ -z "$(printf "%s" "${faulty_list}" | grep -Fo "${faulty_station}")" ] if [ -z "$(printf "%s" "${faulty_list}" | grep -Fo "${faulty_station}")" ]
then then
faulty_list="$(f_trim "${faulty_list} ${faulty_station}")" faulty_list="$(f_trim "${faulty_list} ${faulty_station}")"
last_date="$(/bin/date "+%Y.%m.%d-%H:%M:%S")"
last_date="$(date "+%Y.%m.%d-%H:%M:%S")"
fi fi
fi fi
if [ "${trm_eapcheck}" -eq 0 ]
then
wpa_status="EAP"
else
wpa_status="-"
fi
if [ "${trm_saecheck}" -eq 0 ]
then
wpa_status="${wpa_status}/SAE"
else
wpa_status="${wpa_status}/-"
fi
if [ "${trm_owecheck}" -eq 0 ]
then
wpa_status="${wpa_status}/OWE"
else
wpa_status="${wpa_status}/-"
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_radio:-"-"}/${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 "faulty_stations" "${faulty_list}" json_add_string "faulty_stations" "${faulty_list}"
json_add_string "wpa_capabilities" "${wpa_status:-"-"}"
json_add_string "last_rundate" "${last_date}" json_add_string "last_rundate" "${last_date}"
json_add_string "system" "${trm_sysver}" json_add_string "system" "${trm_sysver}"
json_dump > "${trm_rtfile}" json_dump > "${trm_rtfile}"


Loading…
Cancel
Save