2 * collectd - src/connectivity.c
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
24 * Andrew Bays <abays at redhat.com>
25 * Aneesh Puttur <aputtur at redhat.com>
32 #include "utils_complain.h"
34 #include <asm/types.h>
37 #include <netinet/in.h>
41 #include <sys/socket.h>
44 #include <libmnl/libmnl.h>
45 #include <linux/netlink.h>
46 #include <linux/rtnetlink.h>
48 #include <yajl/yajl_common.h>
49 #include <yajl/yajl_gen.h>
50 #if HAVE_YAJL_YAJL_VERSION_H
51 #include <yajl/yajl_version.h>
53 #if defined(YAJL_MAJOR) && (YAJL_MAJOR > 1)
54 #define HAVE_YAJL_V2 1
57 #define MYPROTO NETLINK_ROUTE
59 #define LINK_STATE_DOWN 0
60 #define LINK_STATE_UP 1
61 #define LINK_STATE_UNKNOWN 2
63 #define CONNECTIVITY_DOMAIN_FIELD "domain"
64 #define CONNECTIVITY_DOMAIN_VALUE "stateChange"
65 #define CONNECTIVITY_EVENT_ID_FIELD "eventId"
66 #define CONNECTIVITY_EVENT_NAME_FIELD "eventName"
67 #define CONNECTIVITY_EVENT_NAME_DOWN_VALUE "down"
68 #define CONNECTIVITY_EVENT_NAME_UP_VALUE "up"
69 #define CONNECTIVITY_LAST_EPOCH_MICROSEC_FIELD "lastEpochMicrosec"
70 #define CONNECTIVITY_PRIORITY_FIELD "priority"
71 #define CONNECTIVITY_PRIORITY_VALUE "high"
72 #define CONNECTIVITY_REPORTING_ENTITY_NAME_FIELD "reportingEntityName"
73 #define CONNECTIVITY_REPORTING_ENTITY_NAME_VALUE "collectd connectivity plugin"
74 #define CONNECTIVITY_SEQUENCE_FIELD "sequence"
75 #define CONNECTIVITY_SEQUENCE_VALUE "0"
76 #define CONNECTIVITY_SOURCE_NAME_FIELD "sourceName"
77 #define CONNECTIVITY_START_EPOCH_MICROSEC_FIELD "startEpochMicrosec"
78 #define CONNECTIVITY_VERSION_FIELD "version"
79 #define CONNECTIVITY_VERSION_VALUE "1.0"
81 #define CONNECTIVITY_NEW_STATE_FIELD "newState"
82 #define CONNECTIVITY_NEW_STATE_FIELD_DOWN_VALUE "outOfService"
83 #define CONNECTIVITY_NEW_STATE_FIELD_UP_VALUE "inService"
84 #define CONNECTIVITY_OLD_STATE_FIELD "oldState"
85 #define CONNECTIVITY_OLD_STATE_FIELD_DOWN_VALUE "outOfService"
86 #define CONNECTIVITY_OLD_STATE_FIELD_UP_VALUE "inService"
87 #define CONNECTIVITY_STATE_CHANGE_FIELDS_FIELD "stateChangeFields"
88 #define CONNECTIVITY_STATE_CHANGE_FIELDS_VERSION_FIELD \
89 "stateChangeFieldsVersion"
90 #define CONNECTIVITY_STATE_CHANGE_FIELDS_VERSION_VALUE "1.0"
91 #define CONNECTIVITY_STATE_INTERFACE_FIELD "stateInterface"
96 struct interface_list_s {
100 uint32_t prev_status;
102 long long unsigned int timestamp;
104 struct interface_list_s *next;
106 typedef struct interface_list_s interface_list_t;
111 static interface_list_t *interface_list_head = NULL;
112 static int monitor_all_interfaces = 0;
114 static int connectivity_thread_loop = 0;
115 static int connectivity_thread_error = 0;
116 static pthread_t connectivity_thread_id;
117 static pthread_mutex_t connectivity_lock = PTHREAD_MUTEX_INITIALIZER;
118 static pthread_cond_t connectivity_cond = PTHREAD_COND_INITIALIZER;
119 static struct mnl_socket *sock;
120 static int event_id = 0;
122 static const char *config_keys[] = {"Interface"};
123 static int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
129 static int gen_message_payload(int state, int old_state, const char *interface,
130 long long unsigned int timestamp, char **buf) {
131 const unsigned char *buf2;
133 char json_str[DATA_MAX_NAME_LEN];
135 #if !defined(HAVE_YAJL_V2)
136 yajl_gen_config conf = {};
143 g = yajl_gen_alloc(NULL);
144 yajl_gen_config(g, yajl_gen_beautify, 0);
147 g = yajl_gen_alloc(&conf, NULL);
152 // *** BEGIN common event header ***
154 if (yajl_gen_map_open(g) != yajl_gen_status_ok)
158 if (yajl_gen_string(g, (u_char *)CONNECTIVITY_DOMAIN_FIELD,
159 strlen(CONNECTIVITY_DOMAIN_FIELD)) != yajl_gen_status_ok)
162 if (yajl_gen_string(g, (u_char *)CONNECTIVITY_DOMAIN_VALUE,
163 strlen(CONNECTIVITY_DOMAIN_VALUE)) != yajl_gen_status_ok)
167 if (yajl_gen_string(g, (u_char *)CONNECTIVITY_EVENT_ID_FIELD,
168 strlen(CONNECTIVITY_EVENT_ID_FIELD)) !=
172 event_id = event_id + 1;
173 int event_id_len = sizeof(char) * sizeof(int) * 4 + 1;
174 memset(json_str, '\0', DATA_MAX_NAME_LEN);
175 snprintf(json_str, event_id_len, "%d", event_id);
177 if (yajl_gen_number(g, json_str, strlen(json_str)) != yajl_gen_status_ok) {
182 if (yajl_gen_string(g, (u_char *)CONNECTIVITY_EVENT_NAME_FIELD,
183 strlen(CONNECTIVITY_EVENT_NAME_FIELD)) !=
187 int event_name_len = 0;
188 event_name_len = event_name_len + strlen(interface); // interface name
189 event_name_len = event_name_len + (state == 0 ? 4 : 2); // "down" or "up"
191 event_name_len + 12; // "interface", 2 spaces and null-terminator
192 memset(json_str, '\0', DATA_MAX_NAME_LEN);
193 snprintf(json_str, event_name_len, "interface %s %s", interface,
194 (state == 0 ? CONNECTIVITY_EVENT_NAME_DOWN_VALUE
195 : CONNECTIVITY_EVENT_NAME_UP_VALUE));
197 if (yajl_gen_string(g, (u_char *)json_str, strlen(json_str)) !=
198 yajl_gen_status_ok) {
203 if (yajl_gen_string(g, (u_char *)CONNECTIVITY_LAST_EPOCH_MICROSEC_FIELD,
204 strlen(CONNECTIVITY_LAST_EPOCH_MICROSEC_FIELD)) !=
208 int last_epoch_microsec_len =
209 sizeof(char) * sizeof(long long unsigned int) * 4 + 1;
210 memset(json_str, '\0', DATA_MAX_NAME_LEN);
211 snprintf(json_str, last_epoch_microsec_len, "%llu",
212 (long long unsigned int)CDTIME_T_TO_US(cdtime()));
214 if (yajl_gen_number(g, json_str, strlen(json_str)) != yajl_gen_status_ok) {
219 if (yajl_gen_string(g, (u_char *)CONNECTIVITY_PRIORITY_FIELD,
220 strlen(CONNECTIVITY_PRIORITY_FIELD)) !=
224 if (yajl_gen_string(g, (u_char *)CONNECTIVITY_PRIORITY_VALUE,
225 strlen(CONNECTIVITY_PRIORITY_VALUE)) !=
229 // reportingEntityName
230 if (yajl_gen_string(g, (u_char *)CONNECTIVITY_REPORTING_ENTITY_NAME_FIELD,
231 strlen(CONNECTIVITY_REPORTING_ENTITY_NAME_FIELD)) !=
235 if (yajl_gen_string(g, (u_char *)CONNECTIVITY_REPORTING_ENTITY_NAME_VALUE,
236 strlen(CONNECTIVITY_REPORTING_ENTITY_NAME_VALUE)) !=
241 if (yajl_gen_string(g, (u_char *)CONNECTIVITY_SEQUENCE_FIELD,
242 strlen(CONNECTIVITY_SEQUENCE_FIELD)) !=
246 if (yajl_gen_number(g, CONNECTIVITY_SEQUENCE_VALUE,
247 strlen(CONNECTIVITY_SEQUENCE_VALUE)) !=
252 if (yajl_gen_string(g, (u_char *)CONNECTIVITY_SOURCE_NAME_FIELD,
253 strlen(CONNECTIVITY_SOURCE_NAME_FIELD)) !=
257 if (yajl_gen_string(g, (u_char *)interface, strlen(interface)) !=
261 // startEpochMicrosec
262 if (yajl_gen_string(g, (u_char *)CONNECTIVITY_START_EPOCH_MICROSEC_FIELD,
263 strlen(CONNECTIVITY_START_EPOCH_MICROSEC_FIELD)) !=
267 int start_epoch_microsec_len =
268 sizeof(char) * sizeof(long long unsigned int) * 4 + 1;
269 memset(json_str, '\0', DATA_MAX_NAME_LEN);
270 snprintf(json_str, start_epoch_microsec_len, "%llu",
271 (long long unsigned int)timestamp);
273 if (yajl_gen_number(g, json_str, strlen(json_str)) != yajl_gen_status_ok) {
278 if (yajl_gen_string(g, (u_char *)CONNECTIVITY_VERSION_FIELD,
279 strlen(CONNECTIVITY_VERSION_FIELD)) != yajl_gen_status_ok)
282 if (yajl_gen_number(g, CONNECTIVITY_VERSION_VALUE,
283 strlen(CONNECTIVITY_VERSION_VALUE)) != yajl_gen_status_ok)
286 // *** END common event header ***
288 // *** BEGIN state change fields ***
290 if (yajl_gen_string(g, (u_char *)CONNECTIVITY_STATE_CHANGE_FIELDS_FIELD,
291 strlen(CONNECTIVITY_STATE_CHANGE_FIELDS_FIELD)) !=
295 if (yajl_gen_map_open(g) != yajl_gen_status_ok)
299 if (yajl_gen_string(g, (u_char *)CONNECTIVITY_NEW_STATE_FIELD,
300 strlen(CONNECTIVITY_NEW_STATE_FIELD)) !=
305 (state == 0 ? strlen(CONNECTIVITY_NEW_STATE_FIELD_DOWN_VALUE)
306 : strlen(CONNECTIVITY_NEW_STATE_FIELD_UP_VALUE));
309 g, (u_char *)(state == 0 ? CONNECTIVITY_NEW_STATE_FIELD_DOWN_VALUE
310 : CONNECTIVITY_NEW_STATE_FIELD_UP_VALUE),
311 new_state_len) != yajl_gen_status_ok)
315 if (yajl_gen_string(g, (u_char *)CONNECTIVITY_OLD_STATE_FIELD,
316 strlen(CONNECTIVITY_OLD_STATE_FIELD)) !=
321 (old_state == 0 ? strlen(CONNECTIVITY_OLD_STATE_FIELD_DOWN_VALUE)
322 : strlen(CONNECTIVITY_OLD_STATE_FIELD_UP_VALUE));
325 g, (u_char *)(old_state == 0 ? CONNECTIVITY_OLD_STATE_FIELD_DOWN_VALUE
326 : CONNECTIVITY_OLD_STATE_FIELD_UP_VALUE),
327 old_state_len) != yajl_gen_status_ok)
330 // stateChangeFieldsVersion
331 if (yajl_gen_string(g,
332 (u_char *)CONNECTIVITY_STATE_CHANGE_FIELDS_VERSION_FIELD,
333 strlen(CONNECTIVITY_STATE_CHANGE_FIELDS_VERSION_FIELD)) !=
337 if (yajl_gen_number(g, CONNECTIVITY_STATE_CHANGE_FIELDS_VERSION_VALUE,
338 strlen(CONNECTIVITY_STATE_CHANGE_FIELDS_VERSION_VALUE)) !=
343 if (yajl_gen_string(g, (u_char *)CONNECTIVITY_STATE_INTERFACE_FIELD,
344 strlen(CONNECTIVITY_STATE_INTERFACE_FIELD)) !=
348 if (yajl_gen_string(g, (u_char *)interface, strlen(interface)) !=
352 if (yajl_gen_map_close(g) != yajl_gen_status_ok)
355 // *** END state change fields ***
357 if (yajl_gen_map_close(g) != yajl_gen_status_ok)
360 if (yajl_gen_get_buf(g, &buf2, &len) != yajl_gen_status_ok)
363 *buf = malloc(strlen((char *)buf2) + 1);
365 sstrncpy(*buf, (char *)buf2, strlen((char *)buf2) + 1);
373 ERROR("connectivity plugin: gen_message_payload failed to generate JSON");
377 static interface_list_t *add_interface(const char *interface, int status,
379 interface_list_t *il;
382 il = malloc(sizeof(*il));
385 ERROR("connectivity plugin: malloc failed during add_interface: %s",
386 sstrerror(errno, errbuf, sizeof(errbuf)));
390 interface2 = strdup(interface);
391 if (interface2 == NULL) {
394 ERROR("connectivity plugin: strdup failed during add_interface: %s",
395 sstrerror(errno, errbuf, sizeof(errbuf)));
399 il->interface = interface2;
401 il->prev_status = prev_status;
402 il->timestamp = (long long unsigned int)CDTIME_T_TO_US(cdtime());
404 il->next = interface_list_head;
405 interface_list_head = il;
407 DEBUG("connectivity plugin: added interface %s", interface2);
412 static int connectivity_link_state(struct nlmsghdr *msg) {
414 struct ifinfomsg *ifi = mnl_nlmsg_get_payload(msg);
416 const char *dev = NULL;
418 pthread_mutex_lock(&connectivity_lock);
420 interface_list_t *il;
422 /* Scan attribute list for device name. */
423 mnl_attr_for_each(attr, msg, sizeof(*ifi)) {
424 if (mnl_attr_get_type(attr) != IFLA_IFNAME)
427 if (mnl_attr_validate(attr, MNL_TYPE_STRING) < 0) {
428 ERROR("connectivity plugin: connectivity_link_state: IFLA_IFNAME "
431 pthread_mutex_unlock(&connectivity_lock);
435 dev = mnl_attr_get_str(attr);
437 for (il = interface_list_head; il != NULL; il = il->next)
438 if (strcmp(dev, il->interface) == 0)
441 if (il == NULL && monitor_all_interfaces == 0) {
442 DEBUG("connectivity plugin: Ignoring link state change for unmonitored "
446 uint32_t prev_status;
449 // We're monitoring all interfaces and we haven't encountered this one
450 // yet, so add it to the linked list
451 il = add_interface(dev, LINK_STATE_UNKNOWN, LINK_STATE_UNKNOWN);
454 ERROR("connectivity plugin: unable to add interface %s during "
455 "connectivity_link_state",
461 prev_status = il->status;
463 ((ifi->ifi_flags & IFF_RUNNING) ? LINK_STATE_UP : LINK_STATE_DOWN);
464 il->timestamp = (long long unsigned int)CDTIME_T_TO_US(cdtime());
466 // If the new status is different than the previous status,
467 // store the previous status and set sent to zero
468 if (il->status != prev_status) {
469 il->prev_status = prev_status;
473 DEBUG("connectivity plugin (%llu): Interface %s status is now %s",
475 ((ifi->ifi_flags & IFF_RUNNING) ? "UP" : "DOWN"));
478 // no need to loop again, we found the interface name attr
479 // (otherwise the first if-statement in the loop would
480 // have moved us on with 'continue')
484 pthread_mutex_unlock(&connectivity_lock);
489 static int msg_handler(struct nlmsghdr *msg) {
490 switch (msg->nlmsg_type) {
496 // Not of interest in current version
499 connectivity_link_state(msg);
502 ERROR("connectivity plugin: msg_handler: Unknown netlink nlmsg_type %d\n",
509 static int read_event(struct mnl_socket *nl,
510 int (*msg_handler)(struct nlmsghdr *)) {
519 status = mnl_socket_recvfrom(nl, buf, sizeof(buf));
522 /* Socket non-blocking so bail out once we have read everything */
523 if (errno == EWOULDBLOCK || errno == EAGAIN)
526 /* Anything else is an error */
527 ERROR("connectivity plugin: read_event: Error mnl_socket_recvfrom: %d\n",
533 DEBUG("connectivity plugin: read_event: EOF\n");
536 /* We need to handle more than one message per 'recvmsg' */
537 for (h = (struct nlmsghdr *)buf; NLMSG_OK(h, (unsigned int)status);
538 h = NLMSG_NEXT(h, status)) {
540 if (h->nlmsg_type == NLMSG_DONE)
543 /* Message is some kind of error */
544 if (h->nlmsg_type == NLMSG_ERROR) {
545 ERROR("connectivity plugin: read_event: Message is an error\n");
549 /* Call message handler */
551 ret = (*msg_handler)(h);
553 ERROR("connectivity plugin: read_event: Message handler error %d\n",
558 ERROR("connectivity plugin: read_event: Error NULL message handler\n");
566 static void *connectivity_thread(void *arg) /* {{{ */
568 pthread_mutex_lock(&connectivity_lock);
570 while (connectivity_thread_loop > 0) {
573 pthread_mutex_unlock(&connectivity_lock);
575 status = read_event(sock, msg_handler);
577 pthread_mutex_lock(&connectivity_lock);
580 connectivity_thread_error = 1;
584 if (connectivity_thread_loop <= 0)
586 } /* while (connectivity_thread_loop > 0) */
588 pthread_mutex_unlock(&connectivity_lock);
591 } /* }}} void *connectivity_thread */
593 static int start_thread(void) /* {{{ */
597 pthread_mutex_lock(&connectivity_lock);
599 if (connectivity_thread_loop != 0) {
600 pthread_mutex_unlock(&connectivity_lock);
604 connectivity_thread_loop = 1;
605 connectivity_thread_error = 0;
608 sock = mnl_socket_open(NETLINK_ROUTE);
611 "connectivity plugin: connectivity_thread: mnl_socket_open failed.");
612 pthread_mutex_unlock(&connectivity_lock);
616 if (mnl_socket_bind(sock, RTMGRP_LINK, MNL_SOCKET_AUTOPID) < 0) {
618 "connectivity plugin: connectivity_thread: mnl_socket_bind failed.");
619 pthread_mutex_unlock(&connectivity_lock);
624 status = plugin_thread_create(&connectivity_thread_id, /* attr = */ NULL,
626 /* arg = */ (void *)0, "connectivity");
628 connectivity_thread_loop = 0;
629 ERROR("connectivity plugin: Starting thread failed.");
630 pthread_mutex_unlock(&connectivity_lock);
631 mnl_socket_close(sock);
635 pthread_mutex_unlock(&connectivity_lock);
637 } /* }}} int start_thread */
639 static int stop_thread(int shutdown) /* {{{ */
644 mnl_socket_close(sock);
646 pthread_mutex_lock(&connectivity_lock);
648 if (connectivity_thread_loop == 0) {
649 pthread_mutex_unlock(&connectivity_lock);
653 connectivity_thread_loop = 0;
654 pthread_cond_broadcast(&connectivity_cond);
655 pthread_mutex_unlock(&connectivity_lock);
658 // Since the thread is blocking, calling pthread_join
659 // doesn't actually succeed in stopping it. It will stick around
660 // until a NETLINK message is received on the socket (at which
661 // it will realize that "connectivity_thread_loop" is 0 and will
662 // break out of the read loop and be allowed to die). This is
663 // fine when the process isn't supposed to be exiting, but in
664 // the case of a process shutdown, we don't want to have an
665 // idle thread hanging around. Calling pthread_cancel here in
666 // the case of a shutdown is just assures that the thread is
667 // gone and that the process has been fully terminated.
669 DEBUG("connectivity plugin: Canceling thread for process shutdown");
671 status = pthread_cancel(connectivity_thread_id);
674 ERROR("connectivity plugin: Unable to cancel thread: %d", status);
678 status = pthread_join(connectivity_thread_id, /* return = */ NULL);
680 ERROR("connectivity plugin: Stopping thread failed.");
685 pthread_mutex_lock(&connectivity_lock);
686 memset(&connectivity_thread_id, 0, sizeof(connectivity_thread_id));
687 connectivity_thread_error = 0;
688 pthread_mutex_unlock(&connectivity_lock);
690 DEBUG("connectivity plugin: Finished requesting stop of thread");
693 } /* }}} int stop_thread */
695 static int connectivity_init(void) /* {{{ */
697 if (interface_list_head == NULL) {
698 NOTICE("connectivity plugin: No interfaces have been selected, so all will "
700 monitor_all_interfaces = 1;
703 return (start_thread());
704 } /* }}} int connectivity_init */
706 static int connectivity_config(const char *key, const char *value) /* {{{ */
708 if (strcasecmp(key, "Interface") == 0) {
709 interface_list_t *il =
710 add_interface(value, LINK_STATE_UNKNOWN, LINK_STATE_UNKNOWN);
712 ERROR("connectivity plugin: unable to add interface %s during "
722 } /* }}} int connectivity_config */
724 static void connectivity_dispatch_notification(
725 const char *interface, const char *type, /* {{{ */
726 gauge_t value, gauge_t old_value, long long unsigned int timestamp) {
729 NOTIF_FAILURE, cdtime(), "", "", "connectivity", "", "", "", NULL};
731 if (value == LINK_STATE_UP)
732 n.severity = NOTIF_OKAY;
735 gethostname(hostname, sizeof(hostname));
737 sstrncpy(n.host, hostname, sizeof(n.host));
738 sstrncpy(n.plugin_instance, interface, sizeof(n.plugin_instance));
739 sstrncpy(n.type, "gauge", sizeof(n.type));
740 sstrncpy(n.type_instance, "interface_status", sizeof(n.type_instance));
742 gen_message_payload(value, old_value, interface, timestamp, &buf);
744 notification_meta_t *m = calloc(1, sizeof(*m));
749 ERROR("connectivity plugin: unable to allocate metadata: %s",
750 sstrerror(errno, errbuf, sizeof(errbuf)));
754 sstrncpy(m->name, "ves", sizeof(m->name));
755 m->nm_value.nm_string = sstrdup(buf);
756 m->type = NM_TYPE_STRING;
759 DEBUG("connectivity plugin: notification message: %s",
760 n.meta->nm_value.nm_string);
762 DEBUG("connectivity plugin: dispatching state %d for interface %s",
763 (int)value, interface);
765 plugin_dispatch_notification(&n);
766 plugin_notification_meta_free(n.meta);
768 // malloc'd in gen_message_payload
773 static int connectivity_read(void) /* {{{ */
775 if (connectivity_thread_error != 0) {
776 ERROR("connectivity plugin: The interface thread had a problem. Restarting "
781 for (interface_list_t *il = interface_list_head; il != NULL;
783 il->status = LINK_STATE_UNKNOWN;
784 il->prev_status = LINK_STATE_UNKNOWN;
791 } /* if (connectivity_thread_error != 0) */
793 for (interface_list_t *il = interface_list_head; il != NULL;
794 il = il->next) /* {{{ */
797 uint32_t prev_status;
800 pthread_mutex_lock(&connectivity_lock);
803 prev_status = il->prev_status;
806 if (status != prev_status && sent == 0) {
807 connectivity_dispatch_notification(il->interface, "gauge", status,
808 prev_status, il->timestamp);
812 pthread_mutex_unlock(&connectivity_lock);
813 } /* }}} for (il = interface_list_head; il != NULL; il = il->next) */
816 } /* }}} int connectivity_read */
818 static int connectivity_shutdown(void) /* {{{ */
820 interface_list_t *il;
822 DEBUG("connectivity plugin: Shutting down thread.");
823 if (stop_thread(1) < 0)
826 il = interface_list_head;
828 interface_list_t *il_next;
832 sfree(il->interface);
839 } /* }}} int connectivity_shutdown */
841 void module_register(void) {
842 plugin_register_config("connectivity", connectivity_config, config_keys,
844 plugin_register_init("connectivity", connectivity_init);
845 plugin_register_read("connectivity", connectivity_read);
846 plugin_register_shutdown("connectivity", connectivity_shutdown);
847 } /* void module_register */