diff --git a/bbf_plugin/qos_bbf.c b/bbf_plugin/qos_bbf.c index cd4a6a9e5fa9c677dfc29eae4abec6f4b81390bd..97d07f842b218c3e4accbd4139d670a2eb3cad1e 100644 --- a/bbf_plugin/qos_bbf.c +++ b/bbf_plugin/qos_bbf.c @@ -380,20 +380,33 @@ static int delObjQoSShaper(char *refparam, struct dmctx *ctx, void *data, char * static int get_QInterface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { char *linker = NULL; + char buf[4096] = {0}; + int pos = 0; dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "ifname", &linker); + if (DM_STRLEN(linker) == 0) + return 0; bbf_get_reference_param("Device.IP.Interface.", "Name", linker, value); + if (DM_STRLEN(*value)) + pos += snprintf(&buf[pos], sizeof(buf) - pos, "%s,", *value); - if (!DM_STRLEN(*value)) - bbf_get_reference_param("Device.PPP.Interface.", "Name", linker, value); + bbf_get_reference_param("Device.PPP.Interface.", "Name", linker, value); + if (DM_STRLEN(*value)) + pos += snprintf(&buf[pos], sizeof(buf) - pos, "%s,", *value); - if (!DM_STRLEN(*value)) - bbf_get_reference_param("Device.Ethernet.Interface.", "Name", linker, value); + bbf_get_reference_param("Device.Ethernet.Interface.", "Name", linker, value); + if (DM_STRLEN(*value)) + pos += snprintf(&buf[pos], sizeof(buf) - pos, "%s,", *value); + + bbf_get_reference_param("Device.WiFi.Radio.", "Name", linker, value); + if (DM_STRLEN(*value)) + pos += snprintf(&buf[pos], sizeof(buf) - pos, "%s,", *value); - if (!DM_STRLEN(*value)) - bbf_get_reference_param("Device.WiFi.Radio.", "Name", linker, value); + if (pos) + buf[pos - 1] = 0; + *value = dmstrdup(buf); return 0; } @@ -1751,17 +1764,29 @@ static int set_QoSQueueStats_Queue(char *refparam, struct dmctx *ctx, void *data static int get_QoSQueueStats_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { char *linker = NULL; + char buf[4096] = {0}; + int pos = 0; dmuci_get_value_by_section_string((struct uci_section *)data, "interface", &linker); + if (DM_STRLEN(linker) == 0) + return 0; bbf_get_reference_param("Device.Ethernet.Interface.", "Name", linker, value); + if (DM_STRLEN(*value)) + pos += snprintf(&buf[pos], sizeof(buf) - pos, "%s,", *value); + + bbf_get_reference_param("Device.IP.Interface.", "Name", linker, value); + if (DM_STRLEN(*value)) + pos += snprintf(&buf[pos], sizeof(buf) - pos, "%s,", *value); - if (!DM_STRLEN(*value)) - bbf_get_reference_param("Device.IP.Interface.", "Name", linker, value); + bbf_get_reference_param("Device.PPP.Interface.", "Name", linker, value); + if (DM_STRLEN(*value)) + pos += snprintf(&buf[pos], sizeof(buf) - pos, "%s,", *value); - if (!DM_STRLEN(*value)) - bbf_get_reference_param("Device.PPP.Interface.", "Name", linker, value); + if (pos) + buf[pos - 1] = 0; + *value = dmstrdup(buf); return 0; }