From: trustchk Date: Thu, 2 Nov 2017 10:31:22 +0000 (+0000) Subject: libcollectdclient: fix usage of ip_mreq X-Git-Tag: collectd-5.8.0~16^2 X-Git-Url: https://git.octo.it/?p=collectd.git;a=commitdiff_plain;h=a69d01a277f48652481c161be3feea16e50d72eb libcollectdclient: fix usage of ip_mreq On both IBM AIX and Gentoo Linux, the struct `ip_mreq` does not define the field `imr_address`, plus the compiler throws an error in the assignment of `sa->s_addr`. With `ip_mreqn` present, the fallback path for `ip_mreq` is not used and everything works. But AIX does not know that struct and fails to compile. --- diff --git a/src/libcollectdclient/server.c b/src/libcollectdclient/server.c index d18cc7da..a81afda8 100644 --- a/src/libcollectdclient/server.c +++ b/src/libcollectdclient/server.c @@ -82,7 +82,7 @@ static int server_multicast_join(lcc_listener_t *srv, }; #else struct ip_mreq mreq = { - .imr_address.s_addr = INADDR_ANY, .imr_multiaddr.s_addr = sa->s_addr, + .imr_multiaddr.s_addr = sa->sin_addr.s_addr, }; #endif status = setsockopt(srv->conn, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq,