examples: add netfailover (reactive policy routing) - #618
Open
lneto wants to merge 1 commit into
Open
Conversation
This was referenced Jul 4, 2026
lneto
force-pushed
the
claude_netfailover
branch
from
July 26, 2026 12:26
84bb5d7 to
0d94f97
Compare
lneto
force-pushed
the
claude_netfailover
branch
from
July 27, 2026 14:23
0d94f97 to
79feb81
Compare
lneto
force-pushed
the
claude_netlink_rule
branch
from
August 3, 2026 12:34
b325d25 to
f382f0f
Compare
lneto
force-pushed
the
claude_netfailover
branch
from
August 3, 2026 12:34
79feb81 to
fe57ca1
Compare
lneto
force-pushed
the
claude_netlink_rule
branch
from
August 3, 2026 13:05
f382f0f to
47a0973
Compare
A demoable use case for the netlink support: when a watched interface goes down, a kernel Lua script installs a backup route via netlink.rt and broadcasts the action on a netlink.channel; it removes the route when the link is back up. No userspace routing daemon, hot-loaded. The netdevice notifier callback runs holding rtnl_lock, so it only records the link state into a shared rcu.table; a separately spawned sleepable reactor does the rtnetlink work without the lock held. The two run in distinct runtimes to avoid an ABBA deadlock between the runtime lock and rtnl_lock. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
lneto
force-pushed
the
claude_netfailover
branch
from
August 3, 2026 13:13
fe57ca1 to
edb07da
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.
A demoable use case for the netlink support: reactive policy routing driven by a link event, entirely in-kernel, in Lua, hot-loaded — no userspace routing daemon, no recompile.
When the watched interface goes down,
reactor.luainstalls a backup route vianetlink.rt(visible inip route show table 200) and broadcasts the action on anetlink.channel; it removes the route when the link is back up.The design point (worth a slide)
A
notifier.netdevicecallback runs holdingrtnl_lock. Issuing rtnetlink from it would re-enterrtnl_lockand self-deadlock, so the work is split across two runtimes:control.lua(process runtime) — the callback only records the link state into a sharedrcu.table. Lock-safe, non-blocking.reactor.lua(spawned kthread, sleepable) — polls the state and reprograms routing withnetlink.rt,rtnl_locknot held, then broadcasts onnetlink.channel.They are deliberately separate runtimes: one shared runtime would deadlock ABBA (reactor holds the runtime lock waiting on
rtnl_lock; the notifier holdsrtnl_lockwaiting on the runtime lock).Validated end-to-end against a
dummy0interface: toggling it down/up installs and removes the backup route in table 200, confirmed inip routeand dmesg. Run steps in the README.Second of three use-case PRs toward the Netdev talk.
🤖 Generated with Claude Code