Skip to content

fix: keep IPv6 addresses across link down/up on dual-stack devices - #47

Open
Frando wants to merge 1 commit into
mainfrom
fix/link-up-dualstack
Open

Frando wants to merge 1 commit into
mainfrom
fix/link-up-dualstack

Conversation

@Frando

@Frando Frando commented Sep 11, 2026

Copy link
Copy Markdown
Member

Iface::link_up failed with EHOSTUNREACH on any dual-stack device after link_down, because Linux flushes IPv6 addresses when a link goes down and the v6 default route then has no on-link gateway. Every namespace now sets keep_addr_on_down=1 so global addresses survive the transition. The kernel drops link-local addresses regardless of that sysctl, so link_up also re-adds the seeded link-local, which restores the interface to its exact pre-down state.

The new link_down_up_dual_stack test reproduces the failure from the issue and checks that both v6 addresses and v6 connectivity are back after the flap. I also verified the RouterPreset::Home scenario from the issue and the Ipv6Profile::Realistic profile manually.

Closes #46

🤖 Generated with Claude Code

Linux flushes an interface's IPv6 addresses when the link goes down, so
`Iface::link_up` failed with EHOSTUNREACH when re-adding the v6 default
route on any dual-stack device: the gateway was no longer on-link. We now
set `keep_addr_on_down=1` in every namespace so global addresses survive
the transition. The kernel drops link-local addresses regardless of that
sysctl, so `link_up` re-adds the seeded link-local as well.

Closes #46

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@Frando
Frando marked this pull request as ready for review September 11, 2026 17:07
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.

link_up() fails with EHOSTUNREACH on dual-stack devices after link_down()

1 participant