mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-02-14 19:41:51 +00:00
Check huawei modem using interface ip
This commit is contained in:
parent
a8a858c6ed
commit
dbe5cdcf12
3 changed files with 7 additions and 5 deletions
|
@ -1,7 +1,9 @@
|
|||
#!/bin/sh
|
||||
MODEM_IP=`echo $1 | grep -E '^(192\.168|10\.|172\.1[6789]\.|172\.2[0-9]\.|172\.3[01]\.)'`
|
||||
INTF_IP=`echo $1 | grep -E '^(192\.168|10\.|172\.1[6789]\.|172\.2[0-9]\.|172\.3[01]\.)'`
|
||||
[ -z "$INTF_IP" ] && return
|
||||
MODEM_IP=`echo $2 | grep -E '^(192\.168|10\.|172\.1[6789]\.|172\.2[0-9]\.|172\.3[01]\.)'`
|
||||
[ -z "$MODEM_IP" ] && return
|
||||
INFO=$2
|
||||
INFO=$3
|
||||
SESTOK=$(curl -s -m 1 -X GET "http://$MODEM_IP/api/webserver/SesTokInfo")
|
||||
[ -z "$SESTOK" ] && return
|
||||
COOKIE=$(echo $SESTOK | sed -ne '/SesInfo/{s/.*<SesInfo>\(.*\)<\/SesInfo>.*/\1/p;q;}')
|
||||
|
|
|
@ -1282,8 +1282,8 @@ function interfaces_status()
|
|||
gw_ping6 = "DOWN"
|
||||
end
|
||||
end
|
||||
if uci:get("openmptcprouter", interface, "manufacturer") == "huawei" then
|
||||
intfdata = ut.trim(sys.exec("omr-huawei " .. gateway .. " all"))
|
||||
if uci:get("openmptcprouter", interface, "manufacturer") == "huawei" and ipaddr ~= "" then
|
||||
intfdata = ut.trim(sys.exec("omr-huawei " .. ipaddr .. " " .. gateway .. " all"))
|
||||
if intfdata ~= "" then
|
||||
signal = ut.trim(sys.exec("echo '".. intfdata .. "' | awk -F';' '{print $1}'"))
|
||||
operator = ut.trim(sys.exec("echo '".. intfdata .. "' | awk -F';' '{print $2}'"))
|
||||
|
|
|
@ -1189,7 +1189,7 @@ if [ "$(uci -q get openmptcprouter.$OMR_TRACKER_INTERFACE.lc)" = "" ] || [ $(($(
|
|||
# uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.state=$(echo $intfdata | awk -F";" '{print $4}')
|
||||
#else
|
||||
if [ "$proto" != "qmi" ] && [ "$proto" != "modemmanager" ]; then
|
||||
if [ -n "$OMR_TRACKER_DEVICE_GATEWAY" ] && [ -n "$(curl -s -m 2 -X GET http://$OMR_TRACKER_DEVICE_GATEWAY/api/webserver/SesTokInfo)" ]; then
|
||||
if [ -n "$OMR_TRACKER_DEVICE_GATEWAY" ] && [ -n "$OMR_TRACKER_DEVICE_IP" ] && [ -n "$(curl --interface $OMR_TRACKER_DEVICE_IP -s -m 2 -X GET http://$OMR_TRACKER_DEVICE_GATEWAY/api/webserver/SesTokInfo)" ]; then
|
||||
uci -q set openmptcprouter.$OMR_TRACKER_INTERFACE.manufacturer='huawei'
|
||||
else
|
||||
uci -q delete openmptcprouter.$OMR_TRACKER_INTERFACE.manufacturer
|
||||
|
|
Loading…
Reference in a new issue