[bug?] bug in the htb netlink messages ?

Thomas Graf tgraf at infradead.org
Tue Feb 21 11:25:43 EST 2012


On Tue, Feb 21, 2012 at 11:12:32AM +0100, Fabrice HOBAYA wrote:
> I'm using the libnl 3.2.3 for rtnl_htb functions, here is my problem:
> 
> When I set the rate (and ceil) of a branch of the htb
> (rtnl_htb_set_rate(...) and rtnl_htb_set_ceil), the real observed
> rate is 16 times bigger whereas the get functions
> (rtnl_htb_get_rate(...) and rtnl_htb_get_ceil(...)) and the
> nl_object_dump function (result at the end of the mail) return the
> right set rate and ceil.
> 
> For example when I set rate and ceil to 15kbits/sec, the observed
> rate is 240kbits/sec (the parent has the same settings).

Seems like the rate calculation is no longer valid. The kernel has
updated the way it expects userpace to provide rates a while ago.

Can you nl_object_dump() your htb class/qdisc before you send it
to the kernel? That will show us if the calculation is wrong or if
the kernel expects something different from us.

> When I tried to debug with NLCB=debug, the request message for the
> setting of the htb is well acknowledged (error message with code 0)
> but seems to have a wrong total length (see below). The second
> attribute [ATTR 02] of the request is not readable without a
> documentation, so I can not continue debugging without help.

These corresponding to TCA_* in <linux/rtnetlink.h>

ATTR 01 is TCA_KIND
ATTR 02 is TCA_OPTIONS

> For information I've used a tc script (on the same system), and
> everything has worked normally.
> 
> Could someone gives me any idea on that ? Thanks in advance.
> 
> Best Regards,
> Fabrice.
> 
> -- Debug: Sent Message:
> --------------------------   BEGIN NETLINK MESSAGE
> ---------------------------
>   [HEADER] 16 octets
>     .nlmsg_len = 2152 (*instead of 16+20+4+2104 = 2144 ???*)

You also have to account for attribute headers:

 16 + 20 + (4 + 4) + (4 + 2104) = 2152



More information about the libnl mailing list