diff --git a/src/qosmngr.c b/src/qosmngr.c index a059ceebd395a2b03bf4fbc782199bf0d79fd6fc..4c05a3f8633845b2525021a1f4385caaed8a90ee 100644 --- a/src/qosmngr.c +++ b/src/qosmngr.c @@ -79,11 +79,15 @@ static int get_no_queues(const char *ifname) uci_foreach_element(&uci_pkg->sections, uci_elmnt) { struct uci_section *uci_sec = uci_to_section(uci_elmnt); if (uci_sec && !strcmp(uci_sec->type, "queue")) { - struct uci_element *e = NULL; - uci_foreach_element(&uci_sec->options, e) { - struct uci_option *uci_opn = uci_to_option(e); - if (uci_opn && !strcmp(uci_opn->v.string, ifname)) - queues++; + const char *opt_enab; + opt_enab = uci_lookup_option_string(uci_ctx, uci_sec, "enable"); + if (opt_enab && !strcmp(opt_enab, "1")) { + struct uci_element *e = NULL; + uci_foreach_element(&uci_sec->options, e) { + struct uci_option *uci_opn = uci_to_option(e); + if (uci_opn && !strcmp(uci_opn->v.string, ifname)) + queues++; + } } } } @@ -383,7 +387,7 @@ static int prepare_stats_blob(struct blob_buf *b, struct qos_stats *stats, void static int get_stats_by_ifname(struct blob_buf *b, struct qos_stats *stats, void *dd, char *ifname, int qid) { - int ret = 0; + int ret = -1; if (qid >= 0) { ret = prepare_stats_blob(b, stats, dd, ifname, qid); @@ -391,10 +395,15 @@ static int get_stats_by_ifname(struct blob_buf *b, struct qos_stats *stats, void int i; int queues = get_no_queues(ifname); + if (queues <= 0) { + ret = 0; + return ret; + } + for (i = 0; i < queues; i++) { - ret = prepare_stats_blob(b, stats, dd, ifname, i); - if (ret != 0) - return ret; + int pst = prepare_stats_blob(b, stats, dd, ifname, i); + if (pst == 0) + ret = 0; } }