From: Miroslav Lichvar Date: Mon, 4 Aug 2014 15:21:26 +0000 (+0200) Subject: cmdmon: allow binding to address that doesn't exist yet X-Git-Tag: 1.31-pre1~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=29647c828015df5db9a558351fe65b12f1014cee;p=thirdparty%2Fchrony.git cmdmon: allow binding to address that doesn't exist yet --- diff --git a/cmdmon.c b/cmdmon.c index bde2a6f8..37f0d3d3 100644 --- a/cmdmon.c +++ b/cmdmon.c @@ -199,6 +199,14 @@ prepare_socket(int family, int port_number) LOG(LOGS_ERR, LOGF_CmdMon, "Could not set reuseaddr socket options"); /* Don't quit - we might survive anyway */ } + +#ifdef IP_FREEBIND + /* Allow binding to address that doesn't exist yet */ + if (setsockopt(sock_fd, IPPROTO_IP, IP_FREEBIND, (char *)&on_off, sizeof(on_off)) < 0) { + LOG(LOGS_ERR, LOGF_CmdMon, "Could not set free bind socket option"); + } +#endif + #ifdef HAVE_IPV6 if (family == AF_INET6) { #ifdef IPV6_V6ONLY