Probe: resolve host names and report the QUIC close cause
Foundation / checks (deploy) (push) Successful in 6s
Foundation / checks (ecs) (push) Successful in 1m56s
Foundation / checks (network) (push) Successful in 9m46s
Foundation / checks (client) (push) Successful in 13m6s
Foundation / checks (tsan) (push) Successful in 8m2s
Foundation / checks (checks) (push) Successful in 32m25s
Foundation / checks (postgres) (push) Successful in 38m45s
Foundation / postgres-tools (push) Successful in 16s
Foundation / image (push) Successful in 2m34s
Foundation / server-image (push) Successful in 4m2s
Foundation / checks (deploy) (push) Successful in 6s
Foundation / checks (ecs) (push) Successful in 1m56s
Foundation / checks (network) (push) Successful in 9m46s
Foundation / checks (client) (push) Successful in 13m6s
Foundation / checks (tsan) (push) Successful in 8m2s
Foundation / checks (checks) (push) Successful in 32m25s
Foundation / checks (postgres) (push) Successful in 38m45s
Foundation / postgres-tools (push) Successful in 16s
Foundation / image (push) Successful in 2m34s
Foundation / server-image (push) Successful in 4m2s
evo-session-probe resolves a host name to IPv4 and prints the address DNS answered, and its closed line names why the QUIC connection ended (untrusted: the server answered but failed the pinned check; idle: nothing answered), via the new RegionSessionClient::transport_cause. Records the UDP route reachability check (not yet the authenticated acceptance run). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -154,6 +154,9 @@ if(EVO_BUILD_QUIC)
|
||||
# M10.4c headless session client (development and test only; ADR-0092).
|
||||
add_executable(evo-session-probe apps/evo-session-probe/main.cpp)
|
||||
target_link_libraries(evo-session-probe PRIVATE evo_session_client evo_network_tls)
|
||||
if(WIN32)
|
||||
target_link_libraries(evo-session-probe PRIVATE ws2_32) # Host name lookup.
|
||||
endif()
|
||||
evo_owned_target(evo-session-probe)
|
||||
evo_msquic_runtime(evo-session-probe)
|
||||
if(BUILD_TESTING)
|
||||
|
||||
@@ -10,11 +10,30 @@
|
||||
// (one per tick, two ticks ahead) and N probe actions (three ticks ahead), queries the
|
||||
// given action ids, and prints one line per answer:
|
||||
// welcome SESSION EPOCH TICK | intention SEQ STATUS | simulated SEQ TICK
|
||||
// receipt ID STATUS TICK | outcome ID RESULT TICK COMMIT | closed REASON | done
|
||||
// receipt ID STATUS TICK | outcome ID RESULT TICK COMMIT | done
|
||||
// resolved HOST ADDRESS (a host name was looked up; IPv4)
|
||||
// closed REASON TRANSPORT (TRANSPORT names why QUIC ended: untrusted means the server
|
||||
// answered but failed the pinned CA/name check; idle means nothing answered)
|
||||
// Statuses, results and reasons are the session-v1 wire values. Exits 0 once every
|
||||
// action is final and every query answered, 1 on timeout, 3 when the server closes.
|
||||
// The issuer key is a development credential: the probe refuses any environment but dev.
|
||||
#include "evo/client/region_session.hpp"
|
||||
#ifdef _WIN32
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#ifndef NOMINMAX
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
#include <winsock2.h>
|
||||
// After <winsock2.h>.
|
||||
#include <ws2tcpip.h>
|
||||
#else
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#include "evo/network/session_grant.hpp"
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
@@ -69,6 +88,49 @@ std::optional<AccountId> account_of(std::string_view hex) {
|
||||
return id.valid() ? std::optional{id} : std::nullopt;
|
||||
}
|
||||
|
||||
// The QUIC endpoint takes a numeric address (the server name is verified separately):
|
||||
// look a host name up once, IPv4, and print what DNS answered.
|
||||
std::optional<std::string> resolve(const std::string& host) {
|
||||
#ifdef _WIN32
|
||||
WSADATA data{};
|
||||
if (WSAStartup(MAKEWORD(2, 2), &data) != 0)
|
||||
return std::nullopt;
|
||||
#endif
|
||||
addrinfo hints{};
|
||||
hints.ai_family = AF_INET;
|
||||
hints.ai_socktype = SOCK_DGRAM;
|
||||
addrinfo* found = nullptr;
|
||||
if (getaddrinfo(host.c_str(), nullptr, &hints, &found) != 0 || found == nullptr)
|
||||
return std::nullopt;
|
||||
char text[INET_ADDRSTRLEN] = {};
|
||||
const auto* address = reinterpret_cast<const sockaddr_in*>(found->ai_addr);
|
||||
const bool ok = inet_ntop(AF_INET, &address->sin_addr, text, sizeof text) != nullptr;
|
||||
freeaddrinfo(found);
|
||||
if (!ok)
|
||||
return std::nullopt;
|
||||
return std::string{text};
|
||||
}
|
||||
const char* cause_name(std::optional<quic::CloseCause> c) {
|
||||
if (!c)
|
||||
return "none";
|
||||
switch (*c) {
|
||||
case quic::CloseCause::local:
|
||||
return "local";
|
||||
case quic::CloseCause::peer:
|
||||
return "peer";
|
||||
case quic::CloseCause::idle:
|
||||
return "idle";
|
||||
case quic::CloseCause::untrusted:
|
||||
return "untrusted";
|
||||
case quic::CloseCause::overloaded:
|
||||
return "overloaded";
|
||||
case quic::CloseCause::protocol:
|
||||
return "protocol";
|
||||
default:
|
||||
return "transport";
|
||||
}
|
||||
}
|
||||
|
||||
int keys(const std::filesystem::path& out) {
|
||||
std::filesystem::create_directories(out);
|
||||
for (int attempt = 0; attempt < 8; ++attempt) {
|
||||
@@ -135,7 +197,14 @@ int run(const RunOptions& o) {
|
||||
return 2;
|
||||
}
|
||||
client::RegionSessionClientConfig config;
|
||||
config.transport.server_address = o.host;
|
||||
const auto address = resolve(o.host);
|
||||
if (!address) {
|
||||
std::puts("error resolve");
|
||||
return 2;
|
||||
}
|
||||
if (*address != o.host)
|
||||
std::printf("resolved %s %s\n", o.host.c_str(), address->c_str());
|
||||
config.transport.server_address = *address;
|
||||
config.transport.port = o.port;
|
||||
config.transport.server_name = o.server_name;
|
||||
config.transport.authority_pem = read(o.ca);
|
||||
@@ -156,8 +225,10 @@ int run(const RunOptions& o) {
|
||||
while (Clock::now() < deadline) {
|
||||
c.poll(Clock::now());
|
||||
if (c.state() == client::RegionSessionState::closed) {
|
||||
std::printf("closed %u\n", static_cast<unsigned>(c.close_reason().value_or(
|
||||
SessionCloseReason::connection_lost)));
|
||||
std::printf("closed %u %s\n",
|
||||
static_cast<unsigned>(
|
||||
c.close_reason().value_or(SessionCloseReason::connection_lost)),
|
||||
cause_name(c.transport_cause()));
|
||||
return 3;
|
||||
}
|
||||
if (c.state() != client::RegionSessionState::established) {
|
||||
|
||||
@@ -4328,3 +4328,22 @@ port `session` UDP 7400; no other Service exposes 7400.
|
||||
Not done (needs the maintainer): Argo sync of this change; the edge firewall rule;
|
||||
internal DNS to 172.10.1.202; retrieving the dev CA and issuer key (no cluster credentials
|
||||
on the workstation); the end-to-end probe through the VIP. The route is not verified.
|
||||
|
||||
## 2026-10-05 — Dev session route reachability over UDP (not yet acceptance)
|
||||
|
||||
After the maintainer synced the UDP route and set internal DNS, from workstation
|
||||
172.10.1.169 (inside 172.10.1.0/24): `void.aeternalisgames.com` resolves to the VIP
|
||||
172.10.1.202 (earlier answers of 172.10.1.160 were cached). `evo-session-probe` with a
|
||||
throwaway CA and issuer key (generated locally; cannot authenticate) against
|
||||
`172.10.1.202:7400` and `void.aeternalisgames.com:7400` ended with transport cause
|
||||
`untrusted` after 62-67 ms: a QUIC server answered with its certificate, which the pinned
|
||||
throwaway CA refused. Control: `172.10.1.202:7401` ended after the 5 s Welcome deadline with
|
||||
no transport event (nothing answered). This shows UDP 7400 reaches the M10 listener through
|
||||
DNS, the MetalLB VIP, the Service and the NetworkPolicy from the same subnet. It is not the
|
||||
acceptance run: that needs the dev CA and issuer key from the cluster Secret (no cluster
|
||||
credentials on the workstation yet), and a client on the same subnet does not cross the
|
||||
edge firewall.
|
||||
Probe changes: host names are resolved (IPv4) and printed (`resolved HOST ADDRESS`), and
|
||||
`closed` lines name the QUIC transport cause (`RegionSessionClient::transport_cause`).
|
||||
Executed: Windows MSVC preset `quic` build; Linux GCC preset `quic` CTest 4/4; clang-tidy 19
|
||||
on the client, probe and evo-server sources.
|
||||
|
||||
@@ -60,6 +60,9 @@ class RegionSessionClient {
|
||||
[[nodiscard]] RegionSessionState state() const noexcept;
|
||||
[[nodiscard]] const std::optional<network::SessionWelcome>& welcome() const noexcept;
|
||||
[[nodiscard]] std::optional<network::SessionCloseReason> close_reason() const noexcept;
|
||||
// Why the QUIC connection itself ended (e.g. `untrusted`: the server answered but its
|
||||
// certificate failed the pinned check), when it ended without a session Close.
|
||||
[[nodiscard]] std::optional<network::quic::CloseCause> transport_cause() const noexcept;
|
||||
|
||||
private:
|
||||
struct Impl;
|
||||
|
||||
@@ -16,6 +16,7 @@ struct RegionSessionClient::Impl {
|
||||
network::quic::ConnectionId connection{};
|
||||
std::optional<network::SessionWelcome> welcome;
|
||||
std::optional<SessionCloseReason> reason;
|
||||
std::optional<network::quic::CloseCause> transport_cause;
|
||||
std::optional<network::SessionRefreshResult> refresh_result;
|
||||
std::uint64_t next_sequence{1}, server_tick{};
|
||||
std::optional<network::SimulatedThrough> simulated;
|
||||
@@ -136,6 +137,7 @@ void RegionSessionClient::poll(Clock::time_point now) {
|
||||
} else if (e.kind == EventKind::datagram) {
|
||||
m.datagram(e.bytes);
|
||||
} else if (e.kind == EventKind::closed) {
|
||||
m.transport_cause = e.cause;
|
||||
m.connection = 0; // Already gone; nothing to close or send.
|
||||
m.end(SessionCloseReason::connection_lost, false);
|
||||
}
|
||||
@@ -212,6 +214,10 @@ const std::optional<network::SessionWelcome>& RegionSessionClient::welcome() con
|
||||
return impl_->welcome;
|
||||
}
|
||||
|
||||
std::optional<network::quic::CloseCause> RegionSessionClient::transport_cause() const noexcept {
|
||||
return impl_->transport_cause;
|
||||
}
|
||||
|
||||
std::optional<SessionCloseReason> RegionSessionClient::close_reason() const noexcept {
|
||||
return impl_->reason;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user