"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "ntpd/ntp_io.c" between
ntp-4.2.8p14.tar.gz and ntp-4.2.8p15.tar.gz

About: NTP is the the Official Reference Implementation of the Network Time Protocol (NTP) that synchronize the clocks of computers over a network.

ntp_io.c  (ntp-4.2.8p14):ntp_io.c  (ntp-4.2.8p15)
skipping to change at line 3262 skipping to change at line 3262
struct refclockio * rp, struct refclockio * rp,
l_fp ts l_fp ts
) )
{ {
u_int read_count; u_int read_count;
int buflen; int buflen;
int saved_errno; int saved_errno;
int consumed; int consumed;
struct recvbuf * rb; struct recvbuf * rb;
rb = get_free_recv_buffer(); rb = get_free_recv_buffer(TRUE);
if (NULL == rb) { if (NULL == rb) {
/* /*
* No buffer space available - just drop the packet * No buffer space available - just drop the 'packet'.
* Since this is a non-blocking character stream we read
* all data that we can.
*
* ...hmmmm... what about "tcflush(fd,TCIFLUSH)" here?!?
*/ */
char buf[RX_BUFF_SIZE]; char buf[128];
do
buflen = read(fd, buf, sizeof buf); buflen = read(fd, buf, sizeof(buf));
while (buflen > 0);
packets_dropped++; packets_dropped++;
return (buflen); return (buflen);
} }
/* TALOS-CAN-0064: avoid signed/unsigned clashes that can lead /* TALOS-CAN-0064: avoid signed/unsigned clashes that can lead
* to buffer overrun and memory corruption * to buffer overrun and memory corruption
*/ */
if (rp->datalen <= 0 || (size_t)rp->datalen > sizeof(rb->recv_space)) if (rp->datalen <= 0 || (size_t)rp->datalen > sizeof(rb->recv_space))
read_count = sizeof(rb->recv_space); read_count = sizeof(rb->recv_space);
else else
skipping to change at line 3454 skipping to change at line 3459
GETSOCKNAME_SOCKLEN_TYPE fromlen; GETSOCKNAME_SOCKLEN_TYPE fromlen;
int buflen; int buflen;
register struct recvbuf *rb; register struct recvbuf *rb;
#ifdef HAVE_PACKET_TIMESTAMP #ifdef HAVE_PACKET_TIMESTAMP
struct msghdr msghdr; struct msghdr msghdr;
struct iovec iovec; struct iovec iovec;
char control[CMSG_BUFSIZE]; char control[CMSG_BUFSIZE];
#endif #endif
/* /*
* Get a buffer and read the frame. If we * Get a buffer and read the frame. If we haven't got a buffer,
* haven't got a buffer, or this is received * or this is received on a disallowed socket, just dump the
* on a disallowed socket, just dump the
* packet. * packet.
*/ */
rb = get_free_recv_buffer(); rb = itf->ignore_packets ? NULL : get_free_recv_buffer(FALSE);
if (NULL == rb || itf->ignore_packets) { if (NULL == rb) {
char buf[RX_BUFF_SIZE]; /* A partial read on a UDP socket truncates the data and
* removes the message from the queue. So there's no
* need to have a full buffer here on the stack.
*/
char buf[16];
sockaddr_u from; sockaddr_u from;
if (rb != NULL) if (rb != NULL)
freerecvbuf(rb); freerecvbuf(rb);
fromlen = sizeof(from); fromlen = sizeof(from);
buflen = recvfrom(fd, buf, sizeof(buf), 0, buflen = recvfrom(fd, buf, sizeof(buf), 0,
&from.sa, &fromlen); &from.sa, &fromlen);
DPRINTF(4, ("%s on (%lu) fd=%d from %s\n", DPRINTF(4, ("%s on (%lu) fd=%d from %s\n",
(itf->ignore_packets) (itf->ignore_packets)
skipping to change at line 4686 skipping to change at line 4694
} }
return; return;
} }
/* /*
* process routing message * process routing message
*/ */
#ifdef HAVE_RTNETLINK #ifdef HAVE_RTNETLINK
for (nh = UA_PTR(struct nlmsghdr, buffer); for (nh = UA_PTR(struct nlmsghdr, buffer);
NLMSG_OK(nh, cnt); NLMSG_OK(nh, cnt);
nh = NLMSG_NEXT(nh, cnt)) { nh = NLMSG_NEXT(nh, cnt))
{
msg_type = nh->nlmsg_type; msg_type = nh->nlmsg_type;
#else #else
for (p = buffer; for (p = buffer;
(p + sizeof(struct rt_msghdr)) <= (buffer + cnt); (p + sizeof(struct rt_msghdr)) <= (buffer + cnt);
p += rtm.rtm_msglen) { p += rtm.rtm_msglen)
{
memcpy(&rtm, p, sizeof(rtm)); memcpy(&rtm, p, sizeof(rtm));
if (rtm.rtm_version != RTM_VERSION) { if (rtm.rtm_version != RTM_VERSION) {
msyslog(LOG_ERR, msyslog(LOG_ERR,
"version mismatch (got %d - expected %d) on routi ng socket - disabling", "version mismatch (got %d - expected %d) on routi ng socket - disabling",
rtm.rtm_version, RTM_VERSION); rtm.rtm_version, RTM_VERSION);
remove_asyncio_reader(reader); remove_asyncio_reader(reader);
delete_asyncio_reader(reader); delete_asyncio_reader(reader);
return; return;
} }
 End of changes. 7 change blocks. 
13 lines changed or deleted 23 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)