Files
AuraVPN/crates
xah30 b904d40fba fix(cli): v3.4.5 — static-reservation IpPool always succeeds (#1 user retest)
Empirical observation from the v3.4.4 retest: the GUI's Connect button
now goes through cleanly, but if the user did `Disconnect → Connect` after
any prior ungraceful exit (SIGKILL, crash, network flap that hadn't yet
timed out), the new handshake immediately died with:

    Error: router run loop
    Caused by: peer connection closed; router shutting down

That's our v3.4 "peer connection broke" guard firing. Looking at the
server log, the cause was:

    WARN aura_cli::server: refusing connection: ip pool denied an address
    (unknown id under static_only, duplicate static reservation, or pool
    exhausted)

i.e. the static reservation `mac-v34 → 10.7.0.10` for the new connection
was refused because the previous (now-dead) session never released
10.7.0.10 from the pool's `in_use` set. Without restarting the systemd
unit, no reconnect was possible.

This was the previously-documented v1 policy ("do not hand out the same IP
twice"). For dynamic allocation that policy is correct — two different
clients fighting for the same IP would corrupt routing. But for STATIC
reservations there is no ambiguity: the static map says "this IP is
reserved for THIS client id", so a reconnect with the same id is the
rightful owner; the previous holder (same id) is by definition stale.

Fix: in `IpPool::assign`, when a static reservation matches the requested
client_id, always return it — skip the `in_use.contains(&ip)` check. The
server's accept loop already runs `ServerRoutes::register(ip, new_conn)`
which evicts any previously-registered conn under the same IP, drops its
Arc, the transport closes, and the orphaned per-conn task ends and calls
`pool.release` naturally. So the in_use marker is correctly cleared by
the eviction cascade within milliseconds of the new assign.

Test updated to match new behaviour:
  `static_reservation_refused_when_already_in_use` →
  `static_reservation_always_honoured_even_if_in_use`

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-29 22:22:47 +03:00
..