mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-02-24 14:54:24 +00:00
sync (#420)
This commit is contained in:
commit
c7639c97aa
4 changed files with 17 additions and 10 deletions
|
@ -145,8 +145,11 @@ else
|
||||||
ID=$(echo "${endpoint}" | sort | grep "dev $DEVICE " | awk '{print $3}')
|
ID=$(echo "${endpoint}" | sort | grep "dev $DEVICE " | awk '{print $3}')
|
||||||
IFF=$(echo "${endpoint}" | sort | grep -m 1 -E "dev $DEVICE " | awk '{print $4}')
|
IFF=$(echo "${endpoint}" | sort | grep -m 1 -E "dev $DEVICE " | awk '{print $4}')
|
||||||
#IP=$(ip a show $DEVICE | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p')
|
#IP=$(ip a show $DEVICE | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p')
|
||||||
[ -f /usr/bin/jsonfilter ] && IP=$(ip -j a show $DEVICE | jsonfilter -e '@[0].addr_info[*].local')
|
if [ -f /usr/bin/jsonfilter ]; then
|
||||||
[ -f /usr/bin/jq ] && IP=$(ip -j a show $DEVICE | jq -r '.[0].addr_info[].local')
|
IP=$(ip -j a show $DEVICE scope global | jsonfilter -e '@[0].addr_info[*].local')
|
||||||
|
elif [ -f /usr/bin/jq ]; then
|
||||||
|
IP=$(ip -j a show $DEVICE scope global | jq -r '.[0].addr_info[].local')
|
||||||
|
fi
|
||||||
[ -z "$ID" ] && [ -n "$IP" ] && ID=$(echo "${endpoint}" show | grep "$IP " | awk '{print $3}')
|
[ -z "$ID" ] && [ -n "$IP" ] && ID=$(echo "${endpoint}" show | grep "$IP " | awk '{print $3}')
|
||||||
RMID=$(echo "${endpoint}" | grep '::ffff' | awk '{ print $3 }')
|
RMID=$(echo "${endpoint}" | grep '::ffff' | awk '{ print $3 }')
|
||||||
[ -n "$RMID" ] && ip mptcp endpoint delete id $RMID 2>&1 >/dev/null
|
[ -n "$RMID" ] && ip mptcp endpoint delete id $RMID 2>&1 >/dev/null
|
||||||
|
|
|
@ -1061,7 +1061,7 @@ fi
|
||||||
|
|
||||||
if [ -n "$OMR_TRACKER_INTERFACE" ] && [ -n "$OMR_TRACKER_DEVICE" ]; then
|
if [ -n "$OMR_TRACKER_INTERFACE" ] && [ -n "$OMR_TRACKER_DEVICE" ]; then
|
||||||
metric="$(uci -q get network.$OMR_TRACKER_INTERFACE.metric)"
|
metric="$(uci -q get network.$OMR_TRACKER_INTERFACE.metric)"
|
||||||
if [ -z "$metric" ] || [ -z "$(ip route show table $metric | grep $OMR_TRACKER_DEVICE)" ]; then
|
if [ -z "$metric" ] || ([ -n "$OMR_TRACKER_DEVICE_IP" ] && [ -z "$(ip route show table $metric | grep $OMR_TRACKER_DEVICE)" ]) || ([ -n "$OMR_TRACKER_DEVICE_IP6" ] && [ -z "$(ip -6 route show table $metric | grep $OMR_TRACKER_DEVICE)" ]); then
|
||||||
/etc/init.d/mptcp reload "$OMR_TRACKER_DEVICE"
|
/etc/init.d/mptcp reload "$OMR_TRACKER_DEVICE"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -130,6 +130,9 @@ _add_fwmark_chain() {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_remove_old_ipset_dnsmasq() {
|
||||||
|
[ -n "$(uci -q get dhcp.${1}.name | grep omr)" ] && uci -q delete dhcp.$1
|
||||||
|
}
|
||||||
_remove_ipset_dnsmasq() {
|
_remove_ipset_dnsmasq() {
|
||||||
[ -n "$(echo $1 | grep omr_dscp)" ] && uci -q delete dhcp.$1
|
[ -n "$(echo $1 | grep omr_dscp)" ] && uci -q delete dhcp.$1
|
||||||
}
|
}
|
||||||
|
@ -151,6 +154,7 @@ _cleanup() {
|
||||||
uci -q del dhcp.@dnsmasq[0].ipset
|
uci -q del dhcp.@dnsmasq[0].ipset
|
||||||
config_load dhcp
|
config_load dhcp
|
||||||
config_foreach _remove_ipset_dnsmasq
|
config_foreach _remove_ipset_dnsmasq
|
||||||
|
config_foreach _remove_old_ipset_dnsmasq
|
||||||
config_load firewall
|
config_load firewall
|
||||||
config_foreach _remove_rules
|
config_foreach _remove_rules
|
||||||
uci -q commit dhcp
|
uci -q commit dhcp
|
||||||
|
|
|
@ -323,7 +323,7 @@ while true; do
|
||||||
if ([ "$OMR_TRACKER_IPV6" = "1" ] || [ "$OMR_TRACKER_IPV6" = "auto" ] || [ -z "$OMR_TRACKER_IPV6" ]) && ([ "$OMR_TRACKER_FAMILY" = "ipv6" ] || [ "$OMR_TRACKER_FAMILY" = "ipv4ipv6" ]); then
|
if ([ "$OMR_TRACKER_IPV6" = "1" ] || [ "$OMR_TRACKER_IPV6" = "auto" ] || [ -z "$OMR_TRACKER_IPV6" ]) && ([ "$OMR_TRACKER_FAMILY" = "ipv6" ] || [ "$OMR_TRACKER_FAMILY" = "ipv4ipv6" ]); then
|
||||||
#OMR_TRACKER_DEVICE_IP6=$(ip -6 -br addr ls dev "$OMR_TRACKER_DEVICE" | awk -F'[ /]+' '{print $3}')
|
#OMR_TRACKER_DEVICE_IP6=$(ip -6 -br addr ls dev "$OMR_TRACKER_DEVICE" | awk -F'[ /]+' '{print $3}')
|
||||||
#if [ -z "$OMR_TRACKER_DEVICE_IP6" ]; then
|
#if [ -z "$OMR_TRACKER_DEVICE_IP6" ]; then
|
||||||
OMR_TRACKER_DEVICE_IP6=$(ip -6 addr show dev "$OMR_TRACKER_DEVICE" | sort -r | grep -m 1 inet6 | awk '{print $2}' | cut -d'/' -s -f1)
|
OMR_TRACKER_DEVICE_IP6=$(ip -6 addr show dev "$OMR_TRACKER_DEVICE" scope global | sort -r | grep -m 1 inet6 | awk '{print $2}' | cut -d'/' -s -f1)
|
||||||
#fi
|
#fi
|
||||||
if [ -z "$OMR_TRACKER_DEVICE_GATEWAY6" ]; then
|
if [ -z "$OMR_TRACKER_DEVICE_GATEWAY6" ]; then
|
||||||
OMR_TRACKER_DEVICE_GATEWAY6=$(uci -q get "network.$OMR_TRACKER_INTERFACE.ip6gw")
|
OMR_TRACKER_DEVICE_GATEWAY6=$(uci -q get "network.$OMR_TRACKER_INTERFACE.ip6gw")
|
||||||
|
@ -501,10 +501,10 @@ while true; do
|
||||||
_ping "$OMR_TRACKER_HOST6" "$OMR_TRACKER_DEVICE" "yes"
|
_ping "$OMR_TRACKER_HOST6" "$OMR_TRACKER_DEVICE" "yes"
|
||||||
statusb=$?
|
statusb=$?
|
||||||
elif [ "$OMR_TRACKER_TYPE" = "httping" ]; then
|
elif [ "$OMR_TRACKER_TYPE" = "httping" ]; then
|
||||||
_httping "$OMR_TRACKER_HOST6" "$OMR_TRACKER_DEVICE_IP" "yes"
|
_httping "$OMR_TRACKER_HOST6" "$OMR_TRACKER_DEVICE_IP6" "yes"
|
||||||
statusb=$?
|
statusb=$?
|
||||||
elif [ "$OMR_TRACKER_TYPE" = "dns" ]; then
|
elif [ "$OMR_TRACKER_TYPE" = "dns" ]; then
|
||||||
_dns "$OMR_TRACKER_HOST6" "$OMR_TRACKER_DEVICE_IP" "yes"
|
_dns "$OMR_TRACKER_HOST6" "$OMR_TRACKER_DEVICE_IP6" "yes"
|
||||||
statusb=$?
|
statusb=$?
|
||||||
fi
|
fi
|
||||||
ip -6 route del "$OMR_TRACKER_HOST6" via "$OMR_TRACKER_DEVICE_GATEWAY6" dev "$OMR_TRACKER_DEVICE" src "$OMR_TRACKER_DEVICE_IP6" > /dev/null 2>&1
|
ip -6 route del "$OMR_TRACKER_HOST6" via "$OMR_TRACKER_DEVICE_GATEWAY6" dev "$OMR_TRACKER_DEVICE" src "$OMR_TRACKER_DEVICE_IP6" > /dev/null 2>&1
|
||||||
|
@ -530,7 +530,7 @@ while true; do
|
||||||
if [ "$serverip_ping" != false ] && [ "$OMR_TRACKER_STATUS" = "OK" ] && [ "$OMR_TRACKER_TYPE" != "httping" ] && [ "$OMR_TRACKER_SERVER_HTTP_TEST" = "1" ]; then
|
if [ "$serverip_ping" != false ] && [ "$OMR_TRACKER_STATUS" = "OK" ] && [ "$OMR_TRACKER_TYPE" != "httping" ] && [ "$OMR_TRACKER_SERVER_HTTP_TEST" = "1" ]; then
|
||||||
serverip_ping=false
|
serverip_ping=false
|
||||||
config_load openmptcprouter
|
config_load openmptcprouter
|
||||||
config_foreach _httping_server server $OMR_TRACKER_DEVICE_IP
|
config_foreach _httping_server server $OMR_TRACKER_DEVICE_IP6
|
||||||
if [ "$serverip_ping" = false ]; then
|
if [ "$serverip_ping" = false ]; then
|
||||||
OMR_TRACKER_STATUS_MSG="No access to server API"
|
OMR_TRACKER_STATUS_MSG="No access to server API"
|
||||||
#OMR_TRACKER_STATUS="ERROR"
|
#OMR_TRACKER_STATUS="ERROR"
|
||||||
|
@ -554,7 +554,7 @@ while true; do
|
||||||
sleep "${OMR_TRACKER_INTERVAL_TRIES:-1}"
|
sleep "${OMR_TRACKER_INTERVAL_TRIES:-1}"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
if [ -z "$OMR_TRACKER_DEVICE_IP" ] || [ -z "$OMR_TRACKER_DEVICE_GATEWAY" ] || [ -z "$OMR_TRACKER_DEVICE_IP6" ] || [ -z "$OMR_TRACKER_DEVICE_GATEWAY6" ]; then
|
if [ "$OMR_TRACKER_STATUS" = "ERROR" ] && ([ -z "$OMR_TRACKER_DEVICE_IP" ] || [ -z "$OMR_TRACKER_DEVICE_GATEWAY" ] || [ -z "$OMR_TRACKER_DEVICE_IP6" ] || [ -z "$OMR_TRACKER_DEVICE_GATEWAY6" ]); then
|
||||||
[ -z "$OMR_TRACKER_STATUS_MSG" ] && OMR_TRACKER_STATUS_MSG="$OMR_TRACKER_INTERFACE may have ip issues"
|
[ -z "$OMR_TRACKER_STATUS_MSG" ] && OMR_TRACKER_STATUS_MSG="$OMR_TRACKER_INTERFACE may have ip issues"
|
||||||
[ -z "$OMR_TRACKER_DEVICE_IP" ] && OMR_TRACKER_STATUS_MSG="$OMR_TRACKER_STATUS_MSG, interface have no IPv4"
|
[ -z "$OMR_TRACKER_DEVICE_IP" ] && OMR_TRACKER_STATUS_MSG="$OMR_TRACKER_STATUS_MSG, interface have no IPv4"
|
||||||
[ -z "$OMR_TRACKER_DEVICE_GATEWAY" ] && OMR_TRACKER_STATUS_MSG="$OMR_TRACKER_STATUS_MSG, interface have no IPv4 gateway"
|
[ -z "$OMR_TRACKER_DEVICE_GATEWAY" ] && OMR_TRACKER_STATUS_MSG="$OMR_TRACKER_STATUS_MSG, interface have no IPv4 gateway"
|
||||||
|
@ -577,9 +577,9 @@ while true; do
|
||||||
fi
|
fi
|
||||||
if [ "$OMR_TRACKER_LIST_HOSTS6" != "" ]; then
|
if [ "$OMR_TRACKER_LIST_HOSTS6" != "" ]; then
|
||||||
if [ "$OMR_TRACKER_STATUS_MSG" = "" ]; then
|
if [ "$OMR_TRACKER_STATUS_MSG" = "" ]; then
|
||||||
OMR_TRACKER_STATUS_MSG="$OMR_TRACKER_TYPE from $OMR_TRACKER_DEVICE_IP error ($OMR_TRACKER_LIST_HOSTS6)"
|
OMR_TRACKER_STATUS_MSG="$OMR_TRACKER_TYPE from $OMR_TRACKER_DEVICE_IP6 error ($OMR_TRACKER_LIST_HOSTS6)"
|
||||||
else
|
else
|
||||||
OMR_TRACKER_STATUS_MSG="$OMR_TRACKER_STATUS_MSG and $OMR_TRACKER_TYPE from $OMR_TRACKER_DEVICE_IP error ($OMR_TRACKER_LIST_HOSTS6)"
|
OMR_TRACKER_STATUS_MSG="$OMR_TRACKER_STATUS_MSG and $OMR_TRACKER_TYPE from $OMR_TRACKER_DEVICE_IP6 error ($OMR_TRACKER_LIST_HOSTS6)"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ "$OMR_TRACKER_CHECK_QUALITY" = "1" ]; then
|
if [ "$OMR_TRACKER_CHECK_QUALITY" = "1" ]; then
|
||||||
|
|
Loading…
Reference in a new issue