mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 18:35:06 -05:00
ntp: use NTP instead of echo for presend
Switch to NTP for presend as the echo service (RFC 862) is rarely enabled. When presend is active, send an NTP client packet to the server/peer and ignore the reply. This also fixes presend with separate client sockets. The destination port can't be changed on connected sockets, so the echo packet was sent to the NTP port instead of the echo port.
This commit is contained in:
17
ntp_io.c
17
ntp_io.c
@@ -687,20 +687,3 @@ NIO_SendAuthenticatedPacket(NTP_Packet *packet, NTP_Remote_Address *remote_addr,
|
||||
{
|
||||
send_packet((void *) packet, NTP_NORMAL_PACKET_SIZE + auth_len, remote_addr, local_addr);
|
||||
}
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
/* We ought to use getservbyname, but I can't really see this changing */
|
||||
#define ECHO_PORT 7
|
||||
|
||||
void
|
||||
NIO_SendEcho(NTP_Remote_Address *remote_addr, NTP_Local_Address *local_addr)
|
||||
{
|
||||
unsigned long magic_message = 0xbe7ab1e7UL;
|
||||
NTP_Remote_Address addr;
|
||||
|
||||
addr = *remote_addr;
|
||||
addr.port = ECHO_PORT;
|
||||
|
||||
send_packet((void *) &magic_message, sizeof(unsigned long), &addr, local_addr);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user