tbf qdisc

Dmitry Kozlov xeb at mail.ru
Tue Oct 12 22:42:29 EDT 2010


Hello!
I'm trying to setup tbf on interface using libnl-1.1, but unsuccessfully.
The code is:

struct nl_handle *nlh;
struct rtnl_qdisc *qdisc;

nlh = nl_alloc_handle();
qdisc = rtnl_qdisc_alloc();
rtnl_qdisc_set_ifindex(qdisc, strtoul(argv[1], NULL, 0));
rtnl_qdisc_set_parent(qdisc, TC_H_ROOT);
rtnl_qdisc_set_handle(qdisc, TC_H_MAKE(1,0));
rtnl_qdisc_set_kind(qdisc, "tbf");
rtnl_qdisc_tbf_set_rate(qdisc, 800, 80, 0);
rtnl_qdisc_tbf_set_limit_by_latency(qdisc, 10000);
nl_connect(nlh, NETLINK_ROUTE);
if (rtnl_qdisc_add(nlh, qdisc, NLM_F_REPLACE) < 0) {
                fprintf(stderr, "Unable to add Qdisc: %s\n", nl_geterror());
}

and get error here:
Unable to add Qdisc: Netlink Error (errno = Invalid argument)

Please point me where i am wrong.



More information about the libnl mailing list