mirror of
https://github.com/rustdesk/rustdesk-server.git
synced 2026-11-26 15:54:36 +00:00
* Match IPv4 clients against the relay lists in their IPv4 form hbbr listens dual-stack by default, so a direct IPv4 client reaches relay() as ::ffff:a.b.c.d. relay() checked BLACKLIST and BLOCKLIST with that form, while the lists hold the plain IPv4 that `ba` and `Ba` are given. A blacklisted IPv4 client was therefore never throttled, and adding it to the blocklist did not end its session. handle_connection already normalizes with try_into_v4 for its accept-time check; relay() now does the same. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JAxkkiaGp2k8okvs4MpCUq * Keep IPv4-mapped list entries matching in relay() The previous commit looked the lists up in the plain IPv4 form only, so an entry in the ::ffff:a.b.c.d form stopped matching. That is the form `usage` and the pairing logs print, so an admin copying an address from them, or an existing list file holding one, lost the throttle and the mid-session blocklist check. relay() now matches either form. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JAxkkiaGp2k8okvs4MpCUq * Match either form of an IPv4-mapped client at accept too handle_connection checked the blocklist in plain IPv4 form only, so an entry in the ::ffff: form, the one usage prints, let the client connect. If that client was the leg parked first, relay() never checks it and the whole session ran. It now matches either form, as relay() does. The relay() test gains a client that is not listed, which must outlive the first list check, and a new test covers the accept check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JAxkkiaGp2k8okvs4MpCUq * Require a timeout in the list tests' unlisted cases An unlisted client passed if relay() or the connection ended with an error, not only if it stayed up until the timeout. Each case now names the one outcome it expects. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JAxkkiaGp2k8okvs4MpCUq --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>