travelmate: update 0.9.5
* change start priority to 25 * add support for hidden uplinks * add support for wpa enterprise uplinks Signed-off-by: Dirk Brenken <dev@brenken.org>
This commit is contained in:
parent
5e42ef5178
commit
9fc66abcc0
4 changed files with 43 additions and 32 deletions
|
@ -6,7 +6,7 @@
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=travelmate
|
PKG_NAME:=travelmate
|
||||||
PKG_VERSION:=0.9.3
|
PKG_VERSION:=0.9.5
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
PKG_LICENSE:=GPL-3.0+
|
PKG_LICENSE:=GPL-3.0+
|
||||||
PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>
|
PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>
|
||||||
|
|
|
@ -10,6 +10,7 @@ To avoid these kind of deadlocks, travelmate set all station interfaces in an "a
|
||||||
* easy setup within normal OpenWrt/LEDE environment
|
* easy setup within normal OpenWrt/LEDE environment
|
||||||
* strong LuCI-Support with builtin interface wizard and a wireless station manager
|
* strong LuCI-Support with builtin interface wizard and a wireless station manager
|
||||||
* fast uplink connections
|
* 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
|
* manual / automatic mode support, the latter one checks the existing uplink connection regardless of ifdown event trigger actions every n seconds
|
||||||
* support of devices with multiple radios
|
* support of devices with multiple radios
|
||||||
* procd init and hotplug support
|
* procd init and hotplug support
|
||||||
|
@ -49,15 +50,14 @@ To avoid these kind of deadlocks, travelmate set all station interfaces in an "a
|
||||||
|
|
||||||
**receive travelmate runtime information:**
|
**receive travelmate runtime information:**
|
||||||
<pre><code>
|
<pre><code>
|
||||||
root@adb2go:~# /etc/init.d/travelmate status
|
|
||||||
::: travelmate runtime information
|
::: travelmate runtime information
|
||||||
travelmate_version : 0.9.1
|
travelmate_version : 0.9.5
|
||||||
station_connection : true
|
station_connection : true
|
||||||
station_ssid : blackhole.nl
|
station_id : blackhole/04:F0:21:2F:B7:64
|
||||||
station_interface : trm_wwan
|
station_interface : trm_wwan
|
||||||
station_radio : radio1
|
station_radio : radio1
|
||||||
last_rundate : 29.07.2017 18:02:01
|
last_rundate : 06.12.2017 16:47:56
|
||||||
system : LEDE Reboot SNAPSHOT r4639-eb43a817f7
|
system : LEDE Reboot SNAPSHOT r5422-9fe59abef8
|
||||||
</code></pre>
|
</code></pre>
|
||||||
|
|
||||||
## Manual Setup
|
## Manual Setup
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh /etc/rc.common
|
#!/bin/sh /etc/rc.common
|
||||||
|
|
||||||
START=90
|
START=25
|
||||||
USE_PROCD=1
|
USE_PROCD=1
|
||||||
|
|
||||||
EXTRA_COMMANDS="status"
|
EXTRA_COMMANDS="status"
|
||||||
|
@ -43,16 +43,15 @@ status()
|
||||||
|
|
||||||
service_triggers()
|
service_triggers()
|
||||||
{
|
{
|
||||||
local auto="$(uci -q get travelmate.global.trm_automatic)"
|
local auto="$(uci_get travelmate.global.trm_automatic)"
|
||||||
|
|
||||||
if [ "${auto}" = "0" ]
|
if [ "${auto}" = "0" ]
|
||||||
then
|
then
|
||||||
local iface="$(uci -q get travelmate.global.trm_iface)"
|
local trigger="$(uci_get travelmate.global.trm_iface)"
|
||||||
local delay="$(uci -q 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" "${iface}" "${trm_init}" start
|
procd_add_interface_trigger "interface.*.down" "${trigger}" "${trm_init}" start
|
||||||
fi
|
fi
|
||||||
PROCD_RELOAD_DELAY=1000
|
procd_add_reload_trigger "travelmate"
|
||||||
procd_add_config_trigger "config.change" "travelmate" "${trm_init}" start
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#
|
#
|
||||||
LC_ALL=C
|
LC_ALL=C
|
||||||
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
|
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
|
||||||
trm_ver="0.9.3"
|
trm_ver="0.9.5"
|
||||||
trm_sysver="$(ubus -S call system board | jsonfilter -e '@.release.description')"
|
trm_sysver="$(ubus -S call system board | jsonfilter -e '@.release.description')"
|
||||||
trm_enabled=0
|
trm_enabled=0
|
||||||
trm_debug=0
|
trm_debug=0
|
||||||
|
@ -123,13 +123,13 @@ f_check()
|
||||||
#
|
#
|
||||||
f_jsnupdate()
|
f_jsnupdate()
|
||||||
{
|
{
|
||||||
local iface="${1}" radio="${2}" ssid="${3}"
|
local iface="${1}" radio="${2}" essid="${3:-"n/a"}" bssid="${4:-"n/a"}"
|
||||||
|
|
||||||
json_init
|
json_init
|
||||||
json_add_object "data"
|
json_add_object "data"
|
||||||
json_add_string "travelmate_version" "${trm_ver}"
|
json_add_string "travelmate_version" "${trm_ver}"
|
||||||
json_add_string "station_connection" "${trm_ifstatus}"
|
json_add_string "station_connection" "${trm_ifstatus}"
|
||||||
json_add_string "station_ssid" "${ssid}"
|
json_add_string "station_id" "${essid}/${bssid}"
|
||||||
json_add_string "station_interface" "${iface}"
|
json_add_string "station_interface" "${iface}"
|
||||||
json_add_string "station_radio" "${radio}"
|
json_add_string "station_radio" "${radio}"
|
||||||
json_add_string "last_rundate" "$(/bin/date "+%d.%m.%Y %H:%M:%S")"
|
json_add_string "last_rundate" "$(/bin/date "+%d.%m.%Y %H:%M:%S")"
|
||||||
|
@ -180,7 +180,7 @@ f_log()
|
||||||
#
|
#
|
||||||
f_main()
|
f_main()
|
||||||
{
|
{
|
||||||
local dev config ssid_list sta_ssid sta_radio sta_iface cnt=1
|
local dev config raw_scan essid_list bssid_list sta_essid sta_bssid sta_radio sta_iface cnt=1
|
||||||
|
|
||||||
f_check "initial"
|
f_check "initial"
|
||||||
if [ "${trm_ifstatus}" != "true" ]
|
if [ "${trm_ifstatus}" != "true" ]
|
||||||
|
@ -203,33 +203,44 @@ f_main()
|
||||||
fi
|
fi
|
||||||
while [ ${trm_maxretry} -eq 0 ] || [ ${cnt} -le ${trm_maxretry} ]
|
while [ ${trm_maxretry} -eq 0 ] || [ ${cnt} -le ${trm_maxretry} ]
|
||||||
do
|
do
|
||||||
ssid_list="$(${trm_iwinfo} "${dev}" scan | awk '/ESSID: "/{ORS=" ";if (!seen[$0]++) for(i=2; i<=NF; i++) print $i}')"
|
raw_scan="$(${trm_iwinfo} "${dev}" scan)"
|
||||||
f_log "debug" "main: ${trm_iwinfo}, dev: ${dev}, ssids: ${ssid_list}"
|
essid_list="$(printf "%s" "${raw_scan}" | awk '/ESSID: "/{ORS=" ";if (!seen[$0]++) for(i=2; i<=NF; i++) print $i}')"
|
||||||
if [ -n "${ssid_list}" ]
|
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}"
|
||||||
|
if [ -n "${essid_list}" ] || [ -n "${bssid_list}" ]
|
||||||
then
|
then
|
||||||
for sta in ${trm_stalist}
|
for sta in ${trm_stalist}
|
||||||
do
|
do
|
||||||
config="${sta%%_*}"
|
config="${sta%%_*}"
|
||||||
sta_radio="${sta##*_}"
|
sta_radio="${sta##*_}"
|
||||||
sta_ssid="$(uci -q get wireless."${config}".ssid)"
|
sta_essid="$(uci -q get wireless."${config}".ssid)"
|
||||||
|
sta_bssid="$(uci -q get wireless."${config}".bssid)"
|
||||||
sta_iface="$(uci -q get wireless."${config}".network)"
|
sta_iface="$(uci -q get wireless."${config}".network)"
|
||||||
if [ -n "$(printf "%s" "${ssid_list}" | grep -Fo "\"${sta_ssid}\"")" ] && [ "${dev}" = "${sta_radio}" ]
|
if ([ -n "$(printf "%s" "${essid_list}" | grep -Fo "\"${sta_essid}\"")" ] ||\
|
||||||
|
[ -n "$(printf "%s" "${bssid_list}" | grep -Fo "${sta_bssid}")" ]) && [ "${dev}" = "${sta_radio}" ]
|
||||||
then
|
then
|
||||||
uci -q set wireless."${config}".disabled=0
|
uci -q set wireless."${config}".disabled=0
|
||||||
f_check "sta"
|
f_check "sta"
|
||||||
if [ "${trm_ifstatus}" = "true" ]
|
if [ "${trm_ifstatus}" = "true" ]
|
||||||
then
|
then
|
||||||
uci -q commit wireless
|
uci -q commit wireless
|
||||||
f_log "info " "interface '${sta_iface}' on '${sta_radio}' connected to uplink '${sta_ssid}' (${trm_sysver})"
|
f_log "info " "interface '${sta_iface}' on '${sta_radio}' connected to uplink '${sta_essid:-"-"}/${sta_bssid:-"-"}' (${trm_sysver})"
|
||||||
f_jsnupdate "${sta_iface}" "${sta_radio}" "${sta_ssid}"
|
f_jsnupdate "${sta_iface}" "${sta_radio}" "${sta_essid}" "${sta_bssid}"
|
||||||
return 0
|
return 0
|
||||||
elif [ ${trm_maxretry} -ne 0 ] && [ ${cnt} -eq ${trm_maxretry} ]
|
elif [ ${trm_maxretry} -ne 0 ] && [ ${cnt} -eq ${trm_maxretry} ]
|
||||||
then
|
then
|
||||||
uci -q set wireless."${config}".disabled=1
|
uci -q set wireless."${config}".disabled=1
|
||||||
uci -q set wireless."${config}".ssid="${sta_ssid}_err"
|
if [ -n "${sta_essid}" ]
|
||||||
|
then
|
||||||
|
uci -q set wireless."${config}".ssid="${sta_essid}_err"
|
||||||
|
fi
|
||||||
|
if [ -n "${sta_bssid}" ]
|
||||||
|
then
|
||||||
|
uci -q set wireless."${config}".bssid="${sta_bssid}_err"
|
||||||
|
fi
|
||||||
uci -q commit wireless
|
uci -q commit wireless
|
||||||
f_check "dev"
|
f_check "dev"
|
||||||
f_log "info " "can't connect to uplink '${sta_ssid}' (${cnt}/${trm_maxretry}), uplink disabled (${trm_sysver})"
|
f_log "info " "can't connect to uplink '${sta_essid:-"-"}/${sta_bssid:-"-"}' (${cnt}/${trm_maxretry}), uplink disabled (${trm_sysver})"
|
||||||
else
|
else
|
||||||
if [ ${trm_maxretry} -eq 0 ]
|
if [ ${trm_maxretry} -eq 0 ]
|
||||||
then
|
then
|
||||||
|
@ -237,9 +248,9 @@ f_main()
|
||||||
fi
|
fi
|
||||||
uci -q revert wireless
|
uci -q revert wireless
|
||||||
f_check "dev"
|
f_check "dev"
|
||||||
f_log "info " "can't connect to uplink '${sta_ssid}' (${cnt}/${trm_maxretry}) (${trm_sysver})"
|
f_log "info " "can't connect to uplink '${sta_essid:-"-"}/${sta_bssid:-"-"}' (${cnt}/${trm_maxretry}) (${trm_sysver})"
|
||||||
fi
|
fi
|
||||||
f_jsnupdate "${sta_iface}" "${sta_radio}" "${sta_ssid}"
|
f_jsnupdate "${sta_iface}" "${sta_radio}" "${sta_essid}" "${sta_bssid}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
@ -250,16 +261,17 @@ f_main()
|
||||||
if [ ! -s "${trm_rtfile}" ]
|
if [ ! -s "${trm_rtfile}" ]
|
||||||
then
|
then
|
||||||
trm_ifstatus="false"
|
trm_ifstatus="false"
|
||||||
f_jsnupdate "n/a" "n/a" "n/a"
|
f_jsnupdate "n/a" "n/a" "n/a" "n/a"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [ ! -s "${trm_rtfile}" ]
|
if [ ! -s "${trm_rtfile}" ]
|
||||||
then
|
then
|
||||||
config="$(ubus -S call network.wireless status | jsonfilter -l1 -e '@.*.interfaces[@.config.mode="sta"].section')"
|
config="$(ubus -S call network.wireless status | jsonfilter -l1 -e '@.*.interfaces[@.config.mode="sta"].section')"
|
||||||
sta_radio="$(uci -q get wireless."${config}".device)"
|
sta_radio="$(uci -q get wireless."${config}".device)"
|
||||||
sta_ssid="$(uci -q get wireless."${config}".ssid)"
|
sta_essid="$(uci -q get wireless."${config}".ssid)"
|
||||||
|
sta_bssid="$(uci -q get wireless."${config}".bssid)"
|
||||||
sta_iface="$(uci -q get wireless."${config}".network)"
|
sta_iface="$(uci -q get wireless."${config}".network)"
|
||||||
f_jsnupdate "${sta_iface}" "${sta_radio}" "${sta_ssid}"
|
f_jsnupdate "${sta_iface}" "${sta_radio}" "${sta_essid}" "${sta_bssid}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue