This commit is contained in:
parent
5e4cda9c1c
commit
d62ae374a9
@ -25,29 +25,35 @@ while /bin/true; do
|
|||||||
for i in ${!STATIC_ROUTE_NEXTHOPS[@]}; do
|
for i in ${!STATIC_ROUTE_NEXTHOPS[@]}; do
|
||||||
nexthop="${STATIC_ROUTE_NEXTHOPS[i]}"
|
nexthop="${STATIC_ROUTE_NEXTHOPS[i]}"
|
||||||
if [[ $nexthop == *"."* ]]; then
|
if [[ $nexthop == *"."* ]]; then
|
||||||
neigh_state=( $(ip -4 neigh show | grep -w $nexthop | tr -s ' ' | cut -d ' ' -f 3,4) )
|
neigh_state=$(ip -4 neigh show | grep -w $nexthop | tr -s ' ')
|
||||||
ping_prefix=ping
|
ping_prefix=ping
|
||||||
elif [[ $nexthop == *":"* ]] ; then
|
elif [[ $nexthop == *":"* ]] ; then
|
||||||
neigh_state=( $(ip -6 neigh show | grep -w $nexthop | tr -s ' ' | cut -d ' ' -f 3,4) )
|
neigh_state=$(ip -6 neigh show | grep -w $nexthop | tr -s ' ')
|
||||||
ping_prefix=ping6
|
ping_prefix=ping6
|
||||||
fi
|
fi
|
||||||
if [[ -z "${neigh_state}" ]] || [[ "${neigh_state[1]}" == "INCOMPLETE" ]] || [[ "${neigh_state[1]}" == "FAILED" ]]; then
|
# Check if there is an INCOMPLETE, FAILED, or STALE entry and try to resolve it again.
|
||||||
|
# STALE entries may be present if there is no traffic on a path. A far-end down event may not
|
||||||
|
# clear the STALE entry. Refresh the STALE entry to clear the table.
|
||||||
|
if [[ -z "${neigh_state}" ]] || [[ -n $(echo ${neigh_state} | grep 'INCOMPLETE\|FAILED\|STALE') ]]; then
|
||||||
interface="${STATIC_ROUTE_IFNAMES[i]}"
|
interface="${STATIC_ROUTE_IFNAMES[i]}"
|
||||||
if [[ -z "$interface" ]]; then
|
if [[ -z "$interface" ]]; then
|
||||||
# should never be here, handling just in case
|
# should never be here, handling just in case
|
||||||
logger "ERR: arp_update: missing interface entry for static route $nexthop"
|
logger "ERR: arp_update: missing interface entry for static route $nexthop"
|
||||||
interface=${neigh_state[0]}
|
continue
|
||||||
fi
|
fi
|
||||||
intf_up=$(ip link show $interface | grep "state UP")
|
intf_up=$(ip link show $interface | grep "state UP")
|
||||||
if [[ -n "$intf_up" ]]; then
|
if [[ -n "$intf_up" ]]; then
|
||||||
pingcmd="timeout 0.2 $ping_prefix -I ${interface} -n -q -i 0 -c 1 -W 1 $nexthop >/dev/null"
|
pingcmd="timeout 0.2 $ping_prefix -I ${interface} -n -q -i 0 -c 1 -W 1 $nexthop >/dev/null"
|
||||||
eval $pingcmd
|
eval $pingcmd
|
||||||
logger "arp_update: static route nexthop not resolved, pinging $nexthop on ${neigh_state[0]}"
|
# STALE entries may appear more often, not logging to prevent periodic syslogs
|
||||||
|
if [[ -z $(echo ${neigh_state} | grep 'STALE') ]]; then
|
||||||
|
logger "arp_update: static route nexthop not resolved ($neigh_state), pinging $nexthop on $interface"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
sleep 300
|
sleep 150
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
# find L3 interfaces which are UP, send ipv6 multicast pings
|
# find L3 interfaces which are UP, send ipv6 multicast pings
|
||||||
|
Reference in New Issue
Block a user