netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* patch: annoying u32 double listing
@ 2005-02-06 19:49 jamal
  2005-02-06 20:44 ` 2.4.29 version: " jamal
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: jamal @ 2005-02-06 19:49 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev

[-- Attachment #1: Type: text/plain, Size: 1786 bytes --]


bug is around since 2.1.x; never cared about chasing it until now
because it is affecting someone i know.
Dave, please apply. I will prepare a 2.4.x version.

To see the problem:

tc qdisc add dev eth0 ingress
#add two filters at different prio levels
tc filter add dev eth0 parent ffff: protocol ip prio 6 \
u32 match ip src 10.0.0.210/32 flowid 1:16
#
tc filter add dev eth0 parent ffff: protocol ip prio 7 \
u32 match ip src 10.0.0.144/32 flowid 1:15 
#now list them..
root@jdev:/# tc -s filter show parent ffff: dev eth0 

filter protocol ip pref 6 u32 
filter protocol ip pref 6 u32 fh 801: ht divisor 1 
filter protocol ip pref 6 u32 fh 801::800 order 2048 key ht 801 bkt 0
flowid 1:15 
  match 0a000090/ffffffff at 12
filter protocol ip pref 6 u32 fh 800: ht divisor 1 
filter protocol ip pref 6 u32 fh 800::800 order 2048 key ht 800 bkt 0
flowid 1:16 
  match 0a0000d2/ffffffff at 12
filter protocol ip pref 7 u32 
filter protocol ip pref 7 u32 fh 801: ht divisor 1 
filter protocol ip pref 7 u32 fh 801::800 order 2048 key ht 801 bkt 0
flowid 1:15 
  match 0a000090/ffffffff at 12
filter protocol ip pref 7 u32 fh 800: ht divisor 1 
filter protocol ip pref 7 u32 fh 800::800 order 2048 key ht 800 bkt 0
flowid 1:16 
  match 0a0000d2/ffffffff at 12

each filter is listed in each priority. So if you had 5 rules in 5 prios
(which is where sherlock started) you see 25 outputs.

AFTER FIX: 
---------

root@jdev:/usr/src# tc -s filter show parent ffff: dev eth0
filter protocol ip pref 6 u32
filter protocol ip pref 6 u32 fh 800::800 order 2048 key ht 800 bkt 0
flowid 1:16  
  match 0a0000d2/ffffffff at 12 
  filter protocol ip pref 7 u32
  filter protocol ip pref 7 u32 fh 801::800 order 2048 key ht 801 bkt 0
flowid 1:15  
    match 0a000090/ffffffff at 12 


cheers,
jamal

[-- Attachment #2: u32multi_p --]
[-- Type: text/plain, Size: 1448 bytes --]

--- 2611-rc3+bk3/net/sched/cls_api.c	2005/02/06 16:28:26	1.1
+++ 2611-rc3+bk3/net/sched/cls_api.c	2005/02/06 16:41:47
@@ -326,6 +326,7 @@
 {
 	struct tcmsg *tcm;
 	struct nlmsghdr  *nlh;
+	int ret;
 	unsigned char	 *b = skb->tail;
 
 	nlh = NLMSG_PUT(skb, pid, seq, event, sizeof(*tcm));
@@ -339,8 +340,11 @@
 	tcm->tcm_handle = fh;
 	if (RTM_DELTFILTER != event) {
 		tcm->tcm_handle = 0;
-		if (tp->ops->dump && tp->ops->dump(tp, fh, skb, tcm) < 0)
-			goto rtattr_failure;
+		if (tp->ops->dump) {
+			ret = tp->ops->dump(tp, fh, skb, tcm);
+			if (ret < 0)
+				goto rtattr_failure;
+		}
 	}
 	nlh->nlmsg_len = skb->tail - b;
 	return skb->len;
@@ -348,6 +352,8 @@
 nlmsg_failure:
 rtattr_failure:
 	skb_trim(skb, b - skb->data);
+	if (ret == -ENOENT)
+		return skb->len;
 	return -1;
 }
 
--- 2611-rc3+bk3/net/sched/cls_u32.c	2005/02/06 16:30:44	1.1
+++ 2611-rc3+bk3/net/sched/cls_u32.c	2005/02/06 16:33:13
@@ -76,6 +76,7 @@
 	char                     indev[IFNAMSIZ];
 #endif
 	u8			fshift;
+	u32			prio;
 	struct tcf_result	res;
 	struct tc_u_hnode	*ht_down;
 #ifdef CONFIG_CLS_U32_PERF
@@ -641,6 +642,7 @@
 	memcpy(&n->sel, s, sizeof(*s) + s->nkeys*sizeof(struct tc_u32_key));
 	n->ht_up = ht;
 	n->handle = handle;
+	n->prio = tp->prio;
 {
 	u8 i = 0;
 	u32 mask = s->hmask;
@@ -736,6 +738,9 @@
 	if (n == NULL)
 		return skb->len;
 
+	if (n->prio != tp->prio)
+		return -ENOENT;
+
 	t->tcm_handle = n->handle;
 
 	rta = (struct rtattr*)b;

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2005-02-09  4:56 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-06 19:49 patch: annoying u32 double listing jamal
2005-02-06 20:44 ` 2.4.29 version: " jamal
2005-02-06 21:29 ` Thomas Graf
2005-02-06 21:42   ` jamal
2005-02-06 22:24     ` Thomas Graf
2005-02-06 21:47   ` Patrick McHardy
2005-02-06 22:12     ` Thomas Graf
2005-02-06 21:39 ` Patrick McHardy
2005-02-06 21:55   ` Patrick McHardy
2005-02-06 22:02   ` jamal
2005-02-06 23:17     ` Patrick McHardy
2005-02-07  6:36       ` David S. Miller
2005-02-07 13:49         ` jamal
2005-02-09  4:56       ` David S. Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).