From: Miroslav Lichvar Date: Mon, 4 Aug 2014 15:21:15 +0000 (+0200) Subject: ntp: allow binding to address that doesn't exist yet X-Git-Tag: 1.31-pre1~39 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=97b15cb3aebee753541bfcae23986f1cd535fe4a;p=thirdparty%2Fchrony.git ntp: allow binding to address that doesn't exist yet --- diff --git a/ntp_io.c b/ntp_io.c index 144e6da0..a0a670ec 100644 --- a/ntp_io.c +++ b/ntp_io.c @@ -190,6 +190,14 @@ prepare_socket(int family, int port_number, int client_only) } #endif +#ifdef IP_FREEBIND + /* Allow binding to address that doesn't exist yet */ + if (my_addr_len > 0 && + setsockopt(sock_fd, IPPROTO_IP, IP_FREEBIND, (char *)&on_off, sizeof(on_off)) < 0) { + LOG(LOGS_ERR, LOGF_NtpIO, "Could not set free bind socket option"); + } +#endif + if (family == AF_INET) { #ifdef IP_PKTINFO /* We want the local IP info on server sockets */