1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-02-15 03:51:51 +00:00

Fix tracker for DHCPv6

This commit is contained in:
Ycarus (Yannick Chabanois) 2021-02-19 15:39:00 +01:00
parent f29538776a
commit 275b9fcc06
2 changed files with 9 additions and 1 deletions

View file

@ -24,6 +24,8 @@ export OMR_TRACKER_DEVICE_IP
export OMR_TRACKER_DEVICE_IP6
export OMR_TRACKER_DEVICE_GATEWAY
export OMR_TRACKER_DEVICE_GATEWAY6
export OMR_TRACKER_IPV6
export OMR_TRACKER_PROTO
dscp=56 # set DSCP CS7 (56) in outgoing packets
initial_hosts="$OMR_TRACKER_HOSTS"
@ -279,6 +281,7 @@ while true; do
OMR_TRACKER_DEVICE_GATEWAY=$(ip -4 r list dev "$OMR_TRACKER_DEVICE" | grep kernel | awk '/proto kernel/ {print $1}' | tr -d "\n")
fi
fi
if [ "$OMR_TRACKER_INTERFACE_IPV6" = "1" ] || [ "$OMR_TRACKER_INTERFACE_IPV6" = "auto" ]; then
#OMR_TRACKER_DEVICE_IP6=$(ip -6 -br addr ls dev "$OMR_TRACKER_DEVICE" | awk -F'[ /]+' '{print $3}')
#if [ -z "$OMR_TRACKER_DEVICE_IP6" ]; then
OMR_TRACKER_DEVICE_IP6=$(ip -6 addr show dev "$OMR_TRACKER_DEVICE" | grep -v 'inet6 f' | grep -m 1 inet | awk '{print $2}' | cut -d'/' -s -f1)
@ -301,6 +304,7 @@ while true; do
if [ -z "$OMR_TRACKER_DEVICE_GATEWAY6" ] || [ "$OMR_TRACKER_DEVICE_GATEWAY6" = "::" ]; then
OMR_TRACKER_DEVICE_GATEWAY6=$(ubus call network.interface.$OMR_TRACKER_INTERFACE status | jsonfilter -q -l 1 -e '@.route[@.nexthop="::"].target' | tr -d "\n")
fi
fi
# execute specific tracker
if [ -n "$OMR_TRACKER_DEVICE_IP" ] && [ -n "$OMR_TRACKER_DEVICE_GATEWAY" ]; then

View file

@ -46,7 +46,7 @@ _launch_tracker() {
loopback|lan*|if0*) return;;
esac
local hosts hosts6 timeout tries interval interval_tries options type enabled wait_test
local hosts hosts6 timeout tries interval interval_tries options type enabled wait_test ipv6 proto
_validate_section "defaults" "defaults"
_validate_section "interface" "$1"
@ -59,6 +59,8 @@ _launch_tracker() {
config_get multipath "$1" multipath
config_get ifenabled "$1" auto
config_get gateway "$1" gateway
config_get ipv6 "$1" ipv6
config_get proto "$1" proto
[ -z "$ifname" ] || [ -z "$multipath" ] || [ "$multipath" = "off" ] && [ "$1" != "glorytun" ] && [ "$1" != "omrvpn" ] && [ "$( uci -q get openmptcprouter.$1.multipathvpn)" != "1" ] && return
[ "${ifenabled}" = "0" ] && return
@ -79,6 +81,8 @@ _launch_tracker() {
procd_append_param env "OMR_TRACKER_DEVICE=$ifname"
procd_append_param env "OMR_TRACKER_DEVICE_GATEWAY=$gateway"
procd_append_param env "OMR_TRACKER_TYPE=$type"
procd_append_param env "OMR_TRACKER_IPV6=$ipv6"
procd_append_param env "OMR_TRACKER_PROTO=$proto"
procd_append_param env "OMR_TRACKER_WAIT_TEST=$wait_test"
procd_set_param limits nofile="51200 51200"
procd_set_param respawn 0 10 0