char ovs_db_node[OVS_DB_ADDR_NODE_SIZE]; /* OVS DB node */
char ovs_db_serv[OVS_DB_ADDR_SERVICE_SIZE]; /* OVS DB service */
char ovs_db_unix[OVS_DB_ADDR_UNIX_SIZE]; /* OVS DB unix socket path */
char ovs_db_node[OVS_DB_ADDR_NODE_SIZE]; /* OVS DB node */
char ovs_db_serv[OVS_DB_ADDR_SERVICE_SIZE]; /* OVS DB service */
char ovs_db_unix[OVS_DB_ADDR_UNIX_SIZE]; /* OVS DB unix socket path */
ovs_db_t *ovs_db; /* pointer to OVS DB instance */
ovs_events_config_t config; /* plugin config */
char *ovs_db_select_params; /* OVS DB select parameter request */
ovs_db_t *ovs_db; /* pointer to OVS DB instance */
ovs_events_config_t config; /* plugin config */
char *ovs_db_select_params; /* OVS DB select parameter request */
*/
static ovs_events_ctx_t ovs_events_ctx = {
.mutex = PTHREAD_MUTEX_INITIALIZER,
*/
static ovs_events_ctx_t ovs_events_ctx = {
.mutex = PTHREAD_MUTEX_INITIALIZER,
.ovs_db_node = "localhost", /* use default OVS DB node */
.ovs_db_serv = "6640"} /* use default OVS DB service */
};
.ovs_db_node = "localhost", /* use default OVS DB node */
.ovs_db_serv = "6640"} /* use default OVS DB service */
};
* in allocated memory. Returns negative value in case of error.
*/
static int ovs_events_plugin_config(oconfig_item_t *ci) {
* in allocated memory. Returns negative value in case of error.
*/
static int ovs_events_plugin_config(oconfig_item_t *ci) {
for (int i = 0; i < ci->children_num; i++) {
oconfig_item_t *child = ci->children + i;
if (strcasecmp("SendNotification", child->key) == 0) {
for (int i = 0; i < ci->children_num; i++) {
oconfig_item_t *child = ci->children + i;
if (strcasecmp("SendNotification", child->key) == 0) {
- strncpy(ovs_events_ctx.config.ovs_db_serv, service,
- sizeof(ovs_events_ctx.config.ovs_db_serv));
+ sstrncpy(ovs_events_ctx.config.ovs_db_serv, service,
+ sizeof(ovs_events_ctx.config.ovs_db_serv));
sfree(service);
} else if (strcasecmp("Socket", child->key) == 0) {
if (cf_util_get_string_buffer(
sfree(service);
} else if (strcasecmp("Socket", child->key) == 0) {
if (cf_util_get_string_buffer(
/* try to find external_ids, name and link_state fields */
jexternal_ids = ovs_utils_get_value_by_key(jobject, "external_ids");
if (jexternal_ids == NULL || ifinfo == NULL)
return -1;
/* try to find external_ids, name and link_state fields */
jexternal_ids = ovs_utils_get_value_by_key(jobject, "external_ids");
if (jexternal_ids == NULL || ifinfo == NULL)
return -1;
/* get iface-id from external_ids field */
jvalue = ovs_utils_get_map_value(jexternal_ids, "iface-id");
if (jvalue != NULL && YAJL_IS_STRING(jvalue))
/* get iface-id from external_ids field */
jvalue = ovs_utils_get_map_value(jexternal_ids, "iface-id");
if (jvalue != NULL && YAJL_IS_STRING(jvalue))
if (ovs_events_ctx.config.send_notification)
ovs_events_dispatch_terminate_notification(msg);
WARNING(OVS_EVENTS_PLUGIN ": %s", msg);
if (ovs_events_ctx.config.send_notification)
ovs_events_dispatch_terminate_notification(msg);
WARNING(OVS_EVENTS_PLUGIN ": %s", msg);
}
/* Read OVS DB interface link status callback */
static int ovs_events_plugin_read(__attribute__((unused)) user_data_t *u) {
}
/* Read OVS DB interface link status callback */
static int ovs_events_plugin_read(__attribute__((unused)) user_data_t *u) {
OVS_EVENTS_CTX_LOCK { is_connected = ovs_events_ctx.is_db_available; }
if (is_connected)
if (ovs_db_send_request(ovs_events_ctx.ovs_db, "transact",
OVS_EVENTS_CTX_LOCK { is_connected = ovs_events_ctx.is_db_available; }
if (is_connected)
if (ovs_db_send_request(ovs_events_ctx.ovs_db, "transact",