Files
tsunagi/.github/workflows/subnet-source.yml
T
Aleksandr Bogomiakov 43894612ee Fix macOS exit sharing and bring exit selection onto the phone home screen
A Mac could install PF rules and advertise itself while IPv4 forwarding
was still off. Check and enable forwarding when applying the offer and
refresh the physical route when the uplink changes. Try the agent's
existing privileges first. When an existing utun needs additional
permission, the foreground tray or CLI can obtain an administrator grant
scoped to the local UID and overlay subnet. Reconcile the current offer
after the dialog so a withdrawal during authorization stays effective.

A user agent denied a host utun can serve peers over bounded TCP, UDP
and ICMP echo sockets bound to the physical interface. Keep host routes
and ordinary local application traffic on the system-utun path. Preserve
the saved choice for intentionally off-host setups and report readiness
separately.

Report exit selection directly to the selected peer over its authenticated
session. Older peers appear for one minute following forwarded traffic.
The optional announcement trailer remains compatible with control v8.
Local IPC v29 carries the new status and authorization results.

Keep the exit user count, left-aligned names and one-row scroll controls
in a single fixed-height block alongside the network details. Show health
and a small traffic trace on folded cards. Open desktop Devices at a
usable width and keep the exit action clickable in its compact layout.

Replace Android's per-card exit buttons with a fixed thumb-sized control.
The chooser and Quick Settings share one list with a single local option,
network groups, measured latency and an accessible confirmation sheet.

Release the applications and packages as 1.0.9.

On macOS, checked formatting, strict workspace Clippy and the workspace
all-target test suite, including real encrypted agents and loopback TCP,
UDP and ICMP. Ran the opt-in user-mode exit UDP round trip on a physical
IPv4 interface. Verified the authorization scripts and syntax of their
PF, sudoers and AppleScript components. The privileged two-utun kernel
test is reserved for an isolated macOS runner. Rendered phone and desktop
layouts in both themes, built the arm64 Android debug APK and cross-
checked all workspace targets for Windows GNU.
2026-11-26 01:57:51 +02:00

121 lines
5.8 KiB
YAML

