Skip to content

examples: add floodguard (adaptive in-kernel blackholing) - #619

Open
lneto wants to merge 1 commit into
masterfrom
claude_floodguard
Open

examples: add floodguard (adaptive in-kernel blackholing)#619
lneto wants to merge 1 commit into
masterfrom
claude_floodguard

Conversation

@lneto

@lneto lneto commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

A demoable dataplane use case for the netlink support: adaptive blackholing that detects flooding sources and mitigates them entirely in the kernel, in Lua, in softirq, streaming each action to userspace over a netlink channel.

A PRE_ROUTING netfilter hook counts packets per source address in an rcu.table; once a source crosses THRESHOLD packets it is dropped and a blackholed <ip> event is broadcast on the floodguard netlink.channel. Detection, mitigation and telemetry all run in one softirq runtime, hot-loaded, with no userspace agent in the packet path. The channel is a genl multicast family a userspace dashboard subscribes to (template: tests/netlink/channel_subscriber.c).

Validated end-to-end against a network namespace source: 150 pings from 10.99.0.2 past a threshold of 100 → ~99 get through, the rest are dropped, and dmesg shows the blackhole event with the correct source address. Run steps in the README.

Scope note

This showcases the softirq netlink.channel (kernel-to-userspace telemetry) with dataplane mitigation. The control-plane variant — a sleepable reactor installing a blackhole FIB rule via netlink.rt — is a natural follow-up once rule support (#616) and an FRA_SRC selector land; it is deliberately not stacked here so this PR stays self-contained on master.

Third of three use-case PRs toward the Netdev talk (nl80211 #617, netfailover #618, floodguard).

🤖 Generated with Claude Code

A demoable dataplane use case: a softirq PRE_ROUTING netfilter hook counts
packets per source address and, once a source crosses a threshold, drops its
traffic and broadcasts the mitigation on a netlink.channel for a userspace
dashboard. Detection, mitigation and telemetry all run in the kernel, in Lua,
hot-loaded, with no userspace agent in the packet path.

Third of three use-case PRs toward the Netdev talk.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@lneto
lneto force-pushed the claude_floodguard branch from 08cb6a3 to 98f6f12 Compare August 3, 2026 12:34
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