tc with netem on 64bit systems

From: Oliver Cook
Date: Wed Jun 20 2007 - 10:15:31 EST


In trying to run tc with netem to introduce latency in the lab on a
64bit system I discovered the following bug in get_qdisc_kind in tc.c:

snprintf(buf, sizeof(buf), "/usr/lib/tc/", str);

The path to the tc qdisc shared objects is hard-coded. On a 64bit system
the correct path is /usr/lib64/tc/.

This manifests itself as follows on 64bit systems running 2.6 kernels:

# tc qdisc add dev eth0 root netem delay 100ms
Unknown qdisc "netem", hence option "delay" is unparsable

# strace tc qdisc add dev eth0 root netem delay 100ms 2>&1|grep netem
execve("/sbin/tc", ["tc", "qdisc", "add", "dev", "eth0", "root",
"delay", "100ms"], [/* 20 vars */]) = 0
open("/usr/lib/tc/", O_RDONLY) = -1 ENOENT (No such file or

A workaround is to symlink /usr/lib/tc/ to /usr/lib64/tc.

A patch that tries first /usr/lib/tc then /usr/lib64/tc is available at for your
consideration, although probably isn't the 'right way' to fix this.


(cc tc maintainer)

Ollie Cook
Performance and Capacity

Office: +44 20 8834 8128
Yahoo! Messenger: olliebetfair

Betfair Limited | Winslow Road | Hammersmith Embankment | London | W6
Company No. 5140986

The information in this e-mail and any attachment is confidential and is
intended only for the named recipient(s). The e-mail may not be
disclosed or used by any person other than the addressee, nor may it be
copied in any way. If you are not a named recipient please notify the
sender immediately and delete any copies of this message. Any
unauthorized copying, disclosure or distribution of the material in this
e-mail is strictly forbidden. Any view or opinions presented are solely
those of the author and do not necessarily represent those of the

In order to protect our email recipients, Betfair Group use SkyScan from
MessageLabs to scan all Incoming and Outgoing mail for viruses.

To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at