Skip to content

fix(netwatch): define Darwin routing constants locally for iOS - #267

Merged
flub merged 3 commits into
n0-computer:mainfrom
Foreverwzh:fix/ios-libc-route-consts
Nov 6, 2026
Merged

flub merged 3 commits into
n0-computer:mainfrom
Foreverwzh:fix/ios-libc-route-consts

Conversation

@Foreverwzh

@Foreverwzh Foreverwzh commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Description

Fixes #261.

libc 0.2.190 dropped the net/route.h constants (RTM_*, RTA_*, RTAX_*, RTF_*) on non-macOS Apple targets (rust-lang/libc#5158), so netwatch no longer builds for aarch64-apple-ios. This defines them in interfaces/bsd/macos.rs, the same way the FreeBSD/NetBSD/OpenBSD backends already do, and adds a macOS-only test that checks them against libc.

Also bumps netdev to 0.47 and libc to 0.2.191 in the lockfile. The lockfile was still on 0.2.189, which is why CI didn't catch this. This overlaps with the netdev bump in #263.

Notes & open questions

Tested with cargo check -p netwatch --target aarch64-apple-ios --all-features (fails with 22 errors before this change, passes after) and cargo test -p netwatch --all-features on macOS (arm64).

There's no iOS build in CI, so this could break again. Happy to add a build-only iOS job like the Android one if you want it here or in a follow-up.

Change checklist

  • Self-review.
  • Documentation updates following the style guide, if relevant.
  • Tests if relevant.
  • All API changes documented.
  • cargo make passes locally.

🤖 Generated with Claude Code

@flub flub left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making this PR!

Comment thread netwatch/src/interfaces/bsd/macos.rs Outdated
// the same on all Darwin targets.
// https://github.com/rust-lang/libc/pull/5158

pub const RTF_GATEWAY: c_int = 0x2;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you make these all pub(crate)? I think that is the eventual visibility? It's easier to see what the visibility is that way rather than having to figure out the visibility of the module.

@github-project-automation github-project-automation Bot moved this from 🚑 Needs Triage to 🏗 In progress in iroh Nov 2, 2026
@flub

flub commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

There's no iOS build in CI, so this could break again. Happy to add a build-only iOS job like the Android one if you want it here or in a follow-up.

Would be great to add such a build-only iOS job! Might as well do it right away on this PR so that we know it works. But if you prefer a separate stacked PR would also be fine.

Foreverwzh and others added 3 commits November 6, 2026 12:54
libc 0.2.190 stopped exposing the net/route.h constants (RTM_*, RTA_*,
RTAX_*, RTF_*) on non-macOS Apple targets (rust-lang/libc#5158), which
broke building netwatch for iOS. Define them in bsd/macos.rs like the
other BSD backends already do, with a macOS test that checks them
against libc.

Also bump netdev to 0.47, which fixes the same problem on its side, and
libc to 0.2.191 in the lockfile so CI builds against the new libc.

Fixes n0-computer#261

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Foreverwzh
Foreverwzh force-pushed the fix/ios-libc-route-consts branch from 6fcea9f to ef7c6dc Compare November 6, 2026 04:54
@Foreverwzh

Copy link
Copy Markdown
Contributor Author

Thanks for the review! Both done:

  • The route constants in interfaces/bsd/macos.rs are now pub(crate).
  • Added an iOS Build Only CI job that builds the workspace with all features for aarch64-apple-ios and aarch64-apple-ios-sim on macos-latest. Both targets build locally with -Dwarnings.

Also fixed the fmt failure in netmon/bsd.rs. CI needs workflow approval to run on the new commits.

@flub flub left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, thanks

@flub
flub enabled auto-merge November 6, 2026 13:05
@flub
flub added this pull request to the merge queue Nov 6, 2026
Merged via the queue into n0-computer:main with commit c8d6e3e Nov 6, 2026
36 checks passed
@github-project-automation github-project-automation Bot moved this from 🏗 In progress to ✅ Done in iroh Nov 6, 2026
pclshm added a commit to hoi-project/hoi that referenced this pull request Nov 8, 2026
Fixes #23

## Change

- Run the Chromium and Firefox major-release checks on Ubuntu 24.04,
which supports the pinned Playwright version. Build the test web app
with an offline release-feed fixture.
- Backport the Darwin routing fix from
[net-tools#267](n0-computer/net-tools#267) to
`netwatch` 0.19.3 so it compiles against the current iOS libc bindings.
- Pace the WebKit onboarding gestures to match the app's input rate
limit and use a standard canvas to generate the test image.

## Validation

- [x] `pnpm check:quick` passed with 76 tests and two existing Windows
skips. The installed dependencies were used with pnpm's dependency
verification set to warn.
- [x] The runner regression test failed before the pin and passed
afterward. The original onboarding timeout reproduced in Windows WebKit.
The updated home-node suite passed using the existing consent fixture to
reach onboarding on Windows.
- [x] `netwatch` failed to compile for iOS before the backport. The
patched crate passed locked checks for both the device and simulator
targets.
- [x] Rust formatting, `hoi-net` Clippy and focused networking tests,
and Cargo license and source checks passed.
- [x] The publication check and `git diff --check` passed.

The complete iOS build needs Xcode. The full major-release browser
matrix still needs GitHub Actions validation.

## Compatibility

The lockfiles resolve the existing `netwatch` version to the local
backport. There are no protocol or storage format changes.
ifdario added a commit to flashmind-labs/beep that referenced this pull request Nov 15, 2026
libc 0.2.190 dropped net/route.h constants on iOS. Carry
n0-computer/net-tools#267 until netwatch releases it.
ifdario added a commit to flashmind-labs/beep that referenced this pull request Nov 16, 2026
libc 0.2.190 dropped net/route.h constants on iOS. Carry
n0-computer/net-tools#267 until netwatch releases it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

netwatch fails to build for iOS with libc >= 0.2.190 (route constants are macOS-only now)

2 participants