]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
ntp: set local address on PTP socket on FreeBSD
authorMiroslav Lichvar <mlichvar@redhat.com>
Thu, 16 Dec 2021 12:08:19 +0000 (13:08 +0100)
committerMiroslav Lichvar <mlichvar@redhat.com>
Thu, 16 Dec 2021 12:17:42 +0000 (13:17 +0100)
Fix the FreeBSD-specific code checking for a bound IPv4 socket to
include the new PTP port. This should fix a multihomed server to respond
to NTP-over-PTP requests from the address which received the request.

Fixes: be3158c4e5b2 ("ntp: add support for NTP over PTP")
ntp_io.c

index b9d5f13ad4644dacba783964958f31a22c0372eb..e4eb379831308c8b3bf0b584760afed341256492 100644 (file)
--- a/ntp_io.c
+++ b/ntp_io.c
@@ -594,7 +594,7 @@ NIO_SendPacket(NTP_Packet *packet, NTP_Remote_Address *remote_addr,
 #if !defined(HAVE_IN_PKTINFO) && defined(IP_SENDSRCADDR)
   /* On FreeBSD a local IPv4 address cannot be specified on bound socket */
   if (message.local_addr.ip.family == IPADDR_INET4 &&
-      (local_addr->sock_fd != server_sock_fd4 || bound_server_sock_fd4))
+      (bound_server_sock_fd4 || !NIO_IsServerSocket(local_addr->sock_fd)))
     message.local_addr.ip.family = IPADDR_UNSPEC;
 #endif