]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
cmdmon: allow binding to address that doesn't exist yet
authorMiroslav Lichvar <mlichvar@redhat.com>
Mon, 4 Aug 2014 15:21:26 +0000 (17:21 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Fri, 15 Aug 2014 08:58:44 +0000 (10:58 +0200)
cmdmon.c

index bde2a6f8886de1aba85f3a8d55347f7248209b58..37f0d3d38302fa11f821c368008ea298c05d89fc 100644 (file)
--- 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