lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 17 Jan 2014 13:22:32 +0000
From:	Harry Mason <harry.mason@...othwall.net>
To:	Sergei Shtylyov <sergei.shtylyov@...entembedded.com>,
	Jamal Hadi Salim <hadi@...atatu.com>,
	Eric Dumazet <eric.dumazet@...il.com>
Cc:	linux-netdev <netdev@...r.kernel.org>
Subject: [PATCH v3] 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@...othwall.net>
---

On Fri, 2014-01-17 at 16:53 +0400, Sergei Shtylyov wrote:
> On 17-01-2014 14:19, Harry Mason wrote:
> > +	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;
> 
>     There should be {} in the *else* arm, since it's in another arm of *if* 
> already -- see Documentation/CodingStyle.

Thanks, updated.

 net/sched/sch_htb.c |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index 717b210..e9c8c08 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -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) {
-- 
1.7.10.4


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