return NULL;
}
+/* Check if bridge is configured to be monitored in config file */
+static int ovs_stats_is_monitored_bridge(const char *br_name) {
+ /* if no bridges are configured, return true */
+ if (g_monitored_bridge_list_head == NULL)
+ return 1;
+
+ /* check if given bridge exists */
+ if (ovs_stats_get_bridge(g_monitored_bridge_list_head, br_name) != NULL)
+ return 1;
+
+ return 0;
+}
+
+
/* Delete bridge */
static int ovs_stats_del_bridge(yajl_val bridge) {
const char *old[] = {"old", NULL};
if (!br_name || !YAJL_IS_STRING(br_name))
return 0;
+ if (!ovs_stats_is_monitored_bridge(YAJL_GET_STRING(br_name)))
+ return 0;
+
bridge_list_t *br =
ovs_stats_get_bridge(g_bridge_list_head, YAJL_GET_STRING(br_name));
if (br == NULL) {
static int ovs_stats_update_iface_ext_ids(interface_list_t *iface,
yajl_val ext_ids) {
- if (ext_ids && YAJL_IS_ARRAY(ext_ids)) {
- for (size_t i = 0; i < YAJL_GET_ARRAY(ext_ids)->len; i++) {
- yajl_val ext_id = YAJL_GET_ARRAY(ext_ids)->values[i];
- if (!YAJL_IS_ARRAY(ext_id))
- return -1;
+ if (!ext_ids || !YAJL_IS_ARRAY(ext_ids))
+ return 0;
- char *key = YAJL_GET_STRING(YAJL_GET_ARRAY(ext_id)->values[0]);
- char *value = YAJL_GET_STRING(YAJL_GET_ARRAY(ext_id)->values[1]);
- if (key && value) {
- if (strncmp(key, "iface-id", strlen(key)) == 0) {
- sstrncpy(iface->ex_iface_id, value, sizeof(iface->ex_iface_id));
- } else if (strncmp(key, "vm-uuid", strlen(key)) == 0) {
- sstrncpy(iface->ex_vm_id, value, sizeof(iface->ex_vm_id));
- }
+ for (size_t i = 0; i < YAJL_GET_ARRAY(ext_ids)->len; i++) {
+ yajl_val ext_id = YAJL_GET_ARRAY(ext_ids)->values[i];
+ if (!YAJL_IS_ARRAY(ext_id))
+ return -1;
+
+ char *key = YAJL_GET_STRING(YAJL_GET_ARRAY(ext_id)->values[0]);
+ char *value = YAJL_GET_STRING(YAJL_GET_ARRAY(ext_id)->values[1]);
+ if (key && value) {
+ if (strncmp(key, "iface-id", strlen(key)) == 0) {
+ sstrncpy(iface->ex_iface_id, value, sizeof(iface->ex_iface_id));
+ } else if (strncmp(key, "vm-uuid", strlen(key)) == 0) {
+ sstrncpy(iface->ex_vm_id, value, sizeof(iface->ex_vm_id));
}
}
}
OVS_DB_TABLE_CB_FLAG_DELETE);
}
-/* Check if bridge is configured to be monitored in config file */
-static int ovs_stats_is_monitored_bridge(const char *br_name) {
- /* if no bridges are configured, return true */
- if (g_monitored_bridge_list_head == NULL)
- return 1;
-
- /* check if given bridge exists */
- if (ovs_stats_get_bridge(g_monitored_bridge_list_head, br_name) != NULL)
- return 1;
-
- return 0;
-}
-
/* Delete all ports from port list */
static void ovs_stats_free_port_list(port_list_t *head) {
for (port_list_t *i = head; i != NULL;) {
pthread_mutex_lock(&g_stats_lock);
for (bridge = g_bridge_list_head; bridge != NULL; bridge = bridge->next) {
- if (!ovs_stats_is_monitored_bridge(bridge->name))
- continue;
-
for (port = g_port_list_head; port != NULL; port = port->next) {
if (port->br != bridge)
continue;