examples: add sniclassify tc/qos - #717
Conversation
8a4aa99 to
9663bff
Compare
lneto
left a comment
There was a problem hiding this comment.
This was already raised on #713 and left unaddressed: the SNI parser must not be duplicated. This PR still ships a verbatim second copy of the ClientHello parser from examples/filter/sni.lua. Please fold that feedback in rather than carry it forward — the duplication should be resolved before this goes in.
The parser belongs in examples/common/sni.lua; PR #721 extracts it and moves filter/sni.lua onto it. Rebase this example there and require("examples.common.sni"). Fixup 11d4916 shows the sniclassify side, which also drops the unpacker closures and flattens the walk.
The same ClientHello parser is needed by the sniclassify example (#717); keep a single copy under examples/common.
df8b3c5 to
86d32f9
Compare
86d32f9 to
7f4bf95
Compare
7f4bf95 to
953e293
Compare
lneto
left a comment
There was a problem hiding this comment.
@sneaky-potato — re-reviewed against the merged #713.
-
Rebase needed. The branch still carries the three original (pre-fixup) #713 commits, so it is not mergeable and would reintroduce the un-fixed binding. Rebase onto master so this PR is just the sniclassify commit. (Rebased on review/717 for reference.)
-
flow_cache is never populated. classify.c declares the map and looks it up, but nothing writes to it — every packet misses and re-runs the Lua classifier, so the cache does nothing. Fixed by caching the classified priority after the run: be4f743
-
README typo — "the classfier" -> "classifier": f875a3a
-
README, double filter — the tc filter is added twice: the HTB block adds it on
egress, then the "Attach ... on egress" step adds it again withparent 1:(the heading says egress but the command usesparent 1:). One is redundant; which attach point does the example want?
The second block is the redundant one. |
Signed-off-by: Ashwani Kumar Kamal <ashwanikamal.im421@gmail.com>
953e293 to
6aa5d2a
Compare
lneto
left a comment
There was a problem hiding this comment.
@sneaky-potato — all addressed: rebased onto master (one commit), flow_cache populated, the typo fixed, and the redundant filter dropped (nice consolidation of the egress attach under its own heading). Built it here — the modules and the sniclassify BPF compile, tc suite 5/5. LGTM.
lneto
left a comment
There was a problem hiding this comment.
@sneaky-potato — re-reviewed at runtime, not just the build: the callback crashes with the merged skb.attr.
skbattr(ctx:skb())—skb.attris now a class; the module table isn't callable ("attempt to call a table value"). Useskbattr.new(ctx:skb()).skb:data()on the view — the reshapedskb.attris a pure attribute view (mark/priority) and does not forward methods, so:data()raises "skb has no attribute 'data'". Keep the raw skb for methods:
local raw = ctx:skb()
local skb = skbattr.new(raw)
local packet = raw:data()
-- skb.priority = classid (the view is for the attribute)Both confirmed by running it; my earlier approval was premature — the example has no test of its own, so its callback never ran under the suite.
Please run the example end-to-end before the next push — load it and drive an HTTPS flow through it. With nothing covering it, a broken callback like this lands green; the API it leans on changed under it, and only running it surfaces that.
|
Hi @lneto, pushed the required changes. I was wondering on the following 2 points:
sudo $TC filter del dev $IF egress 2>/dev/null
sudo $TC qdisc del dev $IF clsact 2>/dev/null
sudo $TC qdisc del dev $IF root 2>/dev/nullNeed suggestions on how to improve on these two points. |
There was a problem hiding this comment.
The current asks are in the visible review comment below: #717 (comment)
|
@sneaky-potato the two runtime bugs are fixed, thanks.
Yes — a small
A Two changes from a closer pass, each as a fixup on
One more thing, not on you: the Lua re-derives the payload offset the eBPF program already computed — a duplicated parse (I have not measured its cost; it is a handful of byte reads, so this is about the redundancy, not a hot path). |
|
@sneaky-potato both scripts and the README change, as one extra commit (not a fixup, so take or adapt it): c1a92ca
I ran both end to end on a dummy interface: setup attaches the classifier and starts the runtime cleanly, cleanup tears it all down. I did not drive real TLS through it, so I exercised the setup and teardown, not the SNI classification itself. |
Add a tc demo script.