name: Native subnet source selection
on:
push:
branches: [master]
paths:
- '.github/workflows/subnet-source.yml'
- 'crates/tsunagi-core/src/overlay/egress.rs'
- 'crates/tsunagi-core/src/overlay/egress/**'
- 'crates/tsunagi-core/src/overlay/interface.rs'
- 'crates/tsunagi-core/src/overlay/router.rs'
- 'crates/tsunagi-core/src/overlay/hostrules/linux_exit*.rs'
- 'crates/tsunagi-core/src/overlay/provision/linux.rs'
- 'crates/tsunagi-core/src/overlay/hostrules/macos*.rs'
- 'crates/tsunagi-core/src/overlay/hostrules/macos/**'
- 'crates/tsunagi-core/src/overlay/hostrules/windows*.rs'
- 'crates/tsunagi-core/src/overlay/provision/macos.rs'
- 'crates/tsunagi-core/src/overlay/provision/windows.rs'
- 'crates/tsunagi-core/src/overlay/provision/mod.rs'
- 'crates/tsunagi-core/src/overlay/provision/factory.rs'
- 'crates/tsunagi-core/src/overlay/tun.rs'
- 'crates/tsunagi-core/src/net.rs'
workflow_dispatch:
permissions:
contents: read
jobs:
source:
if: github.server_url == 'https://github.com'
runs-on: ${{ matrix.os }}
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
test: overlay::hostrules::linux_exit_kernel::serving_an_established_flow_while_switching_the_local_exit
- os: macos-latest
test: overlay::provision::macos::tests::unbound_sockets_choose_each_networks_source_on_one_real_utun
- os: windows-latest
test: overlay::provision::windows::tests::two_windows_subnets_choose_their_own_source_and_survive_removal
env:
TEST_NAME: ${{ matrix.test }}
CARGO_PROFILE_TEST_DEBUG: '0'
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Build and locate the native test
shell: pwsh
run: |
$artifacts = @(cargo test --locked -p tsunagi-core --lib --features tun-device --no-run --message-format=json-render-diagnostics |
ForEach-Object { ConvertFrom-Json -InputObject $_ } |
Where-Object { $_.reason -eq 'compiler-artifact' -and $_.target.name -eq 'tsunagi' -and $_.profile.test -and $_.executable })
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
if ($artifacts.Count -ne 1) { throw "Expected one core test binary, found $($artifacts.Count)" }
$binary = $artifacts[0].executable
$tests = @(& $binary --ignored --exact $env:TEST_NAME --list)
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
if ($tests -notcontains "$($env:TEST_NAME): test") { throw "Missing ignored test: $env:TEST_NAME" }
"TEST_BINARY=$binary" >> $env:GITHUB_ENV
- name: Verify separate forwarding and local egress in Linux namespaces
if: runner.os == 'Linux'
shell: bash
run: sudo -n -- "$TEST_BINARY" --ignored --exact "$TEST_NAME" --nocapture
- name: Verify source selection on a real utun
if: runner.os == 'macOS'
shell: bash
run: sudo -n -- "$TEST_BINARY" --ignored --exact "$TEST_NAME" --nocapture
- name: Verify exit routing and PF translation on two real utuns
if: runner.os == 'macOS'
shell: bash
timeout-minutes: 2
env:
EXIT_TEST: overlay::hostrules::macos_exit::kernel::exit_preserves_underlay_and_both_meshes
run: |
"$TEST_BINARY" --ignored --exact "$EXIT_TEST" --list | grep -Fx "$EXIT_TEST: test"
previous=$(sysctl -n net.inet.ip.forwarding)
trap 'sudo -n sysctl -w "net.inet.ip.forwarding=$previous"' EXIT
sudo -n sysctl -w net.inet.ip.forwarding=0
sudo -n -- "$TEST_BINARY" --ignored --exact "$EXIT_TEST" --nocapture
- name: Verify source selection on a real Wintun adapter
if: runner.os == 'Windows'
shell: pwsh
run: |
$zip = Join-Path $env:RUNNER_TEMP 'wintun.zip'
Invoke-WebRequest -Uri https://www.wintun.net/builds/wintun-0.14.1.zip -OutFile $zip
# This is the signed Wintun distribution pinned by the Windows installer.
if ((Get-FileHash $zip -Algorithm SHA256).Hash -ne '07C256185D6EE3652E09FA55C0B673E2624B565E02C4B9091C79CA7D2F24EF51') {
throw 'Unexpected Wintun archive checksum'
}
$directory = Join-Path $env:RUNNER_TEMP 'wintun-dl'
Expand-Archive -Path $zip -DestinationPath $directory
Copy-Item (Join-Path $directory 'wintun/bin/amd64/wintun.dll') (Split-Path -Parent $env:TEST_BINARY)
& $env:TEST_BINARY --ignored --exact $env:TEST_NAME --nocapture
exit $LASTEXITCODE
- name: Verify forwarded and local traffic to the same destination
if: runner.os == 'Windows'
shell: pwsh
timeout-minutes: 2
run: |
$test = 'overlay::egress::tests::physical_member_sockets_survive_a_more_specific_wintun_route'
$listing = @(& $env:TEST_BINARY --ignored --exact $test --list)
if ($listing -notcontains "${test}: test") { throw "Missing ignored test $test" }
& $env:TEST_BINARY --ignored --exact $test --nocapture
exit $LASTEXITCODE
- name: Verify one Windows exit bypass route through the physical gateway
if: runner.os == 'Windows'
shell: pwsh
timeout-minutes: 2
run: |
$test = 'overlay::hostrules::windows_exit::tests::windows_refresh_installs_only_the_external_test_address'
$listing = @(& $env:TEST_BINARY --ignored --exact $test --list)
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
if ($listing -notcontains "${test}: test") { throw "Missing ignored test: $test" }
& $env:TEST_BINARY --ignored --exact $test --nocapture
exit $LASTEXITCODE