mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 16:35:06 -05:00
ntp: allow online/offline state to be selected by connectability
Allow SRC_MAYBE_ONLINE to be specified for new NTP sources and connectivity setting to select between SRC_ONLINE and SRC_OFFLINE according to the result of the connect() system call, i.e. check whether the client has a route to send its requests.
This commit is contained in:
17
ntp_io.c
17
ntp_io.c
@@ -574,6 +574,23 @@ NIO_IsServerSocket(int sock_fd)
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
int
|
||||
NIO_IsServerConnectable(NTP_Remote_Address *remote_addr)
|
||||
{
|
||||
int sock_fd, r;
|
||||
|
||||
sock_fd = prepare_separate_client_socket(remote_addr->ip_addr.family);
|
||||
if (sock_fd == INVALID_SOCK_FD)
|
||||
return 0;
|
||||
|
||||
r = connect_socket(sock_fd, remote_addr);
|
||||
close_socket(sock_fd);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
static void
|
||||
process_message(struct msghdr *hdr, int length, int sock_fd)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user