Skip to content

Commit

Permalink
[NET_SCHED] sch_htb: htb_requeue fix
Browse files Browse the repository at this point in the history
htb_requeue() enqueues skbs for which htb_classify() returns NULL.
This is wrong because such skbs could be handled by NET_CLS_ACT code,
and the decision could be different than earlier in htb_enqueue().
So htb_requeue() is changed to work and look more like htb_enqueue().

Signed-off-by: Jarek Poplawski <jarkao2@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jarek Poplawski authored and David S. Miller committed Feb 10, 2008
1 parent 238fc7e commit 2134745
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions net/sched/sch_htb.c
Original file line number Diff line number Diff line change
Expand Up @@ -609,14 +609,14 @@ static int htb_enqueue(struct sk_buff *skb, struct Qdisc *sch)
/* TODO: requeuing packet charges it to policers again !! */
static int htb_requeue(struct sk_buff *skb, struct Qdisc *sch)
{
int ret;
struct htb_sched *q = qdisc_priv(sch);
int ret = NET_XMIT_SUCCESS;
struct htb_class *cl = htb_classify(skb, sch, &ret);
struct sk_buff *tskb;

if (cl == HTB_DIRECT || !cl) {
if (cl == HTB_DIRECT) {
/* enqueue to helper queue */
if (q->direct_queue.qlen < q->direct_qlen && cl) {
if (q->direct_queue.qlen < q->direct_qlen) {
__skb_queue_head(&q->direct_queue, skb);
} else {
__skb_queue_head(&q->direct_queue, skb);
Expand All @@ -625,6 +625,13 @@ static int htb_requeue(struct sk_buff *skb, struct Qdisc *sch)
sch->qstats.drops++;
return NET_XMIT_CN;
}
#ifdef CONFIG_NET_CLS_ACT
} else if (!cl) {
if (ret == NET_XMIT_BYPASS)
sch->qstats.drops++;
kfree_skb(skb);
return ret;
#endif
} else if (cl->un.leaf.q->ops->requeue(skb, cl->un.leaf.q) !=
NET_XMIT_SUCCESS) {
sch->qstats.drops++;
Expand Down

0 comments on commit 2134745

Please sign in to comment.