diff options
-rw-r--r-- | src/network/tc/qdisc.c | 13 | ||||
-rw-r--r-- | src/network/tc/qdisc.h | 1 |
2 files changed, 11 insertions, 3 deletions
diff --git a/src/network/tc/qdisc.c b/src/network/tc/qdisc.c index 6aef268d1f..8f8a7408a5 100644 --- a/src/network/tc/qdisc.c +++ b/src/network/tc/qdisc.c @@ -353,10 +353,17 @@ static bool qdisc_is_ready_to_configure(QDisc *qdisc, Link *link) { if (!IN_SET(link->state, LINK_STATE_CONFIGURING, LINK_STATE_CONFIGURED)) return false; - if (IN_SET(qdisc->parent, TC_H_ROOT, TC_H_CLSACT)) /* TC_H_CLSACT == TC_H_INGRESS */ - return true; + /* TC_H_CLSACT == TC_H_INGRESS */ + if (!IN_SET(qdisc->parent, TC_H_ROOT, TC_H_CLSACT) && + link_find_tclass(link, qdisc->parent, NULL) < 0) + return false; + + if (QDISC_VTABLE(qdisc) && + QDISC_VTABLE(qdisc)->is_ready && + QDISC_VTABLE(qdisc)->is_ready(qdisc, link) <= 0) + return false; - return link_find_tclass(link, qdisc->parent, NULL) >= 0; + return true; } static int qdisc_process_request(Request *req, Link *link, QDisc *qdisc) { diff --git a/src/network/tc/qdisc.h b/src/network/tc/qdisc.h index adaaf260c4..155e2adf24 100644 --- a/src/network/tc/qdisc.h +++ b/src/network/tc/qdisc.h @@ -56,6 +56,7 @@ typedef struct QDiscVTable { int (*init)(QDisc *qdisc); int (*fill_message)(Link *link, QDisc *qdisc, sd_netlink_message *m); int (*verify)(QDisc *qdisc); + int (*is_ready)(QDisc *qdisc, Link *link); } QDiscVTable; extern const QDiscVTable * const qdisc_vtable[_QDISC_KIND_MAX]; |