[LARTC] Adding dsmark qdisc fails

2006-01-05 Thread Keith Mitchell
Title: 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 )  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_indexbut 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) 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


RE: [LARTC] Adding dsmark qdisc fails

2006-01-05 Thread Keith Mitchell
K never mind, i'm a dork.
 
  
*   Edit iproute2/Config to enable Diffserv support:
TC_CONFIG_DIFFSERV=y 



From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 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 ) 
 
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


[LARTC] Adding dsmark qdisc fails

2005-03-20 Thread Tero Saarni
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 )

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


Re: [LARTC] Adding dsmark qdisc fails

2005-03-20 Thread Patrick McHardy
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 )

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
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2005/01/18 02:24:18+01:00 [EMAIL PROTECTED] 
#   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 [EMAIL PROTECTED] +2 -2
#   Use NLMSG_TAIL
# 
# tc/q_red.c
#   2005/01/18 02:24:18+01:00 [EMAIL PROTECTED] +2 -3
#   Use NLMSG_TAIL
# 
# tc/q_netem.c
#   2005/01/18 02:24:18+01:00 [EMAIL PROTECTED] +2 -2
#   Use NLMSG_TAIL
# 
# tc/q_htb.c
#   2005/01/18 02:24:18+01:00 [EMAIL PROTECTED] +4 -4
#   Use NLMSG_TAIL
# 
# tc/q_hfsc.c
#   2005/01/18 02:24:18+01:00 [EMAIL PROTECTED] +2 -2
#   Use NLMSG_TAIL
# 
# tc/q_gred.c
#   2005/01/18 02:24:18+01:00 [EMAIL PROTECTED] +4 -6
#   Use NLMSG_TAIL
# 
# tc/q_dsmark.c
#   2005/01/18 02:24:18+01:00 [EMAIL PROTECTED] +4 -4
#   Use NLMSG_TAIL
# 
# tc/q_cbq.c
#   2005/01/18 02:24:18+01:00 [EMAIL PROTECTED] +4 -4
#   Use NLMSG_TAIL
# 
# tc/q_atm.c
#   2005/01/18 02:24:18+01:00 [EMAIL PROTECTED] +2 -2
#   Use NLMSG_TAIL
# 
# tc/m_police.c
#   2005/01/18 02:24:18+01:00 [EMAIL PROTECTED] +2 -2
#   Use NLMSG_TAIL
# 
# tc/m_pedit.c
#   2005/01/18 02:24:18+01:00 [EMAIL PROTECTED] +2 -3
#   Use NLMSG_TAIL
# 
# tc/m_mirred.c
#   2005/01/18 02:24:18+01:00 [EMAIL PROTECTED] +2 -3
#   Use NLMSG_TAIL
# 
# tc/m_ipt.c
#   2005/01/18 02:24:18+01:00 [EMAIL PROTECTED] +2 -3
#   Use NLMSG_TAIL
# 
# tc/m_gact.c
#   2005/01/18 02:24:18+01:00 [EMAIL PROTECTED] +2 -3
#   Use NLMSG_TAIL
# 
# tc/m_action.c
#   2005/01/18 02:24:18+01:00 [EMAIL PROTECTED] +17 -30
#   Use NLMSG_TAIL
# 
# tc/f_u32.c
#   2005/01/18 02:24:18+01:00 [EMAIL PROTECTED] +2 -2
#   Use NLMSG_TAIL
# 
# tc/f_tcindex.c
#   2005/01/18 02:24:18+01:00 [EMAIL PROTECTED] +2 -2
#   Use NLMSG_TAIL
# 
# tc/f_rsvp.c
#   2005/01/18 02:24:18+01:00 [EMAIL PROTECTED] +2 -2
#   Use NLMSG_TAIL
# 
# tc/f_route.c
#   2005/01/18 02:24:18+01:00 [EMAIL PROTECTED] +2 -2
#   Use NLMSG_TAIL
# 
# tc/f_fw.c
#   2005/01/18 02:24:18+01:00 [EMAIL PROTECTED] +2 -2
#   Use NLMSG_TAIL
# 
# include/libnetlink.h
#   2005/01/18 02:24:18+01:00 [EMAIL PROTECTED] +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;
 
-   

Re: [LARTC] Adding dsmark qdisc fails

2005-03-20 Thread Thomas Graf
* Patrick McHardy [EMAIL PROTECTED] 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 )
 
 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 [EMAIL PROTECTED] 
#   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 [EMAIL PROTECTED] +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


Re: [LARTC] Adding dsmark qdisc fails

2005-03-20 Thread Tero Saarni
From: Thomas Graf [EMAIL PROTECTED]
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