X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fnetwork.c;h=cf67c2bd20c5e9bd2b58938eb1565be2476402ad;hb=bc42a61b1f8e518c7decb824dc61e85d4e9f02b8;hp=67a7c3c57b5db7e9059b5769520c34b9dcb8f1e0;hpb=fe9ba13c8866ada19f7a347f3757d4c740613cdb;p=collectd.git diff --git a/src/network.c b/src/network.c index 67a7c3c5..cf67c2bd 100644 --- a/src/network.c +++ b/src/network.c @@ -19,6 +19,8 @@ * Florian octo Forster **/ +#define _BSD_SOURCE /* For struct ip_mreq */ + #include "collectd.h" #include "plugin.h" #include "common.h" @@ -49,6 +51,7 @@ #if HAVE_LIBGCRYPT # include +GCRY_THREAD_OPTION_PTHREAD_IMPL; #endif /* 1500 - 40 - 8 = Ethernet packet - IPv6 header - UDP header */ @@ -2259,9 +2262,6 @@ static void networt_send_buffer_encrypted (sockent_t *se, /* {{{ */ gcry_error_t err; gcry_cipher_hd_t cypher; - DEBUG ("network plugin: networt_send_buffer_encrypted: " - "buffer_size = %zu;", buffer_size); - /* Initialize the header fields */ memset (&pea, 0, sizeof (pea)); pea.head.type = htons (TYPE_ENCR_AES256); @@ -2280,6 +2280,8 @@ static void networt_send_buffer_encrypted (sockent_t *se, /* {{{ */ - sizeof (pea.hash); assert (buffer_size <= sizeof (buffer)); + DEBUG ("network plugin: networt_send_buffer_encrypted: " + "buffer_size = %zu;", buffer_size); pea.head.length = htons ((uint16_t) (PART_ENCRYPTION_AES256_SIZE + username_len + in_buffer_size)); @@ -2767,7 +2769,7 @@ static int network_config_set_cache_flush (const oconfig_item_t *ci) /* {{{ */ tmp = (int) ci->values[0].value.number; if (tmp > 0) - network_config_ttl = tmp; + cache_flush_interval = tmp; return (0); } /* }}} int network_config_set_cache_flush */ @@ -2936,6 +2938,12 @@ static int network_init (void) if (cache_flush_last != 0) return (0); +#if HAVE_LIBGCRYPT + gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread); + gcry_control (GCRYCTL_INIT_SECMEM, 32768, 0); + gcry_control (GCRYCTL_INITIALIZATION_FINISHED, 0); +#endif + plugin_register_shutdown ("network", network_shutdown); network_init_buffer ();