From: Ruben Kerkhof Date: Tue, 2 Aug 2016 13:17:11 +0000 (+0200) Subject: treewide: stop checking for AI_ADDRCONFIG X-Git-Tag: collectd-5.6.0~127^2~4 X-Git-Url: https://git.octo.it/?a=commitdiff_plain;ds=sidebyside;h=c5960550f1b05c46cc7859270a0ed819a8b5fd40;p=collectd.git treewide: stop checking for AI_ADDRCONFIG It has been in RFC 3494 since 2003 and all the platforms we care about have it. --- diff --git a/src/gmond.c b/src/gmond.c index 47158c97..b6971b1a 100644 --- a/src/gmond.c +++ b/src/gmond.c @@ -224,12 +224,10 @@ static int create_sockets (socket_entry_t **ret_sockets, /* {{{ */ if (*ret_sockets != NULL) return (EINVAL); + ai_hints.ai_flags = AI_ADDRCONFIG; #ifdef AI_PASSIVE ai_hints.ai_flags |= AI_PASSIVE; #endif -#ifdef AI_ADDRCONFIG - ai_hints.ai_flags |= AI_ADDRCONFIG; -#endif ai_hints.ai_family = AF_UNSPEC; ai_hints.ai_socktype = SOCK_DGRAM; ai_hints.ai_protocol = IPPROTO_UDP; diff --git a/src/hddtemp.c b/src/hddtemp.c index c32aa358..bda41a19 100644 --- a/src/hddtemp.c +++ b/src/hddtemp.c @@ -92,9 +92,7 @@ static int hddtemp_query_daemon (char *buffer, int buffer_size) struct addrinfo *ai_list, *ai_ptr; int ai_return; -#ifdef AI_ADDRCONFIG - ai_hints.ai_flags |= AI_ADDRCONFIG; -#endif + ai_hints.ai_flags = AI_ADDRCONFIG; ai_hints.ai_family = PF_UNSPEC; ai_hints.ai_socktype = SOCK_STREAM; ai_hints.ai_protocol = IPPROTO_TCP; diff --git a/src/libcollectdclient/client.c b/src/libcollectdclient/client.c index f5eda6d2..58c4e671 100644 --- a/src/libcollectdclient/client.c +++ b/src/libcollectdclient/client.c @@ -437,9 +437,7 @@ static int lcc_open_netsocket (lcc_connection_t *c, /* {{{ */ addr_copy[sizeof(addr_copy) - 1] = '\0'; addr = addr_copy; -#ifdef AI_ADDRCONFIG - ai_hints.ai_flags |= AI_ADDRCONFIG; -#endif + ai_hints.ai_flags = AI_ADDRCONFIG; ai_hints.ai_family = AF_UNSPEC; ai_hints.ai_socktype = SOCK_STREAM; diff --git a/src/libcollectdclient/network.c b/src/libcollectdclient/network.c index 8e6bab86..fdca6e45 100644 --- a/src/libcollectdclient/network.c +++ b/src/libcollectdclient/network.c @@ -130,9 +130,7 @@ static int server_open_socket (lcc_server_t *srv) /* {{{ */ if (srv->fd >= 0) server_close_socket (srv); -#ifdef AI_ADDRCONFIG - ai_hints.ai_flags |= AI_ADDRCONFIG; -#endif + ai_hints.ai_flags = AI_ADDRCONFIG; ai_hints.ai_family = AF_UNSPEC; ai_hints.ai_socktype = SOCK_DGRAM; diff --git a/src/mbmon.c b/src/mbmon.c index ccececd7..bec6bdf2 100644 --- a/src/mbmon.c +++ b/src/mbmon.c @@ -88,9 +88,7 @@ static int mbmon_query_daemon (char *buffer, int buffer_size) struct addrinfo *ai_list, *ai_ptr; int ai_return; -#ifdef AI_ADDRCONFIG - ai_hints.ai_flags |= AI_ADDRCONFIG; -#endif + ai_hints.ai_flags = AI_ADDRCONFIG; ai_hints.ai_family = PF_UNSPEC; ai_hints.ai_socktype = SOCK_STREAM; ai_hints.ai_protocol = IPPROTO_TCP; diff --git a/src/memcached.c b/src/memcached.c index faff5793..17a77609 100644 --- a/src/memcached.c +++ b/src/memcached.c @@ -106,9 +106,7 @@ static int memcached_connect_inet (memcached_t *st) int status; int fd = -1; -#ifdef AI_ADDRCONFIG - ai_hints.ai_flags |= AI_ADDRCONFIG; -#endif + ai_hints.ai_flags = AI_ADDRCONFIG; ai_hints.ai_family = AF_UNSPEC; ai_hints.ai_socktype = SOCK_STREAM; ai_hints.ai_protocol = 0; diff --git a/src/modbus.c b/src/modbus.c index 809194b4..c58cb398 100644 --- a/src/modbus.c +++ b/src/modbus.c @@ -824,9 +824,7 @@ static int mb_config_set_host_address (mb_host_t *host, /* {{{ */ if ((host == NULL) || (address == NULL)) return (EINVAL); -#if AI_ADDRCONFIG - ai_hints.ai_flags |= AI_ADDRCONFIG; -#endif + ai_hints.ai_flags = AI_ADDRCONFIG; /* XXX: libmodbus can only handle IPv4 addresses. */ ai_hints.ai_family = AF_INET; ai_hints.ai_addr = NULL; diff --git a/src/network.c b/src/network.c index 5a8a88ef..4f13aa4a 100644 --- a/src/network.c +++ b/src/network.c @@ -2160,9 +2160,7 @@ static int sockent_client_connect (sockent_t *se) /* {{{ */ if (client->fd >= 0 && !reconnect) /* already connected and not stale*/ return (0); -#ifdef AI_ADDRCONFIG - ai_hints.ai_flags |= AI_ADDRCONFIG; -#endif + ai_hints.ai_flags = AI_ADDRCONFIG; ai_hints.ai_family = AF_UNSPEC; ai_hints.ai_socktype = SOCK_DGRAM; ai_hints.ai_protocol = IPPROTO_UDP; @@ -2258,11 +2256,9 @@ static int sockent_server_listen (sockent_t *se) /* {{{ */ DEBUG ("network plugin: sockent_server_listen: node = %s; service = %s;", node, service); + ai_hints.ai_flags = AI_ADDRCONFIG; #ifdef AI_PASSIVE - ai_hints.ai_flags |= AI_PASSIVE; -#endif -#ifdef AI_ADDRCONFIG - ai_hints.ai_flags |= AI_ADDRCONFIG; + ai_hints.ai_flags |= AI_PASSIVE; #endif ai_hints.ai_family = AF_UNSPEC; ai_hints.ai_socktype = SOCK_DGRAM; diff --git a/src/ntpd.c b/src/ntpd.c index f7b57ba3..f36c5005 100644 --- a/src/ntpd.c +++ b/src/ntpd.c @@ -364,9 +364,7 @@ static int ntpd_connect (void) if (strlen (port) == 0) port = NTPD_DEFAULT_PORT; -#ifdef AI_ADDRCONFIG - ai_hints.ai_flags |= AI_ADDRCONFIG; -#endif + ai_hints.ai_flags = AI_ADDRCONFIG; ai_hints.ai_family = PF_UNSPEC; ai_hints.ai_socktype = SOCK_DGRAM; ai_hints.ai_protocol = IPPROTO_UDP; diff --git a/src/olsrd.c b/src/olsrd.c index 2b7e767e..2a4bf03b 100644 --- a/src/olsrd.c +++ b/src/olsrd.c @@ -155,9 +155,7 @@ static FILE *olsrd_connect (void) /* {{{ */ FILE *fh; -#ifdef AI_ADDRCONFIG - ai_hints.ai_flags |= AI_ADDRCONFIG; -#endif + ai_hints.ai_flags = AI_ADDRCONFIG; ai_hints.ai_family = PF_UNSPEC; ai_hints.ai_socktype = SOCK_STREAM; ai_hints.ai_protocol = IPPROTO_TCP; diff --git a/src/statsd.c b/src/statsd.c index 1eb8cb94..5df072d3 100644 --- a/src/statsd.c +++ b/src/statsd.c @@ -509,10 +509,7 @@ static int statsd_network_init (struct pollfd **ret_fds, /* {{{ */ char const *service = (conf_service != NULL) ? conf_service : STATSD_DEFAULT_SERVICE; - ai_hints.ai_flags = AI_PASSIVE; -#ifdef AI_ADDRCONFIG - ai_hints.ai_flags |= AI_ADDRCONFIG; -#endif + ai_hints.ai_flags = AI_PASSIVE | AI_ADDRCONFIG; ai_hints.ai_family = AF_UNSPEC; ai_hints.ai_socktype = SOCK_DGRAM; diff --git a/src/teamspeak2.c b/src/teamspeak2.c index cf093c5f..89578f0e 100644 --- a/src/teamspeak2.c +++ b/src/teamspeak2.c @@ -216,9 +216,7 @@ static int tss2_get_socket (FILE **ret_read_fh, FILE **ret_write_fh) } /* Get all addrs for this hostname */ -#ifdef AI_ADDRCONFIG - ai_hints.ai_flags |= AI_ADDRCONFIG; -#endif + ai_hints.ai_flags = AI_ADDRCONFIG; ai_hints.ai_family = AF_UNSPEC; ai_hints.ai_socktype = SOCK_STREAM; diff --git a/src/write_graphite.c b/src/write_graphite.c index 25c7a637..a22a2365 100644 --- a/src/write_graphite.c +++ b/src/write_graphite.c @@ -211,9 +211,7 @@ static int wg_callback_init (struct wg_callback *cb) return (EAGAIN); cb->last_connect_time = now; -#ifdef AI_ADDRCONFIG - ai_hints.ai_flags |= AI_ADDRCONFIG; -#endif + ai_hints.ai_flags = AI_ADDRCONFIG; ai_hints.ai_family = AF_UNSPEC; if (0 == strcasecmp ("tcp", cb->protocol)) diff --git a/src/write_sensu.c b/src/write_sensu.c index d37792b4..99fca173 100644 --- a/src/write_sensu.c +++ b/src/write_sensu.c @@ -115,9 +115,7 @@ static int sensu_connect(struct sensu_host *host) /* {{{ */ host->res = NULL; hints.ai_family = AF_INET; hints.ai_socktype = SOCK_STREAM; -#ifdef AI_ADDRCONFIG - hints.ai_flags |= AI_ADDRCONFIG; -#endif + hints.ai_flags = AI_ADDRCONFIG; node = (host->node != NULL) ? host->node : SENSU_HOST; service = (host->service != NULL) ? host->service : SENSU_PORT; diff --git a/src/write_tsdb.c b/src/write_tsdb.c index a044b681..7a8f851f 100644 --- a/src/write_tsdb.c +++ b/src/write_tsdb.c @@ -166,9 +166,7 @@ static int wt_callback_init(struct wt_callback *cb) if (cb->sock_fd > 0) return 0; -#ifdef AI_ADDRCONFIG - ai_hints.ai_flags |= AI_ADDRCONFIG; -#endif + ai_hints.ai_flags = AI_ADDRCONFIG; ai_hints.ai_family = AF_UNSPEC; ai_hints.ai_socktype = SOCK_STREAM;