htb_classify(9)
π htb_classify(9) β the Kernel API Manual, bestie edition π
okay so this is htb_classify, and yes it lives in the Kernel API Manual (section 9, kernel internals, iykyk). she's a little function with a big job and honestly? she ate. let's get into it β¨
πΈ NAME πΈ
htb_classify β classify a packet into class. that's it, that's the whole vibe check π
β¨ SYNOPSIS β¨
struct htb_class * htb_classify (struct sk_buff *skb , struct Qdisc *sch
, int *qerr );
literally copy-pasted the signature exactly because we do not paraphrase code in this house π«Ά
π¦ ARGUMENTS π¦
skbβ the socket buffer. the packet in question. the main character, lowkey πschβ the active queue discipline. like, the qdisc that's currently clocked in and working πΈqerrβ pointer for returned status code. she writes back to you, that's the whole point π
π DESCRIPTION π
okay so here's the tea on what she returns, and it's giving three-outcome situation π
- she returns
NULLif the packet should be dropped. bye bestie π - she returns
-1if the packet should be passed directly thru - in all other cases, the leaf class is returned π
and how does she pick? so glad you asked π§
we allow direct class selection by classid in priority. so that's the first thing she checks, no cap β¨
then we examine filters in qdisc and in inner nodes (if a higher filter points to the inner node). like, she digs down the tree, she's thorough π¦
if we end up with classid MAJOR:0, we enqueue the skb into a special internal fifo (direct). and these packets then go directly thru. no detours, periodt π₯
if we still have no valid leaf, we try to use the MAJOR:default leaf. backup plan energy, we love her for it π
and if it's still unsuccessful β then we finish and return the direct queue. that's the last resort and honestly she tried her best π
ngl the whole thing is a cascade of "try this, then this, then this" so if you're debugging and confused, you're not alone β just walk the order in the same sequence she does π
β SEE ALSO β
kernel file ./net/sched/sch_htb.c, plus the whole squad β go read these, they're iconic π:
htb_add_to_id_tree(9)htb_add_to_wait_tree(9)htb_next_rb_node(9)htb_add_class_to_row(9)htb_remove_class_from_row(9)htb_activate_prios(9)htb_deactivate_prios(9)htb_class_mode(9)htb_change_class_mode(9)htb_activate(9)htb_deactivate(9)htb_charge_class(9)htb_do_events(9)htb_lookup_leaf(9)
and that's the page, bestie π she ships out of ./net/sched and the version stamp on this one is October 2026 β go forth, classify some packets, and slay π
β¨π¦
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms