All of lore.kernel.org
 help / color / mirror / Atom feed
* [LARTC] Adding dsmark qdisc fails
@ 2005-03-20 13:06 Tero Saarni
  2005-03-20 15:15 ` Patrick McHardy
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Tero Saarni @ 2005-03-20 13:06 UTC (permalink / raw)
  To: lartc

I'm trying to configure dsmark qdisc on 2.6.11.4 user mode linux and
tc from iproute2-2.6.11-050314.

I think I have some mismatch in my setup since adding dsmark qdisc
fails *unless* I specify "set_tc_index" argument which I believe should
be optional:

# tc qdisc add dev eth1 handle 1:0 root dsmark indices 8
RTNETLINK answers: Invalid argument
Mar 20 13:00:50 user user.debug kernel: dsmark_init(sch a0bb3ae0,[qdisc 
a0bb3b60],opt 00000000)

here the log shows that opt is null, sch_dsmark checks for that and
bails out.  However running tc with "set_tc_index" goes ok:

# tc qdisc add dev eth1 handle 1:0 root dsmark indices 8 set_tc_index
Mar 20 13:01:12 user user.debug kernel: dsmark_init(sch a0bb3060,[qdisc 
a0bb30e0],opt a038e9d0)
Mar 20 13:01:12 user user.debug kernel: dsmark_init: qdisc a0bb30e0

# tc qdisc show dev eth1
qdisc dsmark 1: indices 0x0008 set_tc_index


but then changing the class fails:

# tc class change dev eth1 classid 1:1 dsmark mask 0x0 value 0xb8
RTNETLINK answers: Invalid argument
Mar 20 13:02:28 user user.debug kernel: dsmark_get(sch a0bb3060,[qdisc 
a0bb30e0],classid 10001)
Mar 20 13:02:28 user user.debug kernel: dsmark_change(sch a0bb3060,[qdisc 
a0bb30e0],classid 10001,parent 0),arg 0x2


Any ideas where I've gone wrong?

--
Tero

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

_______________________________________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

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

* Re: [LARTC] Adding dsmark qdisc fails
  2005-03-20 13:06 [LARTC] Adding dsmark qdisc fails Tero Saarni
@ 2005-03-20 15:15 ` Patrick McHardy
  2005-03-20 16:25 ` Thomas Graf
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Patrick McHardy @ 2005-03-20 15:15 UTC (permalink / raw)
  To: lartc

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

Tero Saarni wrote:
> I'm trying to configure dsmark qdisc on 2.6.11.4 user mode linux and
> tc from iproute2-2.6.11-050314.
> 
> I think I have some mismatch in my setup since adding dsmark qdisc
> fails *unless* I specify "set_tc_index" argument which I believe should
> be optional:
> 
> # tc qdisc add dev eth1 handle 1:0 root dsmark indices 8
> RTNETLINK answers: Invalid argument
> Mar 20 13:00:50 user user.debug kernel: dsmark_init(sch a0bb3ae0,[qdisc 
> a0bb3b60],opt 00000000)
> 
> here the log shows that opt is null, sch_dsmark checks for that and
> bails out.  However running tc with "set_tc_index" goes ok:
> 
> # tc qdisc add dev eth1 handle 1:0 root dsmark indices 8 set_tc_index
> Mar 20 13:01:12 user user.debug kernel: dsmark_init(sch a0bb3060,[qdisc 
> a0bb30e0],opt a038e9d0)
> Mar 20 13:01:12 user user.debug kernel: dsmark_init: qdisc a0bb30e0
> 
> # tc qdisc show dev eth1
> qdisc dsmark 1: indices 0x0008 set_tc_index
> 
> 
> but then changing the class fails:
> 
> # tc class change dev eth1 classid 1:1 dsmark mask 0x0 value 0xb8
> RTNETLINK answers: Invalid argument
> Mar 20 13:02:28 user user.debug kernel: dsmark_get(sch a0bb3060,[qdisc 
> a0bb30e0],classid 10001)
> Mar 20 13:02:28 user user.debug kernel: dsmark_change(sch 
> a0bb3060,[qdisc a0bb30e0],classid 10001,parent 0),arg 0x2
> 
> 
> Any ideas where I've gone wrong?

It is caused by this patch, the transformation to use NLMSG_TAIL is
not equivalent (it calculates the size of the aligned message). This
makes parsing the attributes in rtnetlink_rcv_msg() fail. I haven't 
checked what the exact problem is, Thomas, can you have a look at this
please?

Regards
Patrick

[-- Attachment #2: x --]
[-- Type: text/plain, Size: 19715 bytes --]

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2005/01/18 02:24:18+01:00 tgraf@suug.ch 
#   Transform rta_len calculations for nested TLVs to use NLMSG_TAIL
#   macro to simply code a lot.
# 
# tc/q_tbf.c
#   2005/01/18 02:24:18+01:00 tgraf@suug.ch +2 -2
#   Use NLMSG_TAIL
# 
# tc/q_red.c
#   2005/01/18 02:24:18+01:00 tgraf@suug.ch +2 -3
#   Use NLMSG_TAIL
# 
# tc/q_netem.c
#   2005/01/18 02:24:18+01:00 tgraf@suug.ch +2 -2
#   Use NLMSG_TAIL
# 
# tc/q_htb.c
#   2005/01/18 02:24:18+01:00 tgraf@suug.ch +4 -4
#   Use NLMSG_TAIL
# 
# tc/q_hfsc.c
#   2005/01/18 02:24:18+01:00 tgraf@suug.ch +2 -2
#   Use NLMSG_TAIL
# 
# tc/q_gred.c
#   2005/01/18 02:24:18+01:00 tgraf@suug.ch +4 -6
#   Use NLMSG_TAIL
# 
# tc/q_dsmark.c
#   2005/01/18 02:24:18+01:00 tgraf@suug.ch +4 -4
#   Use NLMSG_TAIL
# 
# tc/q_cbq.c
#   2005/01/18 02:24:18+01:00 tgraf@suug.ch +4 -4
#   Use NLMSG_TAIL
# 
# tc/q_atm.c
#   2005/01/18 02:24:18+01:00 tgraf@suug.ch +2 -2
#   Use NLMSG_TAIL
# 
# tc/m_police.c
#   2005/01/18 02:24:18+01:00 tgraf@suug.ch +2 -2
#   Use NLMSG_TAIL
# 
# tc/m_pedit.c
#   2005/01/18 02:24:18+01:00 tgraf@suug.ch +2 -3
#   Use NLMSG_TAIL
# 
# tc/m_mirred.c
#   2005/01/18 02:24:18+01:00 tgraf@suug.ch +2 -3
#   Use NLMSG_TAIL
# 
# tc/m_ipt.c
#   2005/01/18 02:24:18+01:00 tgraf@suug.ch +2 -3
#   Use NLMSG_TAIL
# 
# tc/m_gact.c
#   2005/01/18 02:24:18+01:00 tgraf@suug.ch +2 -3
#   Use NLMSG_TAIL
# 
# tc/m_action.c
#   2005/01/18 02:24:18+01:00 tgraf@suug.ch +17 -30
#   Use NLMSG_TAIL
# 
# tc/f_u32.c
#   2005/01/18 02:24:18+01:00 tgraf@suug.ch +2 -2
#   Use NLMSG_TAIL
# 
# tc/f_tcindex.c
#   2005/01/18 02:24:18+01:00 tgraf@suug.ch +2 -2
#   Use NLMSG_TAIL
# 
# tc/f_rsvp.c
#   2005/01/18 02:24:18+01:00 tgraf@suug.ch +2 -2
#   Use NLMSG_TAIL
# 
# tc/f_route.c
#   2005/01/18 02:24:18+01:00 tgraf@suug.ch +2 -2
#   Use NLMSG_TAIL
# 
# tc/f_fw.c
#   2005/01/18 02:24:18+01:00 tgraf@suug.ch +2 -2
#   Use NLMSG_TAIL
# 
# include/libnetlink.h
#   2005/01/18 02:24:18+01:00 tgraf@suug.ch +3 -0
#   Add NLMSG_TAIL macro pointing to the tail of a netlink message
# 
diff -Nru a/include/libnetlink.h b/include/libnetlink.h
--- a/include/libnetlink.h	2005-03-20 15:54:37 +01:00
+++ b/include/libnetlink.h	2005-03-20 15:54:37 +01:00
@@ -46,5 +46,8 @@
 extern int rtnl_from_file(FILE *, rtnl_filter_t handler,
 		       void *jarg);
 
+#define NLMSG_TAIL(nmsg) \
+	((struct rtattr *) (((void *) (nmsg)) + NLMSG_ALIGN((nmsg)->nlmsg_len)))
+
 #endif /* __LIBNETLINK_H__ */
 
diff -Nru a/tc/f_fw.c b/tc/f_fw.c
--- a/tc/f_fw.c	2005-03-20 15:54:37 +01:00
+++ b/tc/f_fw.c	2005-03-20 15:54:37 +01:00
@@ -50,7 +50,7 @@
 	if (argc == 0)
 		return 0;
 
-	tail = (struct rtattr*)(((void*)n)+NLMSG_ALIGN(n->nlmsg_len));
+	tail = NLMSG_TAIL(n);
 	addattr_l(n, 4096, TCA_OPTIONS, NULL, 0);
 
 	while (argc > 0) {
@@ -98,7 +98,7 @@
 		}
 		argc--; argv++;
 	}
-	tail->rta_len = (((void*)n)+n->nlmsg_len) - (void*)tail;
+	tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
 	return 0;
 }
 
diff -Nru a/tc/f_route.c b/tc/f_route.c
--- a/tc/f_route.c	2005-03-20 15:54:37 +01:00
+++ b/tc/f_route.c	2005-03-20 15:54:37 +01:00
@@ -54,7 +54,7 @@
 	if (argc == 0)
 		return 0;
 
-	tail = (struct rtattr*)(((void*)n)+NLMSG_ALIGN(n->nlmsg_len));
+	tail = NLMSG_TAIL(n);
 	addattr_l(n, 4096, TCA_OPTIONS, NULL, 0);
 
 	while (argc > 0) {
@@ -125,7 +125,7 @@
 		}
 		argc--; argv++;
 	}
-	tail->rta_len = (((void*)n)+n->nlmsg_len) - (void*)tail;
+	tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
 	if (order) {
 		fh &= ~0x7F00;
 		fh |= (order<<8)&0x7F00;
diff -Nru a/tc/f_rsvp.c b/tc/f_rsvp.c
--- a/tc/f_rsvp.c	2005-03-20 15:54:37 +01:00
+++ b/tc/f_rsvp.c	2005-03-20 15:54:37 +01:00
@@ -189,7 +189,7 @@
 	if (argc == 0)
 		return 0;
 
-	tail = (struct rtattr*)(((void*)n)+NLMSG_ALIGN(n->nlmsg_len));
+	tail = NLMSG_TAIL(n);
 	addattr_l(n, 4096, TCA_OPTIONS, NULL, 0);
 
 	while (argc > 0) {
@@ -282,7 +282,7 @@
 
 	if (pinfo_ok)
 		addattr_l(n, 4096, TCA_RSVP_PINFO, &pinfo, sizeof(pinfo));
-	tail->rta_len = (((void*)n)+n->nlmsg_len) - (void*)tail;
+	tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
 	return 0;
 }
 
diff -Nru a/tc/f_tcindex.c b/tc/f_tcindex.c
--- a/tc/f_tcindex.c	2005-03-20 15:54:37 +01:00
+++ b/tc/f_tcindex.c	2005-03-20 15:54:37 +01:00
@@ -43,7 +43,7 @@
 		}
 	}
 	if (!argc) return 0;
-	tail = (struct rtattr*)(((void*)n)+NLMSG_ALIGN(n->nlmsg_len));
+	tail = NLMSG_TAIL(n);
 	addattr_l(n,4096,TCA_OPTIONS,NULL,0);
 	while (argc) {
 		if (!strcmp(*argv,"hash")) {
@@ -117,7 +117,7 @@
 		argc--;
 		argv++;
 	}
-	tail->rta_len = (((void*)n)+n->nlmsg_len) - (void*)tail;
+	tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
 	return 0;
 }
 
diff -Nru a/tc/f_u32.c b/tc/f_u32.c
--- a/tc/f_u32.c	2005-03-20 15:54:37 +01:00
+++ b/tc/f_u32.c	2005-03-20 15:54:37 +01:00
@@ -794,7 +794,7 @@
 	if (argc == 0)
 		return 0;
 
-	tail = (struct rtattr*)(((void*)n)+NLMSG_ALIGN(n->nlmsg_len));
+	tail = NLMSG_TAIL(n);
 	addattr_l(n, MAX_MSG, TCA_OPTIONS, NULL, 0);
 
 	while (argc > 0) {
@@ -943,7 +943,7 @@
 		addattr_l(n, MAX_MSG, TCA_U32_HASH, &htid, 4);
 	if (sel_ok)
 		addattr_l(n, MAX_MSG, TCA_U32_SEL, &sel, sizeof(sel.sel)+sel.sel.nkeys*sizeof(struct tc_u32_key));
-	tail->rta_len = (((void*)n)+n->nlmsg_len) - (void*)tail;
+	tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
 	return 0;
 }
 
diff -Nru a/tc/m_action.c b/tc/m_action.c
--- a/tc/m_action.c	2005-03-20 15:54:37 +01:00
+++ b/tc/m_action.c	2005-03-20 15:54:37 +01:00
@@ -144,8 +144,7 @@
 	if (argc <= 0)
 		return -1;
 
-	tail = tail2 =
-	    (struct rtattr *) (((void *) n) + NLMSG_ALIGN(n->nlmsg_len));
+	tail = tail2 = NLMSG_TAIL(n);
 
 	addattr_l(n, MAX_MSG, tca_id, NULL, 0);
 
@@ -185,9 +184,7 @@
 				goto bad_val;
 			}
 
-			tail =
-			    (struct rtattr *) (((void *) n) +
-				       NLMSG_ALIGN(n->nlmsg_len));
+			tail = NLMSG_TAIL(n);
 			addattr_l(n, MAX_MSG, ++prio, NULL, 0);
 			addattr_l(n, MAX_MSG, TCA_ACT_KIND, k, strlen(k) + 1);
 
@@ -197,9 +194,7 @@
 				fprintf(stderr,"bad action parsing\n");
 				goto bad_val;
 			}
-			tail->rta_len =
-			    (((void *) n) + NLMSG_ALIGN(n->nlmsg_len)) -
-			    (void *) tail;
+			tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
 			ok++;
 		}
 
@@ -210,8 +205,7 @@
 		goto bad_val;
 	}
 
-	tail2->rta_len =
-	    (((void *) n) + NLMSG_ALIGN(n->nlmsg_len)) - (void *) tail2;
+	tail2->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail2;
 
 done:
 	*argc_p = argc;
@@ -376,8 +370,7 @@
 	argv +=1;
 
 
-	tail = (struct rtattr*)(((void*)&req.n)+NLMSG_ALIGN(req.n.nlmsg_len));
-
+	tail = NLMSG_TAIL(&req.n);
 	addattr_l(&req.n, MAX_MSG, TCA_ACT_TAB, NULL, 0);
 
 	while (argc > 0) {
@@ -425,17 +418,15 @@
 			goto bad_val;
 		}
 
-	tail2 =
-	   (struct rtattr *) (((void *) &req.n) + NLMSG_ALIGN(req.n.nlmsg_len));
-	addattr_l(&req.n, MAX_MSG, ++prio, NULL, 0);
-	addattr_l(&req.n, MAX_MSG, TCA_ACT_KIND, k, strlen(k) + 1);
-	addattr32(&req.n, MAX_MSG, TCA_ACT_INDEX, i);
-	tail2->rta_len =
-	    (((void *) &req.n) + NLMSG_ALIGN(req.n.nlmsg_len)) - (void *) tail2;
+		tail2 = NLMSG_TAIL(&req.n);
+		addattr_l(&req.n, MAX_MSG, ++prio, NULL, 0);
+		addattr_l(&req.n, MAX_MSG, TCA_ACT_KIND, k, strlen(k) + 1);
+		addattr32(&req.n, MAX_MSG, TCA_ACT_INDEX, i);
+		tail2->rta_len = (void *) NLMSG_TAIL(&req.n) - (void *) tail2;
 
 	}
 
-	tail->rta_len = (((void*)&req.n)+ NLMSG_ALIGN(req.n.nlmsg_len)) - (void*)tail;
+	tail->rta_len = (void *) NLMSG_TAIL(&req.n) - (void *) tail;
 
 	if (rtnl_open(&rth, 0) < 0) {
 		fprintf(stderr, "Cannot open rtnetlink\n");
@@ -485,14 +476,14 @@
 	req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct tcamsg));
 	req.n.nlmsg_flags = NLM_F_REQUEST|flags;
 	req.n.nlmsg_type = cmd;
-	tail = (struct rtattr*)(((void*)&req.n)+NLMSG_ALIGN(req.n.nlmsg_len));
+	tail = NLMSG_TAIL(&req.n);
 	argc -=1;
 	argv +=1;
 	if (parse_action(&argc, &argv, TCA_ACT_TAB, &req.n)) {
 		fprintf(stderr, "Illegal \"action\"\n");
 		return -1;
 	}
-	tail->rta_len = (((void*)&req.n)+req.n.nlmsg_len) - (void*)tail;
+	tail->rta_len = (void *) NLMSG_TAIL(&req.n) - (void *) tail;
 
 	if (rtnl_open(&rth, 0) < 0) {
 		fprintf(stderr, "Cannot open rtnetlink\n");
@@ -530,11 +521,9 @@
 
 	req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct tcamsg));
 
-	tail = (struct rtattr*)(((void*)&req.n)+NLMSG_ALIGN(req.n.nlmsg_len));
-
+	tail = NLMSG_TAIL(&req.n);
 	addattr_l(&req.n, MAX_MSG, TCA_ACT_TAB, NULL, 0);
-	tail2 =
-	   (struct rtattr *) (((void *) &req.n) + NLMSG_ALIGN(req.n.nlmsg_len));
+	tail2 = NLMSG_TAIL(&req.n);
 
 	strncpy(k, *argv, sizeof (k) - 1);
 #ifdef CONFIG_GACT
@@ -555,10 +544,8 @@
 
 	addattr_l(&req.n, MAX_MSG, ++prio, NULL, 0);
 	addattr_l(&req.n, MAX_MSG, TCA_ACT_KIND, k, strlen(k) + 1);
-	tail2->rta_len =
-	    (((void *) &req.n) + NLMSG_ALIGN(req.n.nlmsg_len)) - (void *) tail2;
-	tail->rta_len = (((void*)&req.n)+NLMSG_ALIGN(req.n.nlmsg_len)) - (void*)tail;
-
+	tail2->rta_len = (void *) NLMSG_TAIL(&req.n) - (void *) tail2;
+	tail->rta_len = (void *) NLMSG_TAIL(&req.n) - (void *) tail;
 
 	if (rtnl_open(&rth, 0) < 0) {
 		fprintf(stderr, "Cannot open rtnetlink\n");
diff -Nru a/tc/m_gact.c b/tc/m_gact.c
--- a/tc/m_gact.c	2005-03-20 15:54:37 +01:00
+++ b/tc/m_gact.c	2005-03-20 15:54:37 +01:00
@@ -177,7 +177,7 @@
 	if (!ok)
 		return -1;
 
-	tail = (struct rtattr *) (((void *) n) + NLMSG_ALIGN(n->nlmsg_len));
+	tail = NLMSG_TAIL(n);
 	addattr_l(n, MAX_MSG, tca_id, NULL, 0);
 	addattr_l(n, MAX_MSG, TCA_GACT_PARMS, &p, sizeof (p));
 #ifdef CONFIG_GACT_PROB
@@ -185,8 +185,7 @@
 		addattr_l(n, MAX_MSG, TCA_GACT_PROB, &pp, sizeof (pp));
 	}
 #endif
-	tail->rta_len =
-	    (((void *) n) + NLMSG_ALIGN(n->nlmsg_len)) - (void *) tail;
+	tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
 
 	*argc_p = argc;
 	*argv_p = argv;
diff -Nru a/tc/m_ipt.c b/tc/m_ipt.c
--- a/tc/m_ipt.c	2005-03-20 15:54:37 +01:00
+++ b/tc/m_ipt.c	2005-03-20 15:54:37 +01:00
@@ -547,7 +547,7 @@
 		}
 	}
 
-	tail = (struct rtattr *) (((void *) n) + NLMSG_ALIGN(n->nlmsg_len));
+	tail = NLMSG_TAIL(n);
 	addattr_l(n, MAX_MSG, tca_id, NULL, 0);
 	fprintf(stdout, "tablename: %s hook: %s\n ", tname, ipthooks[hook]);
 	fprintf(stdout, "\ttarget: ");
@@ -569,8 +569,7 @@
 	addattr_l(n, MAX_MSG, TCA_IPT_INDEX, &index, 4);
 	if (m)
 		addattr_l(n, MAX_MSG, TCA_IPT_TARG, m->t, m->t->u.target_size);
-	tail->rta_len =
-	    (((void *) n) + NLMSG_ALIGN(n->nlmsg_len)) - (void *) tail;
+	tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
 
 	argc -= optind;
 	argv += optind;
diff -Nru a/tc/m_mirred.c b/tc/m_mirred.c
--- a/tc/m_mirred.c	2005-03-20 15:54:37 +01:00
+++ b/tc/m_mirred.c	2005-03-20 15:54:37 +01:00
@@ -201,11 +201,10 @@
 	if (mirred_d)
 		fprintf(stdout, "Action %d device %s ifindex %d\n",p.action, d,p.ifindex);
 
-	tail = (struct rtattr *) (((void *) n) + NLMSG_ALIGN(n->nlmsg_len));
+	tail = NLMSG_TAIL(n);
 	addattr_l(n, MAX_MSG, tca_id, NULL, 0);
 	addattr_l(n, MAX_MSG, TCA_MIRRED_PARMS, &p, sizeof (p));
-	tail->rta_len =
-	    (((void *) n) + NLMSG_ALIGN(n->nlmsg_len)) - (void *) tail;
+	tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
 
 	*argc_p = argc;
 	*argv_p = argv;
diff -Nru a/tc/m_pedit.c b/tc/m_pedit.c
--- a/tc/m_pedit.c	2005-03-20 15:54:37 +01:00
+++ b/tc/m_pedit.c	2005-03-20 15:54:37 +01:00
@@ -534,11 +534,10 @@
 		}
 	}
 
-	tail = (struct rtattr *) (((void *) n) + NLMSG_ALIGN(n->nlmsg_len));
+	tail = NLMSG_TAIL(n);
 	addattr_l(n, MAX_MSG, tca_id, NULL, 0);
 	addattr_l(n, MAX_MSG, TCA_PEDIT_PARMS,&sel, sizeof(sel.sel)+sel.sel.nkeys*sizeof(struct tc_pedit_key));
-	tail->rta_len =
-	    (((void *) n) + NLMSG_ALIGN(n->nlmsg_len)) - (void *) tail;
+	tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
 
 	*argc_p = argc;
 	*argv_p = argv;
diff -Nru a/tc/m_police.c b/tc/m_police.c
--- a/tc/m_police.c	2005-03-20 15:54:37 +01:00
+++ b/tc/m_police.c	2005-03-20 15:54:37 +01:00
@@ -282,7 +282,7 @@
 		p.peakrate.mpu = mpu;
 	}
 
-	tail = (struct rtattr*)(((void*)n)+NLMSG_ALIGN(n->nlmsg_len));
+	tail = NLMSG_TAIL(n);
 	addattr_l(n, MAX_MSG, tca_id, NULL, 0);
 	addattr_l(n, MAX_MSG, TCA_POLICE_TBF, &p, sizeof(p));
 	if (p.rate.rate)
@@ -294,7 +294,7 @@
 	if (presult)
 		addattr32(n, MAX_MSG, TCA_POLICE_RESULT, presult);
 
-	tail->rta_len = (((void*)n)+NLMSG_ALIGN(n->nlmsg_len)) - (void*)tail;
+	tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
 	res = 0;
 
 	*argc_p = argc;
diff -Nru a/tc/q_atm.c b/tc/q_atm.c
--- a/tc/q_atm.c	2005-03-20 15:54:37 +01:00
+++ b/tc/q_atm.c	2005-03-20 15:54:37 +01:00
@@ -179,12 +179,12 @@
 			perror("ioctl ATMARP_MKIP");
 			return -1;
 		}
-	tail = (struct rtattr *) (((void *) n)+NLMSG_ALIGN(n->nlmsg_len));
+	tail = NLMSG_TAIL(n);
 	addattr_l(n,1024,TCA_OPTIONS,NULL,0);
 	addattr_l(n,1024,TCA_ATM_FD,&s,sizeof(s));
 	if (excess) addattr_l(n,1024,TCA_ATM_EXCESS,&excess,sizeof(excess));
 	if (hdr_len != -1) addattr_l(n,1024,TCA_ATM_HDR,hdr,hdr_len);
-	tail->rta_len = (((void *) n)+NLMSG_ALIGN(n->nlmsg_len))-(void *) tail;
+	tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
 	return 0;
 }
 
diff -Nru a/tc/q_cbq.c b/tc/q_cbq.c
--- a/tc/q_cbq.c	2005-03-20 15:54:37 +01:00
+++ b/tc/q_cbq.c	2005-03-20 15:54:37 +01:00
@@ -151,7 +151,7 @@
 	lss.change = TCF_CBQ_LSS_MAXIDLE|TCF_CBQ_LSS_EWMA|TCF_CBQ_LSS_AVPKT;
 	lss.avpkt = avpkt;
 
-	tail = (struct rtattr*)(((void*)n)+NLMSG_ALIGN(n->nlmsg_len));
+	tail = NLMSG_TAIL(n);
 	addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
 	addattr_l(n, 1024, TCA_CBQ_RATE, &r, sizeof(r));
 	addattr_l(n, 1024, TCA_CBQ_LSSOPT, &lss, sizeof(lss));
@@ -162,7 +162,7 @@
 			printf("%u ", rtab[i]);
 		printf("\n");
 	}
-	tail->rta_len = (((void*)n)+NLMSG_ALIGN(n->nlmsg_len)) - (void*)tail;
+	tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
 	return 0;
 }
 
@@ -385,7 +385,7 @@
 		lss.change |= TCF_CBQ_LSS_EWMA;
 	}
 
-	tail = (struct rtattr*)(((void*)n)+NLMSG_ALIGN(n->nlmsg_len));
+	tail = NLMSG_TAIL(n);
 	addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
 	if (lss.change) {
 		lss.change |= TCF_CBQ_LSS_FLAGS;
@@ -405,7 +405,7 @@
 			printf("\n");
 		}
 	}
-	tail->rta_len = (((void*)n)+NLMSG_ALIGN(n->nlmsg_len)) - (void*)tail;
+	tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
 	return 0;
 }
 
diff -Nru a/tc/q_dsmark.c b/tc/q_dsmark.c
--- a/tc/q_dsmark.c	2005-03-20 15:54:37 +01:00
+++ b/tc/q_dsmark.c	2005-03-20 15:54:37 +01:00
@@ -71,7 +71,7 @@
 		explain();
 		return -1;
 	}
-	tail = (struct rtattr *) (((void *) n)+NLMSG_ALIGN(n->nlmsg_len));
+	tail = NLMSG_TAIL(n);
 	addattr_l(n,1024,TCA_OPTIONS,NULL,0);
 	addattr_l(n,1024,TCA_DSMARK_INDICES,&ind,sizeof(ind));
 	if (dflt != -1) {
@@ -80,7 +80,7 @@
 	    addattr_l(n,1024,TCA_DSMARK_DEFAULT_INDEX,&tmp,sizeof(tmp));
 	}
 	if (set_tc_index) addattr_l(n,1024,TCA_DSMARK_SET_TC_INDEX,NULL,0);
-	tail->rta_len = (((void *) n)+n->nlmsg_len)-(void *) tail;
+	tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
 	return 0;
 }
 
@@ -98,7 +98,7 @@
 	__u8 tmp;
 	char *end;
 
-	tail = (struct rtattr *) (((void *) n)+NLMSG_ALIGN(n->nlmsg_len));
+	tail = NLMSG_TAIL(n);
 	addattr_l(n,1024,TCA_OPTIONS,NULL,0);
 	while (argc > 0) {
 		if (!strcmp(*argv,"mask")) {
@@ -126,7 +126,7 @@
 		argc--;
 		argv++;
 	}
-	tail->rta_len = (((void *) n)+n->nlmsg_len)-(void *) tail;
+	tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
 	return 0;
 }
 
diff -Nru a/tc/q_gred.c b/tc/q_gred.c
--- a/tc/q_gred.c	2005-03-20 15:54:37 +01:00
+++ b/tc/q_gred.c	2005-03-20 15:54:37 +01:00
@@ -106,11 +106,10 @@
 }
 DPRINTF("TC_GRED: sending DPs=%d default=%d\n",opt.DPs,opt.def_DP);
 	n->nlmsg_flags|=NLM_F_CREATE;
-	tail = (struct rtattr*)(((void*)n)+NLMSG_ALIGN(n->nlmsg_len));
-
+	tail = NLMSG_TAIL(n);
 	addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
 	addattr_l(n, 1024, TCA_GRED_DPS, &opt, sizeof(struct tc_gred_sopt));
-	tail->rta_len = (((void*)n)+NLMSG_ALIGN(n->nlmsg_len)) - (void*)tail;
+	tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
 return 0;
 }
 /*
@@ -252,12 +251,11 @@
 	}
 	opt.Scell_log = wlog;
 
-	tail = (struct rtattr*)(((void*)n)+NLMSG_ALIGN(n->nlmsg_len));
-
+	tail = NLMSG_TAIL(n);
 	addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
 	addattr_l(n, 1024, TCA_GRED_PARMS, &opt, sizeof(opt));
 	addattr_l(n, 1024, TCA_GRED_STAB, sbuf, 256);
-	tail->rta_len = (((void*)n)+NLMSG_ALIGN(n->nlmsg_len)) - (void*)tail;
+	tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
 	return 0;
 }
 
diff -Nru a/tc/q_hfsc.c b/tc/q_hfsc.c
--- a/tc/q_hfsc.c	2005-03-20 15:54:37 +01:00
+++ b/tc/q_hfsc.c	2005-03-20 15:54:37 +01:00
@@ -205,7 +205,7 @@
 		return -1;
 	}
 
-	tail = (struct rtattr*)(((void*)n) + NLMSG_ALIGN(n->nlmsg_len));
+	tail = NLMSG_TAIL(n);
 
 	addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
 	if (rsc_ok)
@@ -215,7 +215,7 @@
 	if (usc_ok)
 		addattr_l(n, 1024, TCA_HFSC_USC, &usc, sizeof(usc));
 
-	tail->rta_len = (((void*)n) + NLMSG_ALIGN(n->nlmsg_len)) - (void*)tail;
+	tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
 	return 0;
 }
 
diff -Nru a/tc/q_htb.c b/tc/q_htb.c
--- a/tc/q_htb.c	2005-03-20 15:54:37 +01:00
+++ b/tc/q_htb.c	2005-03-20 15:54:37 +01:00
@@ -93,10 +93,10 @@
 		}
 		argc--; argv++;
 	}
-	tail = (struct rtattr*)(((void*)n)+NLMSG_ALIGN(n->nlmsg_len));
+	tail = NLMSG_TAIL(n);
 	addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
 	addattr_l(n, 2024, TCA_HTB_INIT, &opt, NLMSG_ALIGN(sizeof(opt)));
-	tail->rta_len = (((void*)n)+NLMSG_ALIGN(n->nlmsg_len)) - (void*)tail;
+	tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
 	return 0;
 }
 
@@ -224,12 +224,12 @@
 	opt.cbuffer = tc_calc_xmittime(opt.ceil.rate, cbuffer);
 	opt.ceil.cell_log = ccell_log;
 
-	tail = (struct rtattr*)(((void*)n)+NLMSG_ALIGN(n->nlmsg_len));
+	tail = NLMSG_TAIL(n);
 	addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
 	addattr_l(n, 2024, TCA_HTB_PARMS, &opt, sizeof(opt));
 	addattr_l(n, 3024, TCA_HTB_RTAB, rtab, 1024);
 	addattr_l(n, 4024, TCA_HTB_CTAB, ctab, 1024);
-	tail->rta_len = (((void*)n)+NLMSG_ALIGN(n->nlmsg_len)) - (void*)tail;
+	tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
 	return 0;
 }
 
diff -Nru a/tc/q_netem.c b/tc/q_netem.c
--- a/tc/q_netem.c	2005-03-20 15:54:37 +01:00
+++ b/tc/q_netem.c	2005-03-20 15:54:37 +01:00
@@ -213,7 +213,7 @@
 		argc--; argv++;
 	}
 
-	tail = (struct rtattr*)(((void*)n) + NLMSG_ALIGN(n->nlmsg_len));
+	tail = NLMSG_TAIL(n);
 
 	addattr_l(n, 1024, TCA_OPTIONS, &opt, sizeof(opt));
 	addattr_l(n, 1024, TCA_NETEM_CORR, &cor, sizeof(cor));
@@ -222,7 +222,7 @@
 		addattr_l(n, 32768, TCA_NETEM_DELAY_DIST,
 			  dist_data, dist_size*sizeof(dist_data[0]));
 	}
-	tail->rta_len = (((void*)n)+NLMSG_ALIGN(n->nlmsg_len)) - (void*)tail;
+	tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
 	return 0;
 }
 
diff -Nru a/tc/q_red.c b/tc/q_red.c
--- a/tc/q_red.c	2005-03-20 15:54:37 +01:00
+++ b/tc/q_red.c	2005-03-20 15:54:37 +01:00
@@ -149,12 +149,11 @@
 #endif
 	}
 
-	tail = (struct rtattr*)(((void*)n)+NLMSG_ALIGN(n->nlmsg_len));
-
+	tail = NLMSG_TAIL(n);
 	addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
 	addattr_l(n, 1024, TCA_RED_PARMS, &opt, sizeof(opt));
 	addattr_l(n, 1024, TCA_RED_STAB, sbuf, 256);
-	tail->rta_len = (((void*)n)+NLMSG_ALIGN(n->nlmsg_len)) - (void*)tail;
+	tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
 	return 0;
 }
 
diff -Nru a/tc/q_tbf.c b/tc/q_tbf.c
--- a/tc/q_tbf.c	2005-03-20 15:54:37 +01:00
+++ b/tc/q_tbf.c	2005-03-20 15:54:37 +01:00
@@ -187,13 +187,13 @@
 		opt.peakrate.mpu = mpu;
 	}
 
-	tail = (struct rtattr*)(((void*)n)+NLMSG_ALIGN(n->nlmsg_len));
+	tail = NLMSG_TAIL(n);
 	addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);
 	addattr_l(n, 2024, TCA_TBF_PARMS, &opt, sizeof(opt));
 	addattr_l(n, 3024, TCA_TBF_RTAB, rtab, 1024);
 	if (opt.peakrate.rate)
 		addattr_l(n, 4096, TCA_TBF_PTAB, ptab, 1024);
-	tail->rta_len = (((void*)n)+NLMSG_ALIGN(n->nlmsg_len)) - (void*)tail;
+	tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail;
 	return 0;
 }
 

[-- Attachment #3: Type: text/plain, Size: 143 bytes --]

_______________________________________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

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

* Re: [LARTC] Adding dsmark qdisc fails
  2005-03-20 13:06 [LARTC] Adding dsmark qdisc fails Tero Saarni
  2005-03-20 15:15 ` Patrick McHardy
@ 2005-03-20 16:25 ` Thomas Graf
  2005-03-20 17:00 ` Tero Saarni
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Thomas Graf @ 2005-03-20 16:25 UTC (permalink / raw)
  To: lartc

* Patrick McHardy <423D9398.8050907@trash.net> 2005-03-20 16:15
> ># tc qdisc add dev eth1 handle 1:0 root dsmark indices 8
> >RTNETLINK answers: Invalid argument
> >Mar 20 13:00:50 user user.debug kernel: dsmark_init(sch a0bb3ae0,[qdisc 
> >a0bb3b60],opt 00000000)
> >
> It is caused by this patch, the transformation to use NLMSG_TAIL is
> not equivalent (it calculates the size of the aligned message). This
> makes parsing the attributes in rtnetlink_rcv_msg() fail. I haven't 
> checked what the exact problem is, Thomas, can you have a look at this
> please?

My patch is right but discovered a quite more serious bug in the
generic routing attribute handling. nlmsg_len is not aligned to
RTA_ALIGNTO if the data length of the attribute did not have
this alignment itself. The fact that the addition of the next attribute
fixed this bug automatically by issueing NLMSG_ALIGN(nlmsg_len) + len
put a good shadow around it and made it only a problem when the last
attribute added was not properly aligned. Patch attached, alternatively
one can clone bk://kernel.bkbits.net/tgraf/iproute2-tgr and als get
the new fancy multipath bits installed. ;->

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2005/03/20 17:19:39+01:00 tgraf@suug.ch 
#   Fix netlink message alignment when the last routing attribute added
#   has a data length not aligned to RTA_ALIGNTO.
# 
# lib/libnetlink.c
#   2005/03/20 17:19:38+01:00 tgraf@suug.ch +4 -4
#   Fix netlink message alignment when the last routing attribute added
#   has a data length not aligned to RTA_ALIGNTO.
# 
diff -Nru a/lib/libnetlink.c b/lib/libnetlink.c
--- a/lib/libnetlink.c	2005-03-20 17:19:53 +01:00
+++ b/lib/libnetlink.c	2005-03-20 17:19:53 +01:00
@@ -491,7 +491,7 @@
 	int len = RTA_LENGTH(alen);
 	struct rtattr *rta;
 
-	if (NLMSG_ALIGN(n->nlmsg_len) + len > maxlen) {
+	if (NLMSG_ALIGN(n->nlmsg_len) + RTA_ALIGN(len) > maxlen) {
 		fprintf(stderr, "addattr_l ERROR: message exceeded bound of %d\n",maxlen);
 		return -1;
 	}
@@ -499,7 +499,7 @@
 	rta->rta_type = type;
 	rta->rta_len = len;
 	memcpy(RTA_DATA(rta), data, alen);
-	n->nlmsg_len = NLMSG_ALIGN(n->nlmsg_len) + len;
+	n->nlmsg_len = NLMSG_ALIGN(n->nlmsg_len) + RTA_ALIGN(len);
 	return 0;
 }
 
@@ -539,7 +539,7 @@
 	struct rtattr *subrta;
 	int len = RTA_LENGTH(alen);
 
-	if (RTA_ALIGN(rta->rta_len) + len > maxlen) {
+	if (RTA_ALIGN(rta->rta_len) + RTA_ALIGN(len) > maxlen) {
 		fprintf(stderr,"rta_addattr_l: Error! max allowed bound %d exceeded\n",maxlen);
 		return -1;
 	}
@@ -547,7 +547,7 @@
 	subrta->rta_type = type;
 	subrta->rta_len = len;
 	memcpy(RTA_DATA(subrta), data, alen);
-	rta->rta_len = NLMSG_ALIGN(rta->rta_len) + len;
+	rta->rta_len = NLMSG_ALIGN(rta->rta_len) + RTA_ALIGN(len);
 	return 0;
 }
 
_______________________________________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

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

* Re: [LARTC] Adding dsmark qdisc fails
  2005-03-20 13:06 [LARTC] Adding dsmark qdisc fails Tero Saarni
  2005-03-20 15:15 ` Patrick McHardy
  2005-03-20 16:25 ` Thomas Graf
@ 2005-03-20 17:00 ` Tero Saarni
  2006-01-05 21:34 ` Keith Mitchell
  2006-01-06  0:38 ` Keith Mitchell
  4 siblings, 0 replies; 6+ messages in thread
From: Tero Saarni @ 2005-03-20 17:00 UTC (permalink / raw)
  To: lartc

>From: Thomas Graf <tgraf@suug.ch>
>My patch is right but discovered a quite more serious bug in the
>generic routing attribute handling. nlmsg_len is not aligned to
>RTA_ALIGNTO if the data length of the attribute did not have
>this alignment itself. The fact that the addition of the next attribute
>fixed this bug automatically by issueing NLMSG_ALIGN(nlmsg_len) + len
>put a good shadow around it and made it only a problem when the last
>attribute added was not properly aligned. Patch attached, alternatively
>one can clone bk://kernel.bkbits.net/tgraf/iproute2-tgr and als get
>the new fancy multipath bits installed. ;->

Thanks!
That fixed it.

--
Tero

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar - get it now! 
http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/

_______________________________________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

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

* [LARTC] Adding dsmark qdisc fails
  2005-03-20 13:06 [LARTC] Adding dsmark qdisc fails Tero Saarni
                   ` (2 preceding siblings ...)
  2005-03-20 17:00 ` Tero Saarni
@ 2006-01-05 21:34 ` Keith Mitchell
  2006-01-06  0:38 ` Keith Mitchell
  4 siblings, 0 replies; 6+ messages in thread
From: Keith Mitchell @ 2006-01-05 21:34 UTC (permalink / raw)
  To: lartc

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

--===============1720668432==
Content-class: urn:content-classes:message
Content-Type: multipart/alternative;
	boundary="----_=_NextPart_001_01C6123F.DE99C3DB"

This is a multi-part message in MIME format.

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

 I 'm having a problem identical to one encountered on this list awhile
back: 

>I'm trying to configure dsmark qdisc on 2.6.11.4 user mode linux and 
>tc from iproute2-2.6.11-050314. 
> 
> 
>I think I have some mismatch in my setup since adding dsmark qdisc 
>fails *unless* I specify "set_tc_index" argument which I believe should

>be optional: 
> 
> 
># tc qdisc add dev eth1 handle 1:0 root dsmark indices 8 
>RTNETLINK answers: Invalid argument 
>Mar 20 13:00:50 user user.debug kernel: dsmark_init(sch a0bb3ae0,[qdisc
a0bb3b60],opt 00000000) 
> 
>here the log shows that opt is null, sch_dsmark checks for that and 
>bails out.  However running tc with "set_tc_index" goes ok: 
> 
> 
># tc qdisc add dev eth1 handle 1:0 root dsmark indices 8 set_tc_index 
>Mar 20 13:01:12 user user.debug kernel: dsmark_init(sch a0bb3060,[qdisc
a0bb30e0],opt a038e9d0) 
>Mar 20 13:01:12 user user.debug kernel: dsmark_init: qdisc a0bb30e0 
> 
># tc qdisc show dev eth1 
>qdisc dsmark 1: indices 0x0008 set_tc_index 
> 
> 
> 
>but then changing the class fails: 
> 
> 
># tc class change dev eth1 classid 1:1 dsmark mask 0x0 value 0xb8 
>RTNETLINK answers: Invalid argument 
>Mar 20 13:02:28 user user.debug kernel: dsmark_get(sch a0bb3060,[qdisc
a0bb30e0],classid 10001) 
>Mar 20 13:02:28 user user.debug kernel: dsmark_change(sch
a0bb3060,[qdisc a0bb30e0],classid 10001,parent 0),arg 0x2 
> 
> 
>Any ideas where I've gone wrong? 
> 
> 
>-- 
>Tero 

I've applied the patch to my iproute2 that was suggested as a solution,
as well as upgrading to the latest version
(http://developer.osdl.org/dev/iproute2/download/iproute2-2.6.14-051107.
tar.gz
<http://developer.osdl.org/dev/iproute2/download/iproute2-2.6.14-051107.
tar.gz> ) of iproute2 which includes the patch, but always get the
following errors:

#  tc qdisc add dev eth1 handle 1:0 root dsmark indices 64 
RTNETLINK answers: Invalid argument 

Changing that to: 

#  tc qdisc add dev eth1 handle 1:0 root dsmark indices 64 set_tc_index 

Works, but following that with produces the same error: 

#  tc class change dev eth1 classid 1:1 dsmark mask 0x3 value 0x88 
RTNETLINK answers: Invalid argument 

Is this an iproute2 bug, or user error? 

I'm using iproute2 on FC4 2.6.14-1.1653 


TIY 

Keith Mitchell 
CTO 
Productivity Associates, Inc. 
5625 Ruffin Rd STE 220 
San Diego, CA 92123 
858-495-3528 (Direct) 
858-495-3540 (Fax) 



[-- Attachment #3: Type: text/html, Size: 5175 bytes --]

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

* RE: [LARTC] Adding dsmark qdisc fails
  2005-03-20 13:06 [LARTC] Adding dsmark qdisc fails Tero Saarni
                   ` (3 preceding siblings ...)
  2006-01-05 21:34 ` Keith Mitchell
@ 2006-01-06  0:38 ` Keith Mitchell
  4 siblings, 0 replies; 6+ messages in thread
From: Keith Mitchell @ 2006-01-06  0:38 UTC (permalink / raw)
  To: lartc

K never mind, i'm a dork.
 
  
*	Edit iproute2/Config to enable Diffserv support:
TC_CONFIG_DIFFSERV=y 

________________________________

From: lartc-bounces@mailman.ds9a.nl
[mailto:lartc-bounces@mailman.ds9a.nl] On Behalf Of Keith Mitchell
Sent: Thursday, January 05, 2006 1:35 PM
To: lartc@mailman.ds9a.nl
Subject: [LARTC] Adding dsmark qdisc fails



 I 'm having a problem identical to one encountered on this list awhile
back: 

>I'm trying to configure dsmark qdisc on 2.6.11.4 user mode linux and 
>tc from iproute2-2.6.11-050314. 
> 
> 
>I think I have some mismatch in my setup since adding dsmark qdisc 
>fails *unless* I specify "set_tc_index" argument which I believe should

>be optional: 
> 
> 
># tc qdisc add dev eth1 handle 1:0 root dsmark indices 8 
>RTNETLINK answers: Invalid argument 
>Mar 20 13:00:50 user user.debug kernel: dsmark_init(sch a0bb3ae0,[qdisc
a0bb3b60],opt 00000000) 
> 
>here the log shows that opt is null, sch_dsmark checks for that and 
>bails out.  However running tc with "set_tc_index" goes ok: 
> 
> 
># tc qdisc add dev eth1 handle 1:0 root dsmark indices 8 set_tc_index 
>Mar 20 13:01:12 user user.debug kernel: dsmark_init(sch a0bb3060,[qdisc
a0bb30e0],opt a038e9d0) 
>Mar 20 13:01:12 user user.debug kernel: dsmark_init: qdisc a0bb30e0 
> 
># tc qdisc show dev eth1 
>qdisc dsmark 1: indices 0x0008 set_tc_index 
> 
> 
> 
>but then changing the class fails: 
> 
> 
># tc class change dev eth1 classid 1:1 dsmark mask 0x0 value 0xb8 
>RTNETLINK answers: Invalid argument 
>Mar 20 13:02:28 user user.debug kernel: dsmark_get(sch a0bb3060,[qdisc
a0bb30e0],classid 10001) 
>Mar 20 13:02:28 user user.debug kernel: dsmark_change(sch
a0bb3060,[qdisc a0bb30e0],classid 10001,parent 0),arg 0x2 
> 
> 
>Any ideas where I've gone wrong? 
> 
> 
>-- 
>Tero 

