Repository navigation
feat!: add Iface::carrier_down and carrier_up to simulate a pulled cable - #64
Merged
Merged
Conversation
Frando
marked this pull request as ready for review
November 13, 2026 14:06
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
`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) <[email protected]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This PR already adds variants, so the break is free now. Later variants then no longer break code that matches on the enum. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Frando
force-pushed
the
feat/iface-carrier
branch
from
November 18, 2026 17:54
0fff965 to
c57d956
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
link_downis 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 aslinkdown, 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_downandcarrier_uptake 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 oncarrier_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 matchingcarrier-downandcarrier-upsteps.The first commit moves the router-side veth lookup from
Iface::apply_conditionintoNetworkCore::gateway_vethso both callers share it.Breaking changes
LabEventKindis now non-exhaustive and has two new variants,CarrierUpandCarrierDown, emitted by the new methods. Matches onLabEventKindneed a_arm .