netfilter: share one hook among the instances of a percpu script - #777
Closed
lneto wants to merge 3 commits into
Closed
netfilter: share one hook among the instances of a percpu script#777lneto wants to merge 3 commits into
lneto wants to merge 3 commits into
Conversation
lneto
force-pushed
the
claude_ebpf_lookup
branch
from
September 4, 2026 02:04
23546c4 to
de7f47c
Compare
lneto
force-pushed
the
claude_netfilter_percpu
branch
from
September 4, 2026 02:04
2e21b8d to
4f69039
Compare
lneto
force-pushed
the
claude_ebpf_lookup
branch
from
September 4, 2026 11:59
de7f47c to
95b281f
Compare
lneto
force-pushed
the
claude_netfilter_percpu
branch
2 times, most recently
from
September 4, 2026 12:02
40d44ef to
cc46494
Compare
lneto
force-pushed
the
claude_ebpf_lookup
branch
2 times, most recently
from
September 4, 2026 12:04
68fe207 to
7eb2ac8
Compare
lneto
force-pushed
the
claude_netfilter_percpu
branch
2 times, most recently
from
September 4, 2026 12:07
ff55f15 to
df79884
Compare
lneto
force-pushed
the
claude_ebpf_lookup
branch
from
September 4, 2026 12:07
7eb2ac8 to
02daea2
Compare
lneto
force-pushed
the
claude_netfilter_percpu
branch
from
September 4, 2026 12:37
df79884 to
28afdbf
Compare
lneto
force-pushed
the
claude_ebpf_lookup
branch
from
September 4, 2026 12:37
02daea2 to
efd5c5f
Compare
lneto
force-pushed
the
claude_netfilter_percpu
branch
from
September 4, 2026 12:45
28afdbf to
3f96fbd
Compare
lneto
force-pushed
the
claude_ebpf_lookup
branch
from
September 4, 2026 12:45
efd5c5f to
55c0516
Compare
lneto
force-pushed
the
claude_netfilter_percpu
branch
from
September 4, 2026 12:50
3f96fbd to
ed2dcab
Compare
lneto
force-pushed
the
claude_ebpf_lookup
branch
from
September 4, 2026 12:50
55c0516 to
969ffff
Compare
lneto
force-pushed
the
claude_netfilter_percpu
branch
from
September 4, 2026 13:18
ed2dcab to
075cacd
Compare
lneto
force-pushed
the
claude_ebpf_lookup
branch
2 times, most recently
from
September 4, 2026 13:19
1e79602 to
7a8d7a2
Compare
lneto
force-pushed
the
claude_netfilter_percpu
branch
2 times, most recently
from
September 4, 2026 13:20
7dbded9 to
e574a75
Compare
lneto
force-pushed
the
claude_ebpf_lookup
branch
from
September 4, 2026 13:20
7a8d7a2 to
b2cce07
Compare
lneto
force-pushed
the
claude_netfilter_percpu
branch
from
September 4, 2026 14:32
e574a75 to
f3ac82a
Compare
lneto
force-pushed
the
claude_ebpf_lookup
branch
from
September 4, 2026 14:32
b2cce07 to
c0abebe
Compare
lneto
changed the base branch from
claude_ebpf_lookup
to
claude_percpu_object
September 4, 2026 14:42
lneto
force-pushed
the
claude_netfilter_percpu
branch
from
September 4, 2026 14:42
f3ac82a to
915bcd0
Compare
lneto
force-pushed
the
claude_percpu_object
branch
from
September 4, 2026 14:43
138bb43 to
5e477c2
Compare
lneto
force-pushed
the
claude_netfilter_percpu
branch
from
September 4, 2026 14:43
915bcd0 to
5e38238
Compare
lneto
changed the base branch from
claude_percpu_object
to
claude_ebpf_lookup
September 4, 2026 14:44
lneto
force-pushed
the
claude_netfilter_percpu
branch
from
September 4, 2026 15:04
5e38238 to
6203c0b
Compare
lneto
force-pushed
the
claude_ebpf_lookup
branch
from
September 4, 2026 15:04
c0abebe to
db41c49
Compare
lneto
force-pushed
the
claude_netfilter_percpu
branch
from
September 4, 2026 22:38
6203c0b to
5dc7acc
Compare
lneto
force-pushed
the
claude_ebpf_lookup
branch
from
September 4, 2026 22:38
db41c49 to
20f2c52
Compare
lneto
force-pushed
the
claude_netfilter_percpu
branch
from
September 4, 2026 22:41
5dc7acc to
e35b2dd
Compare
lneto
force-pushed
the
claude_ebpf_lookup
branch
from
September 4, 2026 22:41
20f2c52 to
8d16881
Compare
lneto
force-pushed
the
claude_netfilter_percpu
branch
from
September 4, 2026 22:42
e35b2dd to
933dc13
Compare
lneto
force-pushed
the
claude_ebpf_lookup
branch
from
September 4, 2026 22:42
8d16881 to
fba9af6
Compare
lneto
force-pushed
the
claude_netfilter_percpu
branch
from
September 4, 2026 22:48
933dc13 to
0fba40f
Compare
lneto
force-pushed
the
claude_ebpf_lookup
branch
from
September 4, 2026 22:48
fba9af6 to
0c4375a
Compare
A binding registering from a percpu instance needs the object the dispatch resolves, to register once for the object rather than once per instance. The state carries it next to the CPU id; a plain runtime has none. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
netfilter.register refused a percpu instance because each instance would have registered its own nf_hook_ops and every packet would have been handled once per instance. The hook now belongs to the object the instances share: the first registration of a pf, hooknum and priority installs it, with the percpu object as the runtime lunatik_run resolves to the instance of the CPU the packet arrived on, and the others attach their callbacks to it, each found through its own registry by the hook they share. The hook goes with the last registration, and a plain runtime registers as before, one hook per call. The refusal in percpu_refuse moves to percpu_netfilter, which counts marked ping requests through the shared hook: exactly once, by the instance of the CPU the pinned ping runs on. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
lneto
force-pushed
the
claude_netfilter_percpu
branch
from
September 4, 2026 22:50
0fba40f to
60a73f1
Compare
This was referenced Sep 4, 2026
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.
On master, with the percpu object (#772), the runner (#762) and the lookup (#780) merged: a percpu script registers one netfilter hook, shared by its instances.
netfilter.registerrefused a percpu instance because each instance would have registered its ownnf_hook_opsand every packet would have been handled once per instance. The hook now belongs to the object the instances share: the first registration of apf,hooknumandpriorityinstalls it, with the percpu object as the runtime, solunatik_runresolves the instance of the CPU the packet arrived on; the others attach their callbacks, each found through its own registry by the hook they share. The hook goes with the last registration. A plain runtime registers as before, one hook per call, and a second registration of the same hook in one instance is refused. Exactly-once is structural: there is one hook.The first commit gives an instance the object that owns it, next to its CPU id in the state, which is what lets a binding register for the object rather than the instance.
Tests:
tests/runtime/percpu_netfiltercounts marked ping requests through the shared hook with the ping pinned to the last online CPU, where the loopback delivers it: exactlyCOUNT, on the instance of that CPU; the duplicate registration; the plain runtime. With one hook per instance, as before, every instance counts the requests and the case fails; a hook that fires for an instance that did not register it is a failure too. The netfilter cases leavepercpu_refuse, which keepsdevice.new.Tested on 6.8.0-136 and, after a host reboot, 6.8.0-138 (aarch64): runtime, skb, xdp and tc suites, clean dmesg. The fixup adds the
markto the identity of a shared hook, so instances registering different marks get different hooks.🤖 Generated with Claude Code