I've applied the patch to my iproute2 that was suggested as a solution,
as well as upgrading to the latest version
(http://developer.osdl.org/dev/iproute2/download/iproute2-2.6.14-051107.
tar.gz
<http://developer.osdl.org/dev/iproute2/download/iproute2-2.6.14-051107.
tar.gz> ) of iproute2 which includes the patch, but always get the
following errors:

#  tc qdisc add dev eth1 handle 1:0 root dsmark indices 64 
RTNETLINK answers: Invalid argument 

Changing that to: 

#  tc qdisc add dev eth1 handle 1:0 root dsmark indices 64 set_tc_index 

Works, but following that with produces the same error: 

#  tc class change dev eth1 classid 1:1 dsmark mask 0x3 value 0x88 
RTNETLINK answers: Invalid argument 

Is this an iproute2 bug, or user error? 

I'm using iproute2 on FC4 2.6.14-1.1653 


TIY 

Keith Mitchell 
CTO 
Productivity Associates, Inc. 
5625 Ruffin Rd STE 220 
San Diego, CA 92123 
858-495-3528 (Direct) 
858-495-3540 (Fax) 


_______________________________________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

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

end of thread, other threads:[~2006-01-06  0:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-20 13:06 [LARTC] Adding dsmark qdisc fails Tero Saarni
2005-03-20 15:15 ` Patrick McHardy
2005-03-20 16:25 ` Thomas Graf
2005-03-20 17:00 ` Tero Saarni
2006-01-05 21:34 ` Keith Mitchell
2006-01-06  0:38 ` Keith Mitchell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.