CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: kardel Date: Thu Feb 18 15:13:38 UTC 2021 Modified Files: src/external/bsd/ntp/dist/ntpd: ntp_timer.c Log Message: PR bin/55973: fix routing message triggered one shot interface update. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/external/bsd/ntp/dist/ntpd/ntp_timer.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/ntp_timer.c diff -u src/external/bsd/ntp/dist/ntpd/ntp_timer.c:1.9 src/external/bsd/ntp/dist/ntpd/ntp_timer.c:1.10 --- src/external/bsd/ntp/dist/ntpd/ntp_timer.c:1.9 Sun Jan 3 15:33:05 2021 +++ src/external/bsd/ntp/dist/ntpd/ntp_timer.c Thu Feb 18 15:13:37 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_timer.c,v 1.9 2021/01/03 15:33:05 roy Exp $ */ +/* $NetBSD: ntp_timer.c,v 1.10 2021/02/18 15:13:37 kardel Exp $ */ /* * ntp_timer.c - event timer support routines @@ -428,6 +428,8 @@ timer(void) if (interface_interval) timer_interfacetimeout(current_time + interface_interval); + else + timer_interfacetimeout(0); DPRINTF(2, ("timer: interface update\n")); interface_update(NULL, NULL); }
CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: roy Date: Sun Jan 31 08:27:49 UTC 2021 Modified Files: src/external/bsd/ntp/dist/ntpd: ntp_io.c Log Message: ntpd: ignore errno EINTR on reads from the routing socket To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/external/bsd/ntp/dist/ntpd/ntp_io.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/ntp_io.c diff -u src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.30 src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.31 --- src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.30 Sun Jan 31 08:26:47 2021 +++ src/external/bsd/ntp/dist/ntpd/ntp_io.c Sun Jan 31 08:27:49 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_io.c,v 1.30 2021/01/31 08:26:47 roy Exp $ */ +/* $NetBSD: ntp_io.c,v 1.31 2021/01/31 08:27:49 roy Exp $ */ /* * ntp_io.c - input/output routines for ntpd. The socket-opening code @@ -4741,7 +4741,7 @@ process_routing_msgs(struct asyncio_read cnt = read(reader->fd, buffer, sizeof(buffer)); } while (cnt != -1 || errno == ENOBUFS); timer_interfacetimeout(current_time + UPDATE_GRACE); - } else { + } else if (errno != EINTR) { msyslog(LOG_ERR, "routing socket reports: %m - disabling"); remove_asyncio_reader(reader);
CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: roy Date: Sun Jan 31 08:26:47 UTC 2021 Modified Files: src/external/bsd/ntp/dist/ntpd: ntp_io.c Log Message: ntpd: move route socket overflow message from LOG_ERR to LOG_DEBUG While here stop caring about RTM_LOSING as that's purely informational. If routing does change then we get RTM_ADD/DEL/CHANGE. Also stop caring about RTM_IFANNOUNCE as we really only want addresses and interface flag updates which we get by RTM_NEWADDR/DELADDR/CHGADDR and RTM_IFINFO. To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/external/bsd/ntp/dist/ntpd/ntp_io.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/ntp_io.c diff -u src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.29 src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.30 --- src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.29 Sun Jan 3 15:33:05 2021 +++ src/external/bsd/ntp/dist/ntpd/ntp_io.c Sun Jan 31 08:26:47 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_io.c,v 1.29 2021/01/03 15:33:05 roy Exp $ */ +/* $NetBSD: ntp_io.c,v 1.30 2021/01/31 08:26:47 roy Exp $ */ /* * ntp_io.c - input/output routines for ntpd. The socket-opening code @@ -4730,8 +4730,9 @@ process_routing_msgs(struct asyncio_read if (cnt < 0) { if (errno == ENOBUFS) { - msyslog(LOG_ERR, -"routing socket reports: %m"); + msyslog(LOG_DEBUG, +"routing socket overflowed" +" - will update interfaces"); /* * drain the routing socket as we need to update * the interfaces anyway @@ -4792,15 +4793,9 @@ process_routing_msgs(struct asyncio_read #ifdef RTM_CHANGE case RTM_CHANGE: #endif -#ifdef RTM_LOSING - case RTM_LOSING: -#endif #ifdef RTM_IFINFO case RTM_IFINFO: #endif -#ifdef RTM_IFANNOUNCE - case RTM_IFANNOUNCE: -#endif #ifdef RTM_NEWLINK case RTM_NEWLINK: #endif @@ -4874,15 +4869,9 @@ init_async_notifications() #ifdef RTM_CHANGE RTM_CHANGE, #endif -#ifdef RTM_LOSING - RTM_LOSING, -#endif #ifdef RTM_IFINFO RTM_IFINFO, #endif -#ifdef RTM_IFANNOUNCE - RTM_IFANNOUNCE, -#endif #ifdef RTM_NEWLINK RTM_NEWLINK, #endif
CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: roy Date: Sun Jan 3 15:33:05 UTC 2021 Modified Files: src/external/bsd/ntp/dist/ntpd: cmd_args.c ntp_io.c ntp_timer.c Log Message: ntp: respect user's wishes to disable interface scanning While here, disable periodic scanning by default on NetBSD as it's no longer needed. The user can still enable it though with a positive number to the -U option. kardel@ So far I see no other issues from the pitfalls I know of To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/external/bsd/ntp/dist/ntpd/cmd_args.c cvs rdiff -u -r1.28 -r1.29 src/external/bsd/ntp/dist/ntpd/ntp_io.c cvs rdiff -u -r1.8 -r1.9 src/external/bsd/ntp/dist/ntpd/ntp_timer.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/cmd_args.c diff -u src/external/bsd/ntp/dist/ntpd/cmd_args.c:1.6 src/external/bsd/ntp/dist/ntpd/cmd_args.c:1.7 --- src/external/bsd/ntp/dist/ntpd/cmd_args.c:1.6 Mon May 25 20:47:25 2020 +++ src/external/bsd/ntp/dist/ntpd/cmd_args.c Sun Jan 3 15:33:05 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: cmd_args.c,v 1.6 2020/05/25 20:47:25 christos Exp $ */ +/* $NetBSD: cmd_args.c,v 1.7 2021/01/03 15:33:05 roy Exp $ */ /* * cmd_args.c = command-line argument processing @@ -181,9 +181,11 @@ getCmdOpts( if (HAVE_OPT( UPDATEINTERVAL )) { long val = OPT_VALUE_UPDATEINTERVAL; - if (val >= 0) + if (val >= 0) { interface_interval = val; - else { + if (interface_interval == 0) +disable_dynamic_updates = 1; + } else { fprintf(stderr, "command line interface update interval %ld must not be negative\n", val); Index: src/external/bsd/ntp/dist/ntpd/ntp_io.c diff -u src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.28 src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.29 --- src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.28 Fri Jan 1 17:21:47 2021 +++ src/external/bsd/ntp/dist/ntpd/ntp_io.c Sun Jan 3 15:33:05 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_io.c,v 1.28 2021/01/01 17:21:47 roy Exp $ */ +/* $NetBSD: ntp_io.c,v 1.29 2021/01/03 15:33:05 roy Exp $ */ /* * ntp_io.c - input/output routines for ntpd. The socket-opening code @@ -455,8 +455,13 @@ init_io(void) { /* Init buffer free list and stat counters */ init_recvbuff(RECV_INIT); +#ifdef SO_RERROR + /* route(4) overflow can be observed */ + interface_interval = 0; +#else /* update interface every 5 minutes as default */ interface_interval = 300; +#endif #ifdef WORK_PIPE addremove_io_fd = _addremove_io_fd; Index: src/external/bsd/ntp/dist/ntpd/ntp_timer.c diff -u src/external/bsd/ntp/dist/ntpd/ntp_timer.c:1.8 src/external/bsd/ntp/dist/ntpd/ntp_timer.c:1.9 --- src/external/bsd/ntp/dist/ntpd/ntp_timer.c:1.8 Mon May 25 20:47:25 2020 +++ src/external/bsd/ntp/dist/ntpd/ntp_timer.c Sun Jan 3 15:33:05 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_timer.c,v 1.8 2020/05/25 20:47:25 christos Exp $ */ +/* $NetBSD: ntp_timer.c,v 1.9 2021/01/03 15:33:05 roy Exp $ */ /* * ntp_timer.c - event timer support routines @@ -423,9 +423,11 @@ timer(void) /* * Interface update timer */ - if (interface_interval && interface_timer <= current_time) { - timer_interfacetimeout(current_time + - interface_interval); + if (!disable_dynamic_updates && + interface_timer && interface_timer <= current_time) { + if (interface_interval) + timer_interfacetimeout(current_time + + interface_interval); DPRINTF(2, ("timer: interface update\n")); interface_update(NULL, NULL); }
CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: roy Date: Fri Jan 1 17:21:47 UTC 2021 Modified Files: src/external/bsd/ntp/dist/ntpd: ntp_io.c Log Message: ntpd: In the event of route(4) overflow, update the interfaces To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/external/bsd/ntp/dist/ntpd/ntp_io.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/ntp_io.c diff -u src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.27 src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.28 --- src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.27 Mon May 25 20:47:25 2020 +++ src/external/bsd/ntp/dist/ntpd/ntp_io.c Fri Jan 1 17:21:47 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_io.c,v 1.27 2020/05/25 20:47:25 christos Exp $ */ +/* $NetBSD: ntp_io.c,v 1.28 2021/01/01 17:21:47 roy Exp $ */ /* * ntp_io.c - input/output routines for ntpd. The socket-opening code @@ -4727,6 +4727,14 @@ process_routing_msgs(struct asyncio_read if (errno == ENOBUFS) { msyslog(LOG_ERR, "routing socket reports: %m"); + /* + * drain the routing socket as we need to update + * the interfaces anyway + */ + do { +cnt = read(reader->fd, buffer, sizeof(buffer)); + } while (cnt != -1 || errno == ENOBUFS); + timer_interfacetimeout(current_time + UPDATE_GRACE); } else { msyslog(LOG_ERR, "routing socket reports: %m - disabling"); @@ -4837,6 +4845,9 @@ init_async_notifications() struct sockaddr_nl sa; #else int fd = socket(PF_ROUTE, SOCK_RAW, 0); +#ifdef SO_RERROR + int on = 1; +#endif #endif #ifdef RO_MSGFILTER unsigned char msgfilter[] = { @@ -4907,6 +4918,10 @@ init_async_notifications() , sizeof(msgfilter)) == -1) msyslog(LOG_ERR, "RO_MSGFILTER: %m"); #endif +#ifdef SO_RERROR + if (setsockopt(fd, SOL_SOCKET, SO_RERROR, , sizeof(on)) == -1) + msyslog(LOG_ERR, "SO_RERROR: %m"); +#endif make_socket_nonblocking(fd); #if defined(HAVE_SIGNALED_IO) init_socket_sig(fd);
CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: kardel Date: Thu Sep 3 07:26:41 UTC 2020 Modified Files: src/external/bsd/ntp/dist/ntpd: refclock_parse.c Log Message: remove unneeded newline in quotes variable string - keeps ntpq happy To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/external/bsd/ntp/dist/ntpd/refclock_parse.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/refclock_parse.c diff -u src/external/bsd/ntp/dist/ntpd/refclock_parse.c:1.22 src/external/bsd/ntp/dist/ntpd/refclock_parse.c:1.23 --- src/external/bsd/ntp/dist/ntpd/refclock_parse.c:1.22 Mon May 25 20:47:25 2020 +++ src/external/bsd/ntp/dist/ntpd/refclock_parse.c Thu Sep 3 07:26:41 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_parse.c,v 1.22 2020/05/25 20:47:25 christos Exp $ */ +/* $NetBSD: refclock_parse.c,v 1.23 2020/09/03 07:26:41 kardel Exp $ */ /* * /src/NTP/REPOSITORY/ntp4-dev/ntpd/refclock_parse.c,v 4.81 2009/05/01 10:15:29 kardel RELEASE_20090105_A @@ -4287,7 +4287,7 @@ mk_utcinfo( } else { - snprintf( t, size, "UTC offset parameter: %is, no leap second announced.\n", dtls ); + snprintf( t, size, "UTC offset parameter: %is, no leap second announced.", dtls ); } }
CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: maya Date: Wed Apr 24 11:55:05 UTC 2019 Modified Files: src/external/bsd/ntp/dist/ntpd: ntp_config.c Log Message: Only warn about being unable to make a smaller stack if asking for debug messages. Between ASLR and stack clash random-sized padding, we can't make small stacks reliably. Not doing so isn't a problem, so don't warn users about it on every boot. PR bin/51118 To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/external/bsd/ntp/dist/ntpd/ntp_config.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/ntp_config.c diff -u src/external/bsd/ntp/dist/ntpd/ntp_config.c:1.20 src/external/bsd/ntp/dist/ntpd/ntp_config.c:1.21 --- src/external/bsd/ntp/dist/ntpd/ntp_config.c:1.20 Mon Dec 24 02:58:39 2018 +++ src/external/bsd/ntp/dist/ntpd/ntp_config.c Wed Apr 24 11:55:05 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_config.c,v 1.20 2018/12/24 02:58:39 christos Exp $ */ +/* $NetBSD: ntp_config.c,v 1.21 2019/04/24 11:55:05 maya Exp $ */ /* ntp_config.c * @@ -5252,7 +5252,7 @@ ntp_rlimit( } rl.rlim_cur = rl_value; if (-1 == setrlimit(RLIMIT_STACK, )) { -msyslog(LOG_ERR, +msyslog(LOG_DEBUG, "ntp_rlimit: Cannot set RLIMIT_STACK: %m"); } }
CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: christos Date: Mon Dec 24 02:58:39 UTC 2018 Modified Files: src/external/bsd/ntp/dist/ntpd: ntp_config.c Log Message: only use yydebug if YYDEBUG To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/external/bsd/ntp/dist/ntpd/ntp_config.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/ntp_config.c diff -u src/external/bsd/ntp/dist/ntpd/ntp_config.c:1.19 src/external/bsd/ntp/dist/ntpd/ntp_config.c:1.20 --- src/external/bsd/ntp/dist/ntpd/ntp_config.c:1.19 Sat Sep 29 17:52:33 2018 +++ src/external/bsd/ntp/dist/ntpd/ntp_config.c Sun Dec 23 21:58:39 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_config.c,v 1.19 2018/09/29 21:52:33 christos Exp $ */ +/* $NetBSD: ntp_config.c,v 1.20 2018/12/24 02:58:39 christos Exp $ */ /* ntp_config.c * @@ -4750,7 +4750,7 @@ getconfig( /*** BULK OF THE PARSER ***/ -#ifdef DEBUG +#if defined(DEBUG) && defined(YYDEBUG) yydebug = !!(debug >= 5); #endif yyparse();
CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: christos Date: Sat Oct 20 02:30:43 UTC 2018 Modified Files: src/external/bsd/ntp/dist/ntpd: ntpd.c Log Message: Don't try to drop privileges twice, it produces a spurious error message in the forked child. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/external/bsd/ntp/dist/ntpd/ntpd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/ntpd.c diff -u src/external/bsd/ntp/dist/ntpd/ntpd.c:1.16 src/external/bsd/ntp/dist/ntpd/ntpd.c:1.17 --- src/external/bsd/ntp/dist/ntpd/ntpd.c:1.16 Sat Sep 29 17:52:33 2018 +++ src/external/bsd/ntp/dist/ntpd/ntpd.c Fri Oct 19 22:30:43 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ntpd.c,v 1.16 2018/09/29 21:52:33 christos Exp $ */ +/* $NetBSD: ntpd.c,v 1.17 2018/10/20 02:30:43 christos Exp $ */ /* * ntpd.c - main program for the fixed point NTP daemon @@ -688,24 +688,9 @@ getgroup: return 1; } -/* - * Change (effective) user and group IDs, also initialize the supplementary group access list - */ -int set_user_group_ids(void); -int -set_user_group_ids(void) +static int +set_group_ids(void) { - /* If the the user was already mapped, no need to map it again */ - if ((NULL != user) && (0 == sw_uid)) { - if (0 == map_user()) - exit (-1); - } - /* same applies for the group */ - if ((NULL != group) && (0 == sw_gid)) { - if (0 == map_group()) - exit (-1); - } - if (user && initgroups(user, sw_gid)) { msyslog(LOG_ERR, "Cannot initgroups() to user `%s': %m", user); return 0; @@ -729,6 +714,12 @@ set_user_group_ids(void) msyslog(LOG_ERR, "initgroups(<%s>, %d) filed: %m", pw->pw_name, pw->pw_gid); return 0; } + return 1; +} + +static int +set_user_ids(void) +{ if (user && setuid(sw_uid)) { msyslog(LOG_ERR, "Cannot setuid() to user `%s': %m", user); return 0; @@ -737,6 +728,31 @@ set_user_group_ids(void) msyslog(LOG_ERR, "Cannot seteuid() to user `%s': %m", user); return 0; } + return 1; +} + +/* + * Change (effective) user and group IDs, also initialize the supplementary group access list + */ +int set_user_group_ids(void); +int +set_user_group_ids(void) +{ + /* If the the user was already mapped, no need to map it again */ + if ((NULL != user) && (0 == sw_uid)) { + if (0 == map_user()) + exit (-1); + } + /* same applies for the group */ + if ((NULL != group) && (0 == sw_gid)) { + if (0 == map_group()) + exit (-1); + } + + if (getegid() != sw_gid && 0 == set_group_ids()) + return 0; + if (geteuid() != sw_uid && 0 == set_user_ids()) + return 0; return 1; }
CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: roy Date: Tue Apr 11 14:17:34 UTC 2017 Modified Files: src/external/bsd/ntp/dist/ntpd: ntp_io.c Log Message: Use RO_MSGFILTER. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/external/bsd/ntp/dist/ntpd/ntp_io.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/ntp_io.c diff -u src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.23 src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.24 --- src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.23 Fri Jun 3 20:39:02 2016 +++ src/external/bsd/ntp/dist/ntpd/ntp_io.c Tue Apr 11 14:17:34 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_io.c,v 1.23 2016/06/03 20:39:02 christos Exp $ */ +/* $NetBSD: ntp_io.c,v 1.24 2017/04/11 14:17:34 roy Exp $ */ /* * ntp_io.c - input/output routines for ntpd. The socket-opening code @@ -4795,6 +4795,50 @@ init_async_notifications() #else int fd = socket(PF_ROUTE, SOCK_RAW, 0); #endif +#ifdef RO_MSGFILTER + unsigned char msgfilter[] = { +#ifdef RTM_NEWADDR + RTM_NEWADDR, +#endif +#ifdef RTM_DELADDR + RTM_DELADDR, +#endif +#ifdef RTM_ADD + RTM_ADD, +#endif +#ifdef RTM_DELETE + RTM_DELETE, +#endif +#ifdef RTM_REDIRECT + RTM_REDIRECT, +#endif +#ifdef RTM_CHANGE + RTM_CHANGE, +#endif +#ifdef RTM_LOSING + RTM_LOSING, +#endif +#ifdef RTM_IFINFO + RTM_IFINFO, +#endif +#ifdef RTM_IFANNOUNCE + RTM_IFANNOUNCE, +#endif +#ifdef RTM_NEWLINK + RTM_NEWLINK, +#endif +#ifdef RTM_DELLINK + RTM_DELLINK, +#endif +#ifdef RTM_NEWROUTE + RTM_NEWROUTE, +#endif +#ifdef RTM_DELROUTE + RTM_DELROUTE, +#endif + }; +#endif /* !RO_MSGFILTER */ + if (fd < 0) { msyslog(LOG_ERR, "unable to open routing socket (%m) - using polled interface update"); @@ -4815,6 +4859,11 @@ init_async_notifications() return; } #endif +#ifdef RO_MSGFILTER + if (setsockopt(fd, PF_ROUTE, RO_MSGFILTER, + , sizeof(msgfilter)) == -1) + msyslog(LOG_ERR, "RO_MSGFILTER: %m"); +#endif make_socket_nonblocking(fd); #if defined(HAVE_SIGNALED_IO) init_socket_sig(fd);
CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: joerg Date: Mon Jul 20 13:13:31 UTC 2015 Modified Files: src/external/bsd/ntp/dist/ntpd: ntp_timer.c Log Message: Don't use fabs on integers. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/external/bsd/ntp/dist/ntpd/ntp_timer.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/ntp_timer.c diff -u src/external/bsd/ntp/dist/ntpd/ntp_timer.c:1.3 src/external/bsd/ntp/dist/ntpd/ntp_timer.c:1.4 --- src/external/bsd/ntp/dist/ntpd/ntp_timer.c:1.3 Fri Jul 10 14:20:32 2015 +++ src/external/bsd/ntp/dist/ntpd/ntp_timer.c Mon Jul 20 13:13:31 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_timer.c,v 1.3 2015/07/10 14:20:32 christos Exp $ */ +/* $NetBSD: ntp_timer.c,v 1.4 2015/07/20 13:13:31 joerg Exp $ */ /* * ntp_timer.c - event timer support routines @@ -624,7 +624,7 @@ check_leapsec( const char *leapmsg = NULL; if (lsdata.warped 0) { if (clock_max_back 0.0 - clock_max_back fabs(lsdata.warped)) { + clock_max_back abs(lsdata.warped)) { step_systime(lsdata.warped); leapmsg = leapmsg_p_step; } else { @@ -632,7 +632,7 @@ check_leapsec( } } else if (lsdata.warped 0) { if (clock_max_fwd 0.0 - clock_max_fwd fabs(lsdata.warped)) { + clock_max_fwd abs(lsdata.warped)) { step_systime(lsdata.warped); leapmsg = leapmsg_n_step; } else {
CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: kardel Date: Fri Jul 10 21:31:19 UTC 2015 Modified Files: src/external/bsd/ntp/dist/ntpd: ntp_control.c Log Message: backport fix for bug 2867 - ntpd with autokey active crashed by 'ntpq -crv' To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/external/bsd/ntp/dist/ntpd/ntp_control.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/ntp_control.c diff -u src/external/bsd/ntp/dist/ntpd/ntp_control.c:1.12 src/external/bsd/ntp/dist/ntpd/ntp_control.c:1.13 --- src/external/bsd/ntp/dist/ntpd/ntp_control.c:1.12 Fri Jul 10 14:20:32 2015 +++ src/external/bsd/ntp/dist/ntpd/ntp_control.c Fri Jul 10 21:31:19 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_control.c,v 1.12 2015/07/10 14:20:32 christos Exp $ */ +/* $NetBSD: ntp_control.c,v 1.13 2015/07/10 21:31:19 kardel Exp $ */ /* * ntp_control.c - respond to mode 6 control messages and send async @@ -422,10 +422,10 @@ static const struct ctl_var sys_var[] = { CS_TIMER_XMTS, RO, timer_xmts }, /* 87 */ { CS_FUZZ, RO, fuzz }, /* 88 */ { CS_WANDER_THRESH, RO, clk_wander_threshold }, /* 89 */ -#ifdef LEAP_SMEAR + { CS_LEAPSMEARINTV, RO, leapsmearinterval },/* 90 */ { CS_LEAPSMEAROFFS, RO, leapsmearoffset }, /* 91 */ -#endif /* LEAP_SMEAR */ + #ifdef AUTOKEY { CS_FLAGS, RO, flags }, /* 1 + CS_MAX_NOAUTOKEY */ { CS_HOST, RO, host }, /* 2 + CS_MAX_NOAUTOKEY */ @@ -2404,6 +2404,9 @@ ctl_putsys( ntohl(hostval.tstamp)); break; #endif /* AUTOKEY */ + + default: + break; } }
CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: roy Date: Sat May 2 14:46:51 UTC 2015 Modified Files: src/external/bsd/ntp/dist/ntpd: ntp_io.c Log Message: Don't bind to IN_IFF_TENTATIVE or IN_IFF_DETACHED addresses. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/external/bsd/ntp/dist/ntpd/ntp_io.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/ntp_io.c diff -u src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.17 src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.18 --- src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.17 Tue Apr 7 17:34:19 2015 +++ src/external/bsd/ntp/dist/ntpd/ntp_io.c Sat May 2 14:46:51 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_io.c,v 1.17 2015/04/07 17:34:19 christos Exp $ */ +/* $NetBSD: ntp_io.c,v 1.18 2015/05/02 14:46:51 roy Exp $ */ /* * ntp_io.c - input/output routines for ntpd. The socket-opening code @@ -1647,6 +1647,34 @@ set_wildcard_reuse( } #endif /* OS_NEEDS_REUSEADDR_FOR_IFADDRBIND */ +static isc_boolean_t +check_flags( + sockaddr_u *psau, + const char *name, + u_int32 flags + ) +{ +#if defined(SIOCGIFAFLAG_IN) + struct ifreq ifr; + int fd; + + if (psau-sa.sa_family != AF_INET) + return ISC_FALSE; + if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) 0) + return ISC_FALSE; + ZERO(ifr); + memcpy(ifr.ifr_addr, psau-sa, sizeof(ifr.ifr_addr)); + strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); + if (ioctl(fd, SIOCGIFAFLAG_IN, ifr) 0) { + close(fd); + return ISC_FALSE; + } + close(fd); + if ((ifr.ifr_addrflags flags) != 0) + return ISC_TRUE; +#endif /* SIOCGIFAFLAG_IN */ + return ISC_FALSE; +} static isc_boolean_t check_flags6( @@ -1696,19 +1724,32 @@ is_valid( const char *name ) { - u_int32 flags6; + u_int32 flags; - flags6 = 0; + flags = 0; + switch (psau-sa.sa_family) { + case AF_INET: +#ifdef IN_IFF_DETACHED + flags |= IN_IFF_DETACHED; +#endif +#ifdef IN_IFF_TENTATIVE + flags |= IN_IFF_TENTATIVE; +#endif + return check_flags(psau, name, flags) ? ISC_FALSE : ISC_TRUE; + case AF_INET6: #ifdef IN6_IFF_DEPARTED - flags6 |= IN6_IFF_DEPARTED; + flags |= IN6_IFF_DEPARTED; #endif #ifdef IN6_IFF_DETACHED - flags6 |= IN6_IFF_DETACHED; + flags |= IN6_IFF_DETACHED; #endif #ifdef IN6_IFF_TENTATIVE - flags6 |= IN6_IFF_TENTATIVE; + flags |= IN6_IFF_TENTATIVE; #endif - return check_flags6(psau, name, flags6) ? ISC_FALSE : ISC_TRUE; + return check_flags6(psau, name, flags) ? ISC_FALSE : ISC_TRUE; + default: + return ISC_FALSE; + } } /*
CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: christos Date: Mon Apr 13 17:45:19 UTC 2015 Modified Files: src/external/bsd/ntp/dist/ntpd: refclock_shm.c Log Message: CID 1269537: Unreachable code To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/external/bsd/ntp/dist/ntpd/refclock_shm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/refclock_shm.c diff -u src/external/bsd/ntp/dist/ntpd/refclock_shm.c:1.4 src/external/bsd/ntp/dist/ntpd/refclock_shm.c:1.5 --- src/external/bsd/ntp/dist/ntpd/refclock_shm.c:1.4 Tue Apr 7 13:34:19 2015 +++ src/external/bsd/ntp/dist/ntpd/refclock_shm.c Mon Apr 13 13:45:19 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_shm.c,v 1.4 2015/04/07 17:34:19 christos Exp $ */ +/* $NetBSD: refclock_shm.c,v 1.5 2015/04/13 17:45:19 christos Exp $ */ /* * refclock_shm - clock driver for utc via shared memory @@ -197,9 +197,8 @@ getShmTime( return NULL; } -#endif - return p; +#endif } /* * shm_start - attach to shared memory
CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: christos Date: Tue Jan 27 02:37:18 UTC 2015 Modified Files: src/external/bsd/ntp/dist/ntpd: refclock_parse.c Log Message: put back initialization of the buffer which was accidentally removed. XXX: pullup-7. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/external/bsd/ntp/dist/ntpd/refclock_parse.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/refclock_parse.c diff -u src/external/bsd/ntp/dist/ntpd/refclock_parse.c:1.13 src/external/bsd/ntp/dist/ntpd/refclock_parse.c:1.14 --- src/external/bsd/ntp/dist/ntpd/refclock_parse.c:1.13 Fri Dec 19 15:43:17 2014 +++ src/external/bsd/ntp/dist/ntpd/refclock_parse.c Mon Jan 26 21:37:18 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_parse.c,v 1.13 2014/12/19 20:43:17 christos Exp $ */ +/* $NetBSD: refclock_parse.c,v 1.14 2015/01/27 02:37:18 christos Exp $ */ /* * /src/NTP/REPOSITORY/ntp4-dev/ntpd/refclock_parse.c,v 4.81 2009/05/01 10:15:29 kardel RELEASE_20090105_A @@ -2535,6 +2535,7 @@ parsestate( int i; char *s, *t; + *buffer = '\0'; s = t = buffer; i = 0;
CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: joerg Date: Tue Dec 23 15:47:32 UTC 2014 Modified Files: src/external/bsd/ntp/dist/ntpd: refclock_gpsdjson.c Log Message: myasprintf (wtf) passes down a format string, so use __printflike. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/external/bsd/ntp/dist/ntpd/refclock_gpsdjson.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/refclock_gpsdjson.c diff -u src/external/bsd/ntp/dist/ntpd/refclock_gpsdjson.c:1.3 src/external/bsd/ntp/dist/ntpd/refclock_gpsdjson.c:1.4 --- src/external/bsd/ntp/dist/ntpd/refclock_gpsdjson.c:1.3 Mon Dec 22 04:21:47 2014 +++ src/external/bsd/ntp/dist/ntpd/refclock_gpsdjson.c Tue Dec 23 15:47:32 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_gpsdjson.c,v 1.3 2014/12/22 04:21:47 christos Exp $ */ +/* $NetBSD: refclock_gpsdjson.c,v 1.4 2014/12/23 15:47:32 joerg Exp $ */ /* * refclock_gpsdjson.c - clock driver as GPSD JSON client @@ -120,7 +120,7 @@ static void gpsd_control (int, const str static void gpsd_timer (int, peerT *); static voidgpsd_clockstats (int, peerT *); -static int myasprintf(char**, char const*, ...); +static int myasprintf(char**, char const*, ...) __printflike(2, 3); struct refclock refclock_gpsdjson = { gpsd_start, /* start up driver */
CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: christos Date: Mon Dec 22 04:21:47 UTC 2014 Modified Files: src/external/bsd/ntp/dist/ntpd: refclock_gpsdjson.c Log Message: avoid shadowing of log2 on some platforms. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/external/bsd/ntp/dist/ntpd/refclock_gpsdjson.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/refclock_gpsdjson.c diff -u src/external/bsd/ntp/dist/ntpd/refclock_gpsdjson.c:1.2 src/external/bsd/ntp/dist/ntpd/refclock_gpsdjson.c:1.3 --- src/external/bsd/ntp/dist/ntpd/refclock_gpsdjson.c:1.2 Fri Dec 19 15:43:17 2014 +++ src/external/bsd/ntp/dist/ntpd/refclock_gpsdjson.c Sun Dec 21 23:21:47 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_gpsdjson.c,v 1.2 2014/12/19 20:43:17 christos Exp $ */ +/* $NetBSD: refclock_gpsdjson.c,v 1.3 2014/12/22 04:21:47 christos Exp $ */ /* * refclock_gpsdjson.c - clock driver as GPSD JSON client @@ -856,7 +856,7 @@ process_tpv( const char * gps_time; int gps_mode; double ept, epp, epx, epy, epv; - int log2; + int xlog2; gps_mode = (int)json_object_lookup_int_default( jctx, 0, mode, 0); @@ -922,9 +922,9 @@ process_tpv( ept = min(ept, epp ); ept = min(ept, 0.5 ); ept = max(ept, 1.0-9); - ept = frexp(ept, log2); + ept = frexp(ept, xlog2); - peer-precision = log2; + peer-precision = xlog2; } /* -- */
CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: christos Date: Mon Dec 22 04:23:58 UTC 2014 Modified Files: src/external/bsd/ntp/dist/ntpd: refclock_nmea.c Log Message: avoid shadowing of recv. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/external/bsd/ntp/dist/ntpd/refclock_nmea.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/refclock_nmea.c diff -u src/external/bsd/ntp/dist/ntpd/refclock_nmea.c:1.6 src/external/bsd/ntp/dist/ntpd/refclock_nmea.c:1.7 --- src/external/bsd/ntp/dist/ntpd/refclock_nmea.c:1.6 Fri Dec 19 15:43:17 2014 +++ src/external/bsd/ntp/dist/ntpd/refclock_nmea.c Sun Dec 21 23:23:58 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_nmea.c,v 1.6 2014/12/19 20:43:17 christos Exp $ */ +/* $NetBSD: refclock_nmea.c,v 1.7 2014/12/22 04:23:58 christos Exp $ */ /* * refclock_nmea.c - clock driver for an NMEA GPS CLOCK @@ -314,7 +314,7 @@ static int unfold_century (struct calend static int gpsfix_century (struct calendar * jd, const gps_weektm * wd, u_short * ccentury); static l_fp eval_gps_time (struct peer * peer, const struct calendar * gpst, - const struct timespec * gpso, const l_fp * recv); + const struct timespec * gpso, const l_fp * xrecv); static int nmead_open (const char * device); static void save_ltc(struct refclockproc * const, const char * const, @@ -1782,7 +1782,7 @@ eval_gps_time( struct peer * peer, /* for logging etc */ const struct calendar * gpst, /* GPS time stamp */ const struct timespec * tofs, /* GPS frac second offset */ - const l_fp* recv /* receive time stamp */ + const l_fp* xrecv /* receive time stamp */ ) { struct refclockproc * const pp = peer-procptr; @@ -1838,7 +1838,7 @@ eval_gps_time( } /* - get unfold base: day of full recv time - 512 weeks */ - vi64 = ntpcal_ntp_to_ntp(recv-l_ui, NULL); + vi64 = ntpcal_ntp_to_ntp(xrecv-l_ui, NULL); rs64 = ntpcal_daysplit(vi64); rcv_sec = rs64.lo; rcv_day = rs64.hi - 512 * 7; @@ -1848,7 +1848,7 @@ eval_gps_time( * fractional day of the receive time, we shift the base day for * the unfold by 1. */ if ( gps_sec rcv_sec - || (gps_sec == rcv_sec retv.l_uf recv-l_uf)) + || (gps_sec == rcv_sec retv.l_uf xrecv-l_uf)) rcv_day += 1; /* - don't warp ahead of GPS invention! */
CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: joerg Date: Thu Feb 27 18:11:41 UTC 2014 Modified Files: src/external/bsd/ntp/dist/ntpd: refclock_wwv.c Log Message: Use labs for long arguments and fabs for double ones. To generate a diff of this commit: cvs rdiff -u -r1.1.1.2 -r1.2 src/external/bsd/ntp/dist/ntpd/refclock_wwv.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/refclock_wwv.c diff -u src/external/bsd/ntp/dist/ntpd/refclock_wwv.c:1.1.1.2 src/external/bsd/ntp/dist/ntpd/refclock_wwv.c:1.2 --- src/external/bsd/ntp/dist/ntpd/refclock_wwv.c:1.1.1.2 Fri Dec 27 23:30:52 2013 +++ src/external/bsd/ntp/dist/ntpd/refclock_wwv.c Thu Feb 27 18:11:41 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_wwv.c,v 1.1.1.2 2013/12/27 23:30:52 christos Exp $ */ +/* $NetBSD: refclock_wwv.c,v 1.2 2014/02/27 18:11:41 joerg Exp $ */ /* * refclock_wwv - clock driver for NIST WWV/H time/frequency station @@ -1340,7 +1340,7 @@ wwv_qrz( if (sp-reach (1 AMAX)) sp-count--; if (sp-synmax ATHR sp-synsnr ASNR) { - if (abs(epoch) AWND * MS) { + if (labs(epoch) AWND * MS) { sp-reach |= 1; sp-count++; sp-mepoch = sp-lastpos = sp-pos; @@ -1542,14 +1542,14 @@ wwv_endpoc( */ dtemp = (mepoch - zepoch) % WWV_SEC; if (up-status FGATE) { - if (abs(dtemp) MAXFREQ * MINAVG) { + if (fabs(dtemp) MAXFREQ * MINAVG) { up-freq += (dtemp / 2.) / ((mcount - zcount) * FCONST); if (up-freq MAXFREQ) up-freq = MAXFREQ; else if (up-freq -MAXFREQ) up-freq = -MAXFREQ; - if (abs(dtemp) MAXFREQ * MINAVG / 2.) { + if (fabs(dtemp) MAXFREQ * MINAVG / 2.) { if (avginc 3) { avginc++; } else {
CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: joerg Date: Thu Feb 27 18:12:11 UTC 2014 Modified Files: src/external/bsd/ntp/dist/ntpd: refclock_irig.c Log Message: Use abs for difference of integers. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/external/bsd/ntp/dist/ntpd/refclock_irig.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/refclock_irig.c diff -u src/external/bsd/ntp/dist/ntpd/refclock_irig.c:1.3 src/external/bsd/ntp/dist/ntpd/refclock_irig.c:1.4 --- src/external/bsd/ntp/dist/ntpd/refclock_irig.c:1.3 Sat Dec 28 03:20:14 2013 +++ src/external/bsd/ntp/dist/ntpd/refclock_irig.c Thu Feb 27 18:12:11 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_irig.c,v 1.3 2013/12/28 03:20:14 christos Exp $ */ +/* $NetBSD: refclock_irig.c,v 1.4 2014/02/27 18:12:11 joerg Exp $ */ /* * refclock_irig - audio IRIG-B/E demodulator/decoder @@ -764,7 +764,7 @@ irig_baud( * persist for lots of samples. */ up-exing = -up-yxing; - if (fabs(up-envxing - up-envphase) = 1) { + if (abs(up-envxing - up-envphase) = 1) { up-tcount++; if (up-tcount 20 * up-tc) { up-tc++;
CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: mlelstv Date: Sun Jan 26 02:21:08 UTC 2014 Modified Files: src/external/bsd/ntp/dist/ntpd: ntp_io.c Log Message: stoa() already includes the scope, no need to print it twice. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/external/bsd/ntp/dist/ntpd/ntp_io.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/ntp_io.c diff -u src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.13 src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.14 --- src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.13 Fri Jan 17 17:25:47 2014 +++ src/external/bsd/ntp/dist/ntpd/ntp_io.c Sun Jan 26 02:21:08 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_io.c,v 1.13 2014/01/17 17:25:47 roy Exp $ */ +/* $NetBSD: ntp_io.c,v 1.14 2014/01/26 02:21:08 mlelstv Exp $ */ /* * ntp_io.c - input/output routines for ntpd. The socket-opening code @@ -2818,7 +2818,6 @@ open_socket( { SOCKET fd; int errval; - char scopetext[16]; /* * int is OK for REUSEADR per * http://www.kohala.com/start/mcast.api.txt @@ -2968,16 +2967,10 @@ open_socket( || debug 1 #endif ) { - if (SCOPE(addr)) -snprintf(scopetext, sizeof(scopetext), - %%%d, SCOPE(addr)); - else -scopetext[0] = 0; - msyslog(LOG_ERR, -bind(%d) AF_INET%s %s%s#%d%s flags 0x%x failed: %m, +bind(%d) AF_INET%s %s#%d%s flags 0x%x failed: %m, fd, IS_IPV6(addr) ? 6 : , -stoa(addr), scopetext, SRCPORT(addr), +stoa(addr), SRCPORT(addr), IS_MCAST(addr) ? (multicast) : , interf-flags); }
CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: roy Date: Fri Jan 17 17:25:47 UTC 2014 Modified Files: src/external/bsd/ntp/dist/ntpd: ntp_io.c Log Message: Do not try to bind to un-useable IPv6 addresses. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/external/bsd/ntp/dist/ntpd/ntp_io.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/ntp_io.c diff -u src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.12 src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.13 --- src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.12 Sat Dec 28 17:00:50 2013 +++ src/external/bsd/ntp/dist/ntpd/ntp_io.c Fri Jan 17 17:25:47 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_io.c,v 1.12 2013/12/28 17:00:50 christos Exp $ */ +/* $NetBSD: ntp_io.c,v 1.13 2014/01/17 17:25:47 roy Exp $ */ /* * ntp_io.c - input/output routines for ntpd. The socket-opening code @@ -1632,16 +1632,15 @@ set_wildcard_reuse( static isc_boolean_t -is_anycast( +check_flags6( sockaddr_u *psau, - const char *name + const char *name, + u_int32 flags6 ) { -#if defined(INCLUDE_IPV6_SUPPORT) defined(SIOCGIFAFLAG_IN6) \ -defined(IN6_IFF_ANYCAST) +#if defined(INCLUDE_IPV6_SUPPORT) defined(SIOCGIFAFLAG_IN6) struct in6_ifreq ifr6; int fd; - u_int32 flags6; if (psau-sa.sa_family != AF_INET6) return ISC_FALSE; @@ -1655,13 +1654,45 @@ is_anycast( return ISC_FALSE; } close(fd); - flags6 = ifr6.ifr_ifru.ifru_flags6; - if ((flags6 IN6_IFF_ANYCAST) != 0) + if ((ifr6.ifr_ifru.ifru_flags6 flags6) != 0) return ISC_TRUE; -#endif /* INCLUDE_IPV6_SUPPORT SIOCGIFAFLAG_IN6 IN6_IFF_ANYCAST */ +#endif /* INCLUDE_IPV6_SUPPORT SIOCGIFAFLAG_IN6 */ return ISC_FALSE; } +static isc_boolean_t +is_anycast( + sockaddr_u *psau, + const char *name + ) +{ +#ifdef IN6_IFF_ANYCAST + return check_flags6(psau, name, IN6_IFF_ANYCAST); +#else + return ISC_FALSE; +#endif +} + +static isc_boolean_t +is_valid( + sockaddr_u *psau, + const char *name + ) +{ + u_int32 flags6; + + flags6 = 0; +#ifdef IN6_IFF_DEPARTED + flags6 |= IN6_IFF_DEPARTED; +#endif +#ifdef IN6_IFF_DETACHED + flags6 |= IN6_IFF_DETACHED; +#endif +#ifdef IN6_IFF_TENTATIVE + flags6 |= IN6_IFF_TENTATIVE; +#endif + return check_flags6(psau, name, flags6) ? ISC_FALSE : ISC_TRUE; +} /* * update_interface strategy @@ -1795,6 +1826,12 @@ update_interfaces( continue; /* + * skip any address that is an invalid state to be used + */ + if (!is_valid(enumep.sin, isc_if.name)) + continue; + + /* * map to local *address* in order to map all duplicate * interfaces to an endpt structure with the appropriate * socket. Our name space is (ip-address), NOT
CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: joerg Date: Tue Jan 7 02:10:49 UTC 2014 Modified Files: src/external/bsd/ntp/dist/ntpd: refclock_parse.c Log Message: Fix format strings. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/external/bsd/ntp/dist/ntpd/refclock_parse.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/refclock_parse.c diff -u src/external/bsd/ntp/dist/ntpd/refclock_parse.c:1.11 src/external/bsd/ntp/dist/ntpd/refclock_parse.c:1.12 --- src/external/bsd/ntp/dist/ntpd/refclock_parse.c:1.11 Sun Jan 5 15:13:36 2014 +++ src/external/bsd/ntp/dist/ntpd/refclock_parse.c Tue Jan 7 02:10:49 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_parse.c,v 1.11 2014/01/05 15:13:36 kardel Exp $ */ +/* $NetBSD: refclock_parse.c,v 1.12 2014/01/07 02:10:49 joerg Exp $ */ /* * /src/NTP/REPOSITORY/ntp4-dev/ntpd/refclock_parse.c,v 4.81 2009/05/01 10:15:29 kardel RELEASE_20090105_A @@ -2464,7 +2464,7 @@ init_iobinding( ** support routines **/ -static char * +static __printflike(4, 5) char * ap(char *buffer, size_t len, char *pos, const char *fmt, ...) { va_list va; @@ -5552,28 +5552,28 @@ trimbletsip_message( t = ap(pbuffer, sizeof(pbuffer), t, illegal value 0x%02x, mb(0) 0xFF); break; case 0x00: -t = ap(pbuffer, sizeof(pbuffer), t, doing position fixes, BUFFER_SIZE(pbuffer, t)); +t = ap(pbuffer, sizeof(pbuffer), t, doing position fixes); break; case 0x01: -t = ap(pbuffer, sizeof(pbuffer), t, no GPS time yet, BUFFER_SIZE(pbuffer, t)); +t = ap(pbuffer, sizeof(pbuffer), t, no GPS time yet); break; case 0x03: -t = ap(pbuffer, sizeof(pbuffer), t, PDOP too high, BUFFER_SIZE(pbuffer, t)); +t = ap(pbuffer, sizeof(pbuffer), t, PDOP too high); break; case 0x08: -t = ap(pbuffer, sizeof(pbuffer), t, no usable satellites, BUFFER_SIZE(pbuffer, t)); +t = ap(pbuffer, sizeof(pbuffer), t, no usable satellites); break; case 0x09: -t = ap(pbuffer, sizeof(pbuffer), t, only ONE usable satellite, BUFFER_SIZE(pbuffer, t)); +t = ap(pbuffer, sizeof(pbuffer), t, only ONE usable satellite); break; case 0x0A: -t = ap(pbuffer, sizeof(pbuffer), t, only TWO usable satellites, BUFFER_SIZE(pbuffer, t)); +t = ap(pbuffer, sizeof(pbuffer), t, only TWO usable satellites); break; case 0x0B: -t = ap(pbuffer, sizeof(pbuffer), t, only THREE usable satellites, BUFFER_SIZE(pbuffer, t)); +t = ap(pbuffer, sizeof(pbuffer), t, only THREE usable satellites); break; case 0x0C: -t = ap(pbuffer, sizeof(pbuffer), t, the chosen satellite is unusable, BUFFER_SIZE(pbuffer, t)); +t = ap(pbuffer, sizeof(pbuffer), t, the chosen satellite is unusable); break; }
CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: joerg Date: Thu Jan 2 21:35:50 UTC 2014 Modified Files: src/external/bsd/ntp/dist/ntpd: refclock_true.c Log Message: Add format string attribute for better detection. To generate a diff of this commit: cvs rdiff -u -r1.1.1.3 -r1.2 src/external/bsd/ntp/dist/ntpd/refclock_true.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/refclock_true.c diff -u src/external/bsd/ntp/dist/ntpd/refclock_true.c:1.1.1.3 src/external/bsd/ntp/dist/ntpd/refclock_true.c:1.2 --- src/external/bsd/ntp/dist/ntpd/refclock_true.c:1.1.1.3 Fri Dec 27 23:31:00 2013 +++ src/external/bsd/ntp/dist/ntpd/refclock_true.c Thu Jan 2 21:35:50 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_true.c,v 1.1.1.3 2013/12/27 23:31:00 christos Exp $ */ +/* $NetBSD: refclock_true.c,v 1.2 2014/01/02 21:35:50 joerg Exp $ */ /* * refclock_true - clock driver for the Kinemetrics Truetime receivers @@ -203,6 +203,7 @@ struct refclock refclock_true = { #if !defined(__STDC__) # define true_debug (void) #else +NTP_PRINTF(2, 3) static void true_debug(struct peer *peer, const char *fmt, ...) {
CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: joerg Date: Thu Jan 2 21:37:00 UTC 2014 Modified Files: src/external/bsd/ntp/dist/ntpd: ntp_control.c Log Message: Don't pass in a format string, but flags for using %f / %g and the desired precision. Allows format string verification to work correctly. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/external/bsd/ntp/dist/ntpd/ntp_control.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/ntp_control.c diff -u src/external/bsd/ntp/dist/ntpd/ntp_control.c:1.7 src/external/bsd/ntp/dist/ntpd/ntp_control.c:1.8 --- src/external/bsd/ntp/dist/ntpd/ntp_control.c:1.7 Sat Dec 28 03:20:14 2013 +++ src/external/bsd/ntp/dist/ntpd/ntp_control.c Thu Jan 2 21:37:00 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_control.c,v 1.7 2013/12/28 03:20:14 christos Exp $ */ +/* $NetBSD: ntp_control.c,v 1.8 2014/01/02 21:37:00 joerg Exp $ */ /* * ntp_control.c - respond to mode 6 control messages and send async @@ -60,13 +60,10 @@ static u_short ctlclkstatus (struct refc static void ctl_flushpkt (u_char); static void ctl_putdata (const char *, unsigned int, int); static void ctl_putstr (const char *, const char *, size_t); -static void ctl_putdblf (const char *, const char *, double); -const char ctl_def_dbl_fmt[] = %.3f; -#define ctl_putdbl(tag, d) ctl_putdblf(tag, ctl_def_dbl_fmt, d) -const char ctl_def_dbl6_fmt[] = %.6f; -#define ctl_putdbl6(tag, d) ctl_putdblf(tag, ctl_def_dbl6_fmt, d) -const char ctl_def_sfp_fmt[] = %g; -#define ctl_putsfp(tag, sfp) ctl_putdblf(tag, ctl_def_sfp_fmt, \ +static void ctl_putdblf (const char *, int, int, double); +#define ctl_putdbl(tag, d) ctl_putdblf(tag, 1, 3, d) +#define ctl_putdbl6(tag, d) ctl_putdblf(tag, 1, 6, d) +#define ctl_putsfp(tag, sfp) ctl_putdblf(tag, 0, -1, \ FPTOD(sfp)) static void ctl_putuint (const char *, u_long); static void ctl_puthex (const char *, u_long); @@ -1426,7 +1423,8 @@ ctl_putunqstr( static void ctl_putdblf( const char * tag, - const char * fmt, + int use_f, + int precision, double d ) { @@ -1440,7 +1438,8 @@ ctl_putdblf( *cp++ = *cq++; *cp++ = '='; NTP_INSIST((size_t)(cp - buffer) sizeof(buffer)); - snprintf(cp, sizeof(buffer) - (cp - buffer), fmt, d); + snprintf(cp, sizeof(buffer) - (cp - buffer), use_f ? %.*f : %.*g, + precision, d); cp += strlen(cp); ctl_putdata(buffer, (unsigned)(cp - buffer), 0); } @@ -2097,7 +2096,7 @@ ctl_putsys( case CS_K_OFFSET: CTL_IF_KERNLOOP( ctl_putdblf, - (sys_var[varid].text, %g, to_ms * ntx.offset) + (sys_var[varid].text, 0, -1, to_ms * ntx.offset) ); break; @@ -2111,7 +2110,7 @@ ctl_putsys( case CS_K_MAXERR: CTL_IF_KERNLOOP( ctl_putdblf, - (sys_var[varid].text, %.6g, + (sys_var[varid].text, 0, 6, to_ms * ntx.maxerror) ); break; @@ -2119,7 +2118,7 @@ ctl_putsys( case CS_K_ESTERR: CTL_IF_KERNLOOP( ctl_putdblf, - (sys_var[varid].text, %.6g, + (sys_var[varid].text, 0, 6, to_ms * ntx.esterror) ); break; @@ -2143,7 +2142,7 @@ ctl_putsys( case CS_K_PRECISION: CTL_IF_KERNLOOP( ctl_putdblf, - (sys_var[varid].text, %.6g, + (sys_var[varid].text, 0, 6, to_ms * ntx.precision) ); break;
CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: christos Date: Wed Jan 1 19:52:58 UTC 2014 Modified Files: src/external/bsd/ntp/dist/ntpd: refclock_acts.c Log Message: fd == 0 is a valid descriptor! To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/external/bsd/ntp/dist/ntpd/refclock_acts.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/refclock_acts.c diff -u src/external/bsd/ntp/dist/ntpd/refclock_acts.c:1.6 src/external/bsd/ntp/dist/ntpd/refclock_acts.c:1.7 --- src/external/bsd/ntp/dist/ntpd/refclock_acts.c:1.6 Fri Dec 27 22:20:14 2013 +++ src/external/bsd/ntp/dist/ntpd/refclock_acts.c Wed Jan 1 14:52:58 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_acts.c,v 1.6 2013/12/28 03:20:14 christos Exp $ */ +/* $NetBSD: refclock_acts.c,v 1.7 2014/01/01 19:52:58 christos Exp $ */ /* * refclock_acts - clock driver for the NIST/USNO/PTB/NPL Computer Time @@ -517,7 +517,7 @@ acts_timeout( up-unit); fd = refclock_open(device, SPEED232, LDISC_ACTS | LDISC_RAW | LDISC_REMOTE); - if (fd = 0) { + if (fd 0) { msyslog(LOG_ERR, acts: open fails %m); return; }
CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: christos Date: Mon Dec 30 17:41:57 UTC 2013 Modified Files: src/external/bsd/ntp/dist/ntpd: ntp_scanner.c Log Message: prevent coredumps from syntax errors in the config file causing negative include indexes To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/external/bsd/ntp/dist/ntpd/ntp_scanner.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/ntp_scanner.c diff -u src/external/bsd/ntp/dist/ntpd/ntp_scanner.c:1.5 src/external/bsd/ntp/dist/ntpd/ntp_scanner.c:1.6 --- src/external/bsd/ntp/dist/ntpd/ntp_scanner.c:1.5 Fri Dec 27 22:20:14 2013 +++ src/external/bsd/ntp/dist/ntpd/ntp_scanner.c Mon Dec 30 12:41:57 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_scanner.c,v 1.5 2013/12/28 03:20:14 christos Exp $ */ +/* $NetBSD: ntp_scanner.c,v 1.6 2013/12/30 17:41:57 christos Exp $ */ /* ntp_scanner.c @@ -504,7 +504,7 @@ yylex( if (EOF == ch) { - if (!input_from_file || !curr_include_level) + if (!input_from_file || curr_include_level = 0) return 0; FCLOSE(fp[curr_include_level]);
CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: christos Date: Sat Dec 28 17:00:50 UTC 2013 Modified Files: src/external/bsd/ntp/dist/ntpd: ntp_io.c Log Message: 32 bit build fixes. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/external/bsd/ntp/dist/ntpd/ntp_io.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/ntp_io.c diff -u src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.11 src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.12 --- src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.11 Fri Dec 27 22:20:14 2013 +++ src/external/bsd/ntp/dist/ntpd/ntp_io.c Sat Dec 28 12:00:50 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_io.c,v 1.11 2013/12/28 03:20:14 christos Exp $ */ +/* $NetBSD: ntp_io.c,v 1.12 2013/12/28 17:00:50 christos Exp $ */ /* * ntp_io.c - input/output routines for ntpd. The socket-opening code @@ -3307,8 +3307,8 @@ fetch_timestamp( tvp-tv_usec = (long)(ticks * 1e6 * sys_tick); } -DPRINTF(4, (fetch_timestamp: system usec network time stamp: %ld.%06ld\n, - tvp-tv_sec, (long)tvp-tv_usec)); +DPRINTF(4, (fetch_timestamp: system usec network time stamp: %jd.%06ld\n, + (intmax_t)tvp-tv_sec, (long)tvp-tv_usec)); nts = tval_stamp_to_lfp(*tvp); break; #endif /* HAVE_TIMESTAMP */
CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: kardel Date: Fri Aug 17 22:37:26 UTC 2012 Modified Files: src/external/bsd/ntp/dist/ntpd: ntp_io.c Log Message: re-enable broadcast client config after interface re-scanning make broadcast transmission work again To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/external/bsd/ntp/dist/ntpd/ntp_io.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/ntp_io.c diff -u src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.9 src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.10 --- src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.9 Wed Feb 1 21:21:25 2012 +++ src/external/bsd/ntp/dist/ntpd/ntp_io.c Fri Aug 17 22:37:26 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_io.c,v 1.9 2012/02/01 21:21:25 kardel Exp $ */ +/* $NetBSD: ntp_io.c,v 1.10 2012/08/17 22:37:26 kardel Exp $ */ /* * ntp_io.c - input/output routines for ntpd. The socket-opening code @@ -1592,9 +1592,11 @@ refresh_interface( { #ifdef OS_MISSES_SPECIFIC_ROUTE_UPDATES if (interface-fd != INVALID_SOCKET) { + int bcast = (interface-flags INT_BCASTOPEN) != 0; close_and_delete_fd_from_list(interface-fd); + interface-flags = ~INT_BCASTOPEN; interface-fd = open_socket(interface-sin, - 0, 0, interface); + bcast, 0, interface); /* * reset TTL indication so TTL is is set again * next time around @@ -2047,6 +2049,9 @@ update_interfaces( msyslog(LOG_INFO, peers refreshed); } + if (sys_bclient) + io_setbclient(); + return new_interface_found; } @@ -2074,9 +2079,6 @@ create_sockets( update_interfaces(port, NULL, NULL); - if (sys_bclient) - io_setbclient(); - /* * Now that we have opened all the sockets, turn off the reuse * flag for security.
CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: christos Date: Sun Aug 12 06:16:51 UTC 2012 Modified Files: src/external/bsd/ntp/dist/ntpd: refclock_parse.c Log Message: - make the append function to not append past the end of the string - use the append function some more To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/external/bsd/ntp/dist/ntpd/refclock_parse.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/refclock_parse.c diff -u src/external/bsd/ntp/dist/ntpd/refclock_parse.c:1.7 src/external/bsd/ntp/dist/ntpd/refclock_parse.c:1.8 --- src/external/bsd/ntp/dist/ntpd/refclock_parse.c:1.7 Sat Aug 11 16:09:08 2012 +++ src/external/bsd/ntp/dist/ntpd/refclock_parse.c Sun Aug 12 02:16:51 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_parse.c,v 1.7 2012/08/11 20:09:08 kardel Exp $ */ +/* $NetBSD: refclock_parse.c,v 1.8 2012/08/12 06:16:51 christos Exp $ */ /* * /src/NTP/REPOSITORY/ntp4-dev/ntpd/refclock_parse.c,v 4.81 2009/05/01 10:15:29 kardel RELEASE_20090105_A @@ -2423,12 +2423,23 @@ ap(char *buffer, size_t len, char *pos, { va_list va; int l; + size_t rem = len - (pos - buffer); + + if (rem == 0) + return pos; va_start(va, fmt); - l = vsnprintf(pos, len - (pos - buffer), fmt, va); + l = vsnprintf(pos, rem, fmt, va); va_end(va); - if (l != -1) - pos += l; + + if (l != -1) { + rem--; + if (rem = l) + pos += l; + else + pos += rem; + } + return pos; } @@ -5419,7 +5430,7 @@ trimbletsip_message( if (s) { - snprintf(t, BUFFER_SIZE(pbuffer, t), %s=\, s-varname); + t = ap(pbuffer, sizeof(pbuffer), t, %s=\, s-varname); } else { @@ -5429,12 +5440,10 @@ trimbletsip_message( var_flag = s-varmode; - t += strlen(t); - switch(cmd) { case CMD_RCURTIME: - snprintf(t, BUFFER_SIZE(pbuffer, t), %f, %d, %f, + t = ap(pbuffer, sizeof(pbuffer), t, %f, %d, %f, getflt((unsigned char *)mb(0)), getshort((unsigned char *)mb(4)), getflt((unsigned char *)mb(6))); break;
CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: christos Date: Sun Aug 12 07:22:24 UTC 2012 Modified Files: src/external/bsd/ntp/dist/ntpd: refclock_parse.c Log Message: add cast. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/external/bsd/ntp/dist/ntpd/refclock_parse.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/refclock_parse.c diff -u src/external/bsd/ntp/dist/ntpd/refclock_parse.c:1.8 src/external/bsd/ntp/dist/ntpd/refclock_parse.c:1.9 --- src/external/bsd/ntp/dist/ntpd/refclock_parse.c:1.8 Sun Aug 12 02:16:51 2012 +++ src/external/bsd/ntp/dist/ntpd/refclock_parse.c Sun Aug 12 03:22:24 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_parse.c,v 1.8 2012/08/12 06:16:51 christos Exp $ */ +/* $NetBSD: refclock_parse.c,v 1.9 2012/08/12 07:22:24 christos Exp $ */ /* * /src/NTP/REPOSITORY/ntp4-dev/ntpd/refclock_parse.c,v 4.81 2009/05/01 10:15:29 kardel RELEASE_20090105_A @@ -2434,7 +2434,7 @@ ap(char *buffer, size_t len, char *pos, if (l != -1) { rem--; - if (rem = l) + if (rem = (size_t)l) pos += l; else pos += rem;
CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: kardel Date: Sat Aug 11 20:09:08 UTC 2012 Modified Files: src/external/bsd/ntp/dist/ntpd: refclock_parse.c Log Message: fix some fallout from append correction To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/external/bsd/ntp/dist/ntpd/refclock_parse.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/refclock_parse.c diff -u src/external/bsd/ntp/dist/ntpd/refclock_parse.c:1.6 src/external/bsd/ntp/dist/ntpd/refclock_parse.c:1.7 --- src/external/bsd/ntp/dist/ntpd/refclock_parse.c:1.6 Fri Aug 10 08:22:49 2012 +++ src/external/bsd/ntp/dist/ntpd/refclock_parse.c Sat Aug 11 20:09:08 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_parse.c,v 1.6 2012/08/10 08:22:49 christos Exp $ */ +/* $NetBSD: refclock_parse.c,v 1.7 2012/08/11 20:09:08 kardel Exp $ */ /* * /src/NTP/REPOSITORY/ntp4-dev/ntpd/refclock_parse.c,v 4.81 2009/05/01 10:15:29 kardel RELEASE_20090105_A @@ -3527,7 +3527,9 @@ parse_control( tmpctl.parsegettc.parse_state |= parse-timedata.parse_state (PARSEB_PPS|PARSEB_S_PPS); - (void) parsestate(tmpctl.parsegettc.parse_state, tt, BUFFER_SIZES(start, tt, 512)); + (void)parsestate(tmpctl.parsegettc.parse_state, tt, BUFFER_SIZES(start, tt, 512)); + + tt += strlen(tt); tt = ap(start, 512, tt, \); @@ -3546,13 +3548,18 @@ parse_control( } else { + int count = tmpctl.parseformat.parse_count - 1; + start = tt = add_var(out-kv_list, 80, RO|DEF); tt = ap(start, 80, tt, refclock_format=\); - tt = ap(start, 80, tt, *.*s, - tmpctl.parseformat.parse_count, - tmpctl.parseformat.parse_count, - tmpctl.parseformat.parse_buffer); + if (count 0) { +tt = ap(start, 80, tt, %*.*s, + count, + count, + tmpctl.parseformat.parse_buffer); + } + tt = ap(start, 80, tt, \); } @@ -4535,8 +4542,8 @@ gps16x_message( if (utc.valid) { p = ap(buffer, sizeof(buffer), p, gps_utc_correction=\); - p += strlen(p); mk_utcinfo(p, utc.t0t.wn, utc.WNlsf, utc.DNt, utc.delta_tls, utc.delta_tlsf, BUFFER_SIZE(buffer, p)); + p += strlen(p); p = ap(buffer, sizeof(buffer), p, \); } else @@ -5457,7 +5464,6 @@ trimbletsip_message( t = ap(pbuffer, sizeof(pbuffer), t, -MANUAL, ); else t = ap(pbuffer, sizeof(pbuffer), t, -AUTO, ); - t += strlen(t); t = ap(pbuffer, sizeof(pbuffer), t, satellites %02d %02d %02d %02d, PDOP %.2f, HDOP %.2f, VDOP %.2f, TDOP %.2f, mb(1), mb(2), mb(3), mb(4),
CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: christos Date: Fri Aug 10 08:22:49 UTC 2012 Modified Files: src/external/bsd/ntp/dist/ntpd: refclock_parse.c Log Message: Homogenize all strn{cpy,cat} and snprintf() to a single append function to prevent incorrect usage and buffer overflow. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/external/bsd/ntp/dist/ntpd/refclock_parse.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/refclock_parse.c diff -u src/external/bsd/ntp/dist/ntpd/refclock_parse.c:1.5 src/external/bsd/ntp/dist/ntpd/refclock_parse.c:1.6 --- src/external/bsd/ntp/dist/ntpd/refclock_parse.c:1.5 Wed Feb 1 02:46:22 2012 +++ src/external/bsd/ntp/dist/ntpd/refclock_parse.c Fri Aug 10 04:22:49 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_parse.c,v 1.5 2012/02/01 07:46:22 kardel Exp $ */ +/* $NetBSD: refclock_parse.c,v 1.6 2012/08/10 08:22:49 christos Exp $ */ /* * /src/NTP/REPOSITORY/ntp4-dev/ntpd/refclock_parse.c,v 4.81 2009/05/01 10:15:29 kardel RELEASE_20090105_A @@ -2418,6 +2418,20 @@ init_iobinding( ** support routines **/ +static char * +ap(char *buffer, size_t len, char *pos, const char *fmt, ...) +{ + va_list va; + int l; + + va_start(va, fmt); + l = vsnprintf(pos, len - (pos - buffer), fmt, va); + va_end(va); + if (l != -1) + pos += l; + return pos; +} + /*-- * convert a flag field to a string */ @@ -2464,8 +2478,6 @@ parsestate( int i; char *s, *t; - - *buffer = '\0'; s = t = buffer; i = 0; @@ -2474,9 +2486,8 @@ parsestate( if (flagstrings[i].bit lstate) { if (s != t) -strncpy(t, ; , BUFFER_SIZES(buffer, t, size)); - strncat(t, flagstrings[i].name, BUFFER_SIZES(buffer, t, size)); - t += strlen(t); +t = ap(buffer, size, t, ; ); + t = ap(buffer, size, t, %s, flagstrings[i].name); } i++; } @@ -2484,13 +2495,11 @@ parsestate( if (lstate (PARSEB_S_LEAP|PARSEB_S_ANTENNA|PARSEB_S_PPS|PARSEB_S_POSITION)) { if (s != t) - strncpy(t, ; , BUFFER_SIZES(buffer, t, size)); - - t += strlen(t); + t = ap(buffer, size, t, ; ); - strncpy(t, (, BUFFER_SIZES(buffer, t, size)); + t = ap(buffer, size, t, (); - s = t = t + strlen(t); + s = t; i = 0; while (sflagstrings[i].bit) @@ -2499,16 +2508,15 @@ parsestate( { if (t != s) { - strncpy(t, ; , BUFFER_SIZES(buffer, t, size)); - t += 2; + t = ap(buffer, size, t, ; ); } -strncpy(t, sflagstrings[i].name, BUFFER_SIZES(buffer, t, size)); -t += strlen(t); +t = ap(buffer, size, t, %s, +sflagstrings[i].name); } i++; } - strncpy(t, ), BUFFER_SIZES(buffer, t, size)); + t = ap(buffer, size, t, )); } return buffer; } @@ -2539,7 +2547,9 @@ parsestatus( { 0, NULL } }; int i; + char *t; + t = buffer; *buffer = '\0'; i = 0; @@ -2547,9 +2557,9 @@ parsestatus( { if (flagstrings[i].bit lstate) { - if (buffer[0]) -strncat(buffer, ; , size); - strncat(buffer, flagstrings[i].name, size - 2); + if (t == buffer) +t = ap(buffer, size, t, ; ); + t = ap(buffer, size, t, %s, flagstrings[i].name); } i++; } @@ -2612,10 +2622,11 @@ l_mktime( char *t; buffer[0] = '\0'; + t = buffer; if ((tmp = delta / (60*60*24)) != 0) { - snprintf(buffer, BUFFER_SIZE(buffer, buffer), %ldd+, (u_long)tmp); + t = ap(buffer, sizeof(buffer), t, %ldd+, (u_long)tmp); delta -= tmp * 60*60*24; } @@ -2624,10 +2635,8 @@ l_mktime( m = delta % 60; delta /= 60; - t = buffer + strlen(buffer); - - snprintf(t, BUFFER_SIZE(buffer, t), %02d:%02d:%02d, - (int)delta, (int)m, (int)s); + t = ap(buffer, sizeof(buffer), t, %02d:%02d:%02d, + (int)delta, (int)m, (int)s); return buffer; } @@ -3206,7 +3215,7 @@ parse_start( return 0; /* well, ok - special initialisation broke */ } - strncpy(tmp_ctl.parseformat.parse_buffer, parse-parse_type-cl_format, sizeof(tmp_ctl.parseformat.parse_buffer)); + strlcpy(tmp_ctl.parseformat.parse_buffer, parse-parse_type-cl_format, sizeof(tmp_ctl.parseformat.parse_buffer)); tmp_ctl.parseformat.parse_count = strlen(tmp_ctl.parseformat.parse_buffer); if (!PARSE_SETFMT(parse, tmp_ctl)) @@ -3490,16 +3499,16 @@ parse_control( } start = tt = add_var(out-kv_list, 128, RO|DEF); - snprintf(tt, 128, refclock_time=\); - tt += strlen(tt); + tt = ap(start, 128, tt, refclock_time=\); if (parse-timedata.parse_time.fp.l_ui == 0) { - strncpy(tt, UNDEFINED\, BUFFER_SIZES(start, tt, 128)); + tt = ap(start, 128, tt, UNDEFINED\); } else { - snprintf(tt, 128, %s\, gmprettydate(parse-timedata.parse_time.fp)); + tt = ap(start, 128, tt, %s\, + gmprettydate(parse-timedata.parse_time.fp)); } if (!PARSE_GETTIMECODE(parse, tmpctl)) @@ -3510,8 +3519,7 @@ parse_control( else { start = tt = add_var(out-kv_list, 512,
CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: kardel Date: Wed Feb 1 21:21:26 UTC 2012 Modified Files: src/external/bsd/ntp/dist/ntpd: ntp_io.c Log Message: initialize min_dist To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/external/bsd/ntp/dist/ntpd/ntp_io.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/ntp_io.c diff -u src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.8 src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.9 --- src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.8 Wed Feb 1 20:48:01 2012 +++ src/external/bsd/ntp/dist/ntpd/ntp_io.c Wed Feb 1 21:21:25 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_io.c,v 1.8 2012/02/01 20:48:01 kardel Exp $ */ +/* $NetBSD: ntp_io.c,v 1.9 2012/02/01 21:21:25 kardel Exp $ */ /* * ntp_io.c - input/output routines for ntpd. The socket-opening code @@ -3801,7 +3801,9 @@ findclosestinterface( sockaddr_u addr_dist; sockaddr_u min_dist; + winner = NULL; + min_dist = *addr; for (ep = ep_list; ep != NULL; ep = ep-elink) { if (ep-ignore_packets ||
CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: christos Date: Wed Sep 14 16:18:29 UTC 2011 Modified Files: src/external/bsd/ntp/dist/ntpd: ntp_io.c Log Message: PR/45308: Manuel Bouyer: Update list of broadcast addresses after updating interfaces. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/external/bsd/ntp/dist/ntpd/ntp_io.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/ntp_io.c diff -u src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.5 src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.6 --- src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.5 Sun Jan 9 09:49:40 2011 +++ src/external/bsd/ntp/dist/ntpd/ntp_io.c Wed Sep 14 12:18:29 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_io.c,v 1.5 2011/01/09 14:49:40 kardel Exp $ */ +/* $NetBSD: ntp_io.c,v 1.6 2011/09/14 16:18:29 christos Exp $ */ /* * ntp_io.c - input/output routines for ntpd. The socket-opening code @@ -1782,7 +1782,10 @@ create_wildcards(port); update_interfaces(port, NULL, NULL); - + + if (sys_bclient) + io_setbclient(); + /* * Now that we have opened all the sockets, turn off the reuse * flag for security.
CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: mrg Date: Fri Jul 1 02:18:37 UTC 2011 Modified Files: src/external/bsd/ntp/dist/ntpd: refclock_oncore.c Log Message: avoid a potential uninitialised variable problem. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/external/bsd/ntp/dist/ntpd/refclock_oncore.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/refclock_oncore.c diff -u src/external/bsd/ntp/dist/ntpd/refclock_oncore.c:1.3 src/external/bsd/ntp/dist/ntpd/refclock_oncore.c:1.4 --- src/external/bsd/ntp/dist/ntpd/refclock_oncore.c:1.3 Sat Dec 4 23:08:35 2010 +++ src/external/bsd/ntp/dist/ntpd/refclock_oncore.c Fri Jul 1 02:18:37 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_oncore.c,v 1.3 2010/12/04 23:08:35 christos Exp $ */ +/* $NetBSD: refclock_oncore.c,v 1.4 2011/07/01 02:18:37 mrg Exp $ */ /* @@ -2488,7 +2488,7 @@ { int chan, id, subframe, valid, page, i, j, tow; int day_now, day_lsf; - const char *cp; + const char *cp = NULL /* XXX gcc */; char Msg[120]; enum { WARN_NOT_YET,
CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: mrg Date: Fri Jul 1 02:18:54 UTC 2011 Modified Files: src/external/bsd/ntp/dist/ntpd: ntp_control.c Log Message: avoid an overflow condition. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/external/bsd/ntp/dist/ntpd/ntp_control.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/ntp_control.c diff -u src/external/bsd/ntp/dist/ntpd/ntp_control.c:1.2 src/external/bsd/ntp/dist/ntpd/ntp_control.c:1.3 --- src/external/bsd/ntp/dist/ntpd/ntp_control.c:1.2 Sat Dec 4 23:08:35 2010 +++ src/external/bsd/ntp/dist/ntpd/ntp_control.c Fri Jul 1 02:18:54 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_control.c,v 1.2 2010/12/04 23:08:35 christos Exp $ */ +/* $NetBSD: ntp_control.c,v 1.3 2011/07/01 02:18:54 mrg Exp $ */ /* * ntp_control.c - respond to control messages and send async traps @@ -527,7 +527,7 @@ */ rpkt.r_m_e_op = (u_char) (CTL_RESPONSE|CTL_ERROR|(res_opcode CTL_OP_MASK)); - rpkt.status = htons((u_short) ((errcode8) 0xff00)); + rpkt.status = htons((u_short) ((errcode 0xff) 8)); rpkt.count = 0; /*
CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: mrg Date: Wed Jun 22 03:59:50 UTC 2011 Modified Files: src/external/bsd/ntp/dist/ntpd: refclock_parse.c Log Message: fix a potential off-by-two array overflow found by GCC 4.5.3. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/external/bsd/ntp/dist/ntpd/refclock_parse.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/refclock_parse.c diff -u src/external/bsd/ntp/dist/ntpd/refclock_parse.c:1.3 src/external/bsd/ntp/dist/ntpd/refclock_parse.c:1.4 --- src/external/bsd/ntp/dist/ntpd/refclock_parse.c:1.3 Sat Dec 4 23:08:35 2010 +++ src/external/bsd/ntp/dist/ntpd/refclock_parse.c Wed Jun 22 03:59:49 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_parse.c,v 1.3 2010/12/04 23:08:35 christos Exp $ */ +/* $NetBSD: refclock_parse.c,v 1.4 2011/06/22 03:59:49 mrg Exp $ */ /* * /src/NTP/REPOSITORY/ntp4-dev/ntpd/refclock_parse.c,v 4.81 2009/05/01 10:15:29 kardel RELEASE_20090105_A @@ -2455,7 +2455,7 @@ { if (buffer[0]) strncat(buffer, ; , size); - strncat(buffer, flagstrings[i].name, size); + strncat(buffer, flagstrings[i].name, size - 2); } i++; }
CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: plunky Date: Sun Feb 27 12:10:18 UTC 2011 Modified Files: src/external/bsd/ntp/dist/ntpd: ntp_util.c Log Message: setting USE_FORT=yes means that memmove() becomes a macro, and the #ifdef inside the macro arguments is undefined behaviour (pcc reports a syntax error) This was fixed upstream so change this to be the same as the 4.2.6p3 stable release of ntp (can't find an actual changelog entry that describes this, so have included the memcpy change also - memmove is not required here) To generate a diff of this commit: cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/ntp/dist/ntpd/ntp_util.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/ntp_util.c diff -u src/external/bsd/ntp/dist/ntpd/ntp_util.c:1.1.1.1 src/external/bsd/ntp/dist/ntpd/ntp_util.c:1.2 --- src/external/bsd/ntp/dist/ntpd/ntp_util.c:1.1.1.1 Sun Dec 13 16:55:42 2009 +++ src/external/bsd/ntp/dist/ntpd/ntp_util.c Sun Feb 27 12:10:18 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_util.c,v 1.1.1.1 2009/12/13 16:55:42 kardel Exp $ */ +/* $NetBSD: ntp_util.c,v 1.2 2011/02/27 12:10:18 plunky Exp $ */ /* * ntp_util.c - stuff I didn't have any other place for @@ -358,6 +358,11 @@ int len; char tbuf[80]; char str1[20], str2[20]; +#ifndef VMS + const char temp_ext[] = .TEMP; +#else + const char temp_ext[] = -TEMP; +#endif /* * Expand environment strings under Windows NT, since the @@ -412,14 +417,10 @@ stats_temp_file = erealloc(stats_temp_file, len + sizeof(.TEMP)); - memmove(stats_drift_file, value, (unsigned)(len+1)); - memmove(stats_temp_file, value, (unsigned)len); - memmove(stats_temp_file + len, -#if !defined(VMS) - .TEMP, sizeof(.TEMP)); -#else - -TEMP, sizeof(-TEMP)); -#endif /* VMS */ + memcpy(stats_drift_file, value, (unsigned)(len+1)); + memcpy(stats_temp_file, value, (unsigned)len); + memcpy(stats_temp_file + len, temp_ext, + sizeof(temp_ext)); /* * Open drift file and read frequency. If the file is
CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: christos Date: Sat Nov 6 20:40:12 UTC 2010 Modified Files: src/external/bsd/ntp/dist/ntpd: ntp_io.c Log Message: PR/44052: Takahiro HAYASHI: chrooted ntpd refers freed memory As mentioned in the pr, process_routing_msgs can delete the current reader, so cache the next element before calling it. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/external/bsd/ntp/dist/ntpd/ntp_io.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/ntp_io.c diff -u src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.2 src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.3 --- src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.2 Sun Dec 13 19:43:58 2009 +++ src/external/bsd/ntp/dist/ntpd/ntp_io.c Sat Nov 6 16:40:12 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_io.c,v 1.2 2009/12/14 00:43:58 christos Exp $ */ +/* $NetBSD: ntp_io.c,v 1.3 2010/11/06 20:40:12 christos Exp $ */ /* * ntp_io.c - input/output routines for ntpd. The socket-opening code @@ -3355,11 +3355,14 @@ asyncio_reader = asyncio_reader_list; while (asyncio_reader != NULL) { + struct asyncio_reader *next = asyncio_reader-link; + if (FD_ISSET(asyncio_reader-fd, fds)) { ++select_count; (asyncio_reader-receiver)(asyncio_reader); } - asyncio_reader = asyncio_reader-link; + + asyncio_reader = next; } #endif /* HAS_ROUTING_SOCKET */
CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: christos Date: Wed Sep 22 14:37:08 UTC 2010 Modified Files: src/external/bsd/ntp/dist/ntpd: ntpd.c Log Message: fix typo. From Anon Ymous To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/external/bsd/ntp/dist/ntpd/ntpd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/ntpd.c diff -u src/external/bsd/ntp/dist/ntpd/ntpd.c:1.2 src/external/bsd/ntp/dist/ntpd/ntpd.c:1.3 --- src/external/bsd/ntp/dist/ntpd/ntpd.c:1.2 Sun Dec 13 19:42:47 2009 +++ src/external/bsd/ntp/dist/ntpd/ntpd.c Wed Sep 22 10:37:08 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: ntpd.c,v 1.2 2009/12/14 00:42:47 christos Exp $ */ +/* $NetBSD: ntpd.c,v 1.3 2010/09/22 14:37:08 christos Exp $ */ /* * ntpd.c - main program for the fixed point NTP daemon @@ -1179,7 +1179,7 @@ #ifdef HAVE_DNSREGISTRATION if (mdnsreg (current_time - mdnsreg ) 60 mdnstries sys_leap != LEAP_NOTINSYNC) { mdnsreg = current_time; - msyslog(LOG_INFO, Attemping to register mDNS); + msyslog(LOG_INFO, Attempting to register mDNS); if ( DNSServiceRegister (mdns, 0, 0, NULL, _ntp._udp, NULL, NULL, htons(NTP_PORT), 0, NULL, NULL, NULL) != kDNSServiceErr_NoError ) { if (!--mdnstries) {
CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: kardel Date: Sun Aug 29 18:54:30 UTC 2010 Modified Files: src/external/bsd/ntp/dist/ntpd: ntp_intres.c Log Message: make IPV6 support decision consistent with code in ntp_io.c To generate a diff of this commit: cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/ntp/dist/ntpd/ntp_intres.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/ntp_intres.c diff -u src/external/bsd/ntp/dist/ntpd/ntp_intres.c:1.1.1.1 src/external/bsd/ntp/dist/ntpd/ntp_intres.c:1.2 --- src/external/bsd/ntp/dist/ntpd/ntp_intres.c:1.1.1.1 Sun Dec 13 16:55:34 2009 +++ src/external/bsd/ntp/dist/ntpd/ntp_intres.c Sun Aug 29 18:54:30 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_intres.c,v 1.1.1.1 2009/12/13 16:55:34 kardel Exp $ */ +/* $NetBSD: ntp_intres.c,v 1.2 2010/08/29 18:54:30 kardel Exp $ */ /* * ripped off from ../ntpres/ntpres.c by Greg Troxel 4/2/92 @@ -472,7 +472,7 @@ ce = emalloc(sizeof(*ce)); ce-ce_name = estrdup(name); ce-ce_peeraddr = 0; -#ifdef ISC_PLATFORM_HAVEIPV6 +#ifdef INCLUDE_IPV6_SUPPORT ce-ce_peeraddr6 = in6addr_any; #endif ZERO_SOCK(ce-peer_store);
CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: kardel Date: Sat Aug 28 20:52:55 UTC 2010 Modified Files: src/external/bsd/ntp/dist/ntpd: ntp_scanner.c Log Message: don't return an int casted pointer as 'boolean' value - compare result of strchr with NULL To generate a diff of this commit: cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/ntp/dist/ntpd/ntp_scanner.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/ntp_scanner.c diff -u src/external/bsd/ntp/dist/ntpd/ntp_scanner.c:1.1.1.1 src/external/bsd/ntp/dist/ntpd/ntp_scanner.c:1.2 --- src/external/bsd/ntp/dist/ntpd/ntp_scanner.c:1.1.1.1 Sun Dec 13 16:56:14 2009 +++ src/external/bsd/ntp/dist/ntpd/ntp_scanner.c Sat Aug 28 20:52:55 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_scanner.c,v 1.1.1.1 2009/12/13 16:56:14 kardel Exp $ */ +/* $NetBSD: ntp_scanner.c,v 1.2 2010/08/28 20:52:55 kardel Exp $ */ /* ntp_scanner.c @@ -353,7 +353,7 @@ int ch ) { - return (int)strchr(special_chars, ch); + return strchr(special_chars, ch) != NULL; }
CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: tonnerre Date: Sun Apr 25 22:50:11 UTC 2010 Modified Files: src/external/bsd/ntp/dist/ntpd: ntp_request.c Log Message: Prevent ntpd instances from sending MODE_PRIVATE error responses back and forth. This resolves CVE-2009-3563, but it should be noted that nobody uses this code so far, so this is more of a preventive update than a security one. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/external/bsd/ntp/dist/ntpd/ntp_request.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/ntp_request.c diff -u src/external/bsd/ntp/dist/ntpd/ntp_request.c:1.2 src/external/bsd/ntp/dist/ntpd/ntp_request.c:1.3 --- src/external/bsd/ntp/dist/ntpd/ntp_request.c:1.2 Mon Dec 14 00:46:21 2009 +++ src/external/bsd/ntp/dist/ntpd/ntp_request.c Sun Apr 25 22:50:11 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_request.c,v 1.2 2009/12/14 00:46:21 christos Exp $ */ +/* $NetBSD: ntp_request.c,v 1.3 2010/04/25 22:50:11 tonnerre Exp $ */ /* * ntp_request.c - respond to information requests @@ -411,6 +411,7 @@ int mod_okay ) { + static u_long quiet_until; struct req_pkt *inpkt; struct req_pkt_tail *tailinpkt; sockaddr_u *srcadr; @@ -449,8 +450,14 @@ || (++ec, INFO_MBZ(inpkt-mbz_itemsize) != 0) || (++ec, rbufp-recv_length REQ_LEN_HDR) ) { - msyslog(LOG_ERR, process_private: INFO_ERR_FMT: test %d failed, pkt from %s, ec, stoa(srcadr)); - req_ack(srcadr, inter, inpkt, INFO_ERR_FMT); + NLOG(NLOG_SYSEVENT) + if (current_time = quiet_until) { +msyslog(LOG_ERR, + process_private: drop test %d + failed, pkt from %s, + ec, stoa(srcadr)); +quiet_until = current_time + 60; + } return; }
CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: christos Date: Mon Dec 14 00:40:26 UTC 2009 Modified Files: src/external/bsd/ntp/dist/ntpd: ntp_crypto.c Log Message: constify To generate a diff of this commit: cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/ntp/dist/ntpd/ntp_crypto.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/ntp_crypto.c diff -u src/external/bsd/ntp/dist/ntpd/ntp_crypto.c:1.1.1.1 src/external/bsd/ntp/dist/ntpd/ntp_crypto.c:1.2 --- src/external/bsd/ntp/dist/ntpd/ntp_crypto.c:1.1.1.1 Sun Dec 13 11:55:33 2009 +++ src/external/bsd/ntp/dist/ntpd/ntp_crypto.c Sun Dec 13 19:40:26 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_crypto.c,v 1.1.1.1 2009/12/13 16:55:33 kardel Exp $ */ +/* $NetBSD: ntp_crypto.c,v 1.2 2009/12/14 00:40:26 christos Exp $ */ /* * ntp_crypto.c - NTP version 4 public key routines @@ -403,7 +403,7 @@ keyid_t cookie; /* crumbles */ int hismode; /* packet mode */ int rval = XEVNT_OK; - u_char *ptr; + const u_char *ptr; u_int32 temp32; /* @@ -1553,7 +1553,8 @@ tstamp_t tstamp; /* NTP timestamp */ u_int32 temp32; u_int len; - u_char *ptr; + const u_char *ptr; + u_char *sptr; /* * Extract the public key from the request. @@ -1577,9 +1578,9 @@ len = EVP_PKEY_size(pkey); vp-vallen = htonl(len); vp-ptr = emalloc(len); - ptr = vp-ptr; + sptr = vp-ptr; temp32 = htonl(*cookie); - if (RSA_public_encrypt(4, (u_char *)temp32, ptr, + if (RSA_public_encrypt(4, (const u_char *)temp32, sptr, pkey-pkey.rsa, RSA_PKCS1_OAEP_PADDING) = 0) { msyslog(LOG_ERR, crypto_encrypt: %s, ERR_error_string(ERR_get_error(), NULL)); @@ -2946,7 +2947,7 @@ EVP_MD_CTX ctx; /* message digest context */ tstamp_t tstamp; /* NTP timestamp */ u_int len; - u_char *ptr; + const u_char *ptr; int i, temp; /* @@ -3029,7 +3030,7 @@ vp-vallen = htonl(len); vp-ptr = emalloc(len); ptr = vp-ptr; - i2d_X509(cert, ptr); + i2d_X509(cert, (unsigned char **)ptr); vp-siglen = 0; if (tstamp != 0) { vp-sig = emalloc(sign_siglen); @@ -3132,7 +3133,7 @@ { struct cert_info *xp; /* subject certificate */ X509 *cert; /* X509 certificate */ - u_char *ptr; + const u_char *ptr; /* * Save the issuer on the new certificate, but remember the old @@ -3231,7 +3232,7 @@ struct cert_info *ret; /* certificate info/value */ BIO *bp; char pathbuf[MAXFILENAME]; - u_char *ptr; + const u_char *ptr; int temp, cnt, i; /*
CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: christos Date: Mon Dec 14 00:41:03 UTC 2009 Modified Files: src/external/bsd/ntp/dist/ntpd: ntp_loopfilter.c Log Message: bring back our status printing function To generate a diff of this commit: cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/ntp/dist/ntpd/ntp_loopfilter.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/ntp_loopfilter.c diff -u src/external/bsd/ntp/dist/ntpd/ntp_loopfilter.c:1.1.1.1 src/external/bsd/ntp/dist/ntpd/ntp_loopfilter.c:1.2 --- src/external/bsd/ntp/dist/ntpd/ntp_loopfilter.c:1.1.1.1 Sun Dec 13 11:55:34 2009 +++ src/external/bsd/ntp/dist/ntpd/ntp_loopfilter.c Sun Dec 13 19:41:03 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_loopfilter.c,v 1.1.1.1 2009/12/13 16:55:34 kardel Exp $ */ +/* $NetBSD: ntp_loopfilter.c,v 1.2 2009/12/14 00:41:03 christos Exp $ */ /* * ntp_loopfilter.c - implements the NTP loop filter algorithm @@ -20,6 +20,9 @@ #include signal.h #include setjmp.h +#ifdef __NetBSD__ +#include util.h +#endif #if defined(VMS) defined(VMS_LOCALUNIT) /*wjm*/ #include ntp_refclock.h @@ -178,6 +181,19 @@ #endif /* SIGSYS */ #endif /* KERNEL_PLL */ +static void +sync_status(const char *what, int status) +{ + char buf[256], tbuf[1024]; +#ifdef STA_FMT + snprintb(buf, sizeof(buf), STA_FMT, status); +#else + snprintf(buf, sizeof(buf), %04x, status); +#endif + snprintf(tbuf, sizeof(tbuf), %s status=%s, what, buf); + report_event(EVNT_KERN, NULL, tbuf); +} + /* * init_loopfilter - initialize loop filter data */ @@ -545,16 +561,13 @@ * Enable/disable the PPS if requested. */ if (pps_enable) { -if (!(pll_status STA_PPSTIME)) - report_event(EVNT_KERN, - NULL, PPS enabled); ntv.status |= STA_PPSTIME | STA_PPSFREQ; +if (!(pll_status STA_PPSTIME)) + sync_status(PPS enbled, ntv.status); } else { +ntv.status = ~(STA_PPSTIME | STA_PPSFREQ); if (pll_status STA_PPSTIME) - report_event(EVNT_KERN, - NULL, PPS disabled); -ntv.status = ~(STA_PPSTIME | -STA_PPSFREQ); + sync_status(PPS disabled, ntv.status); } if (sys_leap == LEAP_ADDSECOND) ntv.status |= STA_INS; @@ -569,8 +582,12 @@ */ if (ntp_adjtime(ntv) == TIME_ERROR) { if (!(ntv.status STA_PPSSIGNAL)) -report_event(EVNT_KERN, NULL, -PPS no signal); +sync_status(PPS no signal, ntv.status); + else +sync_status(adjtime error, ntv.status); + } else { + if ((ntv.status ^ pll_status) ~STA_FLL) +sync_status(status change, ntv.status); } pll_status = ntv.status; #ifdef STA_NANO @@ -914,8 +931,7 @@ if (pll_status STA_CLK) ext_enable = 1; #endif /* STA_NANO */ - report_event(EVNT_KERN, NULL, - kernel time sync enabled); + sync_status(kernel time sync enabled, ntv.status); } #endif /* KERNEL_PLL */ #endif /* LOCKCLOCK */ @@ -953,8 +969,7 @@ ntv.modes = MOD_STATUS; ntv.status = STA_UNSYNC; ntp_adjtime(ntv); - report_event(EVNT_KERN, NULL, - kernel time sync disabledx); + sync_status(kernel time sync disabled, ntv.status); } #endif /* KERNEL_PLL */ #endif /* LOCKCLOCK */
CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: christos Date: Mon Dec 14 00:42:21 UTC 2009 Modified Files: src/external/bsd/ntp/dist/ntpd: refclock_acts.c Log Message: fix debug printf format fix bogus ctype cast To generate a diff of this commit: cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/ntp/dist/ntpd/refclock_acts.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/refclock_acts.c diff -u src/external/bsd/ntp/dist/ntpd/refclock_acts.c:1.1.1.1 src/external/bsd/ntp/dist/ntpd/refclock_acts.c:1.2 --- src/external/bsd/ntp/dist/ntpd/refclock_acts.c:1.1.1.1 Sun Dec 13 11:55:43 2009 +++ src/external/bsd/ntp/dist/ntpd/refclock_acts.c Sun Dec 13 19:42:21 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_acts.c,v 1.1.1.1 2009/12/13 16:55:43 kardel Exp $ */ +/* $NetBSD: refclock_acts.c,v 1.2 2009/12/14 00:42:21 christos Exp $ */ /* * refclock_acts - clock driver for the NIST/USNO/PTB/NPL Computer Time @@ -330,7 +330,7 @@ acts_message(peer); up-bufptr = pp-a_lastcode; } - } else if (!iscntrl(*tptr)) { + } else if (!iscntrl((unsigned char)*tptr)) { *up-bufptr++ = *tptr; if (*tptr == '*' || *tptr == '#') { up-tstamp = pp-lastrec; @@ -364,7 +364,7 @@ up = (struct actsunit *)pp-unitptr; #ifdef DEBUG ioctl(pp-io.fd, TIOCMGET, (char *)modem); - snprintf(tbuf, sizeof(tbuf), acts: %04x (%d %d) %d %s, modem, + snprintf(tbuf, sizeof(tbuf), acts: %04x (%d %d) %zu %s, modem, up-state, up-timer, strlen(pp-a_lastcode), pp-a_lastcode); if (debug)
CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: christos Date: Mon Dec 14 00:42:47 UTC 2009 Modified Files: src/external/bsd/ntp/dist/ntpd: ntpd.c Log Message: use initgroups/setgroups proper types for uid and gid. To generate a diff of this commit: cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/ntp/dist/ntpd/ntpd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/ntpd.c diff -u src/external/bsd/ntp/dist/ntpd/ntpd.c:1.1.1.1 src/external/bsd/ntp/dist/ntpd/ntpd.c:1.2 --- src/external/bsd/ntp/dist/ntpd/ntpd.c:1.1.1.1 Sun Dec 13 11:56:15 2009 +++ src/external/bsd/ntp/dist/ntpd/ntpd.c Sun Dec 13 19:42:47 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: ntpd.c,v 1.1.1.1 2009/12/13 16:56:15 kardel Exp $ */ +/* $NetBSD: ntpd.c,v 1.2 2009/12/14 00:42:47 christos Exp $ */ /* * ntpd.c - main program for the fixed point NTP daemon @@ -177,8 +177,8 @@ char *user = NULL; /* User to switch to */ char *group = NULL; /* group to switch to */ const char *chrootdir = NULL; /* directory to chroot to */ -int sw_uid; -int sw_gid; +uid_t sw_uid; +gid_t sw_gid; char *endp; struct group *gr; struct passwd *pw; @@ -962,6 +962,10 @@ msyslog(LOG_ERR, Cannot setegid() to group `%s': %m, group); exit (-1); } + if (group) + setgroups(1, sw_gid); + else + initgroups(pw-pw_name, pw-pw_gid); if (user setuid(sw_uid)) { msyslog(LOG_ERR, Cannot setuid() to user `%s': %m, user); exit (-1);
CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: christos Date: Mon Dec 14 00:43:09 UTC 2009 Modified Files: src/external/bsd/ntp/dist/ntpd: ntpd-opts.h Log Message: don't warn about SLEW; ntpd defines it! To generate a diff of this commit: cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/ntp/dist/ntpd/ntpd-opts.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/ntpd-opts.h diff -u src/external/bsd/ntp/dist/ntpd/ntpd-opts.h:1.1.1.1 src/external/bsd/ntp/dist/ntpd/ntpd-opts.h:1.2 --- src/external/bsd/ntp/dist/ntpd/ntpd-opts.h:1.1.1.1 Sun Dec 13 11:56:16 2009 +++ src/external/bsd/ntp/dist/ntpd/ntpd-opts.h Sun Dec 13 19:43:09 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: ntpd-opts.h,v 1.1.1.1 2009/12/13 16:56:16 kardel Exp $ */ +/* $NetBSD: ntpd-opts.h,v 1.2 2009/12/14 00:43:09 christos Exp $ */ /* * EDIT THIS FILE WITH CAUTION (ntpd-opts.h) @@ -236,10 +236,14 @@ # warning undefining DVAR due to option name conflict # undef DVAR # endif + +/* Defined in ntpsim.h! # ifdefSLEW # warning undefining SLEW due to option name conflict # undef SLEW # endif +*/ + # ifdefUSEPCC # warning undefining USEPCC due to option name conflict # undef USEPCC
CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: christos Date: Mon Dec 14 00:43:58 UTC 2009 Modified Files: src/external/bsd/ntp/dist/ntpd: ntp_io.c Log Message: fix for long long time_t To generate a diff of this commit: cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/ntp/dist/ntpd/ntp_io.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/ntp_io.c diff -u src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.1.1.1 src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.2 --- src/external/bsd/ntp/dist/ntpd/ntp_io.c:1.1.1.1 Sun Dec 13 11:56:13 2009 +++ src/external/bsd/ntp/dist/ntpd/ntp_io.c Sun Dec 13 19:43:58 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_io.c,v 1.1.1.1 2009/12/13 16:56:13 kardel Exp $ */ +/* $NetBSD: ntp_io.c,v 1.2 2009/12/14 00:43:58 christos Exp $ */ /* * ntp_io.c - input/output routines for ntpd. The socket-opening code @@ -3080,8 +3080,8 @@ l_fp nts; tvp = (struct timeval *)CMSG_DATA(cmsghdr); - DPRINTF(4, (fetch_timestamp: system network time stamp: %ld.%06ld\n, -tvp-tv_sec, tvp-tv_usec)); + DPRINTF(4, (fetch_timestamp: system network time stamp: %lld.%06ld\n, +(long long)tvp-tv_sec, tvp-tv_usec)); nts.l_i = tvp-tv_sec + JAN_1970; dtemp = (tvp-tv_usec + (ntp_random() * 2. / FRAC)) / 1e6;
CVS commit: src/external/bsd/ntp/dist/ntpd
Module Name:src Committed By: christos Date: Mon Dec 14 00:46:21 UTC 2009 Modified Files: src/external/bsd/ntp/dist/ntpd: ntp_refclock.c ntp_request.c refclock_arc.c refclock_heath.c refclock_neoclock4x.c refclock_nmea.c refclock_oncore.c refclock_parse.c Log Message: fix bogus ctype casts To generate a diff of this commit: cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/ntp/dist/ntpd/ntp_refclock.c \ src/external/bsd/ntp/dist/ntpd/ntp_request.c \ src/external/bsd/ntp/dist/ntpd/refclock_arc.c \ src/external/bsd/ntp/dist/ntpd/refclock_heath.c \ src/external/bsd/ntp/dist/ntpd/refclock_neoclock4x.c \ src/external/bsd/ntp/dist/ntpd/refclock_nmea.c \ src/external/bsd/ntp/dist/ntpd/refclock_oncore.c \ src/external/bsd/ntp/dist/ntpd/refclock_parse.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/ntp/dist/ntpd/ntp_refclock.c diff -u src/external/bsd/ntp/dist/ntpd/ntp_refclock.c:1.1.1.1 src/external/bsd/ntp/dist/ntpd/ntp_refclock.c:1.2 --- src/external/bsd/ntp/dist/ntpd/ntp_refclock.c:1.1.1.1 Sun Dec 13 11:55:38 2009 +++ src/external/bsd/ntp/dist/ntpd/ntp_refclock.c Sun Dec 13 19:46:21 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_refclock.c,v 1.1.1.1 2009/12/13 16:55:38 kardel Exp $ */ +/* $NetBSD: ntp_refclock.c,v 1.2 2009/12/14 00:46:21 christos Exp $ */ /* * ntp_refclock - processing support for reference clocks Index: src/external/bsd/ntp/dist/ntpd/ntp_request.c diff -u src/external/bsd/ntp/dist/ntpd/ntp_request.c:1.1.1.1 src/external/bsd/ntp/dist/ntpd/ntp_request.c:1.2 --- src/external/bsd/ntp/dist/ntpd/ntp_request.c:1.1.1.1 Sun Dec 13 11:55:40 2009 +++ src/external/bsd/ntp/dist/ntpd/ntp_request.c Sun Dec 13 19:46:21 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: ntp_request.c,v 1.1.1.1 2009/12/13 16:55:40 kardel Exp $ */ +/* $NetBSD: ntp_request.c,v 1.2 2009/12/14 00:46:21 christos Exp $ */ /* * ntp_request.c - respond to information requests @@ -411,7 +411,6 @@ int mod_okay ) { - static u_long quiet_until; struct req_pkt *inpkt; struct req_pkt_tail *tailinpkt; sockaddr_u *srcadr; @@ -450,14 +449,8 @@ || (++ec, INFO_MBZ(inpkt-mbz_itemsize) != 0) || (++ec, rbufp-recv_length REQ_LEN_HDR) ) { - NLOG(NLOG_SYSEVENT) - if (current_time = quiet_until) { -msyslog(LOG_ERR, - process_private: drop test %d - failed, pkt from %s, - ec, stoa(srcadr)); -quiet_until = current_time + 60; - } + msyslog(LOG_ERR, process_private: INFO_ERR_FMT: test %d failed, pkt from %s, ec, stoa(srcadr)); + req_ack(srcadr, inter, inpkt, INFO_ERR_FMT); return; } @@ -1183,7 +1176,7 @@ /* * Importations from the peer module */ - extern int peer_hash_count[NTP_HASH_SIZE]; + extern int peer_hash_count[]; extern int peer_free_count; extern u_long peer_timereset; extern u_long findpeer_calls; Index: src/external/bsd/ntp/dist/ntpd/refclock_arc.c diff -u src/external/bsd/ntp/dist/ntpd/refclock_arc.c:1.1.1.1 src/external/bsd/ntp/dist/ntpd/refclock_arc.c:1.2 --- src/external/bsd/ntp/dist/ntpd/refclock_arc.c:1.1.1.1 Sun Dec 13 11:55:44 2009 +++ src/external/bsd/ntp/dist/ntpd/refclock_arc.c Sun Dec 13 19:46:21 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_arc.c,v 1.1.1.1 2009/12/13 16:55:44 kardel Exp $ */ +/* $NetBSD: refclock_arc.c,v 1.2 2009/12/14 00:46:21 christos Exp $ */ /* * refclock_arc - clock driver for ARCRON MSF/DCF/WWVB receivers @@ -831,7 +831,7 @@ static int get2(char *p, int *val) { - if (!isdigit((int)p[0]) || !isdigit((int)p[1])) return 0; + if (!isdigit((unsigned char)p[0]) || !isdigit((unsigned char)p[1])) return 0; *val = (p[0] - '0') * 10 + p[1] - '0'; return 1; } @@ -839,7 +839,7 @@ static int get1(char *p, int *val) { - if (!isdigit((int)p[0])) return 0; + if (!isdigit((unsigned char)p[0])) return 0; *val = p[0] - '0'; return 1; } @@ -931,7 +931,7 @@ #ifdef DEBUG if(debug) { /* Show \r as `R', other non-printing char as `?'. */ printf(arc: stamp --%c-- (%d chars rcvd)\n, - ((c == '\r') ? 'R' : (isgraph((int)c) ? c : '?')), + ((c == '\r') ? 'R' : (isgraph((unsigned char)c) ? c : '?')), rbufp-recv_length); } #endif Index: src/external/bsd/ntp/dist/ntpd/refclock_heath.c diff -u src/external/bsd/ntp/dist/ntpd/refclock_heath.c:1.1.1.1 src/external/bsd/ntp/dist/ntpd/refclock_heath.c:1.2 --- src/external/bsd/ntp/dist/ntpd/refclock_heath.c:1.1.1.1 Sun Dec 13 11:55:48 2009 +++ src/external/bsd/ntp/dist/ntpd/refclock_heath.c Sun Dec 13 19:46:21 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: refclock_heath.c,v 1.1.1.1 2009/12/13 16:55:48 kardel Exp $ */ +/* $NetBSD: refclock_heath.c,v 1.2 2009/12/14 00:46:21 christos Exp $ */ /* * refclock_heath - clock driver for Heath GC-1000 @@ -379,7 +379,7 @@ /* * Determine synchronization and last update */ - if (!isdigit((int)dsec)) + if (!isdigit((unsigned char)dsec)) pp-leap =