mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Add another way to get interface IP
This commit is contained in:
parent
9b17deeb98
commit
b7d380da31
1 changed files with 3 additions and 0 deletions
|
@ -149,6 +149,9 @@ while true; do
|
||||||
if [ -d "/sys/class/net/$OMR_TRACKER_DEVICE" ]; then
|
if [ -d "/sys/class/net/$OMR_TRACKER_DEVICE" ]; then
|
||||||
# retrieve iface ip and gateway
|
# retrieve iface ip and gateway
|
||||||
OMR_TRACKER_DEVICE_IP=$(ip -4 -br addr ls dev "$OMR_TRACKER_DEVICE" | awk -F'[ /]+' '{print $3}')
|
OMR_TRACKER_DEVICE_IP=$(ip -4 -br addr ls dev "$OMR_TRACKER_DEVICE" | awk -F'[ /]+' '{print $3}')
|
||||||
|
if [ -z "$OMR_TRACKER_DEVICE_IP" ]; then
|
||||||
|
OMR_TRACKER_DEVICE_IP=$(ip -4 addr show dev "$OMR_TRACKER_DEVICE" | grep -m 1 inet | awk '{print $2}' | cur -d'/' -s -f1)
|
||||||
|
fi
|
||||||
#OMR_TRACKER_DEVICE_IP=$(ubus call network.interface.$OMR_TRACKER_INTERFACE status | jsonfilter -e '@["ipv4-address"][0].address' | tr -d "\n")
|
#OMR_TRACKER_DEVICE_IP=$(ubus call network.interface.$OMR_TRACKER_INTERFACE status | jsonfilter -e '@["ipv4-address"][0].address' | tr -d "\n")
|
||||||
#if [ -z "$OMR_TRACKER_DEVICE_GATEWAY" ]; then
|
#if [ -z "$OMR_TRACKER_DEVICE_GATEWAY" ]; then
|
||||||
# OMR_TRACKER_DEVICE_GATEWAY=$(ip -4 r list dev "$OMR_TRACKER_DEVICE" | grep -v default | awk '/proto static/ {print $1}' | tr -d "\n")
|
# OMR_TRACKER_DEVICE_GATEWAY=$(ip -4 r list dev "$OMR_TRACKER_DEVICE" | grep -v default | awk '/proto static/ {print $1}' | tr -d "\n")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue