In order to avoid this problem, the @code{presend} option may be used.
It takes a single integer argument, which is the smallest polling
-interval for which a pair of packets will be exchanged between the
-client and the server prior to the actual measurement being initiated by
-the client. For example, with the following option included in a
+interval for which an extra pair of NTP packets will be exchanged
+between the client and the server prior to the actual measurement.
+For example, with the following option included in a
@code{server} directive :
@example
presend 9
@end example
-when the polling interval is 512 seconds or more, a UDP echo datagram
-will be sent to the server a short time (currently 4 seconds) before the
-NTP client mode datagram.
+when the polling interval is 512 seconds or more, an extra NTP client
+packet will be sent to the server a short time (currently 4 seconds)
+before making the actual measurement.
@item key
The NTP protocol supports the inclusion of checksums in the packets, to
received packets) */
int presend_minpoll; /* If the current polling interval is
- at least this, an echo datagram
- will be send some time before every
+ at least this, an extra client packet
+ will be send some time before normal
transmit. This ensures that both
us and the server/peer have an ARP
entry for each other ready, which
#define IBURST_GOOD_SAMPLES 4
#define IBURST_TOTAL_SAMPLES SOURCE_REACH_BITS
-/* Time to wait after sending echo to 'warm up' link */
+/* Time to wait after sending packet to 'warm up' link */
#define WARM_UP_DELAY 4.0
/* The NTP protocol version that we support */
}
/* Check whether we need to 'warm up' the link to the other end by
- sending an echo exchange to ensure both ends' ARP caches are
+ sending an NTP exchange to ensure both ends' ARP caches are
primed. On loaded systems this might also help ensure that bits
of the program are paged in properly before we start. */
(inst->presend_minpoll <= inst->local_poll) &&
!inst->presend_done) {
- /* Send */
- NIO_SendEcho(&inst->remote_addr, &inst->local_addr);
+ /* Send a client packet, don't store the local tx values
+ as the reply will be ignored */
+ transmit_packet(MODE_CLIENT, inst->local_poll, NTP_VERSION, 0, 0,
+ &inst->remote_orig, &inst->local_rx, NULL, NULL,
+ &inst->remote_addr, &inst->local_addr);
inst->presend_done = 1;
break;
case MODE_SERVER:
+ /* Ignore presend reply */
+ if (inst->presend_done)
+ break;
switch(inst->mode) {
case MODE_ACTIVE:
{
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);
-}
/* Function to transmit an authenticated packet */
extern void NIO_SendAuthenticatedPacket(NTP_Packet *packet, NTP_Remote_Address *remote_addr, NTP_Local_Address *local_addr, int auth_len);
-/* Function to send a datagram to a remote machine's UDP echo port. */
-extern void NIO_SendEcho(NTP_Remote_Address *remote_addr, NTP_Local_Address *local_addr);
-
#endif /* GOT_NTP_IO_H */