mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-05 10:15:06 -05:00
ntp: don't create server sockets if port is configured to 0
This commit is contained in:
4
ntp_io.c
4
ntp_io.c
@@ -313,6 +313,7 @@ NIO_Initialise(int family)
|
||||
#endif
|
||||
|
||||
if (family == IPADDR_UNSPEC || family == IPADDR_INET4) {
|
||||
if (server_port)
|
||||
server_sock_fd4 = prepare_socket(AF_INET, server_port);
|
||||
if (!separate_client_sockets) {
|
||||
if (client_port != server_port || !server_port)
|
||||
@@ -323,6 +324,7 @@ NIO_Initialise(int family)
|
||||
}
|
||||
#ifdef HAVE_IPV6
|
||||
if (family == IPADDR_UNSPEC || family == IPADDR_INET6) {
|
||||
if (server_port)
|
||||
server_sock_fd6 = prepare_socket(AF_INET6, server_port);
|
||||
if (!separate_client_sockets) {
|
||||
if (client_port != server_port || !server_port)
|
||||
@@ -333,7 +335,7 @@ NIO_Initialise(int family)
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((server_sock_fd4 == INVALID_SOCK_FD
|
||||
if ((server_port && server_sock_fd4 == INVALID_SOCK_FD
|
||||
#ifdef HAVE_IPV6
|
||||
&& server_sock_fd6 == INVALID_SOCK_FD
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user