Skip to content
Snippets Groups Projects
Commit a893edc7 authored by Hal Murray's avatar Hal Murray
Browse files

Remove USE_PACKET_TIMESTAMP

It stopped working when ntp_packetstamp.c was split out
of ntp_io.c.  USE_PACKET_TIMESTAMP was defined in ntp_packetstamp.c
but referenced in ntp_io.c.

All modern systems support some form of capturing recv
time stamps via recvmsg.  The current code is using a time
stamp from shortly after the select returns.  We can restore
that action if necessary.  It seems to work OK on lightly
loaded systems.  (Very old code used SIGIO to capture
time stamps.)
parent 0ab49c87
No related branches found
No related tags found
No related merge requests found
......@@ -144,7 +144,6 @@ UNUSED_LOCAL # Used to quiet compiler warnings
UPDATE_GRACE # ntp_io.c only
USE_COMPILETIME_PIVOT # Use build date in disambiguating time.
USE_PACKET_TIMESTAMP # setup and used in ntp_io
USE_SCM_BINTIME # to grab timestamp for recv packet
USE_SCM_TIMESTAMP # "
USE_SCM_TIMESTAMPNS # "
......
......@@ -2040,9 +2040,7 @@ open_socket(
return INVALID_SOCKET;
}
#ifdef USE_PACKET_TIMESTAMP
enable_packetstamps(fd);
#endif /* USE_PACKET_TIMESTAMP */
enable_packetstamps(fd, addr);
DPRINT(4, ("bind(%d) AF_INET%s, addr %s%%%u#%d, flags 0x%x\n",
fd, IS_IPV6(addr) ? "6" : "", socktoa(addr),
......@@ -2192,11 +2190,9 @@ read_network_packet(
socklen_t fromlen;
ssize_t buflen;
register struct recvbuf *rb;
#ifdef USE_PACKET_TIMESTAMP
struct msghdr msghdr;
struct iovec iovec;
char control[CMSG_BUFSIZE];
#endif
char control[100]; /* FIXME: Need space for time stamp plus overhead */
/*
* Get a buffer and read the frame. If we
......@@ -2230,11 +2226,6 @@ read_network_packet(
fromlen = sizeof(rb->recv_srcadr);
#ifndef USE_PACKET_TIMESTAMP
rb->recv_length = (size_t)recvfrom(fd, (char *)&rb->recv_space,
sizeof(rb->recv_space), 0,
&rb->recv_srcadr.sa, &fromlen);
#else
iovec.iov_base = &rb->recv_space;
iovec.iov_len = sizeof(rb->recv_space);
msghdr.msg_name = &rb->recv_srcadr;
......@@ -2245,7 +2236,6 @@ read_network_packet(
msghdr.msg_control = (void *)&control;
msghdr.msg_controllen = sizeof(control);
rb->recv_length = recvmsg(fd, &msghdr, 0);
#endif
buflen = (ssize_t)rb->recv_length;
......@@ -2305,10 +2295,7 @@ read_network_packet(
rb->dstadr = itf;
rb->cast_flags = (uint8_t)(rb->fd == rb->dstadr->bfd ? MDF_BCAST : MDF_UCAST);
rb->fd = fd;
#ifdef USE_PACKET_TIMESTAMP
/* pick up a network time stamp if possible */
ts = fetch_packetstamp(rb, &msghdr, ts);
#endif
rb->recv_time = ts;
rb->receiver = receive;
#ifdef REFCLOCK
......
......@@ -18,7 +18,6 @@
#include "timespecops.h"
#if defined(SO_BINTIME) && defined(SCM_BINTIME) && defined(CMSG_FIRSTHDR)
# define USE_PACKET_TIMESTAMP
# define USE_SCM_BINTIME
/* UNUSED
* # ifdef OVERRIDE_BINTIME_CTLMSGBUF_SIZE
......@@ -28,7 +27,6 @@
* # endif
*/
#elif defined(SO_TIMESTAMPNS) && defined(SCM_TIMESTAMPNS) && defined(CMSG_FIRSTHDR)
# define USE_PACKET_TIMESTAMP
# define USE_SCM_TIMESTAMPNS
/* UNUSED
* # ifdef OVERRIDE_TIMESTAMPNS_CTLMSGBUF_SIZE
......@@ -38,7 +36,6 @@
* # endif
*/
#elif defined(SO_TIMESTAMP) && defined(SCM_TIMESTAMP) && defined(CMSG_FIRSTHDR)
# define USE_PACKET_TIMESTAMP
# define USE_SCM_TIMESTAMP
/* UNUSED
* # ifdef OVERRIDE_TIMESTAMP_CTLMSGBUF_SIZE
......@@ -48,6 +45,7 @@
* # endif
*/
#else
# error "Can't get packet timestamp"
/* fill in for old/other timestamp interfaces */
#endif
......@@ -102,7 +100,6 @@ enable_packetstamps(
}
#ifdef USE_PACKET_TIMESTAMP
/*
* extract timestamps from control message buffer
*/
......@@ -226,6 +223,5 @@ fetch_packetstamp(
}
return ts;
}
#endif /* USE_PACKET_TIMESTAMP */
// end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment