vrrp-wan: size GRACE from the measured hostile failover, not the theory
Some checks failed
Some checks failed
With the matrix actually setting session-control, T4 timed a destroyed
master's takeover at:
replace 26s
deny 148s <-- sizing case
disable 21s
`deny` is the case GRACE exists for: the AC refuses the survivor until its own
dead-peer timer frees the dead session. The session poller caught it happening
-- the destroyed router's session stayed in the table while the survivor's
dials appeared and were rejected, twice, before one took at 148s.
148s is well past the lcp-echo-interval(30) x failure(3) = 90s budget that 180
was sized against, leaving 32s of margin. GRACE=300 is ~2x the worst observed.
Treat 148s as a floor, not a worst case: these are idle 2-vCPU VMs, and the AC
shares an OVS bridge with the routers, so `virsh destroy` removes the port and
accel-ppp sees the peer vanish. A real BRAS over DSL never learns our router
died and waits out longer timers of its own.
The cost is stated in the conf: GRACE is also how long an alive-but-unroutable
master holds every VIP before yielding. bond0.53 covers most of that -- a DHCP
lease satisfies the check in seconds -- so GRACE only dominates when PPPoE is
the last path. Kept the health check's fallback in step, since keepalived runs
it with no environment and that number decides mastership if the conf is ever
missing.
check_invariant no longer fails blind on the AC's session count. That count is
only a proxy for "two of our routers dialled", and only while the AC enforces
single-session; under `disable` it does not, so a destroyed router's session
lingers and the count reads 2 with exactly one live router dialled. The real
invariant -- at most one router holds pppoe0 -- is now the failing one, and the
stale session is reported as a WARN rather than silenced, because it still
occupies the slot at a real ISP and is precisely what made `deny` take 148s.
This commit is contained in:
@@ -95,11 +95,35 @@ status() { r "$1" 'sudo /config/vrrp-wan-reconcile --status'; }
|
||||
ppp_holders() { n=0; for h in "$R1" "$R2"; do
|
||||
[ "$(ppp_on "$h")" != 0 ] && n=$((n+1)); done; echo "$n"; }
|
||||
|
||||
warn() { printf ' \033[33mWARN\033[0m %s\n' "$*"; }
|
||||
|
||||
check_invariant() {
|
||||
local s p ok=0
|
||||
s="$(ac_sessions)"; p="$(ppp_holders)"
|
||||
[ "${s:-0}" -le 1 ] || { fail "INVARIANT: AC reports $s simdsl sessions"; ok=1; }
|
||||
|
||||
# THE invariant. Two of OUR routers dialled at once is the failure that
|
||||
# matters: one ISP account, and against a real ISP that is how you get
|
||||
# rate-limited or locked out.
|
||||
[ "${p:-0}" -le 1 ] || { fail "INVARIANT: $p routers hold pppoe0"; ok=1; }
|
||||
|
||||
# The AC's session count is a PROXY for the above, and only a valid one
|
||||
# while the AC enforces single-session. Under session-control=disable it
|
||||
# does not, so a destroyed router's session simply stays in the table and
|
||||
# the count reads 2 while exactly one live router is dialled -- which is AC
|
||||
# bookkeeping, not a double dial. Attribute it rather than failing blind:
|
||||
# only call it a violation when more than one router is ACTUALLY dialled.
|
||||
#
|
||||
# Do not silence it either. An orphaned session still occupies the single
|
||||
# slot at a real ISP, and that is exactly what made session-control=deny
|
||||
# take 148s while the survivor's dial attempts were refused.
|
||||
if [ "${s:-0}" -gt 1 ]; then
|
||||
if [ "${p:-0}" -gt 1 ]; then
|
||||
fail "INVARIANT: AC reports $s simdsl sessions AND $p routers are dialled"
|
||||
ok=1
|
||||
else
|
||||
warn "AC reports $s simdsl sessions but only ${p:-0} router is dialled -- stale session from the destroyed peer (expected where the AC does not enforce single-session; it is what a hostile AC holds against the survivor)"
|
||||
fi
|
||||
fi
|
||||
return $ok
|
||||
}
|
||||
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
=== 2026-09-06T00:13:35+01:00 ===
|
||||
=== 2026-09-06T00:21:00+01:00 ===
|
||||
--- AC sessions ---
|
||||
ifname | username | ip | ip6 | ip6-dp | calling-sid | rate-limit | state | uptime | rx-bytes | tx-bytes
|
||||
--------+----------+----------------+-----+--------+-------------------+------------+--------+----------+----------+----------
|
||||
ppp0 | simdsl | 198.51.100.128 | | | 52:54:00:e5:95:a2 | | active | 00:00:31 | 514 B | 204 B
|
||||
ppp0 | simdsl | 198.51.100.130 | | | 52:54:00:e5:95:a2 | | active | 00:00:18 | 438 B | 204 B
|
||||
--- 172.31.1.252 ---
|
||||
vip=172.31.1.1 holds_vip=yes wan_disabled=no wan_up=yes ppp_up=yes ppp_active=yes may_dial=yes lease_age=0 dropin=yes role=master
|
||||
pppoe0 UNKNOWN 198.51.100.128 peer 198.51.100.1/32
|
||||
vip=172.31.1.1 holds_vip=yes wan_disabled=no wan_up=yes ppp_up=yes ppp_active=yes may_dial=yes lease_age=30 dropin=yes role=master
|
||||
pppoe0 UNKNOWN 198.51.100.130 peer 198.51.100.1/32
|
||||
default via 203.0.113.1 dev bond0.53 proto failover metric 1
|
||||
Sep 05 23:06:18 apitest vrrp-wan[18704]: MASTER with bond0.53 disabled -> enabling
|
||||
Sep 05 23:06:22 apitest vrrp-wan[19398]: bond0.53 enable commit took 4s
|
||||
Sep 05 23:07:35 apitest vrrp-wan[22111]: GUARD: lease stale (206s > 75s; is vrrp-wan-reconcile.timer running?) -- hanging up pppoe0
|
||||
Sep 05 23:07:43 apitest vrrp-wan[22667]: MASTER: dialling pppoe0
|
||||
Sep 05 23:08:14 apitest vrrp-wan[24120]: MASTER: dialling pppoe0
|
||||
-- Boot c5f23399239b468c8c8b752a4305c515 --
|
||||
Sep 05 23:13:04 apitest vrrp-wan[6261]: MASTER: dialling pppoe0
|
||||
Sep 05 23:13:04 apitest vrrp-wan[6413]: MASTER with bond0.53 disabled -> enabling
|
||||
Sep 05 23:13:08 apitest vrrp-wan[7122]: bond0.53 enable commit took 4s
|
||||
-- Boot 46727d256db344d6ad4b37c142272071 --
|
||||
Sep 05 23:18:31 apitest vrrp-wan[6258]: MASTER: dialling pppoe0
|
||||
Sep 05 23:18:31 apitest vrrp-wan[6411]: MASTER with bond0.53 disabled -> enabling
|
||||
Sep 05 23:18:36 apitest vrrp-wan[7038]: bond0.53 enable commit took 5s
|
||||
--- 172.31.1.253 ---
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
=== 2026-09-06T00:23:19+01:00 ===
|
||||
--- AC sessions ---
|
||||
ifname | username | ip | ip6 | ip6-dp | calling-sid | rate-limit | state | uptime | rx-bytes | tx-bytes
|
||||
--------+----------+----------------+-----+--------+-------------------+------------+--------+----------+----------+----------
|
||||
ppp0 | simdsl | 198.51.100.130 | | | 52:54:00:e5:95:a2 | | active | 00:02:37 | 438 B | 204 B
|
||||
ppp1 | simdsl | 198.51.100.131 | | | 52:54:00:4e:0b:56 | | active | 00:00:27 | 1.1 KiB | 204 B
|
||||
--- 172.31.1.252 ---
|
||||
--- 172.31.1.253 ---
|
||||
vip=172.31.1.1 holds_vip=yes wan_disabled=no wan_up=yes ppp_up=yes ppp_active=yes may_dial=yes lease_age=15 dropin=yes role=master
|
||||
pppoe0 UNKNOWN 198.51.100.131 peer 198.51.100.1/32
|
||||
default nhid 57 dev pppoe0 proto static metric 20
|
||||
Sep 05 23:10:44 vyos vrrp-wan[221212]: MASTER with bond0.53 disabled -> enabling
|
||||
Sep 05 23:10:48 vyos vrrp-wan[221995]: bond0.53 enable commit took 4s
|
||||
-- Boot 1f635fc6900c4661b3ac6d016d63d293 --
|
||||
Sep 05 23:16:10 vyos vrrp-wan[7037]: MASTER: dialling pppoe0
|
||||
Sep 05 23:16:11 vyos vrrp-wan[7190]: MASTER with bond0.53 disabled -> enabling
|
||||
Sep 05 23:16:15 vyos vrrp-wan[7979]: bond0.53 enable commit took 4s
|
||||
-- Boot c0e38585d7354ad6ab018800c7f3f6be --
|
||||
Sep 05 23:22:54 vyos vrrp-wan[5970]: MASTER: dialling pppoe0
|
||||
Sep 05 23:22:54 vyos vrrp-wan[6126]: MASTER with bond0.53 disabled -> enabling
|
||||
Sep 05 23:22:59 vyos vrrp-wan[6915]: bond0.53 enable commit took 5s
|
||||
@@ -1,18 +1,19 @@
|
||||
=== 2026-09-06T00:11:13+01:00 ===
|
||||
=== 2026-09-06T00:16:41+01:00 ===
|
||||
--- AC sessions ---
|
||||
ifname | username | ip | ip6 | ip6-dp | calling-sid | rate-limit | state | uptime | rx-bytes | tx-bytes
|
||||
--------+----------+----------------+-----+--------+-------------------+------------+--------+----------+----------+----------
|
||||
ppp0 | simdsl | 198.51.100.127 | | | 52:54:00:4e:0b:56 | | active | 00:00:30 | 514 B | 204 B
|
||||
ppp0 | simdsl | 198.51.100.129 | | | 52:54:00:4e:0b:56 | | active | 00:00:31 | 438 B | 204 B
|
||||
--- 172.31.1.252 ---
|
||||
--- 172.31.1.253 ---
|
||||
vip=172.31.1.1 holds_vip=yes wan_disabled=no wan_up=yes ppp_up=yes ppp_active=yes may_dial=yes lease_age=10 dropin=yes role=master
|
||||
pppoe0 UNKNOWN 198.51.100.127 peer 198.51.100.1/32
|
||||
default nhid 110 dev pppoe0 proto static metric 20
|
||||
Sep 05 22:57:40 vyos vrrp-wan[199948]: GUARD: lease stale (81s > 75s; is vrrp-wan-reconcile.timer running?) -- hanging up pppoe0
|
||||
Sep 05 23:02:41 vyos vrrp-wan[206596]: MASTER: dialling pppoe0
|
||||
Sep 05 23:06:17 vyos vrrp-wan[213698]: not MASTER: hanging up pppoe0
|
||||
vip=172.31.1.1 holds_vip=yes wan_disabled=no wan_up=yes ppp_up=yes ppp_active=yes may_dial=yes lease_age=22 dropin=yes role=master
|
||||
pppoe0 UNKNOWN 198.51.100.129 peer 198.51.100.1/32
|
||||
default nhid 62 dev pppoe0 proto static metric 20
|
||||
Sep 05 23:06:18 vyos vrrp-wan[213859]: not MASTER but bond0.53 enabled -> releasing
|
||||
Sep 05 23:06:23 vyos vrrp-wan[214503]: bond0.53 disable commit took 5s
|
||||
Sep 05 23:10:43 vyos vrrp-wan[221064]: MASTER: dialling pppoe0
|
||||
Sep 05 23:10:44 vyos vrrp-wan[221212]: MASTER with bond0.53 disabled -> enabling
|
||||
Sep 05 23:10:48 vyos vrrp-wan[221995]: bond0.53 enable commit took 4s
|
||||
-- Boot 1f635fc6900c4661b3ac6d016d63d293 --
|
||||
Sep 05 23:16:10 vyos vrrp-wan[7037]: MASTER: dialling pppoe0
|
||||
Sep 05 23:16:11 vyos vrrp-wan[7190]: MASTER with bond0.53 disabled -> enabling
|
||||
Sep 05 23:16:15 vyos vrrp-wan[7979]: bond0.53 enable commit took 4s
|
||||
|
||||
Reference in New Issue
Block a user