On Tue, 03 Nov 2020 12:11:06 +1100, Dean Scarff wrote:

I should be able to figure it out by poking around in tc with gdb.

I did this, and I confirmed that tc isn't trying to send any nested attributes. So I think the problem is on the kernel side, since it seems to be hallucinating attributes it expects to be nested but aren't.

Note that "tc" does send an empty options attribute:

        addattr_l(n, 1024, TCA_OPTIONS, NULL, 0);

https://salsa.debian.org/debian/iproute2/-/blob/v5.7.0/tc/q_cake.c#L356

It's the same in upstream iproute2 and iproute2-next:
https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/tree/tc/q_cake.c#n356
https://git.kernel.org/pub/scm/network/iproute2/iproute2-next.git/tree/tc/q_cake.c#n356

This looks valid to me. While I'm less sure about all the other attributes being added in cake_parse_opt (i.e. whether they should be nested under TCA_OPTIONS), that's moot in my repro case, because they're not being set anyway.


---
Interesting parts of the gdb session:

(gdb) run qdisc add dev ppp0 root cake
Starting program: /home/dean/iproute2/tc/tc qdisc add dev ppp0 root cake

Breakpoint 10, rtnl_talk (rtnl=0xc72d0 <rth>, n=0x7efefb78, answer=0x0)
    at libnetlink.c:1048
1048    return __rtnl_talk(rtnl, n, answer, true, NULL);
(gdb) p *rtnl
$14 = {fd = 3, local = {nl_family = 16, nl_pad = 0, nl_pid = 18698,
    nl_groups = 0}, peer = {nl_family = 0, nl_pad = 0, nl_pid = 0,
    nl_groups = 0}, seq = 1604370876, dump = 1604370876, proto = 0,
  dump_fp = 0x0, flags = 0}
(gdb) p *n
$15 = {nlmsg_len = 52, nlmsg_type = 36, nlmsg_flags = 1537, nlmsg_seq = 0,
  nlmsg_pid = 0}
(gdb) p sizeof(struct nlmsghdr)
$16 = 16
(gdb) call print_qdisc(n, stdout)
added qdisc cake 0: dev ppp0 root refcnt 0 nonat nowash no-ack-filter no-split-gso noatm overhead 0
$17 = 0

I've annotated the following to show the structure of the request. There are only two attributes, TCA_KIND and TCA_OPTIONS, and neither of those is nested.

(gdb) x/52xb n
nlmsghdr:
0x7efefb78: [0x34] 0x00  0x00  0x00 [0x24] 0x00  0x01  0x06
             len=52                  RTM_NEWQDISC
0x7efefb80:  0x00  0x00  0x00  0x00  0x00  0x00  0x00  0x00

payload:
family header:
0x7efefb88: [0x00][0x00][0x00  0x00][0x05  0x00][0x00  0x00]
             family=AF_UNSPEC        ifindex=ppp0
                   pad1  pad2                    alignment
0x7efefb90: [0x00  0x00  0x00  0x00][0xff  0xff  0xff  0xff]
             handle=0                parent=TC_H_ROOT

                                     attributes:
0x7efefb98: [0x00  0x00  0x00  0x00][0x09  0x00][0x01  0x00]
             info=0                  rta_len=9   rta_type=TCA_KIND
0x7efefba0: [0x63  0x61  0x6b  0x65  0x00][0x00  0x00  0x00]
             rta_data=“cake”               alignment
0x7efefba8: [0x04  0x00][0x02  0x00]
             rta_len=4   rta_type=TCA_OPTIONS


(gdb) up
#1 0x000199a4 in tc_qdisc_modify (cmd=36, flags=1536, argc=0, argv=0x7efffd70)
    at tc_qdisc.c:208
208    if (rtnl_talk(&rth, &req.n, NULL) < 0)
(gdb) p req.t
$19 = {tcm_family = 0 '\000', tcm__pad1 = 0 '\000', tcm__pad2 = 0,
tcm_ifindex = 5, tcm_handle = 0, tcm_parent = 4294967295, tcm_info = 0}

_______________________________________________
Cake mailing list
[email protected]
https://lists.bufferbloat.net/listinfo/cake

Reply via email to