X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=lib%2Fsrc%2Fqos.c;fp=lib%2Fsrc%2Fqos.c;h=e31648afcdd9592b593b9a246fd5e9af7afe3c34;hb=37f89190b48ac9b483286caa0534fba00bb6f7a9;hp=553c87878503cfb12d5ca97df66f85f6e96d7b38;hpb=78cd06b5be7ba802beba11efb9dbc832852cb87d;p=ngadmin diff --git a/lib/src/qos.c b/lib/src/qos.c index 553c878..e31648a 100644 --- a/lib/src/qos.c +++ b/lib/src/qos.c @@ -65,13 +65,15 @@ int ngadmin_getQOSValues (struct ngadmin *nga, char *ports) struct attr *at; int ret = ERR_OK, port; struct attr_qos *aq; + struct swi_attr *sa; if (nga == NULL || ports == NULL) return ERR_INVARG; - else if (nga->current == NULL) - return ERR_NOTLOG; + sa = nga->current; + if (sa == NULL) + return ERR_NOTLOG; attr = createEmptyList(); pushBackList(attr, newEmptyAttr(ATTR_QOS_CONFIG)); @@ -81,13 +83,14 @@ int ngadmin_getQOSValues (struct ngadmin *nga, char *ports) filterAttributes(attr, ATTR_QOS_CONFIG, ATTR_END); - for (port = 0; port < nga->current->ports; port++) + for (port = 0; port < sa->ports; port++) ports[port] = PRIO_UNSPEC; for (ln = attr->first; ln != NULL; ln = ln->next) { at = ln->data; aq = at->data; - ports[aq->port - 1] = aq->prio; + if (aq->port <= sa->ports) + ports[aq->port - 1] = aq->prio; }