Skip to content

feat!: add Iface::carrier_down and carrier_up to simulate a pulled cable - #64

Draft
Frando wants to merge 3 commits into
mainfrom
feat/iface-carrier
Draft

Frando wants to merge 3 commits into
mainfrom
feat/iface-carrier

Conversation

@Frando

@Frando Frando commented Sep 28, 2026

Copy link
Copy Markdown
Member

link_down is an administrative down: the kernel removes routes, flushes IPv6 addresses unless told otherwise, and sends fail with an error. A pulled cable or a lost Wi-Fi association only drops carrier. The interface stays up and keeps its addresses and routes, which the kernel flags as linkdown, and packets vanish silently. Apps that watch netlink, like iroh's network monitor, see different events for the two, so tests need both.

Iface::carrier_down and carrier_up take the router-side end of the interface's veth pair down and up, which the kernel reports as NO-CARRIER on the device side. Nothing on the device changes, so there is nothing to restore on carrier_up, and link conditions on the router-side veth survive the flap. Dummy interfaces have no peer and return an error. The sim runner gets matching carrier-down and carrier-up steps.

The first commit moves the router-side veth lookup from Iface::apply_condition into NetworkCore::gateway_veth so both callers share it.

Breaking changes

  • LabEventKind has two new variants, CarrierUp and CarrierDown, emitted by the new methods. Exhaustive matches on LabEventKind need arms for them.

🤖 Generated with Claude Code

Frando and others added 3 commits September 28, 2026 12:04
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
`link_down` is an administrative down. The kernel removes routes and
flushes IPv6 addresses, and sends fail with an error. A pulled cable or
a lost Wi-Fi association only drops carrier: the interface stays up,
keeps its addresses and routes, and packets vanish silently. Apps that
watch netlink see different events for the two, so tests need both.

Carrier is toggled by taking down the router-side end of the veth pair,
which the kernel reports as NO-CARRIER on the device side.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

1 participant