Skip to content

Switch dependency handling to session-deps (backport from client) - #179

Merged
mpretty-cyro merged 12 commits into
session-foundation:devfrom
mpretty-cyro:session-deps-backport
Oct 6, 2026
Merged

mpretty-cyro merged 12 commits into
session-foundation:devfrom
mpretty-cyro:session-deps-backport

Conversation

@mpretty-cyro

Copy link
Copy Markdown
Collaborator

Backport of the session-deps dependency migration from client to dev, so a release can carry a newer libQuic. Build-system focused; none of the other client work (session-sqlite, mnemonics, schema, PFS, device linking) comes with it.

Three commits, kept separate so the networking one can be reviewed on its own:

  1. Switch dependency handling to session-deps. Replaces the libsodium-internal, zstd and simdutf submodules and cmake/StaticBuild.cmake with cmake/session-deps (pinned to the same commit client uses), and bumps session-router to 2b91e9ab4.
    • xed25519::pubkey() used libsodium-internal's fe25519 internals; it now uses a TweetNaCl subset (src/xed25519-tweetnacl.cpp). It matches the reference y = (u-1)/(u+1) mod p on 20,012 inputs including edge cases. The C API is unchanged (client also changed session_xed25519_pubkey to return void; that is not needed here and is not included).
    • session-deps builds nettle 4, so the digest calls go through src/nettle-compat.hpp (from client).
    • USE_LTO becomes the single LTO switch for session-deps and session-router; without it session-router's LTO probe fails under utils/ios.sh.
    • ENABLE_NETWORKING is kept (client removed it).
  2. Port session_router_router to session-router's tunnel claims, and bump session-router to afb98f9 (libquic 1.9.0). establish_udp() now returns a claim that closes the tunnel when destroyed; the old code discarded it, so fixing only the callback signature would compile and silently close every tunnel. The claims are held in a mutex-guarded map (the failure callback runs on session-router's thread). Not ported from client: striking a node with no relay contact on first contact; the failure reason is only logged.
  3. quic: use max_udp_payload::minimum() instead of the deprecated disable_mtu_discovery. Same behaviour (libquic defines the old one as exactly this value).

Behaviour changes to know about

  • zstd moves from 1.5.2 to 1.5.7, so compressed output differs for the same input (test vectors in test_compression.cpp updated, same as client). This can affect config deduplication at the swarm between clients on different versions.
  • session-router is 75 commits newer, with libquic 1.9.0 (was 1.8.0).

Tested

  • macOS arm64: builds, 149/149 test cases pass (25,756,146 assertions), same as before. dev itself does not link on macOS without hand-added CoreFoundation/Security frameworks; this does.
  • Linux arm64 (Ubuntu 24.04 container): builds, 149/149 on 7 of 7 runs. test_quic_transport.cpp:48 aborts intermittently ("Resource deadlock avoided") on current dev too (1 run in 8).
  • iOS simulator and device arm64 via utils/ios.sh: build. No tests are possible for the static library.
  • Android arm64-v8a, armeabi-v7a, x86_64, x86 and the Desktop Node addon build and link against it through scratch copies of the wrappers, which have no test suites.
  • With ENABLE_NETWORKING=OFF (Desktop/Android config) the library builds; testAll does not, identically on current dev (the tests include oxen/quic.hpp unconditionally).

Not tested: Linux x86_64, Windows/mingw, iOS x86_64 simulator, shared-library mode, Android on a Linux host, any device.

Wrapper impact

  • Android: needs libsodium::sodium-internal → sessiondep::libsodium in its CMake (draft PR: Link libsodium through session-deps libsession-util-android#54). On a macOS host, session-deps builds libsodium with the host ar and gets an empty archive; setting AR/RANLIB to the NDK's llvm tools works around it.
  • Desktop (Node): no source changes; on macOS SDKROOT must now be exported (libsodium is built with autotools even with networking off).
  • iOS: no build-script changes were needed.

Looking ahead to libquic 1.11.0: libsession compiles unchanged against libquic's current dev (1.10.2), but the macOS link then needs -framework CoreFoundation -framework Security for gnutls system-trust symbols, which has to be fixed in libquic, session-deps or here.

Replace the libsodium-internal, zstd and simdutf submodules and cmake/StaticBuild.cmake with
cmake/session-deps, and bump session-router to 2b91e9ab4 (libquic c0b9cf6).

xed25519::pubkey() used libsodium-internal's fe25519 internals; it now uses a TweetNaCl subset
(src/xed25519-tweetnacl.cpp).  session-deps builds nettle 4, so digest calls go through
nettle-compat.hpp.  zstd moves 1.5.2 -> 1.5.7, which changes compressed output; test vectors updated.
USE_LTO becomes the single LTO switch for session-deps and session-router.
…e_mtu_discovery

libquic 1.9 deprecates opt::disable_mtu_discovery as exactly this value; behaviour is unchanged.
@mpretty-cyro
mpretty-cyro marked this pull request as ready for review October 2, 2026 04:09
@mpretty-cyro
mpretty-cyro requested a review from jagerman October 2, 2026 04:09
@mpretty-cyro mpretty-cyro self-assigned this Oct 2, 2026
mpretty-cyro and others added 9 commits October 6, 2026 09:48
session-deps' system-library targets (e.g. protobuf-lite) are not in any export set, so export(TARGETS protos)
fails to generate when building against system libraries. Nothing consumes libsessionTargets.cmake; client
removed these as well.
libquic 1.11.0 relies on session-deps' patched ngtcp2 1.25.0 recipe
(6b37832, d74f5b1).  That change kept session_deps_version at 1.28, the
same as 58c5a08, and with equal versions the first copy loaded wins:
ours, at the top level.  So anything older here would quietly build
libquic against the unpatched ngtcp2.

Also picked up from dae3b07 (what client pins): 9051cd2 passes the macOS
deployment target to the CMake-built deps on native builds (zstd and
simdutf were being built for the SDK's own macOS version, 15.0 on a
current Xcode, rather than our 10.15), and cc67e32 builds CMake deps as
Release by default.
session_network.cpp called SessionRouter::make() unconditionally while
session_router_router.cpp is only compiled with ENABLE_NETWORKING_SROUTER,
so an OFF build produced a static library with an undefined reference
that only showed up when something linked it (which is why the mingw CI
build, a static library alone, never noticed).  Gate the session-router
code on a compile definition, as client does, and throw if the
session_router router is requested from a build without it.

No client on this branch routes through session-router, so default the
option off rather than making every networking build carry it.
libsession takes libquic from session-router's submodule even with
ENABLE_NETWORKING_SROUTER off, so this is what moves it from a
pre-1.9.0 snapshot (c1835882) to 1.11.0.  Since then libquic has fixed
a use-after-free in Endpoint::drop_connection (1.9.1), stopped using a
connection that ngtcp2 has rejected and stopped requesting chunks from
a closing stream (1.10.1), no longer treats writing to a closing or
draining connection as an error (1.10.2), and in 1.11.0 does its own
PMTU probing, drops packets on EMSGSIZE/ENOBUFS rather than closing the
connection, and migrates rather than closes a connection when the
host's source address changes.
session-deps' gnutls recipe never passed on the Security and
CoreFoundation frameworks that gnutls's own gnutls.pc lists on darwin,
so a static macOS link of anything using libquic failed on gnutls's
system-trust symbols unless something else happened to add them.  With
session-router off by default here, nothing else does.
session-deps' meson cross file setup died on utils/macos.sh's x86_64
build (CMAKE_SYSTEM_NAME=Darwin with no SDK_NAME) before any dependency
was asked for, breaking the static macOS build.
Backports client's QUIC payload cap (b46b88f), MTU part only: a size cap in the C++ options, Config, the C
API (session_network_config.quic_max_udp_payload) and QuicTransport. quic_disable_mtu_discovery stays as a
supported alias for a 1200 cap rather than being deprecated. Values under 1200 are rejected when the option
is set instead of when libquic builds the endpoint.
@mpretty-cyro
mpretty-cyro merged commit d8d540b into session-foundation:dev Oct 6, 2026
26 checks passed
@mpretty-cyro
mpretty-cyro deleted the session-deps-backport branch October 6, 2026 02:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants