]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network/tc: re-enumerate traffic control classes when a qdisc created
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 7 Oct 2023 05:25:50 +0000 (14:25 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 7 Oct 2023 12:35:16 +0000 (21:35 +0900)
Some kind of qdisc implicitly creates a class for the qdisc, but the
created class is not notified by the kernel. So, we need to explicitly
enumerate classes after a qdisc is created.

src/network/tc/qdisc.c

index 828fe9ab8292c489db794063bcd26248dd2de5d4..6a4d2043a0a7f394971bae8288fe87602184bf78 100644 (file)
@@ -536,6 +536,14 @@ int manager_rtnl_process_qdisc(sd_netlink *rtnl, sd_netlink_message *message, Ma
                         qdisc = TAKE_PTR(tmp);
                 }
 
+                if (!m->enumerating) {
+                        /* Some kind of QDisc (e.g. tbf) also create an implicit class under the qdisc, but
+                         * the kernel may not notify about the class. Hence, we need to enumerate classes. */
+                        r = link_enumerate_tclass(link, qdisc->handle);
+                        if (r < 0)
+                                log_link_warning_errno(link, r, "Failed to enumerate TClass, ignoring: %m");
+                }
+
                 break;
 
         case RTM_DELQDISC: