From ed980dbc9ebb8c5b1efa20c68fb81a1b4ad95ba7 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 15 Oct 2026 16:55:50 +0000 Subject: [PATCH 01/10] OpenBSD smoke test: diagnose a stuck tunnel, check multipath without rtable Dump the client's process state, both sides' stats endpoints, two seconds of the client's syscalls (ktrace) and the UDP sockets when a check fails, give the rtable path-up client its own log, and check a plain extra multipath path before the routing-table one. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012baC35vUbLPPhuK4pz4uRz --- .github/scripts/smoke-test.sh | 37 +++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/.github/scripts/smoke-test.sh b/.github/scripts/smoke-test.sh index 49846d8..18ecfad 100755 --- a/.github/scripts/smoke-test.sh +++ b/.github/scripts/smoke-test.sh @@ -30,17 +30,35 @@ test -n "$ech" pids="$pids $!" "$bin" serve --addr 0.0.0.0:4433 --rules "$work/rules.json" \ --cert "$work/cert.pem" --key "$work/key.pem" --ech-key "$work/ech.pem" \ + --stats-listen 127.0.0.1:9100 \ > "$work/server.log" 2>&1 & pids="$pids $!" sleep 2 +# diagnose PID STATS_PORT: what a stuck client is doing (OpenBSD only). +diagnose() { + [ "$(uname -s)" = OpenBSD ] || return 0 + echo "--- client process"; ps -o pid,pcpu,state,wchan,command -p "$1" || true + echo "--- client stats"; ftp -V -o - "http://127.0.0.1:$2/stats" 2>&1 || true + echo "--- server stats"; ftp -V -o - "http://127.0.0.1:9100/stats" 2>&1 || true + echo "--- client syscalls (2 s)" + if ktrace -f "$work/ktrace.out" -t cn -p "$1"; then + sleep 2 + ktrace -C || true + kdump -f "$work/ktrace.out" | tail -n 60 + fi + echo "--- udp sockets"; netstat -an -f inet -p udp || true +} + # check NAME PORT [CLIENT_ARGS...]: tunnel one datagram through a fresh client. check() { name="$1" port="$2" shift 2 + stats=$((port + 1000)) "$bin" client --listen "127.0.0.1:$port" \ --endpoint https://localhost:4433/connect --proxy-addr 127.0.0.1:4433 \ + --stats-listen "127.0.0.1:$stats" \ --insecure "$@" > "$work/client-$name.log" 2>&1 & cpid=$! pids="$pids $cpid" @@ -54,13 +72,15 @@ check() { i=$((i + 1)) sleep 1 done - kill "$cpid" 2>/dev/null || true if [ -z "$ok" ]; then echo "FAIL: $name" + diagnose "$cpid" "$stats" + kill "$cpid" 2>/dev/null || true echo "--- server log"; cat "$work/server.log" echo "--- client log"; cat "$work/client-$name.log" exit 1 fi + kill "$cpid" 2>/dev/null || true echo "PASS: $name" } @@ -83,26 +103,31 @@ if [ "$(uname -s)" = OpenBSD ]; then ifconfig exit 1 fi + # The same extra path without a routing table first, to tell multipath + # problems from routing-table ones. + check multipath 6005 --path "$egress_ip:4433" spec="$egress_ip:4433/rtable=0" "$bin" client --listen 127.0.0.1:6003 \ --endpoint https://localhost:4433/connect --proxy-addr 127.0.0.1:4433 \ - --insecure --path "$spec" > "$work/client-rtable.log" 2>&1 & + --stats-listen 127.0.0.1:7003 \ + --insecure --path "$spec" > "$work/client-rtable-up.log" 2>&1 & cpid=$! pids="$pids $cpid" i=0 - until grep -q "multipath path $spec up" "$work/client-rtable.log"; do + until grep -q "multipath path $spec up" "$work/client-rtable-up.log"; do i=$((i + 1)) if [ $i -gt 10 ]; then echo "FAIL: path $spec did not come up" + diagnose "$cpid" 7003 echo "--- server log"; cat "$work/server.log" - echo "--- client log"; cat "$work/client-rtable.log" + echo "--- client log"; cat "$work/client-rtable-up.log" exit 1 fi sleep 1 done - grep -q "routing table 0: socket" "$work/client-rtable.log" || { + grep -q "routing table 0: socket" "$work/client-rtable-up.log" || { echo "FAIL: no routing-table socket" - cat "$work/client-rtable.log" + cat "$work/client-rtable-up.log" exit 1 } kill "$cpid" 2>/dev/null || true From 1c613d6dc3d9e28677360a0236ac86f044210001 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 15 Oct 2026 17:03:54 +0000 Subject: [PATCH 02/10] OpenBSD smoke test: trace the routing-table path Run the routing-table checks against a second server with noq's trace log, trace the client too, and capture the proxy port on lo0 and the egress interface, plus the UDP counters, all shown when a check fails. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012baC35vUbLPPhuK4pz4uRz --- .github/scripts/smoke-test.sh | 55 ++++++++++++++++++++++++++++------- 1 file changed, 45 insertions(+), 10 deletions(-) diff --git a/.github/scripts/smoke-test.sh b/.github/scripts/smoke-test.sh index 18ecfad..e282773 100755 --- a/.github/scripts/smoke-test.sh +++ b/.github/scripts/smoke-test.sh @@ -13,6 +13,7 @@ work="$(mktemp -d)" pids="" cleanup() { for p in $pids; do kill "$p" 2>/dev/null || true; done + [ "$(uname -s)" != OpenBSD ] || sudo -n pkill -x tcpdump 2>/dev/null || true } trap cleanup EXIT INT TERM @@ -40,7 +41,9 @@ diagnose() { [ "$(uname -s)" = OpenBSD ] || return 0 echo "--- client process"; ps -o pid,pcpu,state,wchan,command -p "$1" || true echo "--- client stats"; ftp -V -o - "http://127.0.0.1:$2/stats" 2>&1 || true - echo "--- server stats"; ftp -V -o - "http://127.0.0.1:9100/stats" 2>&1 || true + for port in 9100 9101; do + echo "--- server stats ($port)"; ftp -V -o - "http://127.0.0.1:$port/stats" 2>&1 || true + done echo "--- client syscalls (2 s)" if ktrace -f "$work/ktrace.out" -t cn -p "$1"; then sleep 2 @@ -50,14 +53,33 @@ diagnose() { echo "--- udp sockets"; netstat -an -f inet -p udp || true } +# show_logs CLIENT_LOG: the server's and a client's log; trace logs without +# their span enter/exit noise. +show_logs() { + for log in "$work/server.log" "$work/server-trace.log" "$1"; do + [ -f "$log" ] || continue + echo "--- $(basename "$log")" + grep -v -e '^\[TRACE\] \(->\|<-\|--\) ' -e '^\[TRACE\] nothing' "$log" | tail -n 1500 + done + for cap in "$work"/tcpdump-*.txt; do + [ -f "$cap" ] || continue + echo "--- $(basename "$cap")"; tail -n 200 "$cap" + done + if [ -f "$work/udpstat.before" ]; then + echo "--- UDP counters, before and now" + cat "$work/udpstat.before" + netstat -s -p udp || true + fi +} + # check NAME PORT [CLIENT_ARGS...]: tunnel one datagram through a fresh client. check() { name="$1" port="$2" shift 2 stats=$((port + 1000)) - "$bin" client --listen "127.0.0.1:$port" \ - --endpoint https://localhost:4433/connect --proxy-addr 127.0.0.1:4433 \ + RUST_LOG="${CLIENT_LOG:-info}" "$bin" client --listen "127.0.0.1:$port" \ + --endpoint https://localhost:4433/connect --proxy-addr "127.0.0.1:${proxy_port:-4433}" \ --stats-listen "127.0.0.1:$stats" \ --insecure "$@" > "$work/client-$name.log" 2>&1 & cpid=$! @@ -76,8 +98,7 @@ check() { echo "FAIL: $name" diagnose "$cpid" "$stats" kill "$cpid" 2>/dev/null || true - echo "--- server log"; cat "$work/server.log" - echo "--- client log"; cat "$work/client-$name.log" + show_logs "$work/client-$name.log" exit 1 fi kill "$cpid" 2>/dev/null || true @@ -106,9 +127,24 @@ if [ "$(uname -s)" = OpenBSD ]; then # The same extra path without a routing table first, to tell multipath # problems from routing-table ones. check multipath 6005 --path "$egress_ip:4433" - spec="$egress_ip:4433/rtable=0" - "$bin" client --listen 127.0.0.1:6003 \ - --endpoint https://localhost:4433/connect --proxy-addr 127.0.0.1:4433 \ + # Diagnostics: a second server with noq's trace log, client trace logs, + # packet captures and UDP counters, all shown if a check fails. + RUST_LOG=trace "$bin" serve --addr 0.0.0.0:4434 --rules "$work/rules.json" \ + --cert "$work/cert.pem" --key "$work/key.pem" \ + --stats-listen 127.0.0.1:9101 > "$work/server-trace.log" 2>&1 & + pids="$pids $!" + egress_if="$(ifconfig egress | sed -n '1s/:.*//p')" + for ifc in lo0 "$egress_if"; do + sudo tcpdump -n -l -i "$ifc" udp port 4434 > "$work/tcpdump-$ifc.txt" 2>&1 & + pids="$pids $!" + done + netstat -s -p udp > "$work/udpstat.before" 2>&1 || true + sleep 2 + proxy_port=4434 + export CLIENT_LOG=trace + spec="$egress_ip:4434/rtable=0" + RUST_LOG=trace "$bin" client --listen 127.0.0.1:6003 \ + --endpoint https://localhost:4433/connect --proxy-addr 127.0.0.1:4434 \ --stats-listen 127.0.0.1:7003 \ --insecure --path "$spec" > "$work/client-rtable-up.log" 2>&1 & cpid=$! @@ -119,8 +155,7 @@ if [ "$(uname -s)" = OpenBSD ]; then if [ $i -gt 10 ]; then echo "FAIL: path $spec did not come up" diagnose "$cpid" 7003 - echo "--- server log"; cat "$work/server.log" - echo "--- client log"; cat "$work/client-rtable-up.log" + show_logs "$work/client-rtable-up.log" exit 1 fi sleep 1 From 43803e8bb4977192e29375901a162266e9e60bde Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 15 Oct 2026 17:18:39 +0000 Subject: [PATCH 03/10] OpenBSD smoke test: require the routing-table path to receive The path-up wait now also requires datagrams received on the path (from the client's stats), since the path can be reported up while its socket never receives. Run it against the shared server again (a fresh server did not reproduce the failure), with syscall traces of both processes instead of noq trace logs. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012baC35vUbLPPhuK4pz4uRz --- .github/scripts/smoke-test.sh | 73 ++++++++++++++++++++--------------- 1 file changed, 41 insertions(+), 32 deletions(-) diff --git a/.github/scripts/smoke-test.sh b/.github/scripts/smoke-test.sh index e282773..2f6b494 100755 --- a/.github/scripts/smoke-test.sh +++ b/.github/scripts/smoke-test.sh @@ -33,7 +33,8 @@ pids="$pids $!" --cert "$work/cert.pem" --key "$work/key.pem" --ech-key "$work/ech.pem" \ --stats-listen 127.0.0.1:9100 \ > "$work/server.log" 2>&1 & -pids="$pids $!" +server_pid=$! +pids="$pids $server_pid" sleep 2 # diagnose PID STATS_PORT: what a stuck client is doing (OpenBSD only). @@ -41,9 +42,7 @@ diagnose() { [ "$(uname -s)" = OpenBSD ] || return 0 echo "--- client process"; ps -o pid,pcpu,state,wchan,command -p "$1" || true echo "--- client stats"; ftp -V -o - "http://127.0.0.1:$2/stats" 2>&1 || true - for port in 9100 9101; do - echo "--- server stats ($port)"; ftp -V -o - "http://127.0.0.1:$port/stats" 2>&1 || true - done + echo "--- server stats"; ftp -V -o - "http://127.0.0.1:9100/stats" 2>&1 || true echo "--- client syscalls (2 s)" if ktrace -f "$work/ktrace.out" -t cn -p "$1"; then sleep 2 @@ -53,17 +52,22 @@ diagnose() { echo "--- udp sockets"; netstat -an -f inet -p udp || true } -# show_logs CLIENT_LOG: the server's and a client's log; trace logs without -# their span enter/exit noise. +# show_logs CLIENT_LOG: the server's and a client's log, plus whatever the +# routing-table check captured. show_logs() { - for log in "$work/server.log" "$work/server-trace.log" "$1"; do - [ -f "$log" ] || continue - echo "--- $(basename "$log")" - grep -v -e '^\[TRACE\] \(->\|<-\|--\) ' -e '^\[TRACE\] nothing' "$log" | tail -n 1500 - done + echo "--- server log"; cat "$work/server.log" + echo "--- client log"; cat "$1" for cap in "$work"/tcpdump-*.txt; do [ -f "$cap" ] || continue - echo "--- $(basename "$cap")"; tail -n 200 "$cap" + echo "--- $(basename "$cap")"; tail -n 100 "$cap" + done + for kt in "$work"/*.ktrace; do + [ -f "$kt" ] || continue + echo "--- $(basename "$kt"): socket syscalls, failures, last calls" + kdump -f "$kt" > "$kt.txt" 2>/dev/null || true + grep -E 'CALL +(sendmsg|recvmsg|sendto|recvfrom)' "$kt.txt" | awk '{print $4}' | sed 's/(.*//' | sort | uniq -c + grep -E -A1 'CALL +(sendmsg|recvmsg)' "$kt.txt" | grep -E 'RET +(sendmsg|recvmsg) -1' | sort | uniq -c + grep -E 'sendmsg|recvmsg' "$kt.txt" | tail -n 40 done if [ -f "$work/udpstat.before" ]; then echo "--- UDP counters, before and now" @@ -72,14 +76,22 @@ show_logs() { fi } +# path_rx STATS_PORT REMOTE: datagrams received on the client's path to REMOTE. +path_rx() { + ftp -V -o - "http://127.0.0.1:$1/stats" 2>/dev/null | awk -v r="\"remote\": \"$2\"" ' + index($0, r) { f = 1 } + f && /"udp_rx"/ { g = 1 } + g && /"datagrams"/ { gsub(/[^0-9]/, ""); print; exit }' +} + # check NAME PORT [CLIENT_ARGS...]: tunnel one datagram through a fresh client. check() { name="$1" port="$2" shift 2 stats=$((port + 1000)) - RUST_LOG="${CLIENT_LOG:-info}" "$bin" client --listen "127.0.0.1:$port" \ - --endpoint https://localhost:4433/connect --proxy-addr "127.0.0.1:${proxy_port:-4433}" \ + "$bin" client --listen "127.0.0.1:$port" \ + --endpoint https://localhost:4433/connect --proxy-addr 127.0.0.1:4433 \ --stats-listen "127.0.0.1:$stats" \ --insecure "$@" > "$work/client-$name.log" 2>&1 & cpid=$! @@ -127,45 +139,42 @@ if [ "$(uname -s)" = OpenBSD ]; then # The same extra path without a routing table first, to tell multipath # problems from routing-table ones. check multipath 6005 --path "$egress_ip:4433" - # Diagnostics: a second server with noq's trace log, client trace logs, - # packet captures and UDP counters, all shown if a check fails. - RUST_LOG=trace "$bin" serve --addr 0.0.0.0:4434 --rules "$work/rules.json" \ - --cert "$work/cert.pem" --key "$work/key.pem" \ - --stats-listen 127.0.0.1:9101 > "$work/server-trace.log" 2>&1 & - pids="$pids $!" + # Diagnostics for this check, shown if it fails: syscall traces of the + # server and the client, packet captures and the UDP counters. + ktrace -t c -f "$work/server.ktrace" -p "$server_pid" || true egress_if="$(ifconfig egress | sed -n '1s/:.*//p')" for ifc in lo0 "$egress_if"; do - sudo tcpdump -n -l -i "$ifc" udp port 4434 > "$work/tcpdump-$ifc.txt" 2>&1 & - pids="$pids $!" + sudo tcpdump -n -l -i "$ifc" udp port 4433 > "$work/tcpdump-$ifc.txt" 2>&1 & done netstat -s -p udp > "$work/udpstat.before" 2>&1 || true - sleep 2 - proxy_port=4434 - export CLIENT_LOG=trace - spec="$egress_ip:4434/rtable=0" - RUST_LOG=trace "$bin" client --listen 127.0.0.1:6003 \ - --endpoint https://localhost:4433/connect --proxy-addr 127.0.0.1:4434 \ + sleep 1 + spec="$egress_ip:4433/rtable=0" + ktrace -t c -f "$work/client.ktrace" "$bin" client --listen 127.0.0.1:6003 \ + --endpoint https://localhost:4433/connect --proxy-addr 127.0.0.1:4433 \ --stats-listen 127.0.0.1:7003 \ --insecure --path "$spec" > "$work/client-rtable-up.log" 2>&1 & cpid=$! pids="$pids $cpid" + # The path must come up and receive through its own socket. i=0 - until grep -q "multipath path $spec up" "$work/client-rtable-up.log"; do + until grep -q "multipath path $spec up" "$work/client-rtable-up.log" && + [ "$(path_rx 7003 "$egress_ip:4433")" -gt 0 ] 2>/dev/null; do i=$((i + 1)) - if [ $i -gt 10 ]; then - echo "FAIL: path $spec did not come up" + if [ $i -gt 15 ]; then + echo "FAIL: path $spec did not come up and receive" diagnose "$cpid" 7003 show_logs "$work/client-rtable-up.log" exit 1 fi sleep 1 done + ktrace -C || true grep -q "routing table 0: socket" "$work/client-rtable-up.log" || { echo "FAIL: no routing-table socket" cat "$work/client-rtable-up.log" exit 1 } + echo "PASS: path in routing table 0 up and receiving" kill "$cpid" 2>/dev/null || true check rtable 6004 --path "$spec" - echo "PASS: path in routing table 0 up" fi From 2a65833175c72b7f2968fa28ef6885eac8e33793 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 15 Oct 2026 17:33:00 +0000 Subject: [PATCH 04/10] OpenBSD smoke test: repeat the routing-table check as it first failed Start the routing-table client straight after the previous client exits, with nothing attached, three times; trace the server and client only once a round has failed. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012baC35vUbLPPhuK4pz4uRz --- .github/scripts/smoke-test.sh | 63 +++++++++++++++++------------------ 1 file changed, 31 insertions(+), 32 deletions(-) diff --git a/.github/scripts/smoke-test.sh b/.github/scripts/smoke-test.sh index 2f6b494..dbad395 100755 --- a/.github/scripts/smoke-test.sh +++ b/.github/scripts/smoke-test.sh @@ -136,45 +136,44 @@ if [ "$(uname -s)" = OpenBSD ]; then ifconfig exit 1 fi - # The same extra path without a routing table first, to tell multipath - # problems from routing-table ones. - check multipath 6005 --path "$egress_ip:4433" - # Diagnostics for this check, shown if it fails: syscall traces of the - # server and the client, packet captures and the UDP counters. - ktrace -t c -f "$work/server.ktrace" -p "$server_pid" || true egress_if="$(ifconfig egress | sed -n '1s/:.*//p')" for ifc in lo0 "$egress_if"; do sudo tcpdump -n -l -i "$ifc" udp port 4433 > "$work/tcpdump-$ifc.txt" 2>&1 & done netstat -s -p udp > "$work/udpstat.before" 2>&1 || true - sleep 1 spec="$egress_ip:4433/rtable=0" - ktrace -t c -f "$work/client.ktrace" "$bin" client --listen 127.0.0.1:6003 \ - --endpoint https://localhost:4433/connect --proxy-addr 127.0.0.1:4433 \ - --stats-listen 127.0.0.1:7003 \ - --insecure --path "$spec" > "$work/client-rtable-up.log" 2>&1 & - cpid=$! - pids="$pids $cpid" - # The path must come up and receive through its own socket. - i=0 - until grep -q "multipath path $spec up" "$work/client-rtable-up.log" && - [ "$(path_rx 7003 "$egress_ip:4433")" -gt 0 ] 2>/dev/null; do - i=$((i + 1)) - if [ $i -gt 15 ]; then - echo "FAIL: path $spec did not come up and receive" - diagnose "$cpid" 7003 - show_logs "$work/client-rtable-up.log" + for round in 1 2 3; do + # The same extra path without a routing table first, to tell + # multipath problems from routing-table ones. + check "multipath-$round" 6005 --path "$egress_ip:4433" + "$bin" client --listen 127.0.0.1:6003 \ + --endpoint https://localhost:4433/connect --proxy-addr 127.0.0.1:4433 \ + --stats-listen 127.0.0.1:7003 \ + --insecure --path "$spec" > "$work/client-rtable-up-$round.log" 2>&1 & + cpid=$! + pids="$pids $cpid" + # The path must come up and receive through its own socket. + i=0 + until grep -q "multipath path $spec up" "$work/client-rtable-up-$round.log" && + [ "$(path_rx 7003 "$egress_ip:4433")" -gt 0 ] 2>/dev/null; do + i=$((i + 1)) + if [ $i -gt 15 ]; then + echo "FAIL: path $spec did not come up and receive (round $round)" + ktrace -t c -f "$work/server.ktrace" -p "$server_pid" || true + diagnose "$cpid" 7003 + ktrace -C || true + show_logs "$work/client-rtable-up-$round.log" + exit 1 + fi + sleep 1 + done + grep -q "routing table 0: socket" "$work/client-rtable-up-$round.log" || { + echo "FAIL: no routing-table socket" + cat "$work/client-rtable-up-$round.log" exit 1 - fi - sleep 1 + } + echo "PASS: path in routing table 0 up and receiving after ${i}s (round $round)" + kill "$cpid" 2>/dev/null || true done - ktrace -C || true - grep -q "routing table 0: socket" "$work/client-rtable-up.log" || { - echo "FAIL: no routing-table socket" - cat "$work/client-rtable-up.log" - exit 1 - } - echo "PASS: path in routing table 0 up and receiving" - kill "$cpid" 2>/dev/null || true check rtable 6004 --path "$spec" fi From c39531d3572db1fb1e0d831fa30e20376c9ad109 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 15 Oct 2026 17:39:01 +0000 Subject: [PATCH 05/10] OpenBSD smoke test: check loopback UDP and pf when a check fails A failed round showed a fresh client's handshake packets never reaching lo0 after the previous routing-table client exited. Probe plain UDP over loopback, dump pf rules, states and counters and the interface and IP drop counters, then disable pf and probe again. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012baC35vUbLPPhuK4pz4uRz --- .github/scripts/smoke-test.sh | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/scripts/smoke-test.sh b/.github/scripts/smoke-test.sh index dbad395..a85cb1a 100755 --- a/.github/scripts/smoke-test.sh +++ b/.github/scripts/smoke-test.sh @@ -50,6 +50,23 @@ diagnose() { kdump -f "$work/ktrace.out" | tail -n 60 fi echo "--- udp sockets"; netstat -an -f inet -p udp || true + echo "--- plain UDP over loopback (to the echo target)" + "$tools/udpsend" 127.0.0.1:5390 probe 2>&1 || true + echo "--- interfaces"; netstat -in || true + echo "--- IP counters"; netstat -s -p ip | grep -i -E 'drop|fail|no route|discard|output|fragment' || true + echo "--- capture processes"; ps -ax -o pid,stat,command | grep '[t]cpdump' || true + echo "--- pf"; cat /etc/pf.conf 2>&1 || true + sudo -n pfctl -si 2>&1 || true + sudo -n pfctl -sr 2>&1 || true + echo "states: $(sudo -n pfctl -ss 2>/dev/null | wc -l)" + sudo -n pfctl -ss 2>&1 | grep -E '4433|5390' | head -n 40 || true + echo "--- after disabling pf" + sudo -n pfctl -d 2>&1 || true + "$tools/udpsend" 127.0.0.1:5390 probe 2>&1 || true + if [ -n "${port:-}" ]; then + sleep 5 + "$tools/udpsend" "127.0.0.1:$port" probe 2>&1 || true + fi } # show_logs CLIENT_LOG: the server's and a client's log, plus whatever the @@ -142,7 +159,7 @@ if [ "$(uname -s)" = OpenBSD ]; then done netstat -s -p udp > "$work/udpstat.before" 2>&1 || true spec="$egress_ip:4433/rtable=0" - for round in 1 2 3; do + for round in 1 2 3 4; do # The same extra path without a routing table first, to tell # multipath problems from routing-table ones. check "multipath-$round" 6005 --path "$egress_ip:4433" @@ -159,6 +176,7 @@ if [ "$(uname -s)" = OpenBSD ]; then i=$((i + 1)) if [ $i -gt 15 ]; then echo "FAIL: path $spec did not come up and receive (round $round)" + port=6003 ktrace -t c -f "$work/server.ktrace" -p "$server_pid" || true diagnose "$cpid" 7003 ktrace -C || true From 1bac487684fcc2e9f6d0777d3233aaa6046dbe16 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 15 Oct 2026 17:41:34 +0000 Subject: [PATCH 06/10] OpenBSD smoke test: debug-log the server, trace it on failure In the failing rounds the server reads a fresh client's Initial packets but never answers. Log the server at debug level (handshake errors) and trace both processes' syscalls, with their CPU use, when a check fails. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012baC35vUbLPPhuK4pz4uRz --- .github/scripts/smoke-test.sh | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/.github/scripts/smoke-test.sh b/.github/scripts/smoke-test.sh index a85cb1a..e660168 100755 --- a/.github/scripts/smoke-test.sh +++ b/.github/scripts/smoke-test.sh @@ -29,7 +29,7 @@ test -n "$ech" "$tools/udpecho" 127.0.0.1:5390 > /dev/null 2>&1 & pids="$pids $!" -"$bin" serve --addr 0.0.0.0:4433 --rules "$work/rules.json" \ +RUST_LOG=debug "$bin" serve --addr 0.0.0.0:4433 --rules "$work/rules.json" \ --cert "$work/cert.pem" --key "$work/key.pem" --ech-key "$work/ech.pem" \ --stats-listen 127.0.0.1:9100 \ > "$work/server.log" 2>&1 & @@ -40,15 +40,21 @@ sleep 2 # diagnose PID STATS_PORT: what a stuck client is doing (OpenBSD only). diagnose() { [ "$(uname -s)" = OpenBSD ] || return 0 - echo "--- client process"; ps -o pid,pcpu,state,wchan,command -p "$1" || true + echo "--- processes"; ps -o pid,pcpu,state,wchan,command -p "$1,$server_pid" || true echo "--- client stats"; ftp -V -o - "http://127.0.0.1:$2/stats" 2>&1 || true echo "--- server stats"; ftp -V -o - "http://127.0.0.1:9100/stats" 2>&1 || true - echo "--- client syscalls (2 s)" - if ktrace -f "$work/ktrace.out" -t cn -p "$1"; then - sleep 2 - ktrace -C || true - kdump -f "$work/ktrace.out" | tail -n 60 - fi + echo "--- client and server syscalls (2 s)" + ktrace -f "$work/client-diag.ktrace" -t c -p "$1" || true + ktrace -f "$work/server-diag.ktrace" -t c -p "$server_pid" || true + sleep 2 + ktrace -C || true + for side in client server; do + echo "--- $side syscalls" + kdump -f "$work/$side-diag.ktrace" > "$work/$side-diag.txt" 2>/dev/null || true + awk '$3 == "CALL" { sub(/\(.*/, "", $4); print $4 }' "$work/$side-diag.txt" | sort | uniq -c | sort -rn + grep -E 'RET +[a-z_]+ -1' "$work/$side-diag.txt" | sort | uniq -c | sort -rn | head -n 20 + grep -E 'sendmsg|recvmsg' "$work/$side-diag.txt" | tail -n 30 + done echo "--- udp sockets"; netstat -an -f inet -p udp || true echo "--- plain UDP over loopback (to the echo target)" "$tools/udpsend" 127.0.0.1:5390 probe 2>&1 || true @@ -78,14 +84,6 @@ show_logs() { [ -f "$cap" ] || continue echo "--- $(basename "$cap")"; tail -n 100 "$cap" done - for kt in "$work"/*.ktrace; do - [ -f "$kt" ] || continue - echo "--- $(basename "$kt"): socket syscalls, failures, last calls" - kdump -f "$kt" > "$kt.txt" 2>/dev/null || true - grep -E 'CALL +(sendmsg|recvmsg|sendto|recvfrom)' "$kt.txt" | awk '{print $4}' | sed 's/(.*//' | sort | uniq -c - grep -E -A1 'CALL +(sendmsg|recvmsg)' "$kt.txt" | grep -E 'RET +(sendmsg|recvmsg) -1' | sort | uniq -c - grep -E 'sendmsg|recvmsg' "$kt.txt" | tail -n 40 - done if [ -f "$work/udpstat.before" ]; then echo "--- UDP counters, before and now" cat "$work/udpstat.before" @@ -177,9 +175,7 @@ if [ "$(uname -s)" = OpenBSD ]; then if [ $i -gt 15 ]; then echo "FAIL: path $spec did not come up and receive (round $round)" port=6003 - ktrace -t c -f "$work/server.ktrace" -p "$server_pid" || true diagnose "$cpid" 7003 - ktrace -C || true show_logs "$work/client-rtable-up-$round.log" exit 1 fi From a2e35750ceb36ca9a7acdc2e3d98031b36d88451 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 15 Oct 2026 17:45:11 +0000 Subject: [PATCH 07/10] OpenBSD smoke test: trace the server through the multipath rounds The failing rounds show the server going silent on every connection at once. Trace its syscalls from the first round on and show the first failing sendmsg. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012baC35vUbLPPhuK4pz4uRz --- .github/scripts/smoke-test.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/scripts/smoke-test.sh b/.github/scripts/smoke-test.sh index e660168..04af4c9 100755 --- a/.github/scripts/smoke-test.sh +++ b/.github/scripts/smoke-test.sh @@ -84,6 +84,18 @@ show_logs() { [ -f "$cap" ] || continue echo "--- $(basename "$cap")"; tail -n 100 "$cap" done + if [ -f "$work/server-all.ktrace" ]; then + echo "--- server: failed syscalls since the multipath rounds began" + ktrace -C || true + kdump -f "$work/server-all.ktrace" > "$work/server-all.txt" 2>/dev/null || true + grep -E 'RET +[a-z_]+ -1' "$work/server-all.txt" | sort | uniq -c | sort -rn | head -n 20 + echo "--- server: first failed sendmsg and what preceded it" + grep -n -m 1 -E 'RET +sendmsg -1' "$work/server-all.txt" | cut -d: -f1 | while read -r l; do + sed -n "$((l > 30 ? l - 30 : 1)),$((l + 10))p" "$work/server-all.txt" + done + echo "--- server: sendmsg calls per second" + grep -E 'CALL +sendmsg' "$work/server-all.txt" | wc -l + fi if [ -f "$work/udpstat.before" ]; then echo "--- UDP counters, before and now" cat "$work/udpstat.before" @@ -156,6 +168,8 @@ if [ "$(uname -s)" = OpenBSD ]; then sudo tcpdump -n -l -i "$ifc" udp port 4433 > "$work/tcpdump-$ifc.txt" 2>&1 & done netstat -s -p udp > "$work/udpstat.before" 2>&1 || true + # The server's syscalls throughout, to catch the first failing send. + ktrace -t c -f "$work/server-all.ktrace" -p "$server_pid" || true spec="$egress_ip:4433/rtable=0" for round in 1 2 3 4; do # The same extra path without a routing table first, to tell From 83433a29056c9a96e16d97a14490f6a29cb4c59c Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 15 Oct 2026 17:50:36 +0000 Subject: [PATCH 08/10] Pin noq to the OpenBSD UDP send stall fix (for validation) OpenBSD fails a non-blocking UDP send with EAGAIN when another thread holds the socket's send buffer lock; noq's tokio sender then cleared write readiness and waited for a kqueue event that never comes, so the server went silent on every connection. Pin the fix branch and run six routing-table rounds, without tracing the server throughout. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012baC35vUbLPPhuK4pz4uRz --- .github/scripts/smoke-test.sh | 4 +--- Cargo.lock | 6 +++--- Cargo.toml | 4 ++-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/scripts/smoke-test.sh b/.github/scripts/smoke-test.sh index 04af4c9..0ceb200 100755 --- a/.github/scripts/smoke-test.sh +++ b/.github/scripts/smoke-test.sh @@ -168,10 +168,8 @@ if [ "$(uname -s)" = OpenBSD ]; then sudo tcpdump -n -l -i "$ifc" udp port 4433 > "$work/tcpdump-$ifc.txt" 2>&1 & done netstat -s -p udp > "$work/udpstat.before" 2>&1 || true - # The server's syscalls throughout, to catch the first failing send. - ktrace -t c -f "$work/server-all.ktrace" -p "$server_pid" || true spec="$egress_ip:4433/rtable=0" - for round in 1 2 3 4; do + for round in 1 2 3 4 5 6; do # The same extra path without a routing table first, to tell # multipath problems from routing-table ones. check "multipath-$round" 6005 --path "$egress_ip:4433" diff --git a/Cargo.lock b/Cargo.lock index 48901d5..9df8cfa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -563,7 +563,7 @@ dependencies = [ [[package]] name = "noq" version = "1.3.0" -source = "git+https://github.com/losfair/noq?rev=ac785a68744f799056e791e5e1378eab7cfd1f7d#ac785a68744f799056e791e5e1378eab7cfd1f7d" +source = "git+https://github.com/losfair/noq?rev=2f590c103ad7210b4539a24b4c7ba938afc4be46#2f590c103ad7210b4539a24b4c7ba938afc4be46" dependencies = [ "bytes", "cfg_aliases", @@ -583,7 +583,7 @@ dependencies = [ [[package]] name = "noq-proto" version = "1.3.0" -source = "git+https://github.com/losfair/noq?rev=ac785a68744f799056e791e5e1378eab7cfd1f7d#ac785a68744f799056e791e5e1378eab7cfd1f7d" +source = "git+https://github.com/losfair/noq?rev=2f590c103ad7210b4539a24b4c7ba938afc4be46#2f590c103ad7210b4539a24b4c7ba938afc4be46" dependencies = [ "bytes", "derive_more", @@ -609,7 +609,7 @@ dependencies = [ [[package]] name = "noq-udp" version = "1.3.0" -source = "git+https://github.com/losfair/noq?rev=ac785a68744f799056e791e5e1378eab7cfd1f7d#ac785a68744f799056e791e5e1378eab7cfd1f7d" +source = "git+https://github.com/losfair/noq?rev=2f590c103ad7210b4539a24b4c7ba938afc4be46#2f590c103ad7210b4539a24b4c7ba938afc4be46" dependencies = [ "cfg_aliases", "libc", diff --git a/Cargo.toml b/Cargo.toml index b3afae6..ac0be9b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,10 +32,10 @@ tokio-stream = "0.1" # Pinned to the losfair/noq fork for per-path scheduling priority, the path # spill threshold and datagram queue management (not in upstream noq). Keep # both crates on the same commit. -noq = { git = "https://github.com/losfair/noq", rev = "ac785a68744f799056e791e5e1378eab7cfd1f7d", default-features = false, features = ["runtime-tokio", "ring", "bloom", "tracing-log"] } +noq = { git = "https://github.com/losfair/noq", rev = "2f590c103ad7210b4539a24b4c7ba938afc4be46", default-features = false, features = ["runtime-tokio", "ring", "bloom", "tracing-log"] } # Direct dep only for `coding::Encodable` (to read a `PathId` for the multipath # AEAD nonce); same commit as noq's own. -noq-proto = { git = "https://github.com/losfair/noq", rev = "ac785a68744f799056e791e5e1378eab7cfd1f7d", default-features = false, features = ["ring", "bloom", "tracing-log"] } +noq-proto = { git = "https://github.com/losfair/noq", rev = "2f590c103ad7210b4539a24b4c7ba938afc4be46", default-features = false, features = ["ring", "bloom", "tracing-log"] } # BoringSSL: the TLS 1.3 handshake (via its QUIC API), ECH, and packet # protection (AEAD + header protection). boring 4 keeps the ECH code identical # to zeromasque's. From b54651f1d7e2e654205e208272f8e2ec2d045705 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 15 Oct 2026 18:05:02 +0000 Subject: [PATCH 09/10] Tidy the OpenBSD smoke test; note the UDP send stall Keep what the investigation showed is worth checking: the routing-table path must also receive on its own socket (not just be reported up), and back-to-back multipath rounds, which reproduced the server's stall every time before the noq fix. On failure show both sides' stats, process state, two seconds of syscalls and the UDP sockets; drop the always-on packet captures, pf probing and debug server log. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012baC35vUbLPPhuK4pz4uRz --- .github/scripts/smoke-test.sh | 151 +++++++++++----------------------- AGENTS.md | 6 ++ 2 files changed, 52 insertions(+), 105 deletions(-) diff --git a/.github/scripts/smoke-test.sh b/.github/scripts/smoke-test.sh index 0ceb200..0cb2d88 100755 --- a/.github/scripts/smoke-test.sh +++ b/.github/scripts/smoke-test.sh @@ -2,7 +2,8 @@ # Run-time smoke test for a built rapidmasque binary on the target OS (used # in the OpenBSD VMs to check the cross-built binaries). Brings up a server # and a client on loopback and tunnels UDP to an echo target, plain, with ECH, -# and (on OpenBSD) with an extra multipath path in its own routing table. +# and (on OpenBSD) with an extra multipath path, with and without its own +# routing table. # Usage: smoke-test.sh BINARY TOOLS_DIR # TOOLS_DIR holds udpecho/udpsend/gencert from testing/ built for the target. set -eu @@ -13,7 +14,6 @@ work="$(mktemp -d)" pids="" cleanup() { for p in $pids; do kill "$p" 2>/dev/null || true; done - [ "$(uname -s)" != OpenBSD ] || sudo -n pkill -x tcpdump 2>/dev/null || true } trap cleanup EXIT INT TERM @@ -29,7 +29,7 @@ test -n "$ech" "$tools/udpecho" 127.0.0.1:5390 > /dev/null 2>&1 & pids="$pids $!" -RUST_LOG=debug "$bin" serve --addr 0.0.0.0:4433 --rules "$work/rules.json" \ +"$bin" serve --addr 0.0.0.0:4433 --rules "$work/rules.json" \ --cert "$work/cert.pem" --key "$work/key.pem" --ech-key "$work/ech.pem" \ --stats-listen 127.0.0.1:9100 \ > "$work/server.log" 2>&1 & @@ -37,70 +37,33 @@ server_pid=$! pids="$pids $server_pid" sleep 2 -# diagnose PID STATS_PORT: what a stuck client is doing (OpenBSD only). -diagnose() { - [ "$(uname -s)" = OpenBSD ] || return 0 - echo "--- processes"; ps -o pid,pcpu,state,wchan,command -p "$1,$server_pid" || true - echo "--- client stats"; ftp -V -o - "http://127.0.0.1:$2/stats" 2>&1 || true - echo "--- server stats"; ftp -V -o - "http://127.0.0.1:9100/stats" 2>&1 || true - echo "--- client and server syscalls (2 s)" - ktrace -f "$work/client-diag.ktrace" -t c -p "$1" || true - ktrace -f "$work/server-diag.ktrace" -t c -p "$server_pid" || true - sleep 2 - ktrace -C || true - for side in client server; do - echo "--- $side syscalls" - kdump -f "$work/$side-diag.ktrace" > "$work/$side-diag.txt" 2>/dev/null || true - awk '$3 == "CALL" { sub(/\(.*/, "", $4); print $4 }' "$work/$side-diag.txt" | sort | uniq -c | sort -rn - grep -E 'RET +[a-z_]+ -1' "$work/$side-diag.txt" | sort | uniq -c | sort -rn | head -n 20 - grep -E 'sendmsg|recvmsg' "$work/$side-diag.txt" | tail -n 30 - done - echo "--- udp sockets"; netstat -an -f inet -p udp || true - echo "--- plain UDP over loopback (to the echo target)" - "$tools/udpsend" 127.0.0.1:5390 probe 2>&1 || true - echo "--- interfaces"; netstat -in || true - echo "--- IP counters"; netstat -s -p ip | grep -i -E 'drop|fail|no route|discard|output|fragment' || true - echo "--- capture processes"; ps -ax -o pid,stat,command | grep '[t]cpdump' || true - echo "--- pf"; cat /etc/pf.conf 2>&1 || true - sudo -n pfctl -si 2>&1 || true - sudo -n pfctl -sr 2>&1 || true - echo "states: $(sudo -n pfctl -ss 2>/dev/null | wc -l)" - sudo -n pfctl -ss 2>&1 | grep -E '4433|5390' | head -n 40 || true - echo "--- after disabling pf" - sudo -n pfctl -d 2>&1 || true - "$tools/udpsend" 127.0.0.1:5390 probe 2>&1 || true - if [ -n "${port:-}" ]; then - sleep 5 - "$tools/udpsend" "127.0.0.1:$port" probe 2>&1 || true - fi -} - -# show_logs CLIENT_LOG: the server's and a client's log, plus whatever the -# routing-table check captured. -show_logs() { - echo "--- server log"; cat "$work/server.log" - echo "--- client log"; cat "$1" - for cap in "$work"/tcpdump-*.txt; do - [ -f "$cap" ] || continue - echo "--- $(basename "$cap")"; tail -n 100 "$cap" - done - if [ -f "$work/server-all.ktrace" ]; then - echo "--- server: failed syscalls since the multipath rounds began" +# fail MESSAGE CLIENT_PID CLIENT_STATS_PORT CLIENT_LOG: report a failed check +# with what both sides were doing, and exit. +fail() { + echo "FAIL: $1" + if [ "$(uname -s)" = OpenBSD ]; then + echo "--- processes"; ps -o pid,pcpu,state,wchan,command -p "$2,$server_pid" || true + echo "--- client stats"; ftp -V -o - "http://127.0.0.1:$3/stats" 2>&1 || true + echo "--- server stats"; ftp -V -o - "http://127.0.0.1:9100/stats" 2>&1 || true + # Two seconds of both sides' syscalls: a stalled sender shows no + # sendmsg at all. + ktrace -f "$work/client.ktrace" -t c -p "$2" || true + ktrace -f "$work/server.ktrace" -t c -p "$server_pid" || true + sleep 2 ktrace -C || true - kdump -f "$work/server-all.ktrace" > "$work/server-all.txt" 2>/dev/null || true - grep -E 'RET +[a-z_]+ -1' "$work/server-all.txt" | sort | uniq -c | sort -rn | head -n 20 - echo "--- server: first failed sendmsg and what preceded it" - grep -n -m 1 -E 'RET +sendmsg -1' "$work/server-all.txt" | cut -d: -f1 | while read -r l; do - sed -n "$((l > 30 ? l - 30 : 1)),$((l + 10))p" "$work/server-all.txt" + for side in client server; do + echo "--- $side syscalls (2 s)" + kdump -f "$work/$side.ktrace" > "$work/$side.kdump" 2>/dev/null || true + awk '$3 == "CALL" { sub(/\(.*/, "", $4); print $4 }' "$work/$side.kdump" | + sort | uniq -c | sort -rn + grep -E 'RET +[a-z_]+ -1' "$work/$side.kdump" | sort | uniq -c | sort -rn | head -n 20 done - echo "--- server: sendmsg calls per second" - grep -E 'CALL +sendmsg' "$work/server-all.txt" | wc -l - fi - if [ -f "$work/udpstat.before" ]; then - echo "--- UDP counters, before and now" - cat "$work/udpstat.before" - netstat -s -p udp || true + echo "--- udp sockets"; netstat -an -f inet -p udp || true fi + kill "$2" 2>/dev/null || true + echo "--- server log"; cat "$work/server.log" + echo "--- client log"; cat "$4" + exit 1 } # path_rx STATS_PORT REMOTE: datagrams received on the client's path to REMOTE. @@ -123,23 +86,12 @@ check() { --insecure "$@" > "$work/client-$name.log" 2>&1 & cpid=$! pids="$pids $cpid" - ok="" i=0 - while [ $i -lt 10 ]; do - if "$tools/udpsend" "127.0.0.1:$port" "$name" 2>/dev/null | grep -q "echo:$name"; then - ok=1 - break - fi + until "$tools/udpsend" "127.0.0.1:$port" "$name" 2>/dev/null | grep -q "echo:$name"; do i=$((i + 1)) + [ $i -lt 10 ] || fail "$name" "$cpid" "$stats" "$work/client-$name.log" sleep 1 done - if [ -z "$ok" ]; then - echo "FAIL: $name" - diagnose "$cpid" "$stats" - kill "$cpid" 2>/dev/null || true - show_logs "$work/client-$name.log" - exit 1 - fi kill "$cpid" 2>/dev/null || true echo "PASS: $name" } @@ -153,53 +105,42 @@ grep -q "ech=true" "$work/server.log" || { } echo "PASS: ECH accepted on the server" -# Per-path routing table (OpenBSD): an extra path towards this host's egress -# address in routing table 0, which unprivileged processes may select. The -# path must come up through its own socket and the tunnel keep working. +# Multipath (OpenBSD): an extra path towards this host's egress address, first +# on the client's main socket, then in routing table 0 (which unprivileged +# processes may select) through a socket of its own. The routing-table path +# must come up and receive replies on that socket. Each client exits right +# after its check, so the server sees connections on several paths close +# while others start: a few rounds of that once caught the server's UDP +# socket stalling for good (fixed in losfair/noq#4: OpenBSD send lock contention). if [ "$(uname -s)" = OpenBSD ]; then egress_ip="$(ifconfig egress 2>/dev/null | awk '/inet /{print $2; exit}')" if [ -z "$egress_ip" ]; then - echo "FAIL: no egress address for the routing-table check" + echo "FAIL: no egress address for the multipath checks" ifconfig exit 1 fi - egress_if="$(ifconfig egress | sed -n '1s/:.*//p')" - for ifc in lo0 "$egress_if"; do - sudo tcpdump -n -l -i "$ifc" udp port 4433 > "$work/tcpdump-$ifc.txt" 2>&1 & - done - netstat -s -p udp > "$work/udpstat.before" 2>&1 || true spec="$egress_ip:4433/rtable=0" - for round in 1 2 3 4 5 6; do - # The same extra path without a routing table first, to tell - # multipath problems from routing-table ones. + for round in 1 2 3; do check "multipath-$round" 6005 --path "$egress_ip:4433" + log="$work/client-rtable-$round.log" "$bin" client --listen 127.0.0.1:6003 \ --endpoint https://localhost:4433/connect --proxy-addr 127.0.0.1:4433 \ --stats-listen 127.0.0.1:7003 \ - --insecure --path "$spec" > "$work/client-rtable-up-$round.log" 2>&1 & + --insecure --path "$spec" > "$log" 2>&1 & cpid=$! pids="$pids $cpid" - # The path must come up and receive through its own socket. i=0 - until grep -q "multipath path $spec up" "$work/client-rtable-up-$round.log" && + until grep -q "multipath path $spec up" "$log" && [ "$(path_rx 7003 "$egress_ip:4433")" -gt 0 ] 2>/dev/null; do i=$((i + 1)) - if [ $i -gt 15 ]; then - echo "FAIL: path $spec did not come up and receive (round $round)" - port=6003 - diagnose "$cpid" 7003 - show_logs "$work/client-rtable-up-$round.log" - exit 1 - fi + [ $i -le 15 ] || fail "path $spec did not come up and receive (round $round)" \ + "$cpid" 7003 "$log" sleep 1 done - grep -q "routing table 0: socket" "$work/client-rtable-up-$round.log" || { - echo "FAIL: no routing-table socket" - cat "$work/client-rtable-up-$round.log" - exit 1 - } - echo "PASS: path in routing table 0 up and receiving after ${i}s (round $round)" + grep -q "routing table 0: socket" "$log" || + fail "no routing-table socket (round $round)" "$cpid" 7003 "$log" kill "$cpid" 2>/dev/null || true + echo "PASS: path in routing table 0 up and receiving (round $round)" done check rtable 6004 --path "$spec" fi diff --git a/AGENTS.md b/AGENTS.md index fa0f262..6e3ab53 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -89,6 +89,12 @@ and documented in `README.md`. (`.github/scripts/smoke-test.sh`) exercises a real `rtable=0` path. OpenBSD has no dual-stack sockets: `quic::client_bind_socket` falls back to the primary's family there. +- OpenBSD UDP send stall (fixed in the losfair/noq fork, losfair/noq#4): a + non-blocking UDP `sendmsg` there fails with EAGAIN when another thread is + sending on the same socket, and noq's tokio sender used to clear write + readiness on it and wait forever for a kqueue write event, silencing every + connection on the socket. It looked like a routing-table bug; the smoke + test's back-to-back multipath rounds reproduce it within a few rounds. - Outgoing datagram queue management (always on, no flags; `quic::DATAGRAM_CODEL`) is noq's `TransportConfig::datagram_send_codel` (CoDel plus a hard `max_delay`, in the losfair/noq fork): the queue that builds up is noq's From fbfb3146ec62f2602b515b466a3d7153d3f8e635 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 15 Oct 2026 18:09:36 +0000 Subject: [PATCH 10/10] Pin noq to the merged OpenBSD UDP send stall fix losfair/noq#4 merged as cad1d3a on dev (same tree as the PR head 2f590c1). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012baC35vUbLPPhuK4pz4uRz --- Cargo.lock | 6 +++--- Cargo.toml | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9df8cfa..ad643e1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -563,7 +563,7 @@ dependencies = [ [[package]] name = "noq" version = "1.3.0" -source = "git+https://github.com/losfair/noq?rev=2f590c103ad7210b4539a24b4c7ba938afc4be46#2f590c103ad7210b4539a24b4c7ba938afc4be46" +source = "git+https://github.com/losfair/noq?rev=cad1d3ae29ed1b99f01dfd4498e0bb7d892ef6f6#cad1d3ae29ed1b99f01dfd4498e0bb7d892ef6f6" dependencies = [ "bytes", "cfg_aliases", @@ -583,7 +583,7 @@ dependencies = [ [[package]] name = "noq-proto" version = "1.3.0" -source = "git+https://github.com/losfair/noq?rev=2f590c103ad7210b4539a24b4c7ba938afc4be46#2f590c103ad7210b4539a24b4c7ba938afc4be46" +source = "git+https://github.com/losfair/noq?rev=cad1d3ae29ed1b99f01dfd4498e0bb7d892ef6f6#cad1d3ae29ed1b99f01dfd4498e0bb7d892ef6f6" dependencies = [ "bytes", "derive_more", @@ -609,7 +609,7 @@ dependencies = [ [[package]] name = "noq-udp" version = "1.3.0" -source = "git+https://github.com/losfair/noq?rev=2f590c103ad7210b4539a24b4c7ba938afc4be46#2f590c103ad7210b4539a24b4c7ba938afc4be46" +source = "git+https://github.com/losfair/noq?rev=cad1d3ae29ed1b99f01dfd4498e0bb7d892ef6f6#cad1d3ae29ed1b99f01dfd4498e0bb7d892ef6f6" dependencies = [ "cfg_aliases", "libc", diff --git a/Cargo.toml b/Cargo.toml index ac0be9b..880630e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,10 +32,10 @@ tokio-stream = "0.1" # Pinned to the losfair/noq fork for per-path scheduling priority, the path # spill threshold and datagram queue management (not in upstream noq). Keep # both crates on the same commit. -noq = { git = "https://github.com/losfair/noq", rev = "2f590c103ad7210b4539a24b4c7ba938afc4be46", default-features = false, features = ["runtime-tokio", "ring", "bloom", "tracing-log"] } +noq = { git = "https://github.com/losfair/noq", rev = "cad1d3ae29ed1b99f01dfd4498e0bb7d892ef6f6", default-features = false, features = ["runtime-tokio", "ring", "bloom", "tracing-log"] } # Direct dep only for `coding::Encodable` (to read a `PathId` for the multipath # AEAD nonce); same commit as noq's own. -noq-proto = { git = "https://github.com/losfair/noq", rev = "2f590c103ad7210b4539a24b4c7ba938afc4be46", default-features = false, features = ["ring", "bloom", "tracing-log"] } +noq-proto = { git = "https://github.com/losfair/noq", rev = "cad1d3ae29ed1b99f01dfd4498e0bb7d892ef6f6", default-features = false, features = ["ring", "bloom", "tracing-log"] } # BoringSSL: the TLS 1.3 handshake (via its QUIC API), ECH, and packet # protection (AEAD + header protection). boring 4 keeps the ECH code identical # to zeromasque's.