mirror of
https://github.com/systemd/systemd.git
synced 2024-12-25 01:34:28 +03:00
network/tc: support Parent=X:0 for qdiscs
When the minor part of the parent handle is zero, let's check if the corresponding qdisc exists, rather than tc class.
This commit is contained in:
parent
19607e4371
commit
9e4d87166f
@ -262,20 +262,15 @@ static void log_qdisc_debug(QDisc *qdisc, Link *link, const char *str) {
|
||||
strna(qdisc_get_tca_kind(qdisc)));
|
||||
}
|
||||
|
||||
int link_find_qdisc(Link *link, uint32_t handle, uint32_t parent, const char *kind, QDisc **ret) {
|
||||
int link_find_qdisc(Link *link, uint32_t handle, const char *kind, QDisc **ret) {
|
||||
QDisc *qdisc;
|
||||
|
||||
assert(link);
|
||||
|
||||
handle = TC_H_MAJ(handle);
|
||||
|
||||
SET_FOREACH(qdisc, link->qdiscs) {
|
||||
if (qdisc->handle != handle)
|
||||
continue;
|
||||
|
||||
if (qdisc->parent != parent)
|
||||
continue;
|
||||
|
||||
if (!qdisc_exists(qdisc))
|
||||
continue;
|
||||
|
||||
@ -378,9 +373,15 @@ static bool qdisc_is_ready_to_configure(QDisc *qdisc, Link *link) {
|
||||
return false;
|
||||
|
||||
/* 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 (!IN_SET(qdisc->parent, TC_H_ROOT, TC_H_CLSACT)) {
|
||||
if (TC_H_MIN(qdisc->parent) == 0) {
|
||||
if (link_find_qdisc(link, qdisc->parent, NULL, NULL) < 0)
|
||||
return false;
|
||||
} else {
|
||||
if (link_find_tclass(link, qdisc->parent, NULL) < 0)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (QDISC_VTABLE(qdisc) &&
|
||||
QDISC_VTABLE(qdisc)->is_ready &&
|
||||
|
@ -79,7 +79,7 @@ int qdisc_new_static(QDiscKind kind, Network *network, const char *filename, uns
|
||||
|
||||
QDisc* qdisc_drop(QDisc *qdisc);
|
||||
|
||||
int link_find_qdisc(Link *link, uint32_t handle, uint32_t parent, const char *kind, QDisc **qdisc);
|
||||
int link_find_qdisc(Link *link, uint32_t handle, const char *kind, QDisc **qdisc);
|
||||
|
||||
int link_request_qdisc(Link *link, QDisc *qdisc);
|
||||
|
||||
|
@ -339,7 +339,7 @@ static bool tclass_is_ready_to_configure(TClass *tclass, Link *link) {
|
||||
if (!IN_SET(link->state, LINK_STATE_CONFIGURING, LINK_STATE_CONFIGURED))
|
||||
return false;
|
||||
|
||||
return link_find_qdisc(link, tclass->classid, tclass->parent, tclass_get_tca_kind(tclass), NULL) >= 0;
|
||||
return link_find_qdisc(link, TC_H_MAJ(tclass->classid), tclass_get_tca_kind(tclass), NULL) >= 0;
|
||||
}
|
||||
|
||||
static int tclass_process_request(Request *req, Link *link, TClass *tclass) {
|
||||
|
Loading…
Reference in New Issue
Block a user