Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sch_htb: let skb->priority refer to non-leaf class

If the class in skb->priority is not a leaf, apply filters from the
selected class, not the qdisc. This lets netfilter or user space
partially classify the packet.

Signed-off-by: Harry Mason <harry.mason@smoothwall.net>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Harry Mason and committed by
David S. Miller
29824310 2d36097d

+8 -3
+8 -3
net/sched/sch_htb.c
··· 219 219 if (skb->priority == sch->handle) 220 220 return HTB_DIRECT; /* X:0 (direct flow) selected */ 221 221 cl = htb_find(skb->priority, sch); 222 - if (cl && cl->level == 0) 223 - return cl; 222 + if (cl) { 223 + if (cl->level == 0) 224 + return cl; 225 + /* Start with inner filter chain if a non-leaf class is selected */ 226 + tcf = cl->filter_list; 227 + } else { 228 + tcf = q->filter_list; 229 + } 224 230 225 231 *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS; 226 - tcf = q->filter_list; 227 232 while (tcf && (result = tc_classify(skb, tcf, &res)) >= 0) { 228 233 #ifdef CONFIG_NET_CLS_ACT 229 234 switch (result) {