]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
ntp: provide remote port to NIO_OpenServerSocket()
authorMiroslav Lichvar <mlichvar@redhat.com>
Mon, 16 Aug 2021 12:51:01 +0000 (14:51 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Mon, 16 Aug 2021 12:53:46 +0000 (14:53 +0200)
This will allow selection of different protocols based on the remote
port. Zero means the default (NTP).

ntp_core.c

index 547002217eb5e5345a19d8340c743cfffeaf6a24..240723cf8fe0fdb3c5959736adffe5b611ced934 100644 (file)
@@ -2504,11 +2504,13 @@ NCR_AddAccessRestriction(IPAddr *ip_addr, int subnet_bits, int allow, int all)
     if (server_sock_fd4 == INVALID_SOCK_FD &&
         ADF_IsAnyAllowed(access_auth_table, IPADDR_INET4)) {
       remote_addr.ip_addr.family = IPADDR_INET4;
+      remote_addr.port = 0;
       server_sock_fd4 = NIO_OpenServerSocket(&remote_addr);
     }
     if (server_sock_fd6 == INVALID_SOCK_FD &&
         ADF_IsAnyAllowed(access_auth_table, IPADDR_INET6)) {
       remote_addr.ip_addr.family = IPADDR_INET6;
+      remote_addr.port = 0;
       server_sock_fd6 = NIO_OpenServerSocket(&remote_addr);
     }
   } else {