From 97b15cb3aebee753541bfcae23986f1cd535fe4a Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Mon, 4 Aug 2014 17:21:15 +0200 Subject: [PATCH] ntp: allow binding to address that doesn't exist yet --- ntp_io.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ntp_io.c b/ntp_io.c index 144e6da..a0a670e 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 */