Skip to content

Commit

Permalink
sch_htb: let skb->priority refer to non-leaf class
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Harry Mason authored and David S. Miller committed Jan 23, 2014
1 parent 2d36097 commit 2982431
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions net/sched/sch_htb.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,16 @@ static struct htb_class *htb_classify(struct sk_buff *skb, struct Qdisc *sch,
if (skb->priority == sch->handle)
return HTB_DIRECT; /* X:0 (direct flow) selected */
cl = htb_find(skb->priority, sch);
if (cl && cl->level == 0)
return cl;
if (cl) {
if (cl->level == 0)
return cl;
/* Start with inner filter chain if a non-leaf class is selected */
tcf = cl->filter_list;
} else {
tcf = q->filter_list;
}

*qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
tcf = q->filter_list;
while (tcf && (result = tc_classify(skb, tcf, &res)) >= 0) {
#ifdef CONFIG_NET_CLS_ACT
switch (result) {
Expand Down

0 comments on commit 2982431

Please sign in to comment.