+static interface_list_t *add_interface(const char *interface, int status,
+ int prev_status) {
+ interface_list_t *il;
+ char *interface2;
+
+ il = malloc(sizeof(*il));
+ if (il == NULL) {
+ char errbuf[1024];
+ ERROR("connectivity plugin: malloc failed during add_interface: %s",
+ sstrerror(errno, errbuf, sizeof(errbuf)));
+ return NULL;
+ }
+
+ interface2 = strdup(interface);
+ if (interface2 == NULL) {
+ char errbuf[1024];
+ sfree(il);
+ ERROR("connectivity plugin: strdup failed during add_interface: %s",
+ sstrerror(errno, errbuf, sizeof(errbuf)));
+ return NULL;
+ }
+
+ il->interface = interface2;
+ il->status = status;
+ il->prev_status = prev_status;
+ il->timestamp = (long long unsigned int)CDTIME_T_TO_US(cdtime());
+ il->sent = 0;
+ il->next = interface_list_head;
+ interface_list_head = il;
+
+ DEBUG("connectivity plugin: added interface %s", interface2);
+
+ return il;
+}
+