Commit c14a5696 authored by Vitaly Lipatov's avatar Vitaly Lipatov

route-health: per-gateway failover, iperf3 checks, GRE detection fix

- Flush routes per dead gateway instead of waiting for entire group to die - Add iperf3 bandwidth (success=0 → dead) as third health signal - Ping threshold: >=50% loss is now dead (was 100%) - State tracking per gateway (.state/GROUP/gw-TAG/) - GRE detection: use link UP instead of RX bytes delta (fixes false disconnected status on idle tunnels) - Timer interval: 20s (was 1min) Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent 6fb0f9be
...@@ -105,20 +105,9 @@ fi ...@@ -105,20 +105,9 @@ fi
# --- GRE --- # --- GRE ---
if ip link show gre1 >/dev/null 2>&1; then if ip link show gre1 >/dev/null 2>&1; then
# GRE is stateless — link UP is the only reliable indicator
if ip -o link show gre1 2>/dev/null | grep -q UP; then if ip -o link show gre1 2>/dev/null | grep -q UP; then
# GRE is stateless; check RX bytes are changing via state file echo 'vpn_status type="gre",connected=1i'
rx=$(cat /sys/class/net/gre1/statistics/rx_bytes 2>/dev/null || echo 0)
state_file="$STATE_DIR/gre1_rx_prev"
prev_rx=$(cat "$state_file" 2>/dev/null || echo 0)
echo "$rx" > "$state_file"
if [ "$rx" != "$prev_rx" ] && [ "$prev_rx" != "0" ]; then
echo 'vpn_status type="gre",connected=1i'
elif [ "$prev_rx" = "0" ]; then
# First run, assume OK if link is UP
echo 'vpn_status type="gre",connected=1i'
else
echo 'vpn_status type="gre",connected=0i'
fi
else else
echo 'vpn_status type="gre",connected=0i' echo 'vpn_status type="gre",connected=0i'
fi fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment