summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2016-01-08 17:42:14 +0000
committerdim <dim@FreeBSD.org>2016-01-08 17:42:14 +0000
commitb5c238fc65c2ef8cd6e839857fe5cfd813cd2c59 (patch)
treeda8282d35996a372408778d38763fa68c3c354c5
parentfa38d85e2c222400fa30c70e8a913e8a213a97a7 (diff)
parent368544f6729f740145f0b6572ec35ebe304692bf (diff)
downloadFreeBSD-src-b5c238fc65c2ef8cd6e839857fe5cfd813cd2c59.zip
FreeBSD-src-b5c238fc65c2ef8cd6e839857fe5cfd813cd2c59.tar.gz
Merge ^/head r293280 through r293429.
-rw-r--r--Makefile2
-rw-r--r--Makefile.inc18
-rw-r--r--bin/sh/eval.c7
-rw-r--r--bin/sh/expand.c4
-rw-r--r--bin/sh/options.c37
-rw-r--r--bin/sh/options.h95
-rw-r--r--bin/sh/tests/builtins/Makefile2
-rw-r--r--bin/sh/tests/builtins/cd9.08
-rw-r--r--bin/sh/tests/builtins/cd9.0.stdout2
-rw-r--r--bin/sh/tests/builtins/getopts10.011
-rw-r--r--bin/sh/var.c6
-rw-r--r--contrib/ntp/ChangeLog57
-rw-r--r--contrib/ntp/CommitLog1477
-rw-r--r--contrib/ntp/NEWS107
-rwxr-xr-xcontrib/ntp/configure28
-rw-r--r--contrib/ntp/html/miscopt.html6
-rw-r--r--contrib/ntp/include/Makefile.am1
-rw-r--r--contrib/ntp/include/Makefile.in1
-rw-r--r--contrib/ntp/include/ntp_refclock.h2
-rw-r--r--contrib/ntp/include/ntp_stdlib.h8
-rw-r--r--contrib/ntp/include/ntp_worker.h66
-rw-r--r--contrib/ntp/include/ntpd.h3
-rw-r--r--contrib/ntp/include/safecast.h34
-rw-r--r--contrib/ntp/lib/isc/backtrace.c2
-rw-r--r--contrib/ntp/lib/isc/buffer.c4
-rw-r--r--contrib/ntp/lib/isc/inet_aton.c5
-rw-r--r--contrib/ntp/lib/isc/inet_pton.c6
-rw-r--r--contrib/ntp/lib/isc/log.c2
-rw-r--r--contrib/ntp/lib/isc/netaddr.c2
-rw-r--r--contrib/ntp/lib/isc/sockaddr.c4
-rw-r--r--contrib/ntp/lib/isc/task.c16
-rw-r--r--contrib/ntp/lib/isc/win32/interfaceiter.c2
-rw-r--r--contrib/ntp/lib/isc/win32/net.c3
-rw-r--r--contrib/ntp/libntp/a_md5encrypt.c28
-rw-r--r--contrib/ntp/libntp/atolfp.c4
-rw-r--r--contrib/ntp/libntp/authkeys.c30
-rw-r--r--contrib/ntp/libntp/authreadkeys.c89
-rw-r--r--contrib/ntp/libntp/authusekey.c2
-rw-r--r--contrib/ntp/libntp/dolfptoa.c6
-rw-r--r--contrib/ntp/libntp/hextolfp.c10
-rw-r--r--contrib/ntp/libntp/mstolfp.c3
-rw-r--r--contrib/ntp/libntp/msyslog.c2
-rw-r--r--contrib/ntp/libntp/ntp_crypto_rnd.c3
-rw-r--r--contrib/ntp/libntp/ntp_lineedit.c3
-rw-r--r--contrib/ntp/libntp/ntp_rfc2553.c8
-rw-r--r--contrib/ntp/libntp/ntp_worker.c3
-rw-r--r--contrib/ntp/libntp/snprintf.c20
-rw-r--r--contrib/ntp/libntp/socktohost.c12
-rw-r--r--contrib/ntp/libntp/systime.c24
-rw-r--r--contrib/ntp/libntp/work_thread.c591
-rw-r--r--contrib/ntp/libparse/clk_computime.c2
-rw-r--r--contrib/ntp/libparse/clk_dcf7000.c2
-rw-r--r--contrib/ntp/libparse/clk_hopf6021.c2
-rw-r--r--contrib/ntp/libparse/clk_meinberg.c4
-rw-r--r--contrib/ntp/libparse/clk_rawdcf.c2
-rw-r--r--contrib/ntp/libparse/clk_rcc8000.c2
-rw-r--r--contrib/ntp/libparse/clk_schmid.c2
-rw-r--r--contrib/ntp/libparse/clk_trimtaip.c2
-rw-r--r--contrib/ntp/libparse/clk_varitext.c12
-rw-r--r--contrib/ntp/libparse/clk_wharton.c2
-rw-r--r--contrib/ntp/libparse/parse.c2
-rw-r--r--contrib/ntp/ntpd/invoke-ntp.conf.texi2
-rw-r--r--contrib/ntp/ntpd/invoke-ntp.keys.texi2
-rw-r--r--contrib/ntp/ntpd/invoke-ntpd.texi4
-rw-r--r--contrib/ntp/ntpd/ntp.conf.5man6
-rw-r--r--contrib/ntp/ntpd/ntp.conf.5mdoc4
-rw-r--r--contrib/ntp/ntpd/ntp.conf.html2
-rw-r--r--contrib/ntp/ntpd/ntp.conf.man.in6
-rw-r--r--contrib/ntp/ntpd/ntp.conf.mdoc.in4
-rw-r--r--contrib/ntp/ntpd/ntp.keys.5man4
-rw-r--r--contrib/ntp/ntpd/ntp.keys.5mdoc4
-rw-r--r--contrib/ntp/ntpd/ntp.keys.html2
-rw-r--r--contrib/ntp/ntpd/ntp.keys.man.in4
-rw-r--r--contrib/ntp/ntpd/ntp.keys.mdoc.in4
-rw-r--r--contrib/ntp/ntpd/ntp_control.c10
-rw-r--r--contrib/ntp/ntpd/ntp_crypto.c4
-rw-r--r--contrib/ntp/ntpd/ntp_io.c12
-rw-r--r--contrib/ntp/ntpd/ntp_loopfilter.c46
-rw-r--r--contrib/ntp/ntpd/ntp_parser.c349
-rw-r--r--contrib/ntp/ntpd/ntp_proto.c323
-rw-r--r--contrib/ntp/ntpd/ntp_refclock.c6
-rw-r--r--contrib/ntp/ntpd/ntp_request.c4
-rw-r--r--contrib/ntp/ntpd/ntp_restrict.c4
-rw-r--r--contrib/ntp/ntpd/ntp_signd.c5
-rw-r--r--contrib/ntp/ntpd/ntp_timer.c13
-rw-r--r--contrib/ntp/ntpd/ntp_util.c6
-rw-r--r--contrib/ntp/ntpd/ntpd-opts.c14
-rw-r--r--contrib/ntp/ntpd/ntpd-opts.h6
-rw-r--r--contrib/ntp/ntpd/ntpd.1ntpdman6
-rw-r--r--contrib/ntp/ntpd/ntpd.1ntpdmdoc4
-rw-r--r--contrib/ntp/ntpd/ntpd.c14
-rw-r--r--contrib/ntp/ntpd/ntpd.html4
-rw-r--r--contrib/ntp/ntpd/ntpd.man.in6
-rw-r--r--contrib/ntp/ntpd/ntpd.mdoc.in4
-rw-r--r--contrib/ntp/ntpd/refclock_local.c1
-rw-r--r--contrib/ntp/ntpd/refclock_parse.c4
-rw-r--r--contrib/ntp/ntpd/refclock_shm.c5
-rw-r--r--contrib/ntp/ntpd/refclock_true.c2
-rw-r--r--contrib/ntp/ntpd/refclock_tsyncpci.c2
-rw-r--r--contrib/ntp/ntpdate/ntpdate.c14
-rw-r--r--contrib/ntp/ntpdc/invoke-ntpdc.texi4
-rw-r--r--contrib/ntp/ntpdc/ntpdc-opts.c14
-rw-r--r--contrib/ntp/ntpdc/ntpdc-opts.h6
-rw-r--r--contrib/ntp/ntpdc/ntpdc.1ntpdcman6
-rw-r--r--contrib/ntp/ntpdc/ntpdc.1ntpdcmdoc4
-rw-r--r--contrib/ntp/ntpdc/ntpdc.c70
-rw-r--r--contrib/ntp/ntpdc/ntpdc.h2
-rw-r--r--contrib/ntp/ntpdc/ntpdc.html4
-rw-r--r--contrib/ntp/ntpdc/ntpdc.man.in6
-rw-r--r--contrib/ntp/ntpdc/ntpdc.mdoc.in4
-rw-r--r--contrib/ntp/ntpdc/ntpdc_ops.c218
-rw-r--r--contrib/ntp/ntpq/invoke-ntpq.texi4
-rw-r--r--contrib/ntp/ntpq/libntpq.c16
-rw-r--r--contrib/ntp/ntpq/libntpq.h2
-rw-r--r--contrib/ntp/ntpq/libntpq_subs.c2
-rw-r--r--contrib/ntp/ntpq/ntpq-opts.c14
-rw-r--r--contrib/ntp/ntpq/ntpq-opts.h6
-rw-r--r--contrib/ntp/ntpq/ntpq-subs.c97
-rw-r--r--contrib/ntp/ntpq/ntpq.1ntpqman6
-rw-r--r--contrib/ntp/ntpq/ntpq.1ntpqmdoc4
-rw-r--r--contrib/ntp/ntpq/ntpq.c135
-rw-r--r--contrib/ntp/ntpq/ntpq.h18
-rw-r--r--contrib/ntp/ntpq/ntpq.html4
-rw-r--r--contrib/ntp/ntpq/ntpq.man.in6
-rw-r--r--contrib/ntp/ntpq/ntpq.mdoc.in4
-rw-r--r--contrib/ntp/ntpsnmpd/invoke-ntpsnmpd.texi4
-rw-r--r--contrib/ntp/ntpsnmpd/ntpsnmpd-opts.c14
-rw-r--r--contrib/ntp/ntpsnmpd/ntpsnmpd-opts.h6
-rw-r--r--contrib/ntp/ntpsnmpd/ntpsnmpd.1ntpsnmpdman6
-rw-r--r--contrib/ntp/ntpsnmpd/ntpsnmpd.1ntpsnmpdmdoc4
-rw-r--r--contrib/ntp/ntpsnmpd/ntpsnmpd.html2
-rw-r--r--contrib/ntp/ntpsnmpd/ntpsnmpd.man.in6
-rw-r--r--contrib/ntp/ntpsnmpd/ntpsnmpd.mdoc.in4
-rw-r--r--contrib/ntp/packageinfo.sh2
-rw-r--r--contrib/ntp/scripts/calc_tickadj/Makefile.am2
-rw-r--r--contrib/ntp/scripts/calc_tickadj/Makefile.in13
-rw-r--r--contrib/ntp/scripts/calc_tickadj/calc_tickadj.1calc_tickadjman6
-rw-r--r--contrib/ntp/scripts/calc_tickadj/calc_tickadj.1calc_tickadjmdoc4
-rw-r--r--contrib/ntp/scripts/calc_tickadj/calc_tickadj.html2
-rw-r--r--contrib/ntp/scripts/calc_tickadj/calc_tickadj.man.in6
-rw-r--r--contrib/ntp/scripts/calc_tickadj/calc_tickadj.mdoc.in4
-rw-r--r--contrib/ntp/scripts/calc_tickadj/invoke-calc_tickadj.texi2
-rw-r--r--contrib/ntp/scripts/invoke-plot_summary.texi4
-rw-r--r--contrib/ntp/scripts/invoke-summary.texi4
-rw-r--r--contrib/ntp/scripts/ntp-wait/invoke-ntp-wait.texi4
-rw-r--r--contrib/ntp/scripts/ntp-wait/ntp-wait-opts4
-rw-r--r--contrib/ntp/scripts/ntp-wait/ntp-wait.1ntp-waitman6
-rw-r--r--contrib/ntp/scripts/ntp-wait/ntp-wait.1ntp-waitmdoc4
-rw-r--r--contrib/ntp/scripts/ntp-wait/ntp-wait.html4
-rw-r--r--contrib/ntp/scripts/ntp-wait/ntp-wait.man.in6
-rw-r--r--contrib/ntp/scripts/ntp-wait/ntp-wait.mdoc.in4
-rw-r--r--contrib/ntp/scripts/ntpsweep/invoke-ntpsweep.texi4
-rw-r--r--contrib/ntp/scripts/ntpsweep/ntpsweep-opts4
-rw-r--r--contrib/ntp/scripts/ntpsweep/ntpsweep.1ntpsweepman6
-rw-r--r--contrib/ntp/scripts/ntpsweep/ntpsweep.1ntpsweepmdoc4
-rw-r--r--contrib/ntp/scripts/ntpsweep/ntpsweep.html4
-rw-r--r--contrib/ntp/scripts/ntpsweep/ntpsweep.man.in6
-rw-r--r--contrib/ntp/scripts/ntpsweep/ntpsweep.mdoc.in4
-rw-r--r--contrib/ntp/scripts/ntptrace/invoke-ntptrace.texi4
-rw-r--r--contrib/ntp/scripts/ntptrace/ntptrace-opts4
-rw-r--r--contrib/ntp/scripts/ntptrace/ntptrace.1ntptraceman6
-rw-r--r--contrib/ntp/scripts/ntptrace/ntptrace.1ntptracemdoc4
-rw-r--r--contrib/ntp/scripts/ntptrace/ntptrace.html4
-rw-r--r--contrib/ntp/scripts/ntptrace/ntptrace.man.in6
-rw-r--r--contrib/ntp/scripts/ntptrace/ntptrace.mdoc.in4
-rw-r--r--contrib/ntp/scripts/plot_summary-opts4
-rw-r--r--contrib/ntp/scripts/plot_summary.1plot_summaryman6
-rw-r--r--contrib/ntp/scripts/plot_summary.1plot_summarymdoc4
-rw-r--r--contrib/ntp/scripts/plot_summary.html4
-rw-r--r--contrib/ntp/scripts/plot_summary.man.in6
-rw-r--r--contrib/ntp/scripts/plot_summary.mdoc.in4
-rw-r--r--contrib/ntp/scripts/summary-opts4
-rw-r--r--contrib/ntp/scripts/summary.1summaryman6
-rw-r--r--contrib/ntp/scripts/summary.1summarymdoc4
-rw-r--r--contrib/ntp/scripts/summary.html4
-rw-r--r--contrib/ntp/scripts/summary.man.in6
-rw-r--r--contrib/ntp/scripts/summary.mdoc.in4
-rw-r--r--contrib/ntp/scripts/update-leap/invoke-update-leap.texi2
-rw-r--r--contrib/ntp/scripts/update-leap/update-leap-opts4
-rw-r--r--contrib/ntp/scripts/update-leap/update-leap.1update-leapman6
-rw-r--r--contrib/ntp/scripts/update-leap/update-leap.1update-leapmdoc4
-rw-r--r--contrib/ntp/scripts/update-leap/update-leap.html2
-rw-r--r--contrib/ntp/scripts/update-leap/update-leap.man.in6
-rw-r--r--contrib/ntp/scripts/update-leap/update-leap.mdoc.in4
-rwxr-xr-xcontrib/ntp/sntp/configure23
-rw-r--r--contrib/ntp/sntp/include/version.def2
-rw-r--r--contrib/ntp/sntp/include/version.texi6
-rw-r--r--contrib/ntp/sntp/invoke-sntp.texi4
-rw-r--r--contrib/ntp/sntp/m4/ntp_libevent.m43
-rw-r--r--contrib/ntp/sntp/m4/ntp_problemtests.m45
-rw-r--r--contrib/ntp/sntp/m4/version.m42
-rw-r--r--contrib/ntp/sntp/networking.c2
-rw-r--r--contrib/ntp/sntp/sntp-opts.c14
-rw-r--r--contrib/ntp/sntp/sntp-opts.h6
-rw-r--r--contrib/ntp/sntp/sntp.1sntpman6
-rw-r--r--contrib/ntp/sntp/sntp.1sntpmdoc4
-rw-r--r--contrib/ntp/sntp/sntp.html4
-rw-r--r--contrib/ntp/sntp/sntp.man.in6
-rw-r--r--contrib/ntp/sntp/sntp.mdoc.in4
-rw-r--r--contrib/ntp/sntp/tests/keyFile.c31
-rw-r--r--contrib/ntp/sntp/tests/kodDatabase.c2
-rw-r--r--contrib/ntp/sntp/tests/kodFile.c1
-rw-r--r--contrib/ntp/sntp/tests/run-kodDatabase.c11
-rw-r--r--contrib/ntp/sntp/tests/run-t-log.c6
-rw-r--r--contrib/ntp/sntp/tests/t-log.c55
-rw-r--r--contrib/ntp/sntp/tests/utilities.c4
-rw-r--r--contrib/ntp/sntp/unity/unity_internals.h14
-rw-r--r--contrib/ntp/sntp/version.c2
-rw-r--r--contrib/ntp/tests/bug-2803/bug-2803.c2
-rw-r--r--contrib/ntp/tests/bug-2803/run-bug-2803.c2
-rw-r--r--contrib/ntp/tests/libntp/a_md5encrypt.c42
-rw-r--r--contrib/ntp/tests/libntp/authkeys.c48
-rw-r--r--contrib/ntp/tests/libntp/buftvtots.c24
-rw-r--r--contrib/ntp/tests/libntp/calendar.c169
-rw-r--r--contrib/ntp/tests/libntp/caljulian.c65
-rw-r--r--contrib/ntp/tests/libntp/clocktime.c72
-rw-r--r--contrib/ntp/tests/libntp/decodenetnum.c10
-rw-r--r--contrib/ntp/tests/libntp/humandate.c18
-rw-r--r--contrib/ntp/tests/libntp/lfpfunc.c198
-rw-r--r--contrib/ntp/tests/libntp/lfptostr.c9
-rw-r--r--contrib/ntp/tests/libntp/modetoa.c10
-rw-r--r--contrib/ntp/tests/libntp/msyslog.c10
-rw-r--r--contrib/ntp/tests/libntp/netof.c57
-rw-r--r--contrib/ntp/tests/libntp/numtoa.c11
-rw-r--r--contrib/ntp/tests/libntp/numtohost.c13
-rw-r--r--contrib/ntp/tests/libntp/octtoint.c50
-rw-r--r--contrib/ntp/tests/libntp/prettydate.c15
-rw-r--r--contrib/ntp/tests/libntp/recvbuff.c5
-rw-r--r--contrib/ntp/tests/libntp/refidsmear.c15
-rw-r--r--contrib/ntp/tests/libntp/refnumtoa.c20
-rw-r--r--contrib/ntp/tests/libntp/run-a_md5encrypt.c10
-rw-r--r--contrib/ntp/tests/libntp/run-calendar.c30
-rw-r--r--contrib/ntp/tests/libntp/run-decodenetnum.c12
-rw-r--r--contrib/ntp/tests/libntp/run-humandate.c4
-rw-r--r--contrib/ntp/tests/libntp/run-lfpfunc.c18
-rw-r--r--contrib/ntp/tests/libntp/run-lfptostr.c22
-rw-r--r--contrib/ntp/tests/libntp/run-modetoa.c4
-rw-r--r--contrib/ntp/tests/libntp/run-msyslog.c16
-rw-r--r--contrib/ntp/tests/libntp/run-netof.c8
-rw-r--r--contrib/ntp/tests/libntp/run-numtoa.c4
-rw-r--r--contrib/ntp/tests/libntp/run-numtohost.c2
-rw-r--r--contrib/ntp/tests/libntp/run-prettydate.c2
-rw-r--r--contrib/ntp/tests/libntp/run-refnumtoa.c4
-rw-r--r--contrib/ntp/tests/libntp/run-sfptostr.c17
-rw-r--r--contrib/ntp/tests/libntp/run-socktoa.c12
-rw-r--r--contrib/ntp/tests/libntp/run-statestr.c8
-rw-r--r--contrib/ntp/tests/libntp/run-strtolfp.c14
-rw-r--r--contrib/ntp/tests/libntp/run-timespecops.c56
-rw-r--r--contrib/ntp/tests/libntp/run-timevalops.c56
-rw-r--r--contrib/ntp/tests/libntp/run-uglydate.c2
-rw-r--r--contrib/ntp/tests/libntp/sfptostr.c11
-rw-r--r--contrib/ntp/tests/libntp/socktoa.c15
-rw-r--r--contrib/ntp/tests/libntp/statestr.c11
-rw-r--r--contrib/ntp/tests/libntp/strtolfp.c10
-rw-r--r--contrib/ntp/tests/libntp/timespecops.c229
-rw-r--r--contrib/ntp/tests/libntp/timevalops.c228
-rw-r--r--contrib/ntp/tests/libntp/uglydate.c18
-rw-r--r--contrib/ntp/tests/ntpd/leapsec.c323
-rw-r--r--contrib/ntp/tests/ntpd/ntp_prio_q.c1
-rw-r--r--contrib/ntp/tests/ntpd/ntp_restrict.c1
-rw-r--r--contrib/ntp/tests/ntpd/rc_cmdlength.c1
-rw-r--r--contrib/ntp/tests/ntpd/run-leapsec.c66
-rw-r--r--contrib/ntp/tests/ntpd/run-ntp_restrict.c16
-rw-r--r--contrib/ntp/tests/ntpd/run-rc_cmdlength.c3
-rw-r--r--contrib/ntp/tests/ntpd/run-t-ntp_signd.c14
-rw-r--r--contrib/ntp/tests/ntpd/t-ntp_scanner.c6
-rw-r--r--contrib/ntp/tests/ntpd/t-ntp_signd.c119
-rw-r--r--contrib/ntp/tests/sandbox/run-uglydate.c3
-rw-r--r--contrib/ntp/tests/sandbox/smeartest.c6
-rw-r--r--contrib/ntp/tests/sandbox/uglydate.c23
-rw-r--r--contrib/ntp/tests/sec-2853/sec-2853.c17
-rw-r--r--contrib/ntp/util/invoke-ntp-keygen.texi4
-rw-r--r--contrib/ntp/util/ntp-keygen-opts.c14
-rw-r--r--contrib/ntp/util/ntp-keygen-opts.h6
-rw-r--r--contrib/ntp/util/ntp-keygen.1ntp-keygenman6
-rw-r--r--contrib/ntp/util/ntp-keygen.1ntp-keygenmdoc4
-rw-r--r--contrib/ntp/util/ntp-keygen.c6
-rw-r--r--contrib/ntp/util/ntp-keygen.html4
-rw-r--r--contrib/ntp/util/ntp-keygen.man.in6
-rw-r--r--contrib/ntp/util/ntp-keygen.mdoc.in4
-rw-r--r--gnu/usr.bin/binutils/ld/Makefile5
-rw-r--r--lib/libdpv/util.h4
-rw-r--r--lib/libmd/Makefile.depend3
-rw-r--r--lib/libstand/Makefile2
-rw-r--r--lib/libsysdecode/Makefile.depend22
-rw-r--r--libexec/rtld-elf/rtld.c6
-rw-r--r--libexec/rtld-elf/rtld.h1
-rw-r--r--sbin/geom/class/eli/Makefile1
-rw-r--r--share/man/man4/ioat.412
-rw-r--r--share/man/man4/nvme.418
-rw-r--r--share/man/man7/ascii.78
-rw-r--r--share/man/man9/DEVICE_PROBE.93
-rw-r--r--share/man/man9/Makefile3
-rw-r--r--share/man/man9/kern_testfrwk.93
-rw-r--r--share/man/man9/make_dev.9180
-rw-r--r--share/man/man9/malloc.92
-rw-r--r--share/man/man9/timeout.92
-rw-r--r--share/misc/ascii6
-rw-r--r--sys/amd64/include/metadata.h57
-rw-r--r--sys/arm/arm/db_interface.c4
-rw-r--r--sys/boot/efi/boot1/Makefile7
-rw-r--r--sys/boot/efi/boot1/fat-amd64.tmpl.bz2.uu34
-rw-r--r--sys/boot/efi/boot1/fat-arm.tmpl.bz2.uu39
-rw-r--r--sys/boot/efi/boot1/fat-arm64.tmpl.bz2.uu40
-rw-r--r--sys/boot/efi/boot1/fat-i386.tmpl.bz2.uu39
-rwxr-xr-xsys/boot/efi/boot1/generate-fat.sh15
-rw-r--r--sys/boot/i386/loader/main.c3
-rw-r--r--sys/boot/libstand32/Makefile1
-rw-r--r--sys/boot/libstand32/Makefile.depend1
-rw-r--r--sys/boot/userboot/test/Makefile.depend1
-rw-r--r--sys/boot/userboot/userboot/main.c55
-rw-r--r--sys/cam/ctl/ctl.c15
-rw-r--r--sys/cam/scsi/scsi_ch.c24
-rw-r--r--sys/cam/scsi/scsi_enc.c28
-rw-r--r--sys/cam/scsi/scsi_pass.c32
-rw-r--r--sys/cam/scsi/scsi_pt.c27
-rw-r--r--sys/cam/scsi/scsi_sa.c63
-rw-r--r--sys/cam/scsi/scsi_sg.c29
-rw-r--r--sys/compat/linuxkpi/common/include/linux/gfp.h8
-rw-r--r--sys/compat/linuxkpi/common/include/linux/interrupt.h23
-rw-r--r--sys/compat/linuxkpi/common/include/linux/kthread.h13
-rw-r--r--sys/compat/linuxkpi/common/include/linux/netdevice.h103
-rw-r--r--sys/compat/linuxkpi/common/src/linux_compat.c109
-rw-r--r--sys/conf/files1
-rw-r--r--sys/dev/bwi/if_bwi.c12
-rw-r--r--sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_cm.c37
-rw-r--r--sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c3
-rw-r--r--sys/dev/cxgb/ulp/tom/cxgb_listen.c17
-rw-r--r--sys/dev/cxgbe/iw_cxgbe/cm.c43
-rw-r--r--sys/dev/cxgbe/tom/t4_cpl_io.c3
-rw-r--r--sys/dev/cxgbe/tom/t4_listen.c42
-rw-r--r--sys/dev/e1000/if_em.c296
-rw-r--r--sys/dev/e1000/if_em.h20
-rw-r--r--sys/dev/if_ndis/if_ndis.c13
-rw-r--r--sys/dev/ioat/ioat.c15
-rw-r--r--sys/dev/ioat/ioat.h15
-rw-r--r--sys/dev/ismt/ismt.c2
-rw-r--r--sys/dev/iwi/if_iwi.c14
-rw-r--r--sys/dev/ixgbe/if_ix.c58
-rw-r--r--sys/dev/ixgbe/if_ixv.c5
-rw-r--r--sys/dev/malo/if_malo.c10
-rw-r--r--sys/dev/netmap/if_em_netmap.h16
-rw-r--r--sys/dev/nvd/nvd.c69
-rw-r--r--sys/dev/nvme/nvme.c2
-rw-r--r--sys/dev/nvme/nvme_ctrlr.c292
-rw-r--r--sys/dev/nvme/nvme_private.h4
-rw-r--r--sys/dev/nvme/nvme_qpair.c3
-rw-r--r--sys/dev/nvme/nvme_sysctl.c6
-rw-r--r--sys/dev/otus/if_otus.c14
-rw-r--r--sys/dev/ral/rt2560.c12
-rw-r--r--sys/dev/ral/rt2661.c12
-rw-r--r--sys/dev/ral/rt2860.c12
-rw-r--r--sys/dev/rtwn/if_rtwn.c10
-rw-r--r--sys/dev/usb/wlan/if_rsu.c13
-rw-r--r--sys/dev/usb/wlan/if_rum.c13
-rw-r--r--sys/dev/usb/wlan/if_run.c13
-rw-r--r--sys/dev/usb/wlan/if_uath.c13
-rw-r--r--sys/dev/usb/wlan/if_upgt.c11
-rw-r--r--sys/dev/usb/wlan/if_ural.c13
-rw-r--r--sys/dev/usb/wlan/if_urtw.c11
-rw-r--r--sys/dev/usb/wlan/if_urtwn.c10
-rw-r--r--sys/dev/usb/wlan/if_zyd.c11
-rw-r--r--sys/fs/ext2fs/ext2_bmap.c19
-rw-r--r--sys/geom/eli/g_eli.c83
-rw-r--r--sys/geom/eli/g_eli.h96
-rw-r--r--sys/geom/eli/g_eli_crypto.c72
-rw-r--r--sys/geom/eli/g_eli_hmac.c150
-rw-r--r--sys/geom/eli/g_eli_key_cache.c32
-rw-r--r--sys/geom/eli/pkcs5v2.c2
-rw-r--r--sys/i386/include/metadata.h37
-rw-r--r--sys/kern/kern_conf.c98
-rw-r--r--sys/kern/tty.c99
-rw-r--r--sys/kern/vfs_cache.c55
-rw-r--r--sys/modules/geom/geom_eli/Makefile1
-rw-r--r--sys/net/route.c52
-rw-r--r--sys/netgraph/netflow/netflow.c32
-rw-r--r--sys/netinet/tcp_input.c102
-rw-r--r--sys/netinet/tcp_output.c16
-rw-r--r--sys/netinet/tcp_stacks/fastpath.c4
-rw-r--r--sys/netinet/tcp_subr.c57
-rw-r--r--sys/netinet/tcp_timer.c21
-rw-r--r--sys/netinet/tcp_usrreq.c10
-rw-r--r--sys/netinet/tcp_var.h5
-rw-r--r--sys/netpfil/pf/pf.c131
-rw-r--r--sys/ofed/include/rdma/Kbuild1
-rw-r--r--sys/sys/conf.h30
-rw-r--r--sys/sys/nv.h2
-rw-r--r--sys/x86/include/metadata.h57
-rw-r--r--targets/pseudo/userland/lib/Makefile.depend1
-rw-r--r--tools/build/mk/OptionalObsoleteFiles.inc7
-rwxr-xr-xtools/tools/nanobsd/defaults.sh7
-rw-r--r--tools/tools/nanobsd/embedded/common22
-rw-r--r--usr.bin/cap_mkdb/cap_mkdb.c2
-rw-r--r--usr.bin/kdump/Makefile.depend3
-rw-r--r--usr.bin/nfsstat/Makefile.depend2
-rw-r--r--usr.bin/truss/Makefile.depend.amd643
-rw-r--r--usr.sbin/jls/Makefile.depend2
-rw-r--r--usr.sbin/mountd/exports.52
-rw-r--r--usr.sbin/mountd/mountd.c71
-rw-r--r--usr.sbin/ntp/config.h33
-rw-r--r--usr.sbin/ntp/doc/ntp-keygen.84
-rw-r--r--usr.sbin/ntp/doc/ntp.conf.54
-rw-r--r--usr.sbin/ntp/doc/ntp.keys.54
-rw-r--r--usr.sbin/ntp/doc/ntpd.84
-rw-r--r--usr.sbin/ntp/doc/ntpdc.84
-rw-r--r--usr.sbin/ntp/doc/ntpq.84
-rw-r--r--usr.sbin/ntp/doc/sntp.84
-rw-r--r--usr.sbin/services_mkdb/services_mkdb.c20
-rw-r--r--usr.sbin/sesutil/Makefile.depend1
409 files changed, 7351 insertions, 3629 deletions
diff --git a/Makefile b/Makefile
index 836097b..acb061b 100644
--- a/Makefile
+++ b/Makefile
@@ -205,7 +205,7 @@ _TARGET_ARCH?= ${MACHINE_ARCH}
# The user can define ALWAYS_CHECK_MAKE to have this check performed
# for all targets.
#
-.if defined(ALWAYS_CHECK_MAKE)
+.if defined(ALWAYS_CHECK_MAKE) || !defined(.PARSEDIR)
${TGTS}: upgrade_checks
.else
buildworld: upgrade_checks
diff --git a/Makefile.inc1 b/Makefile.inc1
index e6c318c..c5b09f3 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -1230,7 +1230,7 @@ reinstallkernel reinstallkernel.debug: _installcheck_kernel
${CROSSENV} PATH=${TMPPATH} \
${MAKE} ${IMAKE_INSTALL} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel//}
.endif
-.if ${BUILDKERNELS:[#]} > 1
+.if ${BUILDKERNELS:[#]} > 1 && !defined(NO_INSTALLEXTRAKERNELS)
.for _kernel in ${BUILDKERNELS:[2..-1]}
@echo "--------------------------------------------------------------"
@echo ">>> Installing kernel ${_kernel}"
@@ -1261,7 +1261,7 @@ distributekernel distributekernel.debug:
${DESTDIR}/${DISTDIR}/kernel.meta
.endif
.endif
-.if ${BUILDKERNELS:[#]} > 1
+.if ${BUILDKERNELS:[#]} > 1 && !defined(NO_INSTALLEXTRAKERNELS)
.for _kernel in ${BUILDKERNELS:[2..-1]}
.if defined(NO_ROOT)
echo "#${MTREE_MAGIC}" > ${DESTDIR}/${DISTDIR}/kernel.${_kernel}.premeta
@@ -1292,7 +1292,7 @@ packagekernel:
tar cvf - --include '*/*/*.debug' \
@${DESTDIR}/${DISTDIR}/kernel.meta | \
${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel-dbg.txz
-.if ${BUILDKERNELS:[#]} > 1
+.if ${BUILDKERNELS:[#]} > 1 && !defined(NO_INSTALLEXTRAKERNELS)
.for _kernel in ${BUILDKERNELS:[2..-1]}
cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
tar cvf - --exclude '*.debug' \
@@ -1313,7 +1313,7 @@ packagekernel:
cd ${DESTDIR}/${DISTDIR}/kernel; \
tar cvf - --include '*/*/*.debug' $$(eval find .) | \
${XZ_CMD} > ${DESTDIR}/${DISTDIR}/kernel-dbg.txz
-.if ${BUILDKERNELS:[#]} > 1
+.if ${BUILDKERNELS:[#]} > 1 && !defined(NO_INSTALLEXTRAKERNELS)
.for _kernel in ${BUILDKERNELS:[2..-1]}
cd ${DESTDIR}/${DISTDIR}/kernel.${_kernel}; \
tar cvf - --exclude '*.debug' . | \
diff --git a/bin/sh/eval.c b/bin/sh/eval.c
index 46c00de..5a3f8e7 100644
--- a/bin/sh/eval.c
+++ b/bin/sh/eval.c
@@ -496,10 +496,12 @@ exphere(union node *redir, struct arglist *fn)
struct jmploc *savehandler;
struct localvar *savelocalvars;
int need_longjmp = 0;
+ unsigned char saveoptreset;
redir->nhere.expdoc = "";
savelocalvars = localvars;
localvars = NULL;
+ saveoptreset = shellparam.reset;
forcelocal++;
savehandler = handler;
if (setjmp(jmploc.loc))
@@ -514,6 +516,7 @@ exphere(union node *redir, struct arglist *fn)
forcelocal--;
poplocalvars();
localvars = savelocalvars;
+ shellparam.reset = saveoptreset;
if (need_longjmp)
longjmp(handler->loc, 1);
INTON;
@@ -647,6 +650,7 @@ evalbackcmd(union node *n, struct backcmd *result)
struct jmploc jmploc;
struct jmploc *savehandler;
struct localvar *savelocalvars;
+ unsigned char saveoptreset;
result->fd = -1;
result->buf = NULL;
@@ -661,6 +665,7 @@ evalbackcmd(union node *n, struct backcmd *result)
if (is_valid_fast_cmdsubst(n)) {
savelocalvars = localvars;
localvars = NULL;
+ saveoptreset = shellparam.reset;
forcelocal++;
savehandler = handler;
if (setjmp(jmploc.loc)) {
@@ -671,6 +676,7 @@ evalbackcmd(union node *n, struct backcmd *result)
forcelocal--;
poplocalvars();
localvars = savelocalvars;
+ shellparam.reset = saveoptreset;
longjmp(handler->loc, 1);
}
} else {
@@ -681,6 +687,7 @@ evalbackcmd(union node *n, struct backcmd *result)
forcelocal--;
poplocalvars();
localvars = savelocalvars;
+ shellparam.reset = saveoptreset;
} else {
if (pipe(pip) < 0)
error("Pipe call failed: %s", strerror(errno));
diff --git a/bin/sh/expand.c b/bin/sh/expand.c
index 59ba549..c661541 100644
--- a/bin/sh/expand.c
+++ b/bin/sh/expand.c
@@ -951,8 +951,8 @@ varvalue(const char *name, int quoted, int subtype, int flag,
case '-':
p = buf;
for (i = 0 ; i < NSHORTOPTS ; i++) {
- if (optlist[i].val)
- *p++ = optlist[i].letter;
+ if (optval[i])
+ *p++ = optletter[i];
}
*p = '\0';
strtodest(buf, flag, subtype, quoted, dst);
diff --git a/bin/sh/options.c b/bin/sh/options.c
index d131200..606ccfb 100644
--- a/bin/sh/options.c
+++ b/bin/sh/options.c
@@ -91,7 +91,7 @@ procargs(int argc, char **argv)
if (argc > 0)
argptr++;
for (i = 0; i < NOPTS; i++)
- optlist[i].val = 2;
+ optval[i] = 2;
privileged = (getuid() != geteuid() || getgid() != getegid());
options(1);
if (*argptr == NULL && minusc == NULL)
@@ -104,8 +104,8 @@ procargs(int argc, char **argv)
if (mflag == 2)
mflag = iflag;
for (i = 0; i < NOPTS; i++)
- if (optlist[i].val == 2)
- optlist[i].val = 0;
+ if (optval[i] == 2)
+ optval[i] = 0;
arg0 = argv[0];
if (sflag == 0 && minusc == NULL) {
scriptname = *argptr++;
@@ -250,26 +250,29 @@ static void
minus_o(char *name, int val)
{
int i;
+ const unsigned char *on;
+ size_t len;
if (name == NULL) {
if (val) {
/* "Pretty" output. */
out1str("Current option settings\n");
- for (i = 0; i < NOPTS; i++)
- out1fmt("%-16s%s\n", optlist[i].name,
- optlist[i].val ? "on" : "off");
+ for (i = 0, on = optname; i < NOPTS; i++, on += *on + 1)
+ out1fmt("%-16.*s%s\n", *on, on + 1,
+ optval[i] ? "on" : "off");
} else {
/* Output suitable for re-input to shell. */
- for (i = 0; i < NOPTS; i++)
- out1fmt("%s %co %s%s",
+ for (i = 0, on = optname; i < NOPTS; i++, on += *on + 1)
+ out1fmt("%s %co %.*s%s",
i % 6 == 0 ? "set" : "",
- optlist[i].val ? '-' : '+',
- optlist[i].name,
+ optval[i] ? '-' : '+',
+ *on, on + 1,
i % 6 == 5 || i == NOPTS - 1 ? "\n" : "");
}
} else {
- for (i = 0; i < NOPTS; i++)
- if (equal(name, optlist[i].name)) {
+ len = strlen(name);
+ for (i = 0, on = optname; i < NOPTS; i++, on += *on + 1)
+ if (*on == len && memcmp(on + 1, name, len) == 0) {
setoptionbyindex(i, val);
return;
}
@@ -281,18 +284,18 @@ minus_o(char *name, int val)
static void
setoptionbyindex(int idx, int val)
{
- if (optlist[idx].letter == 'p' && !val && privileged) {
+ if (optletter[idx] == 'p' && !val && privileged) {
if (setgid(getgid()) == -1)
error("setgid");
if (setuid(getuid()) == -1)
error("setuid");
}
- optlist[idx].val = val;
+ optval[idx] = val;
if (val) {
/* #%$ hack for ksh semantics */
- if (optlist[idx].letter == 'V')
+ if (optletter[idx] == 'V')
Eflag = 0;
- else if (optlist[idx].letter == 'E')
+ else if (optletter[idx] == 'E')
Vflag = 0;
}
}
@@ -303,7 +306,7 @@ setoption(int flag, int val)
int i;
for (i = 0; i < NSHORTOPTS; i++)
- if (optlist[i].letter == flag) {
+ if (optletter[i] == flag) {
setoptionbyindex(i, val);
return;
}
diff --git a/bin/sh/options.h b/bin/sh/options.h
index b5cd67f..d997e6f 100644
--- a/bin/sh/options.h
+++ b/bin/sh/options.h
@@ -45,60 +45,57 @@ struct shparam {
-#define eflag optlist[0].val
-#define fflag optlist[1].val
-#define Iflag optlist[2].val
-#define iflag optlist[3].val
-#define mflag optlist[4].val
-#define nflag optlist[5].val
-#define sflag optlist[6].val
-#define xflag optlist[7].val
-#define vflag optlist[8].val
-#define Vflag optlist[9].val
-#define Eflag optlist[10].val
-#define Cflag optlist[11].val
-#define aflag optlist[12].val
-#define bflag optlist[13].val
-#define uflag optlist[14].val
-#define privileged optlist[15].val
-#define Tflag optlist[16].val
-#define Pflag optlist[17].val
-#define hflag optlist[18].val
-#define nologflag optlist[19].val
+#define eflag optval[0]
+#define fflag optval[1]
+#define Iflag optval[2]
+#define iflag optval[3]
+#define mflag optval[4]
+#define nflag optval[5]
+#define sflag optval[6]
+#define xflag optval[7]
+#define vflag optval[8]
+#define Vflag optval[9]
+#define Eflag optval[10]
+#define Cflag optval[11]
+#define aflag optval[12]
+#define bflag optval[13]
+#define uflag optval[14]
+#define privileged optval[15]
+#define Tflag optval[16]
+#define Pflag optval[17]
+#define hflag optval[18]
+#define nologflag optval[19]
#define NSHORTOPTS 19
#define NOPTS 20
-struct optent {
- const char *name;
- const char letter;
- char val;
-};
-
-extern struct optent optlist[NOPTS];
+extern char optval[NOPTS];
+extern const char optletter[NSHORTOPTS];
#ifdef DEFINE_OPTIONS
-struct optent optlist[NOPTS] = {
- { "errexit", 'e', 0 },
- { "noglob", 'f', 0 },
- { "ignoreeof", 'I', 0 },
- { "interactive",'i', 0 },
- { "monitor", 'm', 0 },
- { "noexec", 'n', 0 },
- { "stdin", 's', 0 },
- { "xtrace", 'x', 0 },
- { "verbose", 'v', 0 },
- { "vi", 'V', 0 },
- { "emacs", 'E', 0 },
- { "noclobber", 'C', 0 },
- { "allexport", 'a', 0 },
- { "notify", 'b', 0 },
- { "nounset", 'u', 0 },
- { "privileged", 'p', 0 },
- { "trapsasync", 'T', 0 },
- { "physical", 'P', 0 },
- { "trackall", 'h', 0 },
- { "nolog", '\0', 0 },
-};
+char optval[NOPTS];
+const char optletter[NSHORTOPTS] = "efIimnsxvVECabupTPh";
+static const unsigned char optname[] =
+ "\007errexit"
+ "\006noglob"
+ "\011ignoreeof"
+ "\013interactive"
+ "\007monitor"
+ "\006noexec"
+ "\005stdin"
+ "\006xtrace"
+ "\007verbose"
+ "\002vi"
+ "\005emacs"
+ "\011noclobber"
+ "\011allexport"
+ "\006notify"
+ "\007nounset"
+ "\012privileged"
+ "\012trapsasync"
+ "\010physical"
+ "\010trackall"
+ "\005nolog"
+;
#endif
diff --git a/bin/sh/tests/builtins/Makefile b/bin/sh/tests/builtins/Makefile
index 63e6ab5..11240ca 100644
--- a/bin/sh/tests/builtins/Makefile
+++ b/bin/sh/tests/builtins/Makefile
@@ -48,6 +48,7 @@ FILES+= cd5.0
FILES+= cd6.0
FILES+= cd7.0
FILES+= cd8.0
+FILES+= cd9.0 cd9.0.stdout
FILES+= command1.0
FILES+= command2.0
FILES+= command3.0
@@ -95,6 +96,7 @@ FILES+= getopts6.0
FILES+= getopts7.0
FILES+= getopts8.0 getopts8.0.stdout
FILES+= getopts9.0 getopts9.0.stdout
+FILES+= getopts10.0
FILES+= hash1.0 hash1.0.stdout
FILES+= hash2.0 hash2.0.stdout
FILES+= hash3.0 hash3.0.stdout
diff --git a/bin/sh/tests/builtins/cd9.0 b/bin/sh/tests/builtins/cd9.0
new file mode 100644
index 0000000..78bcdff
--- /dev/null
+++ b/bin/sh/tests/builtins/cd9.0
@@ -0,0 +1,8 @@
+# $FreeBSD$
+
+cd /dev
+cd /bin
+cd - >/dev/null
+pwd
+cd - >/dev/null
+pwd
diff --git a/bin/sh/tests/builtins/cd9.0.stdout b/bin/sh/tests/builtins/cd9.0.stdout
new file mode 100644
index 0000000..dac16a7
--- /dev/null
+++ b/bin/sh/tests/builtins/cd9.0.stdout
@@ -0,0 +1,2 @@
+/dev
+/bin
diff --git a/bin/sh/tests/builtins/getopts10.0 b/bin/sh/tests/builtins/getopts10.0
new file mode 100644
index 0000000..a88e6ca
--- /dev/null
+++ b/bin/sh/tests/builtins/getopts10.0
@@ -0,0 +1,11 @@
+# $FreeBSD$
+
+set -- -x arg
+opt=not
+getopts x opt
+r1=$? OPTIND1=$OPTIND opt1=$opt
+: $(: $((OPTIND = 1)))
+getopts x opt
+r2=$? OPTIND2=$OPTIND
+[ "$r1" = 0 ] && [ "$OPTIND1" = 2 ] && [ "$opt1" = x ] && [ "$r2" != 0 ] &&
+ [ "$OPTIND2" = 2 ]
diff --git a/bin/sh/var.c b/bin/sh/var.c
index c124a5d..d401361 100644
--- a/bin/sh/var.c
+++ b/bin/sh/var.c
@@ -754,8 +754,8 @@ mklocal(char *name)
INTOFF;
lvp = ckmalloc(sizeof (struct localvar));
if (name[0] == '-' && name[1] == '\0') {
- lvp->text = ckmalloc(sizeof optlist);
- memcpy(lvp->text, optlist, sizeof optlist);
+ lvp->text = ckmalloc(sizeof optval);
+ memcpy(lvp->text, optval, sizeof optval);
vp = NULL;
} else {
vp = find_var(name, &vpp, NULL);
@@ -797,7 +797,7 @@ poplocalvars(void)
localvars = lvp->next;
vp = lvp->vp;
if (vp == NULL) { /* $- saved */
- memcpy(optlist, lvp->text, sizeof optlist);
+ memcpy(optval, lvp->text, sizeof optval);
ckfree(lvp->text);
optschanged();
} else if ((lvp->flags & (VUNSET|VSTRFIXED)) == VUNSET) {
diff --git a/contrib/ntp/ChangeLog b/contrib/ntp/ChangeLog
index 5d8346b..304bd85 100644
--- a/contrib/ntp/ChangeLog
+++ b/contrib/ntp/ChangeLog
@@ -1,4 +1,61 @@
---
+(4.2.8p5) 2016/01/07 Released by Harlan Stenn <stenn@ntp.org>
+
+* [Sec 2956] small-step/big-step. Close the panic gate earlier. HStenn.
+* CID 1339955: Free allocated memory in caljulian test. HStenn.
+* CID 1339962: Explicitly initialize variable in caljulian test. HStenn.
+* CID 1341527: Quiet a CHECKED_RETURN in sntp/tests/t-log.c. HStenn.
+* CID 1341533: Missing assertion in sntp/tests/t-log.c. HStenn.
+* CID 1341534: Resource leak in tests/ntpd/t-ntp_signd.c. HStenn.
+* CID 1341535: Resource leak in tests/ntpd/t-ntp_signd.c. HStenn.
+* CID 1341536: Resource leak in tests/ntpd/t-ntp_signd.c. HStenn.
+* CID 1341537: Resource leak in tests/ntpd/t-ntp_signd.c. HStenn.
+* CID 1341538: Memory leak in tests/ntpd/ntp_prio_q.c:262. HStenn.
+* CID 1341677: Nits in sntp/tests/keyFile.c. HStenn.
+* CID 1341678: Nits in sntp/tests/keyFile.c. HStenn.
+* CID 1341679: Nits in sntp/tests/keyFile.c. HStenn.
+* CID 1341680: Nits in sntp/tests/keyFile.c. HStenn.
+* CID 1341681: Nits in sntp/tests/keyFile.c. HStenn.
+* CID 1341682: Nit in libntp/authreadkeys.c. HStenn.
+* CID 1341684: Nit in tests/ntpd/t-ntp_signd.c. HStenn.
+* [Bug 2829] Look at pipe_fds in ntpd.c (did so. perlinger@ntp.org)
+* [Bug 2887] stratum -1 config results as showing value 99
+ - fudge stratum should only accept values [0..16]. perlinger@ntp.org
+* [Bug 2932] Update leapsecond file info in miscopt.html. CWoodbury, HStenn.
+* [Bug 2934] tests/ntpd/t-ntp_scanner.c has a magic constant wired in. HMurray
+* [Bug 2944] errno is not preserved properly in ntpdate after sendto call.
+ - applied patch by Christos Zoulas. perlinger@ntp.org
+* [Bug 2952] Symmetric active/passive mode is broken. HStenn.
+* [Bug 2954] Version 4.2.8p4 crashes on startup with sig fault
+ - fixed data race conditions in threaded DNS worker. perlinger@ntp.org
+ - limit threading warm-up to linux; FreeBSD bombs on it. perlinger@ntp.org
+* [Bug 2957] 'unsigned int' vs 'size_t' format clash. perlinger@ntp.org
+ - accept key file only if there are no parsing errors
+ - fixed size_t/u_int format clash
+ - fixed wrong use of 'strlcpy'
+* [Bug 2958] ntpq: fatal error messages need a final newline. Craig Leres.
+* [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets. perlinger@ntp.org
+ - fixed several other warnings (cast-alignment, missing const, missing prototypes)
+ - promote use of 'size_t' for values that express a size
+ - use ptr-to-const for read-only arguments
+ - make sure SOCKET values are not truncated (win32-specific)
+ - format string fixes
+* [Bug 2965] Local clock didn't work since 4.2.8p4. Martin Burnicki.
+* [Bug 2967] ntpdate command suffers an assertion failure
+ - fixed ntp_rfc2553.c to return proper address length. perlinger@ntp.org
+* [Bug 2969] Seg fault from ntpq/mrulist when looking at server with
+ lots of clients. perlinger@ntp.org
+* [Bug 2971] ntpq bails on ^C: select fails: Interrupted system call
+ - changed stacked/nested handling of CTRL-C. perlinger@ntp.org
+* Unity cleanup for FreeBSD-6.4. Harlan Stenn.
+* Unity test cleanup. Harlan Stenn.
+* Libevent autoconf pthread fixes for FreeBSD-10. Harlan Stenn.
+* Header cleanup in tests/sandbox/uglydate.c. Harlan Stenn.
+* Header cleanup in tests/libntp/sfptostr.c. Harlan Stenn.
+* Quiet a warning from clang. Harlan Stenn.
+* Update the NEWS file. Harlan Stenn.
+* Update scripts/calc_tickadj/Makefile.am. Harlan Stenn.
+---
(4.2.8p4) 2015/10/21 Released by Harlan Stenn <stenn@ntp.org>
(4.2.8p4-RC1) 2015/10/06 Released by Harlan Stenn <stenn@ntp.org>
diff --git a/contrib/ntp/CommitLog b/contrib/ntp/CommitLog
index 3366f2f..9caeaa2 100644
--- a/contrib/ntp/CommitLog
+++ b/contrib/ntp/CommitLog
@@ -1,3 +1,1480 @@
+ChangeSet@1.3623, 2016-01-07 23:33:11+00:00, stenn@deacon.udel.edu
+ NTP_4_2_8P5
+ TAG: NTP_4_2_8P5
+
+ ChangeLog@1.1791 +1 -0
+ NTP_4_2_8P5
+
+ ntpd/invoke-ntp.conf.texi@1.194 +1 -1
+ NTP_4_2_8P5
+
+ ntpd/invoke-ntp.keys.texi@1.186 +1 -1
+ NTP_4_2_8P5
+
+ ntpd/invoke-ntpd.texi@1.503 +2 -2
+ NTP_4_2_8P5
+
+ ntpd/ntp.conf.5man@1.228 +3 -3
+ NTP_4_2_8P5
+
+ ntpd/ntp.conf.5mdoc@1.228 +2 -2
+ NTP_4_2_8P5
+
+ ntpd/ntp.conf.html@1.182 +1 -1
+ NTP_4_2_8P5
+
+ ntpd/ntp.conf.man.in@1.228 +3 -3
+ NTP_4_2_8P5
+
+ ntpd/ntp.conf.mdoc.in@1.228 +2 -2
+ NTP_4_2_8P5
+
+ ntpd/ntp.keys.5man@1.220 +2 -2
+ NTP_4_2_8P5
+
+ ntpd/ntp.keys.5mdoc@1.220 +2 -2
+ NTP_4_2_8P5
+
+ ntpd/ntp.keys.html@1.182 +1 -1
+ NTP_4_2_8P5
+
+ ntpd/ntp.keys.man.in@1.220 +2 -2
+ NTP_4_2_8P5
+
+ ntpd/ntp.keys.mdoc.in@1.220 +2 -2
+ NTP_4_2_8P5
+
+ ntpd/ntpd-opts.c@1.525 +7 -7
+ NTP_4_2_8P5
+
+ ntpd/ntpd-opts.h@1.524 +3 -3
+ NTP_4_2_8P5
+
+ ntpd/ntpd.1ntpdman@1.332 +3 -3
+ NTP_4_2_8P5
+
+ ntpd/ntpd.1ntpdmdoc@1.332 +2 -2
+ NTP_4_2_8P5
+
+ ntpd/ntpd.html@1.176 +2 -2
+ NTP_4_2_8P5
+
+ ntpd/ntpd.man.in@1.332 +3 -3
+ NTP_4_2_8P5
+
+ ntpd/ntpd.mdoc.in@1.332 +2 -2
+ NTP_4_2_8P5
+
+ ntpdc/invoke-ntpdc.texi@1.500 +2 -2
+ NTP_4_2_8P5
+
+ ntpdc/ntpdc-opts.c@1.518 +7 -7
+ NTP_4_2_8P5
+
+ ntpdc/ntpdc-opts.h@1.517 +3 -3
+ NTP_4_2_8P5
+
+ ntpdc/ntpdc.1ntpdcman@1.331 +3 -3
+ NTP_4_2_8P5
+
+ ntpdc/ntpdc.1ntpdcmdoc@1.331 +2 -2
+ NTP_4_2_8P5
+
+ ntpdc/ntpdc.html@1.344 +2 -2
+ NTP_4_2_8P5
+
+ ntpdc/ntpdc.man.in@1.331 +3 -3
+ NTP_4_2_8P5
+
+ ntpdc/ntpdc.mdoc.in@1.331 +2 -2
+ NTP_4_2_8P5
+
+ ntpq/invoke-ntpq.texi@1.507 +2 -2
+ NTP_4_2_8P5
+
+ ntpq/ntpq-opts.c@1.524 +7 -7
+ NTP_4_2_8P5
+
+ ntpq/ntpq-opts.h@1.522 +3 -3
+ NTP_4_2_8P5
+
+ ntpq/ntpq.1ntpqman@1.335 +3 -3
+ NTP_4_2_8P5
+
+ ntpq/ntpq.1ntpqmdoc@1.335 +2 -2
+ NTP_4_2_8P5
+
+ ntpq/ntpq.html@1.173 +2 -2
+ NTP_4_2_8P5
+
+ ntpq/ntpq.man.in@1.335 +3 -3
+ NTP_4_2_8P5
+
+ ntpq/ntpq.mdoc.in@1.335 +2 -2
+ NTP_4_2_8P5
+
+ ntpsnmpd/invoke-ntpsnmpd.texi@1.502 +2 -2
+ NTP_4_2_8P5
+
+ ntpsnmpd/ntpsnmpd-opts.c@1.520 +7 -7
+ NTP_4_2_8P5
+
+ ntpsnmpd/ntpsnmpd-opts.h@1.519 +3 -3
+ NTP_4_2_8P5
+
+ ntpsnmpd/ntpsnmpd.1ntpsnmpdman@1.331 +3 -3
+ NTP_4_2_8P5
+
+ ntpsnmpd/ntpsnmpd.1ntpsnmpdmdoc@1.331 +2 -2
+ NTP_4_2_8P5
+
+ ntpsnmpd/ntpsnmpd.html@1.171 +1 -1
+ NTP_4_2_8P5
+
+ ntpsnmpd/ntpsnmpd.man.in@1.331 +3 -3
+ NTP_4_2_8P5
+
+ ntpsnmpd/ntpsnmpd.mdoc.in@1.331 +2 -2
+ NTP_4_2_8P5
+
+ packageinfo.sh@1.522 +2 -2
+ NTP_4_2_8P5
+
+ scripts/calc_tickadj/calc_tickadj.1calc_tickadjman@1.92 +3 -3
+ NTP_4_2_8P5
+
+ scripts/calc_tickadj/calc_tickadj.1calc_tickadjmdoc@1.93 +2 -2
+ NTP_4_2_8P5
+
+ scripts/calc_tickadj/calc_tickadj.html@1.94 +1 -1
+ NTP_4_2_8P5
+
+ scripts/calc_tickadj/calc_tickadj.man.in@1.91 +3 -3
+ NTP_4_2_8P5
+
+ scripts/calc_tickadj/calc_tickadj.mdoc.in@1.93 +2 -2
+ NTP_4_2_8P5
+
+ scripts/calc_tickadj/invoke-calc_tickadj.texi@1.96 +1 -1
+ NTP_4_2_8P5
+
+ scripts/invoke-plot_summary.texi@1.113 +2 -2
+ NTP_4_2_8P5
+
+ scripts/invoke-summary.texi@1.113 +2 -2
+ NTP_4_2_8P5
+
+ scripts/ntp-wait/invoke-ntp-wait.texi@1.323 +2 -2
+ NTP_4_2_8P5
+
+ scripts/ntp-wait/ntp-wait-opts@1.59 +2 -2
+ NTP_4_2_8P5
+
+ scripts/ntp-wait/ntp-wait.1ntp-waitman@1.320 +3 -3
+ NTP_4_2_8P5
+
+ scripts/ntp-wait/ntp-wait.1ntp-waitmdoc@1.321 +2 -2
+ NTP_4_2_8P5
+
+ scripts/ntp-wait/ntp-wait.html@1.340 +2 -2
+ NTP_4_2_8P5
+
+ scripts/ntp-wait/ntp-wait.man.in@1.320 +3 -3
+ NTP_4_2_8P5
+
+ scripts/ntp-wait/ntp-wait.mdoc.in@1.321 +2 -2
+ NTP_4_2_8P5
+
+ scripts/ntpsweep/invoke-ntpsweep.texi@1.111 +2 -2
+ NTP_4_2_8P5
+
+ scripts/ntpsweep/ntpsweep-opts@1.61 +2 -2
+ NTP_4_2_8P5
+
+ scripts/ntpsweep/ntpsweep.1ntpsweepman@1.99 +3 -3
+ NTP_4_2_8P5
+
+ scripts/ntpsweep/ntpsweep.1ntpsweepmdoc@1.99 +2 -2
+ NTP_4_2_8P5
+
+ scripts/ntpsweep/ntpsweep.html@1.112 +2 -2
+ NTP_4_2_8P5
+
+ scripts/ntpsweep/ntpsweep.man.in@1.99 +3 -3
+ NTP_4_2_8P5
+
+ scripts/ntpsweep/ntpsweep.mdoc.in@1.100 +2 -2
+ NTP_4_2_8P5
+
+ scripts/ntptrace/invoke-ntptrace.texi@1.112 +2 -2
+ NTP_4_2_8P5
+
+ scripts/ntptrace/ntptrace-opts@1.61 +2 -2
+ NTP_4_2_8P5
+
+ scripts/ntptrace/ntptrace.1ntptraceman@1.99 +3 -3
+ NTP_4_2_8P5
+
+ scripts/ntptrace/ntptrace.1ntptracemdoc@1.100 +2 -2
+ NTP_4_2_8P5
+
+ scripts/ntptrace/ntptrace.html@1.113 +2 -2
+ NTP_4_2_8P5
+
+ scripts/ntptrace/ntptrace.man.in@1.99 +3 -3
+ NTP_4_2_8P5
+
+ scripts/ntptrace/ntptrace.mdoc.in@1.101 +2 -2
+ NTP_4_2_8P5
+
+ scripts/plot_summary-opts@1.61 +2 -2
+ NTP_4_2_8P5
+
+ scripts/plot_summary.1plot_summaryman@1.111 +3 -3
+ NTP_4_2_8P5
+
+ scripts/plot_summary.1plot_summarymdoc@1.111 +2 -2
+ NTP_4_2_8P5
+
+ scripts/plot_summary.html@1.114 +2 -2
+ NTP_4_2_8P5
+
+ scripts/plot_summary.man.in@1.111 +3 -3
+ NTP_4_2_8P5
+
+ scripts/plot_summary.mdoc.in@1.111 +2 -2
+ NTP_4_2_8P5
+
+ scripts/summary-opts@1.61 +2 -2
+ NTP_4_2_8P5
+
+ scripts/summary.1summaryman@1.111 +3 -3
+ NTP_4_2_8P5
+
+ scripts/summary.1summarymdoc@1.111 +2 -2
+ NTP_4_2_8P5
+
+ scripts/summary.html@1.114 +2 -2
+ NTP_4_2_8P5
+
+ scripts/summary.man.in@1.111 +3 -3
+ NTP_4_2_8P5
+
+ scripts/summary.mdoc.in@1.111 +2 -2
+ NTP_4_2_8P5
+
+ scripts/update-leap/invoke-update-leap.texi@1.12 +1 -1
+ NTP_4_2_8P5
+
+ scripts/update-leap/update-leap-opts@1.12 +2 -2
+ NTP_4_2_8P5
+
+ scripts/update-leap/update-leap.1update-leapman@1.12 +3 -3
+ NTP_4_2_8P5
+
+ scripts/update-leap/update-leap.1update-leapmdoc@1.12 +2 -2
+ NTP_4_2_8P5
+
+ scripts/update-leap/update-leap.html@1.12 +1 -1
+ NTP_4_2_8P5
+
+ scripts/update-leap/update-leap.man.in@1.12 +3 -3
+ NTP_4_2_8P5
+
+ scripts/update-leap/update-leap.mdoc.in@1.12 +2 -2
+ NTP_4_2_8P5
+
+ sntp/invoke-sntp.texi@1.500 +2 -2
+ NTP_4_2_8P5
+
+ sntp/sntp-opts.c@1.519 +7 -7
+ NTP_4_2_8P5
+
+ sntp/sntp-opts.h@1.517 +3 -3
+ NTP_4_2_8P5
+
+ sntp/sntp.1sntpman@1.335 +3 -3
+ NTP_4_2_8P5
+
+ sntp/sntp.1sntpmdoc@1.335 +2 -2
+ NTP_4_2_8P5
+
+ sntp/sntp.html@1.515 +2 -2
+ NTP_4_2_8P5
+
+ sntp/sntp.man.in@1.335 +3 -3
+ NTP_4_2_8P5
+
+ sntp/sntp.mdoc.in@1.335 +2 -2
+ NTP_4_2_8P5
+
+ util/invoke-ntp-keygen.texi@1.503 +2 -2
+ NTP_4_2_8P5
+
+ util/ntp-keygen-opts.c@1.521 +7 -7
+ NTP_4_2_8P5
+
+ util/ntp-keygen-opts.h@1.519 +3 -3
+ NTP_4_2_8P5
+
+ util/ntp-keygen.1ntp-keygenman@1.331 +3 -3
+ NTP_4_2_8P5
+
+ util/ntp-keygen.1ntp-keygenmdoc@1.331 +2 -2
+ NTP_4_2_8P5
+
+ util/ntp-keygen.html@1.177 +2 -2
+ NTP_4_2_8P5
+
+ util/ntp-keygen.man.in@1.331 +3 -3
+ NTP_4_2_8P5
+
+ util/ntp-keygen.mdoc.in@1.331 +2 -2
+ NTP_4_2_8P5
+
+ChangeSet@1.3622, 2016-01-07 17:52:24-05:00, stenn@deacon.udel.edu
+ ntp-4.2.8p5
+
+ packageinfo.sh@1.521 +1 -1
+ ntp-4.2.8p5
+
+ChangeSet@1.3621, 2016-01-07 22:20:05+00:00, stenn@psp-at1.ntp.org
+ cleanup
+
+ NEWS@1.152 +2 -2
+ cleanup
+
+ChangeSet@1.3620, 2016-01-07 09:33:11+00:00, stenn@psp-at1.ntp.org
+ typo in ntp_proto.c - leap smear. Reported by Martin Burnicki
+
+ ntpd/ntp_proto.c@1.371 +1 -1
+ typo in ntp_proto.c - leap smear. Reported by Martin Burnicki
+
+ChangeSet@1.3619, 2016-01-07 06:33:08+00:00, stenn@psp-at1.ntp.org
+ Update scripts/calc_tickadj/Makefile.am. Harlan Stenn.
+
+ ChangeLog@1.1790 +1 -0
+ Update scripts/calc_tickadj/Makefile.am. Harlan Stenn.
+
+ scripts/calc_tickadj/Makefile.am@1.11 +2 -0
+ Update scripts/calc_tickadj/Makefile.am. Harlan Stenn.
+
+ChangeSet@1.3616.1.1, 2016-01-05 10:57:45+00:00, stenn@psp-at1.ntp.org
+ Bug 2952 fixes
+
+ ChangeLog@1.1787.1.1 +1 -0
+ Bug 2952 fixes
+
+ ntpd/ntp_proto.c@1.370 +165 -152
+ Bug 2952 fixes
+
+ChangeSet@1.3617, 2016-01-05 09:56:31+00:00, stenn@psp-at1.ntp.org
+ ntp-4.2.8p5 prep
+
+ ChangeLog@1.1788 +2 -1
+ ntp-4.2.8p5 prep
+
+ NEWS@1.151 +104 -3
+ ntp-4.2.8p5 prep
+
+ChangeSet@1.3616, 2015-12-06 11:20:02+00:00, stenn@psp-deb1.ntp.org
+ Quiet a warning from clang. Harlan Stenn.
+
+ ChangeLog@1.1787 +1 -0
+ Quiet a warning from clang. Harlan Stenn.
+
+ libntp/ntp_rfc2553.c@1.50 +3 -2
+ Quiet a warning from clang. Harlan Stenn.
+
+ChangeSet@1.3615, 2015-12-05 10:41:51+00:00, stenn@psp-at1.ntp.org
+ CID 1341677: Nits in sntp/tests/keyFile.c. HStenn.
+
+ ChangeLog@1.1786 +1 -0
+ CID 1341677: Nits in sntp/tests/keyFile.c. HStenn.
+
+ sntp/tests/keyFile.c@1.12 +5 -2
+ CID 1341677: Nits in sntp/tests/keyFile.c. HStenn.
+
+ChangeSet@1.3614, 2015-12-05 10:38:28+00:00, stenn@psp-at1.ntp.org
+ CID 1341678: Nits in sntp/tests/keyFile.c. HStenn.
+
+ ChangeLog@1.1785 +1 -0
+ CID 1341678: Nits in sntp/tests/keyFile.c. HStenn.
+
+ sntp/tests/keyFile.c@1.11 +5 -1
+ CID 1341678: Nits in sntp/tests/keyFile.c. HStenn.
+
+ChangeSet@1.3613, 2015-12-05 10:31:39+00:00, stenn@psp-at1.ntp.org
+ CID 1341679: Nits in sntp/tests/keyFile.c. HStenn.
+
+ ChangeLog@1.1784 +1 -0
+ CID 1341679: Nits in sntp/tests/keyFile.c. HStenn.
+
+ sntp/tests/keyFile.c@1.10 +4 -2
+ CID 1341679: Nits in sntp/tests/keyFile.c. HStenn.
+
+ChangeSet@1.3612, 2015-12-05 10:27:40+00:00, stenn@psp-at1.ntp.org
+ CID 1341680: Nits in sntp/tests/keyFile.c. HStenn.
+
+ ChangeLog@1.1783 +1 -0
+ CID 1341680: Nits in sntp/tests/keyFile.c. HStenn.
+
+ sntp/tests/keyFile.c@1.9 +4 -2
+ CID 1341680: Nits in sntp/tests/keyFile.c. HStenn.
+
+ChangeSet@1.3611, 2015-12-05 10:21:07+00:00, stenn@psp-at1.ntp.org
+ CID 1341681: Nits in sntp/tests/keyFile.c. HStenn.
+
+ ChangeLog@1.1782 +1 -0
+ CID 1341681: Nits in sntp/tests/keyFile.c. HStenn.
+
+ChangeSet@1.3610, 2015-12-05 10:18:23+00:00, stenn@psp-at1.ntp.org
+ sntp/tests/keyFile.c lint
+
+ sntp/tests/keyFile.c@1.8 +4 -2
+ sntp/tests/keyFile.c lint
+
+ChangeSet@1.3609, 2015-12-05 10:01:47+00:00, stenn@psp-at1.ntp.org
+ CID 1341682: Nit in libntp/authreadkeys.c. HStenn.
+
+ ChangeLog@1.1781 +1 -0
+ CID 1341682: Nit in libntp/authreadkeys.c. HStenn.
+
+ libntp/authreadkeys.c@1.24 +3 -4
+ CID 1341682: Nit in libntp/authreadkeys.c. HStenn.
+
+ChangeSet@1.3608, 2015-12-05 09:40:44+00:00, stenn@psp-at1.ntp.org
+ CID 1341684: Nit in tests/ntpd/t-ntp_signd.c. HStenn.
+
+ ChangeLog@1.1780 +1 -0
+ CID 1341684: Nit in tests/ntpd/t-ntp_signd.c. HStenn.
+
+ tests/ntpd/t-ntp_signd.c@1.15 +4 -0
+ CID 1341684: Nit in tests/ntpd/t-ntp_signd.c. HStenn.
+
+ChangeSet@1.3607, 2015-12-03 12:07:30+00:00, stenn@psp-at1.ntp.org
+ Update some test runners
+
+ tests/libntp/run-sfptostr.c@1.7 +9 -8
+ update
+
+ tests/sandbox/run-uglydate.c@1.7 +2 -1
+ update
+
+ChangeSet@1.3606, 2015-12-03 03:28:15-08:00, cov-build@cov7.ntfo.org
+ Header cleanup in tests/libntp/sfptostr.c. Harlan Stenn.
+
+ ChangeLog@1.1779 +1 -0
+ Header cleanup in tests/libntp/sfptostr.c. Harlan Stenn.
+
+ tests/libntp/sfptostr.c@1.5 +1 -0
+ Header cleanup in tests/libntp/sfptostr.c. Harlan Stenn.
+
+ChangeSet@1.3605, 2015-12-03 03:26:50-08:00, cov-build@cov7.ntfo.org
+ Header cleanup in tests/sandbox/uglydate.c. Harlan Stenn.
+
+ ChangeLog@1.1778 +1 -0
+ Header cleanup in tests/sandbox/uglydate.c. Harlan Stenn.
+
+ tests/sandbox/uglydate.c@1.6 +2 -1
+ Header cleanup in tests/sandbox/uglydate.c. Harlan Stenn.
+
+ChangeSet@1.3604, 2015-12-03 02:16:02-08:00, cov-build@cov7.ntfo.org
+ CID 1341527: Quiet a CHECKED_RETURN in sntp/tests/t-log.c. HStenn.
+
+ ChangeLog@1.1777 +1 -0
+ CID 1341527: Quiet a CHECKED_RETURN in sntp/tests/t-log.c. HStenn.
+
+ sntp/tests/t-log.c@1.7 +1 -1
+ CID 1341527: Quiet a CHECKED_RETURN in sntp/tests/t-log.c. HStenn.
+
+ChangeSet@1.3603, 2015-12-03 02:00:58-08:00, cov-build@cov7.ntfo.org
+ CID 1341533: Missing assertion in sntp/tests/t-log.c. HStenn.
+
+ ChangeLog@1.1776 +1 -0
+ CID 1341533: Missing assertion in sntp/tests/t-log.c. HStenn.
+
+ sntp/tests/t-log.c@1.6 +2 -0
+ CID 1341533: Missing assertion in sntp/tests/t-log.c. HStenn.
+
+ChangeSet@1.3602, 2015-12-03 01:50:11-08:00, cov-build@cov7.ntfo.org
+ CID 134534-134537: Resource leaks in tests/ntpd/t-ntp_signd.c. HStenn.
+
+ ChangeLog@1.1775 +4 -0
+ CID 134534-134537: Resource leaks in tests/ntpd/t-ntp_signd.c. HStenn.
+
+ tests/ntpd/t-ntp_signd.c@1.14 +9 -0
+ CID 134534-134537: Resource leaks in tests/ntpd/t-ntp_signd.c. HStenn.
+
+ChangeSet@1.3601, 2015-12-03 01:22:22-08:00, cov-build@cov7.ntfo.org
+ CID 1341538: Memory leak in tests/ntpd/ntp_prio_q.c:262. HStenn.
+
+ ChangeLog@1.1774 +1 -0
+ CID 1341538: Memory leak in tests/ntpd/ntp_prio_q.c:262. HStenn.
+
+ tests/ntpd/ntp_prio_q.c@1.3 +1 -0
+ CID 1341538: Memory leak in tests/ntpd/ntp_prio_q.c:262. HStenn.
+
+ChangeSet@1.3597.4.1, 2015-11-30 06:03:47+01:00, jnperlin@hydra.localnet
+ [Bug 2829] Look at pipe_fds in ntpd.c (initial value issue)
+
+ ChangeLog@1.1770.4.1 +1 -0
+ [Bug 2829] Look at pipe_fds in ntpd.c
+
+ ntpd/ntpd.c@1.167 +3 -0
+ [Bug 2829] Look at pipe_fds in ntpd.c (initial value issue)
+
+ChangeSet@1.3597.3.1, 2015-11-29 13:03:58+01:00, jnperlin@hydra.localnet
+ [Bug 2887] stratum -1 config results as showing value 99
+ - fudge stratum only accepts values [0..16].
+
+ ChangeLog@1.1770.3.1 +2 -0
+ [Bug 2887] stratum -1 config results as showing value 99
+ - fudge stratum only accepts values [0..16].
+
+ ntpd/ntp_parser.c@1.100 +178 -171
+ [Bug 2887] stratum -1 config results as showing value 99
+ - fudge stratum only accepts values [0..16]. (file regenerated by bison & trimmed manually)
+
+ ntpd/ntp_parser.y@1.90 +8 -1
+ [Bug 2887] stratum -1 config results as showing value 99
+ - fudge stratum only accepts values [0..16], gives error otherwise
+
+ChangeSet@1.3597.2.1, 2015-11-28 22:59:39+01:00, jnperlin@hydra.localnet
+ [Bug 2944] errno is not preserved properly in ntpdate after sendto call.
+ - applied patch by Christos Zoulas.
+
+ ChangeLog@1.1770.2.1 +2 -0
+ [Bug 2944] errno is not preserved properly in ntpdate after sendto call.
+ - applied patch by Christos Zoulas.
+
+ libntp/socktohost.c@1.16 +10 -2
+ [Bug 2944] errno is not preserved properly in ntpdate after sendto call.
+ - save errno around calls to getnameinfo/getaddrinfo (patch by Christos Zoulas)
+
+ChangeSet@1.3597.1.4, 2015-11-28 19:09:53+01:00, jnperlin@hydra.localnet
+ Bug 2971 - ntpq bails on ^C: select fails: Interrupted system call
+ - changed stacked/nested handling of CTRL-C.
+
+ ChangeLog@1.1770.1.2 +2 -0
+ Bug 2971 - ntpq bails on ^C: select fails: Interrupted system call
+ - changed stacked/nested handling of CTRL-C.
+
+ ntpq/ntpq-subs.c@1.114 +11 -8
+ Bug 2971 - ntpq bails on ^C: select fails: Interrupted system call
+ - changed stacked/nested handling of CTRL-C.
+
+ ntpq/ntpq.c@1.165 +57 -8
+ Bug 2971 - ntpq bails on ^C: select fails: Interrupted system call
+ - changed stacked/nested handling of CTRL-C.
+
+ ntpq/ntpq.h@1.31 +4 -0
+ Bug 2971 - ntpq bails on ^C: select fails: Interrupted system call
+ - changed stacked/nested handling of CTRL-C.
+
+ChangeSet@1.3597.1.3, 2015-11-25 22:10:45-08:00, harlan@max.pfcs.com
+ Libevent autoconf pthread fixes for FreeBSD-10. Harlan Stenn.
+
+ ChangeLog@1.1770.1.1 +1 -0
+ Libevent autoconf pthread fixes for FreeBSD-10. Harlan Stenn.
+
+ sntp/m4/ntp_libevent.m4@1.16 +2 -1
+ Libevent autoconf pthread fixes for FreeBSD-10. Harlan Stenn.
+
+ChangeSet@1.3597.1.2, 2015-11-25 12:23:40+00:00, stenn@psp-at1.ntp.org
+ Unity test cleanup. Harlan Stenn.
+
+ tests/ntpd/run-t-ntp_signd.c@1.11 +6 -6
+ Unity test cleanup. Harlan Stenn.
+
+ tests/ntpd/t-ntp_signd.c@1.13 +19 -5
+ Unity test cleanup. Harlan Stenn.
+
+ChangeSet@1.3597.1.1, 2015-11-25 11:50:51+00:00, stenn@psp-at1.ntp.org
+ Unity test cleanup. Harlan Stenn.
+
+ sntp/unity/unity_internals.h@1.5 +13 -1
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/calendar.c@1.12 +8 -3
+ Unity test cleanup. Harlan Stenn.
+
+ tests/ntpd/leapsec.c@1.4 +241 -82
+ Unity test cleanup. Harlan Stenn.
+
+ tests/ntpd/run-leapsec.c@1.6 +33 -33
+ Unity test cleanup. Harlan Stenn.
+
+ tests/ntpd/run-t-ntp_signd.c@1.10 +6 -6
+ Unity test cleanup. Harlan Stenn.
+
+ tests/ntpd/t-ntp_signd.c@1.12 +40 -13
+ Unity test cleanup. Harlan Stenn.
+
+ tests/sandbox/smeartest.c@1.10 +3 -0
+ Unity test cleanup. Harlan Stenn.
+
+ChangeSet@1.3598, 2015-11-24 08:06:41+01:00, jnperlin@hydra.localnet
+ [Bug 2967] ntpdate command suffers an assertion failure
+ - fixed ntp_rfc2553.c to return proper address length.
+
+ ChangeLog@1.1771 +2 -0
+ [Bug 2967] ntpdate command suffers an assertion failure
+ - fixed ntp_rfc2553.c to return proper address length.
+
+ libntp/ntp_rfc2553.c@1.49 +2 -1
+ [Bug 2967] ntpdate command suffers an assertion failure
+ - fix do_nodename() to return the proper address length when name is NULL.
+
+ChangeSet@1.3597, 2015-11-23 10:55:16+00:00, stenn@psp-at1.ntp.org
+ ChangeLog, caljulian.c:
+ * CID 1339955: Free allocated memory in caljulian test. HStenn.
+ * CID 1339962: Explicitly initialize variable in caljulian test. HStenn.
+
+ ChangeLog@1.1770 +2 -0
+ * CID 1339955: Free allocated memory in caljulian test. HStenn.
+ * CID 1339962: Explicitly initialize variable in caljulian test. HStenn.
+
+ tests/libntp/caljulian.c@1.14 +16 -10
+ * CID 1339955: Free allocated memory in caljulian test. HStenn.
+ * CID 1339962: Explicitly initialize variable in caljulian test. HStenn.
+
+ChangeSet@1.3596, 2015-11-20 20:16:24-08:00, harlan@hms-mbp11.pfcs.com
+ Unity test cleanup. Harlan Stenn.
+
+ sntp/tests/kodDatabase.c@1.9 +0 -4
+ Unity test cleanup. Harlan Stenn.
+
+ sntp/tests/run-kodDatabase.c@1.9 +5 -5
+ Unity test cleanup. Harlan Stenn.
+
+ChangeSet@1.3595, 2015-11-20 19:41:16-08:00, harlan@hms-mbp11.pfcs.com
+ Unity test cleanup. Harlan Stenn.
+
+ sntp/tests/kodDatabase.c@1.8 +6 -0
+ Unity test cleanup. Harlan Stenn.
+
+ sntp/tests/kodFile.c@1.9 +1 -0
+ Unity test cleanup. Harlan Stenn.
+
+ sntp/tests/run-kodDatabase.c@1.8 +6 -5
+ Unity test cleanup. Harlan Stenn.
+
+ sntp/tests/run-t-log.c@1.5 +3 -3
+ Unity test cleanup. Harlan Stenn.
+
+ sntp/tests/t-log.c@1.5 +32 -16
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/calendar.c@1.11 +11 -0
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/caljulian.c@1.13 +1 -0
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/decodenetnum.c@1.10 +10 -0
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/humandate.c@1.7 +10 -0
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/lfptostr.c@1.8 +9 -0
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/modetoa.c@1.8 +10 -0
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/msyslog.c@1.7 +10 -0
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/netof.c@1.9 +10 -0
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/numtoa.c@1.7 +11 -0
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/numtohost.c@1.7 +11 -0
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/prettydate.c@1.6 +10 -0
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/recvbuff.c@1.7 +3 -0
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/refidsmear.c@1.7 +10 -0
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/refnumtoa.c@1.7 +10 -0
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/run-calendar.c@1.11 +15 -15
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/run-decodenetnum.c@1.10 +6 -6
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/run-humandate.c@1.7 +2 -2
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/run-lfptostr.c@1.8 +11 -11
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/run-modetoa.c@1.12 +2 -2
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/run-msyslog.c@1.9 +8 -8
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/run-netof.c@1.8 +4 -4
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/run-numtoa.c@1.11 +2 -2
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/run-numtohost.c@1.11 +1 -1
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/run-prettydate.c@1.6 +1 -1
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/run-refidsmear.c@1.8 +1 -1
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/run-refnumtoa.c@1.9 +2 -2
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/run-sfptostr.c@1.6 +8 -8
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/run-socktoa.c@1.13 +6 -6
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/run-statestr.c@1.11 +4 -4
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/run-strtolfp.c@1.6 +7 -7
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/run-timespecops.c@1.11 +28 -28
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/run-timevalops.c@1.13 +28 -28
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/run-uglydate.c@1.11 +1 -1
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/sfptostr.c@1.4 +10 -0
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/socktoa.c@1.11 +11 -0
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/statestr.c@1.6 +11 -0
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/strtolfp.c@1.7 +10 -0
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/timespecops.c@1.10 +10 -0
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/timevalops.c@1.13 +10 -0
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/uglydate.c@1.10 +13 -1
+ Unity test cleanup. Harlan Stenn.
+
+ tests/sandbox/run-uglydate.c@1.6 +1 -1
+ Unity test cleanup. Harlan Stenn.
+
+ tests/sandbox/smeartest.c@1.9 +2 -0
+ Unity test cleanup. Harlan Stenn.
+
+ tests/sandbox/uglydate.c@1.5 +11 -0
+ Unity test cleanup. Harlan Stenn.
+
+ChangeSet@1.3594, 2015-11-20 07:40:57+00:00, stenn@psp-at1.ntp.org
+ [Bug 2958] ntpq: fatal error messages need a final newline. Craig Leres.
+
+ ChangeLog@1.1769 +1 -0
+ [Bug 2958] ntpq: fatal error messages need a final newline. Craig Leres.
+
+ ntpq/ntpq.c@1.164 +1 -1
+ [Bug 2958] ntpq: fatal error messages need a final newline. Craig Leres.
+
+ChangeSet@1.3593, 2015-11-20 07:27:27+00:00, stenn@psp-at1.ntp.org
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/authkeys.c@1.13 +36 -10
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/buftvtots.c@1.6 +18 -6
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/calendar.c@1.10 +100 -47
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/caljulian.c@1.12 +27 -9
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/clocktime.c@1.9 +48 -24
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/humandate.c@1.6 +6 -2
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/lfpfunc.c@1.15 +113 -69
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/netof.c@1.8 +22 -7
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/numtohost.c@1.6 +1 -1
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/octtoint.c@1.7 +36 -14
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/refidsmear.c@1.6 +1 -4
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/refnumtoa.c@1.6 +5 -5
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/run-lfpfunc.c@1.18 +9 -9
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/run-refidsmear.c@1.7 +1 -1
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/timespecops.c@1.9 +173 -48
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/timestructs.h@1.3 +22 -22
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/timevalops.c@1.12 +168 -52
+ Unity test cleanup. Harlan Stenn.
+
+ChangeSet@1.3592, 2015-11-20 02:57:37+01:00, jnperlin@nemesis.localnet
+ [Bug 2969] Seg fault from ntpq/mrulist when looking at server with lots of clients
+
+ ChangeLog@1.1768 +2 -0
+ [Bug 2969] Seg fault from ntpq/mrulist when looking at server with lots of clients
+
+ lib/isc/sockaddr.c@1.14 +1 -1
+ [Bug 2969] Seg fault from ntpq/mrulist when looking at server with lots of clients
+ - cast fro size_t to u_int (no overflow danger); not related the bug, found while double-checking changes
+
+ ntpq/ntpq-subs.c@1.113 +1 -1
+ [Bug 2969] Seg fault from ntpq/mrulist when looking at server with lots of clients
+ - make end-of-buffer test unsigned-safe
+
+ChangeSet@1.3591, 2015-11-17 11:12:02+00:00, stenn@psp-at1.ntp.org
+ [Bug 2932] Update leapsecond file info in miscopt.html. CWoodbury, HStenn.
+
+ ChangeLog@1.1767 +1 -0
+ [Bug 2932] Update leapsecond file info in miscopt.html. CWoodbury, HStenn.
+
+ html/miscopt.html@1.84 +3 -3
+ [Bug 2932] Update leapsecond file info in miscopt.html. CWoodbury, HStenn.
+
+ChangeSet@1.3588, 2015-11-17 05:02:10+00:00, stenn@psp-at1.ntp.org
+ Credit Martin for 2965
+
+ ChangeLog@1.1764.1.3 +1 -1
+ Credit Martin for 2965
+
+ChangeSet@1.3587, 2015-11-17 04:53:39+00:00, stenn@psp-at1.ntp.org
+ cleanup
+
+ ChangeLog@1.1764.1.2 +1 -1
+ cleanup
+
+ChangeSet@1.3584.2.1, 2015-11-16 11:59:55+01:00, burnicki@pc-martin4.
+ [Bug 2965] Local clock didn't work since 4.2.8p4
+
+ ChangeLog@1.1764.1.1 +1 -0
+ [Bug 2965] Local clock didn't work since 4.2.8p4
+
+ ntpd/refclock_local.c@1.22 +1 -0
+ [Bug 2965] Local clock didn't work since 4.2.8p4
+
+ChangeSet@1.3584.1.2, 2015-11-14 01:01:05+01:00, jnperlin@hydra.localnet
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - fix warnings in test cases
+
+ tests/libntp/a_md5encrypt.c@1.14 +23 -15
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - fix terrible const/noconst and alignment mess
+
+ tests/libntp/authkeys.c@1.12 +1 -1
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - fixed cast to const cast
+
+ tests/libntp/run-a_md5encrypt.c@1.15 +5 -5
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - update generated file
+
+ tests/ntpd/rc_cmdlength.c@1.3 +1 -0
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - add header to get prototype
+
+ tests/ntpd/run-rc_cmdlength.c@1.4 +2 -1
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+
+ChangeSet@1.3584.1.1, 2015-11-13 22:54:35+01:00, jnperlin@hydra.localnet
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - fixed several other warnings (cast-alignment, missing const, missing prorotypes)
+ - promote use of 'size_t' for values that express a size
+ - use ptr-to-const for read-only arguments
+ - make sure SOCKET values are not truncated (win32-specific)
+ - format string fixes
+
+ ChangeLog@1.1765 +6 -0
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets.
+
+ include/Makefile.am@1.53 +1 -0
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - added 'safeconst.h' to noinstall-headers
+
+ include/ntp_refclock.h@1.37 +1 -1
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - use ptr-to-const for read-only values
+
+ include/ntp_stdlib.h@1.80 +4 -4
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - promote use of 'size_t' for values that express a size
+ - use ptr-to-const for read-only data
+
+ include/ntpd.h@1.193 +1 -1
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - promote use of 'size_t' for values that express a size
+
+ include/safecast.h@1.1 +34 -0
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - checked or saturated size conversion
+ - added unaligned pointer casts
+
+ include/safecast.h@1.0 +0 -0
+
+ lib/isc/backtrace.c@1.3 +1 -1
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - avoid increased-alignment-earning in pointer cast
+
+ lib/isc/buffer.c@1.2 +2 -2
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - promote use of 'size_t' for values that express a size
+
+ lib/isc/inet_aton.c@1.6 +2 -3
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - promote use of 'size_t' for values that express a size
+
+ lib/isc/inet_pton.c@1.7 +3 -3
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - promote use of 'size_t' for values that express a size
+
+ lib/isc/log.c@1.9 +1 -1
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - promote use of 'size_t' for values that express a size
+
+ lib/isc/netaddr.c@1.14 +1 -1
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - explicit cast (no overflow) to u_int
+
+ lib/isc/sockaddr.c@1.13 +1 -1
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - explicit cast to 'u_int' (no overflow possible)
+
+ lib/isc/task.c@1.8 +8 -8
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - avoid warnings about increased alignment requirements (not using 'safecast.h' since it's not in this lib)
+
+ lib/isc/win32/interfaceiter.c@1.23 +1 -1
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - avoid truncation of SOCKET
+
+ lib/isc/win32/net.c@1.17 +2 -1
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - avoid truncation of SOCKET
+
+ libntp/a_md5encrypt.c@1.35 +14 -14
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - promote use of 'size_t' for values that express a size
+ - use ptr-to-const for read-only values
+
+ libntp/atolfp.c@1.7 +2 -2
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - explit cast from size_t to u_long (no overflow possoble)
+
+ libntp/authkeys.c@1.27.1.1 +4 -4
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - promote use of 'size_t' for values that express a size
+
+ libntp/authusekey.c@1.10 +1 -1
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - promote use of 'size_t' for values that express a size
+
+ libntp/dolfptoa.c@1.12 +3 -3
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - explicit cast to size_t to in (no overflow possible)
+
+ libntp/hextolfp.c@1.5 +6 -4
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - explicit cast size_t to u_long (no overflow possible)
+
+ libntp/mstolfp.c@1.5 +1 -2
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - promote use of 'size_t' for values that express a size
+
+ libntp/msyslog.c@1.54 +1 -1
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - promote use of 'size_t' for values that express a size
+
+ libntp/ntp_crypto_rnd.c@1.4 +2 -1
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - use checked cast for interface with openSSL
+
+ libntp/ntp_lineedit.c@1.14 +2 -1
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - downcast of size_t (no risk here)
+
+ libntp/ntp_worker.c@1.6 +2 -1
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - downcast of size_t (no real risk of overflow)
+
+ libntp/snprintf.c@1.13 +10 -10
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - use explicit downcasts in conversions
+
+ libparse/clk_computime.c@1.13 +1 -1
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - use "%p" to format pointers
+
+ libparse/clk_dcf7000.c@1.13 +1 -1
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - use "%p" to format pointers
+
+ libparse/clk_hopf6021.c@1.12 +1 -1
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - use "%p" to format pointers
+
+ libparse/clk_meinberg.c@1.16 +2 -2
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - use "%p" to format pointers
+
+ libparse/clk_rawdcf.c@1.23 +1 -1
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - use "%p" to format pointers
+
+ libparse/clk_rcc8000.c@1.12 +1 -1
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - use "%p" to format pointers
+
+ libparse/clk_schmid.c@1.15 +1 -1
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - use "%p" to format pointers
+
+ libparse/clk_trimtaip.c@1.13 +1 -1
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - use "%p" to format pointers
+
+ libparse/clk_varitext.c@1.12 +6 -6
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - commented unused static const values
+ ---
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - use "%p" to format pointers
+
+ libparse/clk_wharton.c@1.11 +1 -1
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - use "%p" to format pointers
+
+ libparse/parse.c@1.21 +1 -1
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - use "%p" to format pointers
+
+ ntpd/ntp_control.c@1.205 +5 -5
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - promote use of 'size_t' for values that express a size
+
+ ntpd/ntp_crypto.c@1.185 +2 -2
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - fix small signed/unsigned clash
+
+ ntpd/ntp_io.c@1.409 +6 -6
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - remove cast-alignment warnings by casting via 'void*'
+ - proper cast from SOCKET to int when file descriptor needed
+
+ ntpd/ntp_loopfilter.c@1.188 +2 -0
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - avoid 'unused' warnings
+
+ ntpd/ntp_proto.c@1.369 +8 -6
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - promote use of 'size_t' for values that express a size
+ - format string fixes
+ - fix signed/unsigned clash
+
+ ntpd/ntp_refclock.c@1.121 +3 -3
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - use ptr-to-const for read-only parameters
+
+ ntpd/ntp_request.c@1.115 +2 -2
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - avoid serious LP64 problem by using uint32_t instead of u_long
+
+ ntpd/ntp_restrict.c@1.40 +2 -2
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - promote use of 'size_t' for values that express a size
+
+ ntpd/ntp_signd.c@1.5 +3 -2
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - fixed missing 'const' in cast
+
+ ntpd/ntp_timer.c@1.93 +7 -6
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - avoid mixed float/int calculations
+
+ ntpd/ntp_util.c@1.117 +3 -3
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - promote use of 'size_t' for values that express a size
+
+ ntpd/refclock_parse.c@1.82 +2 -2
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - promote use of 'size_t' for values that express a size
+
+ ntpd/refclock_shm.c@1.38 +3 -2
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - fixed some volatile madness & casts
+
+ ntpd/refclock_true.c@1.25 +1 -1
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - promote use of 'size_t' for values that express a size
+
+ ntpd/refclock_tsyncpci.c@1.10 +1 -1
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - remove cast-alignment warnings by omitting superfluous cast
+
+ ntpdate/ntpdate.c@1.97 +7 -7
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - promote use of 'size_t' for values that express a size
+ - avoid truncation of SOCKET handles
+
+ ntpdc/ntpdc.c@1.105 +36 -34
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - promote use of 'size_t' for values that express a size
+ - format string fixes
+
+ ntpdc/ntpdc.h@1.12 +1 -1
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - promote use of 'size_t' for values that express a size
+
+ ntpdc/ntpdc_ops.c@1.81 +109 -109
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - promote use of 'size_t' for values that express a size
+ - format string fixes
+
+ ntpq/libntpq.c@1.13 +7 -9
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - promote use of 'size_t' for values that express a size
+ - format string fixes
+
+ ntpq/libntpq.h@1.11 +1 -1
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - more size_t propagation and format string fixes
+
+ ntpq/libntpq_subs.c@1.7 +1 -1
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - more size_t propagation and format string fixes
+
+ ntpq/ntpq-subs.c@1.112 +39 -37
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - promote use of 'size_t' for values that express a size
+ - format string fixes
+
+ ntpq/ntpq.c@1.163 +34 -34
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - promote use of 'size_t' for values that express a size
+ - format string fixes
+
+ ntpq/ntpq.h@1.30 +7 -7
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - promote use of 'size_t' for values that express a size
+
+ ports/winnt/include/config.h@1.113 +1 -1
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - use ptr-to-const for read-only values
+
+ ports/winnt/include/ntp_iocompletionport.h@1.21 +1 -1
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - avoid truncation of SOCKET identifiers
+
+ ports/winnt/instsrv/instsrv.c@1.7 +6 -6
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - explicit cast to DWORD (overflow hardly possible)
+
+ ports/winnt/libntp/termios.c@1.32 +18 -16
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - promote use of 'size_t' for values that express a size
+ - use ptr-to-const for read-only values
+ - avoid truncation of handle
+
+ ports/winnt/ntpd/ntp_iocompletionport.c@1.72 +9 -6
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - avoid truncation of SOCKET handles
+
+ ports/winnt/vs2008/common.vsprops@1.2 +1 -1
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - disable a size_t cast warnings
+
+ ports/winnt/vs2008/ntpd/ntpd.vcproj@1.50 +49 -17
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - disable C4307 (integer constant overflow) on refclock_arc.c
+
+ ports/winnt/vs2013/common.props@1.2 +1 -1
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - disable the annoying truncation-of-value error
+
+ ports/winnt/vs2013/libntp/libntp.vcxproj@1.9 +1 -0
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - add 'safecast.h' header
+
+ ports/winnt/vs2013/libntp/libntp.vcxproj.filters@1.7 +3 -0
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - add safecast.h header
+
+ ports/winnt/vs2013/ntpd/ntpd.vcxproj@1.8 +7 -1
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - refclock_arc is very noisy with integer constant overflow
+
+ sntp/networking.c@1.67 +1 -1
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - remove cast-alignment warnings by casting via 'void*'
+
+ tests/libntp/authkeys.c@1.11 +1 -1
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - fix missing 'const' in cast
+
+ tests/ntpd/ntp_restrict.c@1.3 +1 -0
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - fix function declarations
+
+ tests/ntpd/run-ntp_restrict.c@1.5 +8 -8
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - update auto-generated file
+
+ tests/ntpd/run-t-ntp_signd.c@1.9 +7 -7
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - fix function prototypes
+
+ tests/ntpd/t-ntp_scanner.c@1.7 +3 -3
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - add missing 'const' declarations
+
+ tests/ntpd/t-ntp_signd.c@1.11 +24 -13
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - added missing prototypes and a fix serious pointer problem
+
+ tests/sandbox/run-uglydate.c@1.3.1.1 +1 -1
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - update generated file
+
+ tests/sandbox/uglydate.c@1.2.1.1 +4 -1
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - add prototypes
+
+ tests/sec-2853/sec-2853.c@1.7 +6 -6
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - fix size_t format
+
+ util/ntp-keygen.c@1.107 +3 -3
+ [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets
+ - let openssl sort out the string size
+
+ChangeSet@1.3585, 2015-11-07 23:46:41+00:00, stenn@psp-at1.ntp.org
+ Unity test cleanup. Harlan Stenn.
+
+ sntp/tests/t-log.c@1.4 +1 -1
+ Unity test cleanup. Harlan Stenn.
+
+ tests/sandbox/run-uglydate.c@1.4 +1 -1
+ Unity test cleanup. Harlan Stenn.
+
+ tests/sandbox/uglydate.c@1.3 +2 -0
+ Unity test cleanup. Harlan Stenn.
+
+ChangeSet@1.3581.1.1, 2015-11-06 08:33:23+01:00, jnperlin@hydra.localnet
+ [Bug 2957] format specifies type 'unsigned int' but the argument has type 'size_t'
+ - accept key file only if there are no parsing errors
+ - fixed size_t/u_int format clash
+ - restore pre-Bug1243 compatibility (revert 'strlcpy()' to 'strncpy()' as 'strlcpy()' is wrong here)
+
+ ChangeLog@1.1761.1.1 +4 -0
+ [Bug 2957] format specifies type 'unsigned int' but the argument has type 'size_t'
+ - accept key file only if there are no parsing errors
+ - fixed size_t/u_int format clash
+ - restore pre-Bug1243 compatibility (revert 'strlcpy()' to 'strncpy()' as 'strlcpy()' is wrong here)
+
+ libntp/authkeys.c@1.28 +17 -5
+ [Bug 2957] format specifies type 'unsigned int' but the argument has type 'size_t'
+ - restore pre-Bug1243 compatibility (revert 'strlcpy()' to 'strncpy()' as 'strlcpy()' is wrong here)
+
+ libntp/authreadkeys.c@1.23 +68 -22
+ [Bug 2957] format specifies type 'unsigned int' but the argument has type 'size_t'
+ - accept key file only if there are no parsing errors
+ - fixed size_t/u_int format clash
+
+ChangeSet@1.3584, 2015-11-05 11:47:50+00:00, stenn@psp-at1.ntp.org
+ Unity test cleanup. Harlan Stenn.
+
+ ChangeLog@1.1764 +1 -0
+ Unity test cleanup. Harlan Stenn.
+
+ sntp/tests/run-t-log.c@1.4 +1 -1
+ Unity test cleanup. Harlan Stenn.
+
+ sntp/tests/t-log.c@1.3 +1 -0
+ Unity test cleanup. Harlan Stenn.
+
+ sntp/tests/utilities.c@1.5 +2 -2
+ Unity test cleanup. Harlan Stenn.
+
+ tests/bug-2803/bug-2803.c@1.10 +1 -1
+ Unity test cleanup. Harlan Stenn.
+
+ tests/bug-2803/run-bug-2803.c@1.9 +2 -0
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/a_md5encrypt.c@1.13 +2 -2
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/caljulian.c@1.11 +4 -4
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/lfpfunc.c@1.14 +9 -9
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/netof.c@1.7 +10 -10
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/prettydate.c@1.5 +3 -2
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/recvbuff.c@1.6 +1 -1
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/socktoa.c@1.10 +2 -2
+ Unity test cleanup. Harlan Stenn.
+
+ tests/libntp/uglydate.c@1.9 +2 -2
+ Unity test cleanup. Harlan Stenn.
+
+ tests/sandbox/smeartest.c@1.8 +1 -0
+ Unity test cleanup. Harlan Stenn.
+
+ tests/sandbox/uglydate.c@1.2 +2 -2
+ Unity test cleanup. Harlan Stenn.
+
+ tests/sec-2853/sec-2853.c@1.6 +1 -4
+ Unity test cleanup. Harlan Stenn.
+
+ChangeSet@1.3583, 2015-11-05 10:37:38+00:00, stenn@psp-at1.ntp.org
+ Unity cleanup for FreeBSD-6.4. Harlan Stenn.
+
+ ChangeLog@1.1763 +1 -1
+ Unity cleanup for FreeBSD-6.4. Harlan Stenn.
+
+ ChangeLog@1.1762 +1 -0
+ Unity cleanup for FreeBSD-6.2. Harlan Stenn.
+
+ sntp/m4/ntp_problemtests.m4@1.4 +4 -1
+ Unity cleanup for FreeBSD-6.4. Harlan Stenn.
+
+ChangeSet@1.3582, 2015-11-05 10:01:57+00:00, stenn@psp-at1.ntp.org
+ Sec 2956 cleanup
+
+ include/ntpd.h@1.192 +1 -0
+ Sec 2956 cleanup
+
+ libntp/systime.c@1.70 +2 -3
+ Sec 2956 cleanup
+
+ ntpd/ntp_loopfilter.c@1.187 +0 -2
+ Sec 2956 cleanup
+
+ ntpdate/ntpdate.c@1.96 +0 -3
+ Sec 2956 cleanup
+
+ ntpsnmpd/ntpsnmpd.c@1.10 +0 -3
+ Sec 2956 cleanup
+
+ sntp/main.c@1.98 +0 -3
+ Sec 2956 cleanup
+
+ChangeSet@1.3581, 2015-11-04 10:02:25+00:00, stenn@psp-at1.ntp.org
+ [Bug 2934] tests/ntpd/t-ntp_scanner.c has a magic constant wired in. HMurray
+
+ ChangeLog@1.1761 +2 -1
+ [Bug 2934] tests/ntpd/t-ntp_scanner.c has a magic constant wired in. HMurray
+
+ tests/ntpd/t-ntp_scanner.c@1.6 +1 -1
+ [Bug 2934] tests/ntpd/t-ntp_scanner.c has a magic constant wired in. HMurray
+
+ChangeSet@1.3580, 2015-11-04 08:39:12+00:00, stenn@psp-at1.ntp.org
+ [Sec 2956] small-step/big-step. Close the panic gate earlier.
+
+ ChangeLog@1.1760 +2 -0
+ [Sec 2956] small-step/big-step. Close the panic gate earlier.
+
+ libntp/systime.c@1.69 +23 -2
+ [Sec 2956] small-step/big-step. Close the panic gate earlier.
+
+ ntpd/ntp_loopfilter.c@1.186 +17 -27
+ [Sec 2956] small-step/big-step. Close the panic gate earlier.
+
+ ntpdate/ntpdate.c@1.95 +3 -0
+ [Sec 2956] small-step/big-step. Close the panic gate earlier.
+
+ ntpsnmpd/ntpsnmpd.c@1.9 +3 -0
+ [Sec 2956] small-step/big-step. Close the panic gate earlier.
+
+ sntp/main.c@1.97 +3 -0
+ [Sec 2956] small-step/big-step. Close the panic gate earlier.
+
+ChangeSet@1.3579, 2015-11-03 22:08:46+01:00, jnperlin@hydra.localnet
+ [Bug 2954] Version 4.2.8p4 crashes on startup with sig fault
+ - limit threading warm-up to linux; FreeBSD bombs on it. perlinger@ntp.org
+
+ ChangeLog@1.1759 +1 -0
+ [Bug 2954] Version 4.2.8p4 crashes on startup with sig fault
+ - limit threading warm-up to linux; FreeBSD bombs on it. perlinger@ntp.org
+
+ ntpd/ntpd.c@1.166 +9 -2
+ [Bug 2954] Version 4.2.8p4 crashes on startup with sig fault
+ - limit threading warm-up to linux; FreeBSD bombs on it. perlinger@ntp.org
+
+ChangeSet@1.3578, 2015-10-31 18:04:18+00:00, perlinger@psp-deb1.ntp.org
+ [Bug 2954] Version 4.2.8p4 crashes on startup with sig fault
+ - fixed race conditions between worker and main thread in DNS worker
+
+ ChangeLog@1.1758 +3 -0
+ [Bug 2954] Version 4.2.8p4 crashes on startup with sig fault
+ - fixed race conditions between worker and main thread in DNS worker
+
+ include/ntp_worker.h@1.4 +45 -21
+ [Bug 2954] Version 4.2.8p4 crashes on startup with sig fault
+ - provide shared access lock based on semaphore
+ - better isolation of OS dependencies
+
+ libntp/work_thread.c@1.18 +370 -231
+ [Bug 2954] Version 4.2.8p4 crashes on startup with sig fault
+ - fixed race conditions between worker and main thread
+ - better (still not perfect) isolation of OS dependent code for semaphore handling
+
ChangeSet@1.3577, 2015-10-21 12:42:02-04:00, stenn@deacon.udel.edu
NTP_4_2_8P4
TAG: NTP_4_2_8P4
diff --git a/contrib/ntp/NEWS b/contrib/ntp/NEWS
index e16d937..32c9288 100644
--- a/contrib/ntp/NEWS
+++ b/contrib/ntp/NEWS
@@ -1,7 +1,108 @@
---
+
+NTP 4.2.8p5
+
+Focus: Security, Bug fixes, enhancements.
+
+Severity: MEDIUM
+
+In addition to bug fixes and enhancements, this release fixes the
+following medium-severity vulnerability:
+
+* Small-step/big-step. Close the panic gate earlier.
+ References: Sec 2956, CVE-2015-5300
+ Affects: All ntp-4 releases up to, but not including 4.2.8p5, and
+ 4.3.0 up to, but not including 4.3.78
+ CVSS3: (AV:N/AC:H/PR:H/UI:R/S:C/C:L/I:N/A:L) Base Score: 4.0, MEDIUM
+ Summary: If ntpd is always started with the -g option, which is
+ common and against long-standing recommendation, and if at the
+ moment ntpd is restarted an attacker can immediately respond to
+ enough requests from enough sources trusted by the target, which
+ is difficult and not common, there is a window of opportunity
+ where the attacker can cause ntpd to set the time to an
+ arbitrary value. Similarly, if an attacker is able to respond
+ to enough requests from enough sources trusted by the target,
+ the attacker can cause ntpd to abort and restart, at which
+ point it can tell the target to set the time to an arbitrary
+ value if and only if ntpd was re-started against long-standing
+ recommendation with the -g flag, or if ntpd was not given the
+ -g flag, the attacker can move the target system's time by at
+ most 900 seconds' time per attack.
+ Mitigation:
+ Configure ntpd to get time from multiple sources.
+ Upgrade to 4.2.8p5, or later, from the NTP Project Download
+ Page or the NTP Public Services Project Download Page
+ As we've long documented, only use the -g option to ntpd in
+ cold-start situations.
+ Monitor your ntpd instances.
+ Credit: This weakness was discovered by Aanchal Malhotra,
+ Isaac E. Cohen, and Sharon Goldberg at Boston University.
+
+ NOTE WELL: The -g flag disables the limit check on the panic_gate
+ in ntpd, which is 900 seconds by default. The bug identified by
+ the researchers at Boston University is that the panic_gate
+ check was only re-enabled after the first change to the system
+ clock that was greater than 128 milliseconds, by default. The
+ correct behavior is that the panic_gate check should be
+ re-enabled after any initial time correction.
+
+ If an attacker is able to inject consistent but erroneous time
+ responses to your systems via the network or "over the air",
+ perhaps by spoofing radio, cellphone, or navigation satellite
+ transmissions, they are in a great position to affect your
+ system's clock. There comes a point where your very best
+ defenses include:
+
+ Configure ntpd to get time from multiple sources.
+ Monitor your ntpd instances.
+
+Other fixes:
+
+* Coverity submission process updated from Coverity 5 to Coverity 7.
+ The NTP codebase has been undergoing regular Coverity scans on an
+ ongoing basis since 2006. As part of our recent upgrade from
+ Coverity 5 to Coverity 7, Coverity identified 16 nits in some of
+ the newly-written Unity test programs. These were fixed.
+* [Bug 2829] Clean up pipe_fds in ntpd.c perlinger@ntp.org
+* [Bug 2887] stratum -1 config results as showing value 99
+ - fudge stratum should only accept values [0..16]. perlinger@ntp.org
+* [Bug 2932] Update leapsecond file info in miscopt.html. CWoodbury, HStenn.
+* [Bug 2934] tests/ntpd/t-ntp_scanner.c has a magic constant wired in. HMurray
+* [Bug 2944] errno is not preserved properly in ntpdate after sendto call.
+ - applied patch by Christos Zoulas. perlinger@ntp.org
+* [Bug 2952] Peer associations broken by fix for Bug 2901/CVE-2015-7704.
+* [Bug 2954] Version 4.2.8p4 crashes on startup on some OSes.
+ - fixed data race conditions in threaded DNS worker. perlinger@ntp.org
+ - limit threading warm-up to linux; FreeBSD bombs on it. perlinger@ntp.org
+* [Bug 2957] 'unsigned int' vs 'size_t' format clash. perlinger@ntp.org
+ - accept key file only if there are no parsing errors
+ - fixed size_t/u_int format clash
+ - fixed wrong use of 'strlcpy'
+* [Bug 2958] ntpq: fatal error messages need a final newline. Craig Leres.
+* [Bug 2962] truncation of size_t/ptrdiff_t on 64bit targets. perlinger@ntp.org
+ - fixed several other warnings (cast-alignment, missing const, missing prototypes)
+ - promote use of 'size_t' for values that express a size
+ - use ptr-to-const for read-only arguments
+ - make sure SOCKET values are not truncated (win32-specific)
+ - format string fixes
+* [Bug 2965] Local clock didn't work since 4.2.8p4. Martin Burnicki.
+* [Bug 2967] ntpdate command suffers an assertion failure
+ - fixed ntp_rfc2553.c to return proper address length. perlinger@ntp.org
+* [Bug 2969] Seg fault from ntpq/mrulist when looking at server with
+ lots of clients. perlinger@ntp.org
+* [Bug 2971] ntpq bails on ^C: select fails: Interrupted system call
+ - changed stacked/nested handling of CTRL-C. perlinger@ntp.org
+* Unity cleanup for FreeBSD-6.4. Harlan Stenn.
+* Unity test cleanup. Harlan Stenn.
+* Libevent autoconf pthread fixes for FreeBSD-10. Harlan Stenn.
+* Header cleanup in tests/sandbox/uglydate.c. Harlan Stenn.
+* Header cleanup in tests/libntp/sfptostr.c. Harlan Stenn.
+* Quiet a warning from clang. Harlan Stenn.
+
+---
NTP 4.2.8p4
-Focus: Security, Bug fies, enhancements.
+Focus: Security, Bug fixes, enhancements.
Severity: MEDIUM
@@ -339,8 +440,8 @@ Credit: This weakness was discovered by Aleksandar Nikolic of Cisco Talos.
Backward-Incompatible changes:
* [Bug 2817] Default on Linux is now "rlimit memlock -1".
-While the general default of 32M is still the case, under Linux
-the default value has been changed to -1 (do not lock ntpd into
+ While the general default of 32M is still the case, under Linux
+ the default value has been changed to -1 (do not lock ntpd into
memory). A value of 0 means "lock ntpd into memory with whatever
memory it needs." If your ntp.conf file has an explicit "rlimit memlock"
value in it, that value will continue to be used.
diff --git a/contrib/ntp/configure b/contrib/ntp/configure
index 04813a8..758ffa9 100755
--- a/contrib/ntp/configure
+++ b/contrib/ntp/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for ntp 4.2.8p4.
+# Generated by GNU Autoconf 2.69 for ntp 4.2.8p5.
#
# Report bugs to <http://bugs.ntp.org./>.
#
@@ -590,8 +590,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='ntp'
PACKAGE_TARNAME='ntp'
-PACKAGE_VERSION='4.2.8p4'
-PACKAGE_STRING='ntp 4.2.8p4'
+PACKAGE_VERSION='4.2.8p5'
+PACKAGE_STRING='ntp 4.2.8p5'
PACKAGE_BUGREPORT='http://bugs.ntp.org./'
PACKAGE_URL='http://www.ntp.org./'
@@ -1616,7 +1616,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures ntp 4.2.8p4 to adapt to many kinds of systems.
+\`configure' configures ntp 4.2.8p5 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1686,7 +1686,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of ntp 4.2.8p4:";;
+ short | recursive ) echo "Configuration of ntp 4.2.8p5:";;
esac
cat <<\_ACEOF
@@ -1919,7 +1919,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-ntp configure 4.2.8p4
+ntp configure 4.2.8p5
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2749,7 +2749,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by ntp $as_me 4.2.8p4, which was
+It was created by ntp $as_me 4.2.8p5, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -3750,7 +3750,7 @@ fi
# Define the identity of the package.
PACKAGE='ntp'
- VERSION='4.2.8p4'
+ VERSION='4.2.8p5'
cat >>confdefs.h <<_ACEOF
@@ -20018,9 +20018,10 @@ $as_echo "$as_me: Using the installed libevent" >&6;}
# LDADD_LIBEVENT=`$PKG_CONFIG --libs libevent | sed 's:-levent::'`
# So now we dance...
LDADD_LIBEVENT=
- for i in `$PKG_CONFIG --libs libevent`
+ for i in `$PKG_CONFIG --libs libevent` `$PKG_CONFIG --cflags-only-other libevent_pthreads`
do
case "$i" in
+ -D*) ;;
-levent*) ;;
*) case "$LDADD_LIBEVENT" in
'') LDADD_LIBEVENT="$i" ;;
@@ -37035,8 +37036,9 @@ $as_echo "$ntp_ept" >&6; }
$as_echo_n "checking if we can run test-ntp_restrict... " >&6; }
ntp_test_ntp_restrict="no"
case "$ntp_ept:$cross:$host" in
+ no:0:*-*-freebsd6.4) ;;
+ no:0:*-*-hpux11.23*) ;;
no:0:*-*-solaris*) ;;
- no:0:*-*-hpux-11.23*) ;;
*) ntp_test_ntp_restrict="yes" ;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ntp_test_ntp_restrict" >&5
@@ -37054,6 +37056,7 @@ fi
$as_echo_n "checking if we can run test-ntp_scanner... " >&6; }
ntp_test_ntp_scanner="no"
case "$ntp_ept:$cross:$host" in
+ no:0:*-*-freebsd6.4) ;;
no:0:*-*-solaris*) ;;
*) ntp_test_ntp_scanner="yes" ;;
esac
@@ -37072,6 +37075,7 @@ fi
$as_echo_n "checking if we can run test-ntp_signd... " >&6; }
ntp_test_ntp_signd="no"
case "$ntp_ept:$cross:$host" in
+ no:0:*-*-freebsd6.4) ;;
no:0:*-*-solaris*) ;;
*) ntp_test_ntp_signd="yes" ;;
esac
@@ -37836,7 +37840,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by ntp $as_me 4.2.8p4, which was
+This file was extended by ntp $as_me 4.2.8p5, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -37903,7 +37907,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-ntp config.status 4.2.8p4
+ntp config.status 4.2.8p5
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/contrib/ntp/html/miscopt.html b/contrib/ntp/html/miscopt.html
index c619022..261b08f 100644
--- a/contrib/ntp/html/miscopt.html
+++ b/contrib/ntp/html/miscopt.html
@@ -3,7 +3,7 @@
<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
<title>Miscellaneous Commands and Options</title>
-<!-- Changed by: Harlan Stenn, 29-Jun-2015 -->
+<!-- Changed by: Harlan Stenn, 17-Nov-2015 -->
<link href="scripts/style.css" type="text/css" rel="stylesheet">
</head>
<body>
@@ -11,7 +11,7 @@
<img src="pic/boom3.gif" alt="gif" align="left"><a href="http://www.eecis.udel.edu/~mills/pictures.html">from <i>Pogo</i>, Walt Kelly</a>
<p>We have three, now looking for more.</p>
<p>Last update:
- <!-- #BeginDate format:En2m -->23-Sep-2015 10:20<!-- #EndDate -->
+ <!-- #BeginDate format:En2m -->17-Nov-2015 11:06<!-- #EndDate -->
UTC</p>
<br clear="left">
<h4>Related Links</h4>
@@ -57,7 +57,7 @@
<dt id="interface"><tt>interface [listen | ignore | drop] [all | ipv4 | ipv6 | wildcard | <i>name</i> | <i>address</i>[/<i>prefixlen</i>]]</tt></dt>
<dd>This command controls which network addresses <tt>ntpd</tt> opens, and whether input is dropped without processing. The first parameter determines the action for addresses which match the second parameter. That parameter specifies a class of addresses, or a specific interface name, or an address. In the address case, <tt><i>prefixlen</i></tt> determines how many bits must match for this rule to apply. <tt>ignore</tt> prevents opening matching addresses, <tt>drop</tt> causes <tt>ntpd</tt> to open the address and drop all received packets without examination. Multiple <tt>interface</tt> commands can be used. The last rule which matches a particular address determines the action for it. <tt>interface</tt> commands are disabled if any <a href="ntpd.html#--interface"><tt>-I</tt></a>, <a href="ntpd.html#--interface"><tt>--interface</tt></a>, <a href="ntpd.html#--novirtualips"><tt>-L</tt></a>, or <a href="ntpd.html#--novirtualips"><tt>--novirtualips</tt></a> command-line options are used. If none of those options are used and no <tt>interface</tt> actions are specified in the configuration file, all available network addresses are opened. The <tt>nic</tt> command is an alias for <tt>interface</tt>.</dd>
<dt id="leapfile"><tt>leapfile <i>leapfile</i></tt></dt>
- <dd>This command loads the NIST leapseconds file and initializes the leapsecond values for the next leapsecond time, expiration time and TAI offset. The file can be obtained directly from NIST national time servers using <tt>ftp</tt> as the ASCII file <tt>pub/leap-seconds</tt>.</dd>
+ <dd>This command loads the IERS leapseconds file and initializes the leapsecond values for the next leapsecond time, expiration time and TAI offset. The file can be obtained directly from the IERS at <a href="https://hpiers.obspm.fr/iers/bul/bulc/ntp/leap-seconds.list">https://hpiers.obspm.fr/iers/bul/bulc/ntp/leap-seconds.list</a> or <a href="ftp://hpiers.obspm.fr/iers/bul/bulc/ntp/leap-seconds.list">ftp://hpiers.obspm.fr/iers/bul/bulc/ntp/leap-seconds.list</a>.</dd>
<dd>The <i>leapfile</i> is scanned when <tt>ntpd</tt> processes the <tt>leapfile</tt> directive or when <tt>ntpd</tt> detects that <i>leapfile</i> has changed. <tt>ntpd</tt> checks once a day to see if the <i>leapfile</i> has changed.</dd>
<dd>While not strictly a security function, the Autokey protocol provides means to securely retrieve the current or updated leapsecond values from a server.</dd>
<dt id="leapsmearinterval"><tt>leapsmearinterval <i>seconds</i></tt></dt>
diff --git a/contrib/ntp/include/Makefile.am b/contrib/ntp/include/Makefile.am
index f032c97..d8b4dd2 100644
--- a/contrib/ntp/include/Makefile.am
+++ b/contrib/ntp/include/Makefile.am
@@ -66,6 +66,7 @@ noinst_HEADERS = \
recvbuff.h \
refclock_atom.h \
refidsmear.h \
+ safecast.h \
ssl_applink.c \
timepps-SCO.h \
timepps-Solaris.h \
diff --git a/contrib/ntp/include/Makefile.in b/contrib/ntp/include/Makefile.in
index 8f0968b..6e45e93 100644
--- a/contrib/ntp/include/Makefile.in
+++ b/contrib/ntp/include/Makefile.in
@@ -551,6 +551,7 @@ noinst_HEADERS = \
recvbuff.h \
refclock_atom.h \
refidsmear.h \
+ safecast.h \
ssl_applink.c \
timepps-SCO.h \
timepps-Solaris.h \
diff --git a/contrib/ntp/include/ntp_refclock.h b/contrib/ntp/include/ntp_refclock.h
index f92d14c..b264dfa 100644
--- a/contrib/ntp/include/ntp_refclock.h
+++ b/contrib/ntp/include/ntp_refclock.h
@@ -220,7 +220,7 @@ extern void refclock_buginfo(sockaddr_u *,
extern void refclock_control(sockaddr_u *,
const struct refclockstat *,
struct refclockstat *);
-extern int refclock_open (char *, u_int, u_int);
+extern int refclock_open (const char *, u_int, u_int);
extern int refclock_setup (int, u_int, u_int);
extern void refclock_timer (struct peer *);
extern void refclock_transmit(struct peer *);
diff --git a/contrib/ntp/include/ntp_stdlib.h b/contrib/ntp/include/ntp_stdlib.h
index a2e62da..d735b41 100644
--- a/contrib/ntp/include/ntp_stdlib.h
+++ b/contrib/ntp/include/ntp_stdlib.h
@@ -65,8 +65,8 @@ typedef void (*ctrl_c_fn)(void);
/* authkeys.c */
extern void auth_delkeys (void);
extern int auth_havekey (keyid_t);
-extern int authdecrypt (keyid_t, u_int32 *, int, int);
-extern int authencrypt (keyid_t, u_int32 *, int);
+extern int authdecrypt (keyid_t, u_int32 *, size_t, size_t);
+extern size_t authencrypt (keyid_t, u_int32 *, size_t);
extern int authhavekey (keyid_t);
extern int authistrusted (keyid_t);
extern int authreadkeys (const char *);
@@ -95,8 +95,8 @@ extern void auth_prealloc_symkeys(int);
extern int ymd2yd (int, int, int);
/* a_md5encrypt.c */
-extern int MD5authdecrypt (int, u_char *, u_int32 *, int, int);
-extern int MD5authencrypt (int, u_char *, u_int32 *, int);
+extern int MD5authdecrypt (int, const u_char *, u_int32 *, size_t, size_t);
+extern size_t MD5authencrypt (int, const u_char *, u_int32 *, size_t);
extern void MD5auth_setkey (keyid_t, int, const u_char *, size_t);
extern u_int32 addr2refid (sockaddr_u *);
diff --git a/contrib/ntp/include/ntp_worker.h b/contrib/ntp/include/ntp_worker.h
index f7e8d5b..50616b3 100644
--- a/contrib/ntp/include/ntp_worker.h
+++ b/contrib/ntp/include/ntp_worker.h
@@ -43,19 +43,22 @@ typedef struct blocking_pipe_header_tag {
} blocking_pipe_header;
# ifdef WORK_THREAD
-# ifdef WORK_PIPE
-typedef pthread_t * thr_ref;
-typedef sem_t * sem_ref;
+# ifdef SYS_WINNT
+typedef struct { HANDLE thnd; } thread_type;
+typedef struct { HANDLE shnd; } sema_type;
# else
-typedef HANDLE thr_ref;
-typedef HANDLE sem_ref;
+typedef pthread_t thread_type;
+typedef sem_t sema_type;
# endif
+typedef thread_type *thr_ref;
+typedef sema_type *sem_ref;
# endif
/*
*
*/
-#ifdef WORK_FORK
+#if defined(WORK_FORK)
+
typedef struct blocking_child_tag {
int reusable;
int pid;
@@ -66,38 +69,59 @@ typedef struct blocking_child_tag {
int resp_write_pipe;
int ispipe;
} blocking_child;
+
#elif defined(WORK_THREAD)
+
typedef struct blocking_child_tag {
/*
* blocking workitems and blocking_responses are dynamically-sized
* one-dimensional arrays of pointers to blocking worker requests and
* responses.
+ *
+ * IMPORTANT: This structure is shared between threads, and all access
+ * that is not atomic (especially queue operations) must hold the
+ * 'accesslock' semaphore to avoid data races.
+ *
+ * The resource management (thread/semaphore creation/destruction)
+ * functions and functions just testing a handle are safe because these
+ * are only changed by the main thread when no worker is running on the
+ * same data structure.
*/
int reusable;
- thr_ref thread_ref;
- u_int thread_id;
- blocking_pipe_header * volatile * volatile
+ sem_ref accesslock; /* shared access lock */
+ thr_ref thread_ref; /* thread 'handle' */
+
+ /* the reuest queue */
+ blocking_pipe_header ** volatile
workitems;
volatile size_t workitems_alloc;
- size_t next_workitem; /* parent */
- size_t next_workeritem; /* child */
- blocking_pipe_header * volatile * volatile
+ size_t head_workitem; /* parent */
+ size_t tail_workitem; /* child */
+ sem_ref workitems_pending; /* signalling */
+
+ /* the response queue */
+ blocking_pipe_header ** volatile
responses;
volatile size_t responses_alloc;
- size_t next_response; /* child */
- size_t next_workresp; /* parent */
+ size_t head_response; /* child */
+ size_t tail_response; /* parent */
+
/* event handles / sem_t pointers */
- /* sem_ref child_is_blocking; */
- sem_ref blocking_req_ready;
sem_ref wake_scheduled_sleep;
+
+ /* some systems use a pipe for notification, others a semaphore.
+ * Both employ the queue above for the actual data transfer.
+ */
#ifdef WORK_PIPE
- int resp_read_pipe; /* parent */
- int resp_write_pipe;/* child */
+ int resp_read_pipe; /* parent */
+ int resp_write_pipe; /* child */
int ispipe;
- void * resp_read_ctx; /* child */
+ void * resp_read_ctx; /* child */
#else
- sem_ref blocking_response_ready;
+ sem_ref responses_pending; /* signalling */
#endif
+ sema_type sem_table[4];
+ thread_type thr_table[1];
} blocking_child;
#endif /* WORK_THREAD */
@@ -111,7 +135,7 @@ extern u_int available_blocking_child_slot(void);
extern int queue_blocking_request(blocking_work_req, void *,
size_t, blocking_work_callback,
void *);
-extern int queue_blocking_response(blocking_child *,
+extern int queue_blocking_response(blocking_child *,
blocking_pipe_header *, size_t,
const blocking_pipe_header *);
extern void process_blocking_resp(blocking_child *);
diff --git a/contrib/ntp/include/ntpd.h b/contrib/ntp/include/ntpd.h
index be3cd3e..362068c 100644
--- a/contrib/ntp/include/ntpd.h
+++ b/contrib/ntp/include/ntpd.h
@@ -156,7 +156,7 @@ extern u_int sys_tai;
extern int freq_cnt;
/* ntp_monitor.c */
-#define MON_HASH_SIZE (1U << mon_hash_bits)
+#define MON_HASH_SIZE ((size_t)1U << mon_hash_bits)
#define MON_HASH_MASK (MON_HASH_SIZE - 1)
#define MON_HASH(addr) (sock_hash(addr) & MON_HASH_MASK)
extern void init_mon (void);
@@ -408,6 +408,7 @@ extern int hardpps_enable; /* kernel PPS discipline enabled */
extern int ext_enable; /* external clock enabled */
extern int cal_enable; /* refclock calibrate enable */
extern int allow_panic; /* allow panic correction (-g) */
+extern int enable_panic_check; /* Can we check allow_panic's state? */
extern int force_step_once; /* always step time once at startup (-G) */
extern int mode_ntpdate; /* exit on first clock set (-q) */
extern int peer_ntpdate; /* count of ntpdate peers */
diff --git a/contrib/ntp/include/safecast.h b/contrib/ntp/include/safecast.h
new file mode 100644
index 0000000..9300463
--- /dev/null
+++ b/contrib/ntp/include/safecast.h
@@ -0,0 +1,34 @@
+#ifndef SAFECAST_H
+#define SAFECAST_H
+
+#include <limits.h>
+static inline int size2int_chk(size_t v)
+{
+ if (v > INT_MAX)
+ abort();
+ return (int)(v);
+}
+
+static inline int size2int_sat(size_t v)
+{
+ return (v > INT_MAX) ? INT_MAX : (int)v;
+}
+
+/* Compilers can emit warning about increased alignment requirements
+ * when casting pointers. The impact is tricky: on machines where
+ * alignment is just a performance issue (x86,x64,...) this might just
+ * cause a performance penalty. On others, an address error can occur
+ * and the process dies...
+ *
+ * Still, there are many cases where the pointer arithmetic and the
+ * buffer alignment make sure this does not happen. OTOH, the compiler
+ * doesn't know this and still emits warnings.
+ *
+ * The following cast macros are going through void pointers to tell
+ * the compiler that there is no alignment requirement to watch.
+ */
+#define UA_PTR(ptype,pval) ((ptype *)(void*)(pval))
+#define UAC_PTR(ptype,pval) ((const ptype *)(const void*)(pval))
+#define UAV_PTR(ptype,pval) ((volatile ptype *)(volatile void*)(pval))
+
+#endif
diff --git a/contrib/ntp/lib/isc/backtrace.c b/contrib/ntp/lib/isc/backtrace.c
index 4274da3..e0425e1 100644
--- a/contrib/ntp/lib/isc/backtrace.c
+++ b/contrib/ntp/lib/isc/backtrace.c
@@ -278,7 +278,7 @@ isc_backtrace_getsymbol(const void *addr, const char **symbolp,
result = ISC_R_NOTFOUND;
else {
*symbolp = found->symbol;
- *offsetp = (const char *)addr - (char *)found->addr;
+ *offsetp = (u_long)((const char *)addr - (char *)found->addr);
}
return (result);
diff --git a/contrib/ntp/lib/isc/buffer.c b/contrib/ntp/lib/isc/buffer.c
index 1b59e65..6a50985 100644
--- a/contrib/ntp/lib/isc/buffer.c
+++ b/contrib/ntp/lib/isc/buffer.c
@@ -406,7 +406,7 @@ isc__buffer_putmem(isc_buffer_t *b, const unsigned char *base,
void
isc__buffer_putstr(isc_buffer_t *b, const char *source) {
- unsigned int l;
+ size_t l;
unsigned char *cp;
REQUIRE(ISC_BUFFER_VALID(b));
@@ -421,7 +421,7 @@ isc__buffer_putstr(isc_buffer_t *b, const char *source) {
cp = isc_buffer_used(b);
memcpy(cp, source, l);
- b->used += l;
+ b->used += (u_int)l; /* checked above - no overflow here */
}
isc_result_t
diff --git a/contrib/ntp/lib/isc/inet_aton.c b/contrib/ntp/lib/isc/inet_aton.c
index 14b4887..3fc3a4d 100644
--- a/contrib/ntp/lib/isc/inet_aton.c
+++ b/contrib/ntp/lib/isc/inet_aton.c
@@ -92,7 +92,7 @@ static char rcsid[] = "$Id: inet_aton.c,v 1.23 2008/12/01 23:47:45 tbox Exp $";
int
isc_net_aton(const char *cp, struct in_addr *addr) {
unsigned long val;
- int base, n;
+ int base;
unsigned char c;
isc_uint8_t parts[4];
isc_uint8_t *pp = parts;
@@ -166,8 +166,7 @@ isc_net_aton(const char *cp, struct in_addr *addr) {
* Concoct the address according to
* the number of parts specified.
*/
- n = pp - parts + 1;
- switch (n) {
+ switch (pp - parts + 1) {
case 1: /* a -- 32 bits */
break;
diff --git a/contrib/ntp/lib/isc/inet_pton.c b/contrib/ntp/lib/isc/inet_pton.c
index 66b5de0..eac631b 100644
--- a/contrib/ntp/lib/isc/inet_pton.c
+++ b/contrib/ntp/lib/isc/inet_pton.c
@@ -92,7 +92,7 @@ inet_pton4(const char *src, unsigned char *dst) {
const char *pch;
if ((pch = strchr(digits, ch)) != NULL) {
- unsigned int newv = *tp * 10 + (pch - digits);
+ size_t newv = *tp * 10 + (pch - digits);
if (saw_digit && *tp == 0)
return (0);
@@ -197,12 +197,12 @@ inet_pton6(const char *src, unsigned char *dst) {
* Since some memmove()'s erroneously fail to handle
* overlapping regions, we'll do the shift by hand.
*/
- const int n = tp - colonp;
+ const size_t n = tp - colonp;
int i;
if (tp == endp)
return (0);
- for (i = 1; i <= n; i++) {
+ for (i = 1; (size_t)i <= n; i++) {
endp[- i] = colonp[n - i];
colonp[n - i] = 0;
}
diff --git a/contrib/ntp/lib/isc/log.c b/contrib/ntp/lib/isc/log.c
index 38f0c4f..dfe4fdf 100644
--- a/contrib/ntp/lib/isc/log.c
+++ b/contrib/ntp/lib/isc/log.c
@@ -1146,7 +1146,7 @@ greatest_version(isc_logchannel_t *channel, int *greatestp) {
char *basenam, *digit_end;
const char *dirname;
int version, greatest = -1;
- unsigned int basenamelen;
+ size_t basenamelen;
isc_dir_t dir;
isc_result_t result;
char sep = '/';
diff --git a/contrib/ntp/lib/isc/netaddr.c b/contrib/ntp/lib/isc/netaddr.c
index 457576b..9710466 100644
--- a/contrib/ntp/lib/isc/netaddr.c
+++ b/contrib/ntp/lib/isc/netaddr.c
@@ -159,7 +159,7 @@ isc_netaddr_totext(const isc_netaddr_t *netaddr, isc_buffer_t *target) {
if (r == NULL)
return (ISC_R_FAILURE);
- alen = strlen(abuf);
+ alen = (unsigned int)strlen(abuf); /* no overflow possible */
INSIST(alen < sizeof(abuf));
zlen = 0;
diff --git a/contrib/ntp/lib/isc/sockaddr.c b/contrib/ntp/lib/isc/sockaddr.c
index 1ae5e7c..c6932d4 100644
--- a/contrib/ntp/lib/isc/sockaddr.c
+++ b/contrib/ntp/lib/isc/sockaddr.c
@@ -134,7 +134,7 @@ isc_sockaddr_totext(const isc_sockaddr_t *sockaddr, isc_buffer_t *target) {
break;
#ifdef ISC_PLAFORM_HAVESYSUNH
case AF_UNIX:
- plen = strlen(sockaddr->type.sunix.sun_path);
+ plen = (unsigned int)strlen(sockaddr->type.sunix.sun_path);
if (plen >= isc_buffer_availablelength(target))
return (ISC_R_NOSPACE);
@@ -153,7 +153,7 @@ isc_sockaddr_totext(const isc_sockaddr_t *sockaddr, isc_buffer_t *target) {
return (ISC_R_FAILURE);
}
- plen = strlen(pbuf);
+ plen = (unsigned int)strlen(pbuf);
INSIST(plen < sizeof(pbuf));
isc_netaddr_fromsockaddr(&netaddr, sockaddr);
diff --git a/contrib/ntp/lib/isc/task.c b/contrib/ntp/lib/isc/task.c
index cd19d2d..5b899b3 100644
--- a/contrib/ntp/lib/isc/task.c
+++ b/contrib/ntp/lib/isc/task.c
@@ -329,7 +329,7 @@ ISC_TASKFUNC_SCOPE isc_result_t
isc__task_create(isc_taskmgr_t *manager0, unsigned int quantum,
isc_task_t **taskp)
{
- isc__taskmgr_t *manager = (isc__taskmgr_t *)manager0;
+ isc__taskmgr_t *manager = (void*)manager0;
isc__task_t *task;
isc_boolean_t exiting;
isc_result_t result;
@@ -1463,7 +1463,7 @@ isc__taskmgr_destroy(isc_taskmgr_t **managerp) {
*/
REQUIRE(managerp != NULL);
- manager = (isc__taskmgr_t *)*managerp;
+ manager = (void*)(*managerp);
REQUIRE(VALID_MANAGER(manager));
#ifndef USE_WORKER_THREADS
@@ -1559,7 +1559,7 @@ isc__taskmgr_destroy(isc_taskmgr_t **managerp) {
ISC_TASKFUNC_SCOPE void
isc__taskmgr_setmode(isc_taskmgr_t *manager0, isc_taskmgrmode_t mode) {
- isc__taskmgr_t *manager = (isc__taskmgr_t *)manager0;
+ isc__taskmgr_t *manager = (void*)manager0;
LOCK(&manager->lock);
manager->mode = mode;
@@ -1568,7 +1568,7 @@ isc__taskmgr_setmode(isc_taskmgr_t *manager0, isc_taskmgrmode_t mode) {
ISC_TASKFUNC_SCOPE isc_taskmgrmode_t
isc__taskmgr_mode(isc_taskmgr_t *manager0) {
- isc__taskmgr_t *manager = (isc__taskmgr_t *)manager0;
+ isc__taskmgr_t *manager = (void*)manager0;
isc_taskmgrmode_t mode;
LOCK(&manager->lock);
mode = manager->mode;
@@ -1579,7 +1579,7 @@ isc__taskmgr_mode(isc_taskmgr_t *manager0) {
#ifndef USE_WORKER_THREADS
isc_boolean_t
isc__taskmgr_ready(isc_taskmgr_t *manager0) {
- isc__taskmgr_t *manager = (isc__taskmgr_t *)manager0;
+ isc__taskmgr_t *manager = (void*)manager0;
isc_boolean_t is_ready;
#ifdef USE_SHARED_MANAGER
@@ -1598,7 +1598,7 @@ isc__taskmgr_ready(isc_taskmgr_t *manager0) {
isc_result_t
isc__taskmgr_dispatch(isc_taskmgr_t *manager0) {
- isc__taskmgr_t *manager = (isc__taskmgr_t *)manager0;
+ isc__taskmgr_t *manager = (void*)manager0;
#ifdef USE_SHARED_MANAGER
if (manager == NULL)
@@ -1615,7 +1615,7 @@ isc__taskmgr_dispatch(isc_taskmgr_t *manager0) {
#else
ISC_TASKFUNC_SCOPE void
isc__taskmgr_pause(isc_taskmgr_t *manager0) {
- isc__taskmgr_t *manager = (isc__taskmgr_t *)manager0;
+ isc__taskmgr_t *manager = (void*)manager0;
LOCK(&manager->lock);
while (manager->tasks_running > 0) {
WAIT(&manager->paused, &manager->lock);
@@ -1626,7 +1626,7 @@ isc__taskmgr_pause(isc_taskmgr_t *manager0) {
ISC_TASKFUNC_SCOPE void
isc__taskmgr_resume(isc_taskmgr_t *manager0) {
- isc__taskmgr_t *manager = (isc__taskmgr_t *)manager0;
+ isc__taskmgr_t *manager = (void*)manager0;
LOCK(&manager->lock);
if (manager->pause_requested) {
diff --git a/contrib/ntp/lib/isc/win32/interfaceiter.c b/contrib/ntp/lib/isc/win32/interfaceiter.c
index 8753aa8..af52788 100644
--- a/contrib/ntp/lib/isc/win32/interfaceiter.c
+++ b/contrib/ntp/lib/isc/win32/interfaceiter.c
@@ -54,7 +54,7 @@ struct isc_interfaceiter {
IP_ADAPTER_ADDRESSES * ipaaCur; /* enumeration position */
IP_ADAPTER_UNICAST_ADDRESS *ipuaCur; /* enumeration subposition */
/* fields used for the older address enumeration ioctls */
- int socket;
+ SOCKET socket;
INTERFACE_INFO IFData; /* Current Interface Info */
int numIF; /* Current Interface count */
int v4IF; /* Number of IPv4 Interfaces */
diff --git a/contrib/ntp/lib/isc/win32/net.c b/contrib/ntp/lib/isc/win32/net.c
index 12876da..53e1435 100644
--- a/contrib/ntp/lib/isc/win32/net.c
+++ b/contrib/ntp/lib/isc/win32/net.c
@@ -216,7 +216,8 @@ initialize_ipv6only(void) {
static void
try_ipv6pktinfo(void) {
- int s, on;
+ SOCKET s;
+ int on;
char strbuf[ISC_STRERRORSIZE];
isc_result_t result;
int optname;
diff --git a/contrib/ntp/libntp/a_md5encrypt.c b/contrib/ntp/libntp/a_md5encrypt.c
index ffabc47..beaf6fd 100644
--- a/contrib/ntp/libntp/a_md5encrypt.c
+++ b/contrib/ntp/libntp/a_md5encrypt.c
@@ -16,12 +16,12 @@
*
* Returns length of MAC including key ID and digest.
*/
-int
+size_t
MD5authencrypt(
- int type, /* hash algorithm */
- u_char *key, /* key pointer */
- u_int32 *pkt, /* packet pointer */
- int length /* packet length */
+ int type, /* hash algorithm */
+ const u_char * key, /* key pointer */
+ u_int32 * pkt, /* packet pointer */
+ size_t length /* packet length */
)
{
u_char digest[EVP_MAX_MD_SIZE];
@@ -44,7 +44,7 @@ MD5authencrypt(
EVP_DigestInit(&ctx, EVP_get_digestbynid(type));
#endif
EVP_DigestUpdate(&ctx, key, cache_secretsize);
- EVP_DigestUpdate(&ctx, (u_char *)pkt, (u_int)length);
+ EVP_DigestUpdate(&ctx, (u_char *)pkt, length);
EVP_DigestFinal(&ctx, digest, &len);
memmove((u_char *)pkt + length + 4, digest, len);
return (len + 4);
@@ -58,11 +58,11 @@ MD5authencrypt(
*/
int
MD5authdecrypt(
- int type, /* hash algorithm */
- u_char *key, /* key pointer */
- u_int32 *pkt, /* packet pointer */
- int length, /* packet length */
- int size /* MAC size */
+ int type, /* hash algorithm */
+ const u_char * key, /* key pointer */
+ u_int32 * pkt, /* packet pointer */
+ size_t length, /* packet length */
+ size_t size /* MAC size */
)
{
u_char digest[EVP_MAX_MD_SIZE];
@@ -85,14 +85,14 @@ MD5authdecrypt(
EVP_DigestInit(&ctx, EVP_get_digestbynid(type));
#endif
EVP_DigestUpdate(&ctx, key, cache_secretsize);
- EVP_DigestUpdate(&ctx, (u_char *)pkt, (u_int)length);
+ EVP_DigestUpdate(&ctx, (u_char *)pkt, length);
EVP_DigestFinal(&ctx, digest, &len);
- if ((u_int)size != len + 4) {
+ if (size != (size_t)len + 4) {
msyslog(LOG_ERR,
"MAC decrypt: MAC length error");
return (0);
}
- return !memcmp(digest, (char *)pkt + length + 4, len);
+ return !memcmp(digest, (const char *)pkt + length + 4, len);
}
/*
diff --git a/contrib/ntp/libntp/atolfp.c b/contrib/ntp/libntp/atolfp.c
index 9a2f691..439194e 100644
--- a/contrib/ntp/libntp/atolfp.c
+++ b/contrib/ntp/libntp/atolfp.c
@@ -68,7 +68,7 @@ atolfp(
while (*cp != '\0' && (ind = strchr(digits, *cp)) != NULL) {
dec_i = (dec_i << 3) + (dec_i << 1); /* multiply by 10 */
- dec_i += (ind - digits);
+ dec_i += (u_long)(ind - digits);
cp++;
}
@@ -80,7 +80,7 @@ atolfp(
&& (ind = strchr(digits, *cp)) != NULL) {
ndec++;
dec_f = (dec_f << 3) + (dec_f << 1); /* *10 */
- dec_f += (ind - digits);
+ dec_f += (u_long)(ind - digits);
cp++;
}
diff --git a/contrib/ntp/libntp/authkeys.c b/contrib/ntp/libntp/authkeys.c
index 667ca29..f7462a2 100644
--- a/contrib/ntp/libntp/authkeys.c
+++ b/contrib/ntp/libntp/authkeys.c
@@ -63,7 +63,7 @@ symkey key_listhead; /* list of all in-use keys */;
* keyid. We make this fairly big for potentially busy servers.
*/
#define DEF_AUTHHASHSIZE 64
-//#define HASHMASK ((HASHSIZE)-1)
+/*#define HASHMASK ((HASHSIZE)-1)*/
#define KEYHASH(keyid) ((keyid) & authhashmask)
int authhashdisabled;
@@ -511,7 +511,17 @@ authistrusted(
return TRUE;
}
-
+/* Note: There are two locations below where 'strncpy()' is used. While
+ * this function is a hazard by itself, it's essential that it is used
+ * here. Bug 1243 involved that the secret was filled with NUL bytes
+ * after the first NUL encountered, and 'strlcpy()' simply does NOT have
+ * this behaviour. So disabling the fix and reverting to the buggy
+ * behaviour due to compatibility issues MUST also fill with NUL and
+ * this needs 'strncpy'. Also, the secret is managed as a byte blob of a
+ * given size, and eventually truncating it and replacing the last byte
+ * with a NUL would be a bug.
+ * perlinger@ntp.org 2015-10-10
+ */
void
MD5auth_setkey(
keyid_t keyno,
@@ -546,7 +556,8 @@ MD5auth_setkey(
#ifndef DISABLE_BUG1243_FIX
memcpy(sk->secret, key, secretsize);
#else
- strlcpy((char *)sk->secret, (const char *)key,
+ /* >MUST< use 'strncpy()' here! See above! */
+ strncpy((char *)sk->secret, (const char *)key,
secretsize);
#endif
if (cache_keyid == keyno) {
@@ -565,7 +576,8 @@ MD5auth_setkey(
#ifndef DISABLE_BUG1243_FIX
memcpy(secret, key, secretsize);
#else
- strlcpy((char *)secret, (const char *)key, secretsize);
+ /* >MUST< use 'strncpy()' here! See above! */
+ strncpy((char *)secret, (const char *)key, secretsize);
#endif
allocsymkey(bucket, keyno, 0, (u_short)keytype, 0,
(u_short)secretsize, secret);
@@ -641,13 +653,13 @@ auth_agekeys(void)
*
* Returns length of authenticator field, zero if key not found.
*/
-int
+size_t
authencrypt(
keyid_t keyno,
u_int32 * pkt,
- int length
+ size_t length
)
-{\
+{
/*
* A zero key identifier means the sender has not verified
* the last message was correctly authenticated. The MAC
@@ -675,8 +687,8 @@ int
authdecrypt(
keyid_t keyno,
u_int32 * pkt,
- int length,
- int size
+ size_t length,
+ size_t size
)
{
/*
diff --git a/contrib/ntp/libntp/authreadkeys.c b/contrib/ntp/libntp/authreadkeys.c
index 1c4c07c..95a357a 100644
--- a/contrib/ntp/libntp/authreadkeys.c
+++ b/contrib/ntp/libntp/authreadkeys.c
@@ -77,14 +77,23 @@ nexttok(
* data on global/static level.
*/
-static const size_t nerr_loglimit = 5u;
-static const size_t nerr_maxlimit = 15;
+static const u_int nerr_loglimit = 5u;
+static const u_int nerr_maxlimit = 15;
-static void log_maybe(size_t*, const char*, ...) NTP_PRINTF(2, 3);
+static void log_maybe(u_int*, const char*, ...) NTP_PRINTF(2, 3);
+
+typedef struct keydata KeyDataT;
+struct keydata {
+ KeyDataT *next; /* queue/stack link */
+ keyid_t keyid; /* stored key ID */
+ u_short keytype; /* stored key type */
+ u_short seclen; /* length of secret */
+ u_char secbuf[1]; /* begin of secret (formal only)*/
+};
static void
log_maybe(
- size_t *pnerr,
+ u_int *pnerr,
const char *fmt ,
...)
{
@@ -113,25 +122,24 @@ authreadkeys(
u_char keystr[32]; /* Bug 2537 */
size_t len;
size_t j;
- size_t nerr;
+ u_int nerr;
+ KeyDataT *list = NULL;
+ KeyDataT *next = NULL;
/*
* Open file. Complain and return if it can't be opened.
*/
fp = fopen(file, "r");
if (fp == NULL) {
- msyslog(LOG_ERR, "authreadkeys: file %s: %m",
+ msyslog(LOG_ERR, "authreadkeys: file '%s': %m",
file);
- return (0);
+ goto onerror;
}
INIT_SSL();
/*
- * Remove all existing keys
- */
- auth_delkeys();
-
- /*
- * Now read lines from the file, looking for key entries
+ * Now read lines from the file, looking for key entries. Put
+ * the data into temporary store for later propagation to avoid
+ * two-pass processing.
*/
nerr = 0;
while ((line = fgets(buf, sizeof buf, fp)) != NULL) {
@@ -216,11 +224,16 @@ authreadkeys(
"authreadkeys: no key for key %d", keyno);
continue;
}
+ next = NULL;
len = strlen(token);
if (len <= 20) { /* Bug 2537 */
- MD5auth_setkey(keyno, keytype, (u_char *)token, len);
+ next = emalloc(sizeof(KeyDataT) + len);
+ next->keyid = keyno;
+ next->keytype = keytype;
+ next->seclen = len;
+ memcpy(next->secbuf, token, len);
} else {
- char hex[] = "0123456789abcdef";
+ static const char hex[] = "0123456789abcdef";
u_char temp;
char *ptr;
size_t jlim;
@@ -242,19 +255,51 @@ authreadkeys(
keyno);
continue;
}
- MD5auth_setkey(keyno, keytype, keystr, jlim / 2);
+ len = jlim/2; /* hmmmm.... what about odd length?!? */
+ next = emalloc(sizeof(KeyDataT) + len);
+ next->keyid = keyno;
+ next->keytype = keytype;
+ next->seclen = len;
+ memcpy(next->secbuf, keystr, len);
}
+ INSIST(NULL != next);
+ next->next = list;
+ list = next;
}
fclose(fp);
if (nerr > nerr_maxlimit) {
msyslog(LOG_ERR,
- "authreadkeys: emergency break after %u errors",
- nerr);
- return (0);
- } else if (nerr > nerr_loglimit) {
+ "authreadkeys: rejecting file '%s' after %u errors (emergency break)",
+ file, nerr);
+ goto onerror;
+ }
+ if (nerr > 0) {
msyslog(LOG_ERR,
- "authreadkeys: found %u more error(s)",
- nerr - nerr_loglimit);
+ "authreadkeys: rejecting file '%s' after %u error(s)",
+ file, nerr);
+ goto onerror;
+ }
+
+ /* first remove old file-based keys */
+ auth_delkeys();
+ /* insert the new key material */
+ while (NULL != (next = list)) {
+ list = next->next;
+ MD5auth_setkey(next->keyid, next->keytype,
+ next->secbuf, next->seclen);
+ /* purge secrets from memory before free()ing it */
+ memset(next, 0, sizeof(*next) + next->seclen);
+ free(next);
}
return (1);
+
+ onerror:
+ /* Mop up temporary storage before bailing out. */
+ while (NULL != (next = list)) {
+ list = next->next;
+ /* purge secrets from memory before free()ing it */
+ memset(next, 0, sizeof(*next) + next->seclen);
+ free(next);
+ }
+ return (0);
}
diff --git a/contrib/ntp/libntp/authusekey.c b/contrib/ntp/libntp/authusekey.c
index c1d0813..0ccf522 100644
--- a/contrib/ntp/libntp/authusekey.c
+++ b/contrib/ntp/libntp/authusekey.c
@@ -23,7 +23,7 @@ authusekey(
const u_char *str
)
{
- int len;
+ size_t len;
len = strlen((const char *)str);
if (0 == len)
diff --git a/contrib/ntp/libntp/dolfptoa.c b/contrib/ntp/libntp/dolfptoa.c
index 07ead95..68f56e1 100644
--- a/contrib/ntp/libntp/dolfptoa.c
+++ b/contrib/ntp/libntp/dolfptoa.c
@@ -40,7 +40,7 @@ dolfptoa(
* including a possible rounding from the fractional part.
*/
cp = cpend = cpdec = &cbuf[10];
- for (dec = cp - cbuf; dec > 0 && fpi != 0; dec--) {
+ for (dec = (int)(cp - cbuf); dec > 0 && fpi != 0; dec--) {
/* can add another digit */
u_int32 digit;
@@ -62,7 +62,7 @@ dolfptoa(
cpdec += 3;
}
if ((size_t)dec > sizeof(cbuf) - (cpend - cbuf))
- dec = sizeof(cbuf) - (cpend - cbuf);
+ dec = (int)(sizeof(cbuf) - (cpend - cbuf));
/*
* If there's a fraction to deal with, do so.
@@ -95,7 +95,7 @@ dolfptoa(
u_char *tp = cpend;
int carry = ((fpv & 0x80000000) != 0);
- for (dec = tp - cbuf; carry && dec > 0; dec--) {
+ for (dec = (int)(tp - cbuf); carry && dec > 0; dec--) {
*--tp += 1;
if (*tp == 10)
*tp = 0;
diff --git a/contrib/ntp/libntp/hextolfp.c b/contrib/ntp/libntp/hextolfp.c
index 2bff929..19a93cd 100644
--- a/contrib/ntp/libntp/hextolfp.c
+++ b/contrib/ntp/libntp/hextolfp.c
@@ -37,8 +37,9 @@ hextolfp(
while (*cp != '\0' && (cp - cpstart) < 8 &&
(ind = strchr(digits, *cp)) != NULL) {
dec_i = dec_i << 4; /* multiply by 16 */
- dec_i += ((ind - digits) > 15) ? (ind - digits) - 6
- : (ind - digits);
+ dec_i += ((ind - digits) > 15)
+ ? (u_long)(ind - digits - 6)
+ : (u_long)(ind - digits);
cp++;
}
@@ -51,8 +52,9 @@ hextolfp(
while (*cp != '\0' && (cp - cpstart) < 8 &&
(ind = strchr(digits, *cp)) != NULL) {
dec_f = dec_f << 4; /* multiply by 16 */
- dec_f += ((ind - digits) > 15) ? (ind - digits) - 6
- : (ind - digits);
+ dec_f += ((ind - digits) > 15)
+ ? (u_long)(ind - digits - 6)
+ : (u_long)(ind - digits);
cp++;
}
diff --git a/contrib/ntp/libntp/mstolfp.c b/contrib/ntp/libntp/mstolfp.c
index 828b14c..7da20dc 100644
--- a/contrib/ntp/libntp/mstolfp.c
+++ b/contrib/ntp/libntp/mstolfp.c
@@ -70,8 +70,7 @@ mstolfp(
*/
*bp++ = '.';
if ((cpdec - cp) < 3) {
- register int i = 3 - (cpdec - cp);
-
+ size_t i = 3 - (cpdec - cp);
do {
*bp++ = '0';
} while (--i > 0);
diff --git a/contrib/ntp/libntp/msyslog.c b/contrib/ntp/libntp/msyslog.c
index cc8868f..9682d30 100644
--- a/contrib/ntp/libntp/msyslog.c
+++ b/contrib/ntp/libntp/msyslog.c
@@ -331,7 +331,7 @@ msnprintf(
)
{
va_list ap;
- size_t rc;
+ int rc;
va_start(ap, fmt);
rc = mvsnprintf(buf, bufsiz, fmt, ap);
diff --git a/contrib/ntp/libntp/ntp_crypto_rnd.c b/contrib/ntp/libntp/ntp_crypto_rnd.c
index 96348f2..2a4f91a 100644
--- a/contrib/ntp/libntp/ntp_crypto_rnd.c
+++ b/contrib/ntp/libntp/ntp_crypto_rnd.c
@@ -16,6 +16,7 @@
#include <l_stdlib.h>
#include <ntp_random.h>
+#include "safecast.h"
#ifdef USE_OPENSSL_CRYPTO_RAND
#include <openssl/err.h>
@@ -93,7 +94,7 @@ ntp_crypto_random_buf(
#ifdef USE_OPENSSL_CRYPTO_RAND
int rc;
- rc = RAND_bytes(buf, nbytes);
+ rc = RAND_bytes(buf, size2int_chk(nbytes));
if (1 != rc) {
unsigned long err;
char *err_str;
diff --git a/contrib/ntp/libntp/ntp_lineedit.c b/contrib/ntp/libntp/ntp_lineedit.c
index a2b2d29..ebd456a 100644
--- a/contrib/ntp/libntp/ntp_lineedit.c
+++ b/contrib/ntp/libntp/ntp_lineedit.c
@@ -29,6 +29,7 @@
#include "ntp.h"
#include "ntp_stdlib.h"
#include "ntp_lineedit.h"
+#include "safecast.h"
#define MAXEDITLINE 512
@@ -213,7 +214,7 @@ ntp_readline(
line = fgets(line_buf, sizeof(line_buf), stdin);
if (NULL != line && *line) {
- *pcount = strlen(line);
+ *pcount = (int)strlen(line); /* cannot overflow here */
line = estrdup(line);
} else
line = NULL;
diff --git a/contrib/ntp/libntp/ntp_rfc2553.c b/contrib/ntp/libntp/ntp_rfc2553.c
index a9ebb4b..8409629 100644
--- a/contrib/ntp/libntp/ntp_rfc2553.c
+++ b/contrib/ntp/libntp/ntp_rfc2553.c
@@ -203,11 +203,12 @@ copy_addrinfo_common(
else
ai_nxt = ai_src->ai_next;
*ai_cpy = *ai_src;
- REQUIRE(ai_src->ai_addrlen <= sizeof(sockaddr_u));
+ DEBUG_INSIST(ai_cpy->ai_canonname == ai_src->ai_canonname);
+ INSIST(ai_src->ai_addrlen <= sizeof(sockaddr_u));
memcpy(psau, ai_src->ai_addr, ai_src->ai_addrlen);
ai_cpy->ai_addr = &psau->sa;
++psau;
- if (NULL != ai_cpy->ai_canonname) {
+ if (NULL != ai_src->ai_canonname) {
ai_cpy->ai_canonname = pcanon;
str_octets = 1 + strlen(ai_src->ai_canonname);
memcpy(pcanon, ai_src->ai_canonname, str_octets);
@@ -480,15 +481,16 @@ do_nodename(
* set elsewhere so that we can set the appropriate wildcard
*/
if (nodename == NULL) {
- ai->ai_addrlen = sizeof(struct sockaddr_storage);
if (ai->ai_family == AF_INET)
{
+ ai->ai_addrlen = sizeof(struct sockaddr_in);
sockin = (struct sockaddr_in *)ai->ai_addr;
sockin->sin_family = (short) ai->ai_family;
sockin->sin_addr.s_addr = htonl(INADDR_ANY);
}
else
{
+ ai->ai_addrlen = sizeof(struct sockaddr_in6);
sockin6 = (struct sockaddr_in6 *)ai->ai_addr;
sockin6->sin6_family = (short) ai->ai_family;
/*
diff --git a/contrib/ntp/libntp/ntp_worker.c b/contrib/ntp/libntp/ntp_worker.c
index 32970da..f5642e1 100644
--- a/contrib/ntp/libntp/ntp_worker.c
+++ b/contrib/ntp/libntp/ntp_worker.c
@@ -150,7 +150,8 @@ available_blocking_child_slot(void)
prev_octets);
blocking_children_alloc = new_alloc;
- return prev_alloc;
+ /* assume we'll never have enough workers to overflow u_int */
+ return (u_int)prev_alloc;
}
diff --git a/contrib/ntp/libntp/snprintf.c b/contrib/ntp/libntp/snprintf.c
index 2b6a374..f4685e1 100644
--- a/contrib/ntp/libntp/snprintf.c
+++ b/contrib/ntp/libntp/snprintf.c
@@ -889,19 +889,19 @@ rpl_vsnprintf(char *str, size_t size, const char *format, va_list args)
switch (cflags) {
case PRINT_C_CHAR:
charptr = va_arg(args, signed char *);
- *charptr = len;
+ *charptr = (signed char)len;
break;
case PRINT_C_SHORT:
shortptr = va_arg(args, short int *);
- *shortptr = len;
+ *shortptr = (short int)len;
break;
case PRINT_C_LONG:
longptr = va_arg(args, long int *);
- *longptr = len;
+ *longptr = (long int)len;
break;
case PRINT_C_LLONG:
llongptr = va_arg(args, LLONG *);
- *llongptr = len;
+ *llongptr = (LLONG)len;
break;
case PRINT_C_SIZE:
/*
@@ -912,19 +912,19 @@ rpl_vsnprintf(char *str, size_t size, const char *format, va_list args)
* size_t argument." (7.19.6.1, 7)
*/
sizeptr = va_arg(args, SSIZE_T *);
- *sizeptr = len;
+ *sizeptr = (SSIZE_T)len;
break;
case PRINT_C_INTMAX:
intmaxptr = va_arg(args, INTMAX_T *);
- *intmaxptr = len;
+ *intmaxptr = (INTMAX_T)len;
break;
case PRINT_C_PTRDIFF:
ptrdiffptr = va_arg(args, PTRDIFF_T *);
- *ptrdiffptr = len;
+ *ptrdiffptr = (PTRDIFF_T)len;
break;
default:
intptr = va_arg(args, int *);
- *intptr = len;
+ *intptr = (int)len;
break;
}
break;
@@ -1209,7 +1209,7 @@ again:
* Factor of ten with the number of digits needed for the fractional
* part. For example, if the precision is 3, the mask will be 1000.
*/
- mask = mypow10(precision);
+ mask = (UINTMAX_T)mypow10(precision);
/*
* We "cheat" by converting the fractional part to integer by
* multiplying by a factor of ten.
@@ -1461,7 +1461,7 @@ cast(LDOUBLE value)
if (value >= UINTMAX_MAX)
return UINTMAX_MAX;
- result = value;
+ result = (UINTMAX_T)value;
/*
* At least on NetBSD/sparc64 3.0.2 and 4.99.30, casting long double to
* an integer type converts e.g. 1.9 to 2 instead of 1 (which violates
diff --git a/contrib/ntp/libntp/socktohost.c b/contrib/ntp/libntp/socktohost.c
index 3d9ab960..fdf9adb 100644
--- a/contrib/ntp/libntp/socktohost.c
+++ b/contrib/ntp/libntp/socktohost.c
@@ -36,13 +36,18 @@ socktohost(
sockaddr_u addr;
size_t octets;
int a_info;
+ int saved_errno;
+
+ saved_errno = socket_errno();
/* reverse the address to purported DNS name */
LIB_GETBUF(pbuf);
gni_flags = NI_DGRAM | NI_NAMEREQD;
if (getnameinfo(&sock->sa, SOCKLEN(sock), pbuf, LIB_BUFLENGTH,
- NULL, 0, gni_flags))
+ NULL, 0, gni_flags)) {
+ errno = saved_errno;
return stoa(sock); /* use address */
+ }
TRACE(1, ("%s reversed to %s\n", stoa(sock), pbuf));
@@ -97,8 +102,10 @@ socktohost(
}
freeaddrinfo(alist);
- if (ai != NULL)
+ if (ai != NULL) {
+ errno = saved_errno;
return pbuf; /* forward check passed */
+ }
forward_fail:
TRACE(1, ("%s forward check lookup fail: %s\n", pbuf,
@@ -106,5 +113,6 @@ socktohost(
LIB_GETBUF(pliar);
snprintf(pliar, LIB_BUFLENGTH, "%s (%s)", stoa(sock), pbuf);
+ errno = saved_errno;
return pliar;
}
diff --git a/contrib/ntp/libntp/systime.c b/contrib/ntp/libntp/systime.c
index f5eabcd..c89d157 100644
--- a/contrib/ntp/libntp/systime.c
+++ b/contrib/ntp/libntp/systime.c
@@ -25,6 +25,8 @@
# include <utmpx.h>
#endif /* HAVE_UTMPX_H */
+int allow_panic = FALSE; /* allow panic correction (-g) */
+int enable_panic_check = TRUE; /* Can we check allow_panic's state? */
#ifndef USE_COMPILETIME_PIVOT
# define USE_COMPILETIME_PIVOT 1
@@ -295,8 +297,13 @@ adj_systime(
* EVNT_NSET adjtime() can be aborted by a tiny adjtime()
* triggered by sys_residual.
*/
- if (0. == now)
+ if (0. == now) {
+ if (enable_panic_check && allow_panic) {
+ msyslog(LOG_ERR, "adj_systime: allow_panic is TRUE!");
+ INSIST(!allow_panic);
+ }
return TRUE;
+ }
/*
* Most Unix adjtime() implementations adjust the system clock
@@ -333,9 +340,15 @@ adj_systime(
if (adjtv.tv_sec != 0 || adjtv.tv_usec != 0) {
if (adjtime(&adjtv, &oadjtv) < 0) {
msyslog(LOG_ERR, "adj_systime: %m");
+ if (enable_panic_check && allow_panic) {
+ msyslog(LOG_ERR, "adj_systime: allow_panic is TRUE!");
+ }
return FALSE;
}
}
+ if (enable_panic_check && allow_panic) {
+ msyslog(LOG_ERR, "adj_systime: allow_panic is TRUE!");
+ }
return TRUE;
}
#endif
@@ -419,6 +432,9 @@ step_systime(
/* now set new system time */
if (ntp_set_tod(&timetv, NULL) != 0) {
msyslog(LOG_ERR, "step-systime: %m");
+ if (enable_panic_check && allow_panic) {
+ msyslog(LOG_ERR, "step_systime: allow_panic is TRUE!");
+ }
return FALSE;
}
@@ -445,7 +461,7 @@ step_systime(
* long ut_time;
* };
* and appends line="|", name="date", host="", time for the OLD
- * and appends line="{", name="date", host="", time for the NEW
+ * and appends line="{", name="date", host="", time for the NEW // }
* to _PATH_WTMP .
*
* Some OSes have utmp, some have utmpx.
@@ -564,6 +580,10 @@ step_systime(
#endif /* UPDATE_WTMPX */
}
+ if (enable_panic_check && allow_panic) {
+ msyslog(LOG_ERR, "step_systime: allow_panic is TRUE!");
+ INSIST(!allow_panic);
+ }
return TRUE;
}
diff --git a/contrib/ntp/libntp/work_thread.c b/contrib/ntp/libntp/work_thread.c
index 38d8747..49e90c1 100644
--- a/contrib/ntp/libntp/work_thread.c
+++ b/contrib/ntp/libntp/work_thread.c
@@ -32,16 +32,20 @@
#define THREAD_MINSTACKSIZE (64U * 1024)
#endif
-#ifndef DEVOLATILE
-#define DEVOLATILE(type, var) ((type)(uintptr_t)(volatile void *)(var))
-#endif
-
#ifdef SYS_WINNT
+
# define thread_exit(c) _endthreadex(c)
-# define tickle_sem SetEvent
+# define tickle_sem(sh) ReleaseSemaphore((sh->shnd), 1, NULL)
+u_int WINAPI blocking_thread(void *);
+static BOOL same_os_sema(const sem_ref obj, void * osobj);
+
#else
+
# define thread_exit(c) pthread_exit((void*)(size_t)(c))
# define tickle_sem sem_post
+void * blocking_thread(void *);
+static void block_thread_signals(sigset_t *);
+
#endif
#ifdef WORK_PIPE
@@ -54,18 +58,10 @@ static void start_blocking_thread(blocking_child *);
static void start_blocking_thread_internal(blocking_child *);
static void prepare_child_sems(blocking_child *);
static int wait_for_sem(sem_ref, struct timespec *);
-static void ensure_workitems_empty_slot(blocking_child *);
-static void ensure_workresp_empty_slot(blocking_child *);
+static int ensure_workitems_empty_slot(blocking_child *);
+static int ensure_workresp_empty_slot(blocking_child *);
static int queue_req_pointer(blocking_child *, blocking_pipe_header *);
static void cleanup_after_child(blocking_child *);
-#ifdef SYS_WINNT
-u_int WINAPI blocking_thread(void *);
-#else
-void * blocking_thread(void *);
-#endif
-#ifndef SYS_WINNT
-static void block_thread_signals(sigset_t *);
-#endif
void
@@ -76,7 +72,9 @@ exit_worker(
thread_exit(exitcode); /* see #define thread_exit */
}
-
+/* --------------------------------------------------------------------
+ * sleep for a given time or until the wakup semaphore is tickled.
+ */
int
worker_sleep(
blocking_child * c,
@@ -98,9 +96,7 @@ worker_sleep(
}
# endif
until.tv_sec += seconds;
- do {
- rc = wait_for_sem(c->wake_scheduled_sleep, &until);
- } while (-1 == rc && EINTR == errno);
+ rc = wait_for_sem(c->wake_scheduled_sleep, &until);
if (0 == rc)
return -1;
if (-1 == rc && ETIMEDOUT == errno)
@@ -110,6 +106,9 @@ worker_sleep(
}
+/* --------------------------------------------------------------------
+ * Wake up a worker that takes a nap.
+ */
void
interrupt_worker_sleep(void)
{
@@ -124,65 +123,79 @@ interrupt_worker_sleep(void)
}
}
-
-static void
+/* --------------------------------------------------------------------
+ * Make sure there is an empty slot at the head of the request
+ * queue. Tell if the queue is currently empty.
+ */
+static int
ensure_workitems_empty_slot(
blocking_child *c
)
{
- const size_t each = sizeof(blocking_children[0]->workitems[0]);
- size_t new_alloc;
- size_t old_octets;
- size_t new_octets;
- void * nonvol_workitems;
-
-
- if (c->workitems != NULL &&
- NULL == c->workitems[c->next_workitem])
- return;
-
- new_alloc = c->workitems_alloc + WORKITEMS_ALLOC_INC;
- old_octets = c->workitems_alloc * each;
- new_octets = new_alloc * each;
- nonvol_workitems = DEVOLATILE(void *, c->workitems);
- c->workitems = erealloc_zero(nonvol_workitems, new_octets,
- old_octets);
- if (0 == c->next_workitem)
- c->next_workitem = c->workitems_alloc;
- c->workitems_alloc = new_alloc;
+ /*
+ ** !!! PRECONDITION: caller holds access lock!
+ **
+ ** This simply tries to increase the size of the buffer if it
+ ** becomes full. The resize operation does *not* maintain the
+ ** order of requests, but that should be irrelevant since the
+ ** processing is considered asynchronous anyway.
+ **
+ ** Return if the buffer is currently empty.
+ */
+
+ static const size_t each =
+ sizeof(blocking_children[0]->workitems[0]);
+
+ size_t new_alloc;
+ size_t slots_used;
+
+ slots_used = c->head_workitem - c->tail_workitem;
+ if (slots_used >= c->workitems_alloc) {
+ new_alloc = c->workitems_alloc + WORKITEMS_ALLOC_INC;
+ c->workitems = erealloc(c->workitems, new_alloc * each);
+ c->tail_workitem = 0;
+ c->head_workitem = c->workitems_alloc;
+ c->workitems_alloc = new_alloc;
+ }
+ return (0 == slots_used);
}
-
-static void
+/* --------------------------------------------------------------------
+ * Make sure there is an empty slot at the head of the response
+ * queue. Tell if the queue is currently empty.
+ */
+static int
ensure_workresp_empty_slot(
blocking_child *c
)
{
- const size_t each = sizeof(blocking_children[0]->responses[0]);
- size_t new_alloc;
- size_t old_octets;
- size_t new_octets;
- void * nonvol_responses;
-
- if (c->responses != NULL &&
- NULL == c->responses[c->next_response])
- return;
-
- new_alloc = c->responses_alloc + RESPONSES_ALLOC_INC;
- old_octets = c->responses_alloc * each;
- new_octets = new_alloc * each;
- nonvol_responses = DEVOLATILE(void *, c->responses);
- c->responses = erealloc_zero(nonvol_responses, new_octets,
- old_octets);
- if (0 == c->next_response)
- c->next_response = c->responses_alloc;
- c->responses_alloc = new_alloc;
+ /*
+ ** !!! PRECONDITION: caller holds access lock!
+ **
+ ** Works like the companion function above.
+ */
+
+ static const size_t each =
+ sizeof(blocking_children[0]->responses[0]);
+
+ size_t new_alloc;
+ size_t slots_used;
+
+ slots_used = c->head_response - c->tail_response;
+ if (slots_used >= c->responses_alloc) {
+ new_alloc = c->responses_alloc + RESPONSES_ALLOC_INC;
+ c->responses = erealloc(c->responses, new_alloc * each);
+ c->tail_response = 0;
+ c->head_response = c->responses_alloc;
+ c->responses_alloc = new_alloc;
+ }
+ return (0 == slots_used);
}
-/*
+/* --------------------------------------------------------------------
* queue_req_pointer() - append a work item or idle exit request to
- * blocking_workitems[].
+ * blocking_workitems[]. Employ proper locking.
*/
static int
queue_req_pointer(
@@ -190,21 +203,28 @@ queue_req_pointer(
blocking_pipe_header * hdr
)
{
- c->workitems[c->next_workitem] = hdr;
- c->next_workitem = (1 + c->next_workitem) % c->workitems_alloc;
+ size_t qhead;
+
+ /* >>>> ACCESS LOCKING STARTS >>>> */
+ wait_for_sem(c->accesslock, NULL);
+ ensure_workitems_empty_slot(c);
+ qhead = c->head_workitem;
+ c->workitems[qhead % c->workitems_alloc] = hdr;
+ c->head_workitem = 1 + qhead;
+ tickle_sem(c->accesslock);
+ /* <<<< ACCESS LOCKING ENDS <<<< */
- /*
- * We only want to signal the wakeup event if the child is
- * blocking on it, which is indicated by setting the blocking
- * event. Wait with zero timeout to test.
- */
- /* !!!! if (WAIT_OBJECT_0 == WaitForSingleObject(c->child_is_blocking, 0)) */
- tickle_sem(c->blocking_req_ready);
+ /* queue consumer wake-up notification */
+ tickle_sem(c->workitems_pending);
return 0;
}
-
+/* --------------------------------------------------------------------
+ * API function to make sure a worker is running, a proper private copy
+ * of the data is made, the data eneterd into the queue and the worker
+ * is signalled.
+ */
int
send_blocking_req_internal(
blocking_child * c,
@@ -223,12 +243,8 @@ send_blocking_req_internal(
return 1; /* failure */
payload_octets = hdr->octets - sizeof(*hdr);
- ensure_workitems_empty_slot(c);
- if (NULL == c->thread_ref) {
- ensure_workresp_empty_slot(c);
+ if (NULL == c->thread_ref)
start_blocking_thread(c);
- }
-
threadcopy = emalloc(hdr->octets);
memcpy(threadcopy, hdr, sizeof(*hdr));
memcpy((char *)threadcopy + sizeof(*hdr), data, payload_octets);
@@ -236,43 +252,41 @@ send_blocking_req_internal(
return queue_req_pointer(c, threadcopy);
}
-
+/* --------------------------------------------------------------------
+ * Wait for the 'incoming queue no longer empty' signal, lock the shared
+ * structure and dequeue an item.
+ */
blocking_pipe_header *
receive_blocking_req_internal(
blocking_child * c
)
{
blocking_pipe_header * req;
- int rc;
+ size_t qhead, qtail;
- /*
- * Child blocks here when idle. SysV semaphores maintain a
- * count and release from sem_wait() only when it reaches 0.
- * Windows auto-reset events are simpler, and multiple SetEvent
- * calls before any thread waits result in a single wakeup.
- * On Windows, the child drains all workitems each wakeup, while
- * with SysV semaphores wait_sem() is used before each item.
- */
-#ifdef SYS_WINNT
- while (NULL == c->workitems[c->next_workeritem]) {
- /* !!!! SetEvent(c->child_is_blocking); */
- rc = wait_for_sem(c->blocking_req_ready, NULL);
- INSIST(0 == rc);
- /* !!!! ResetEvent(c->child_is_blocking); */
- }
-#else
+ req = NULL;
do {
- rc = wait_for_sem(c->blocking_req_ready, NULL);
- } while (-1 == rc && EINTR == errno);
- INSIST(0 == rc);
-#endif
+ /* wait for tickle from the producer side */
+ wait_for_sem(c->workitems_pending, NULL);
+
+ /* >>>> ACCESS LOCKING STARTS >>>> */
+ wait_for_sem(c->accesslock, NULL);
+ qhead = c->head_workitem;
+ do {
+ qtail = c->tail_workitem;
+ if (qhead == qtail)
+ break;
+ c->tail_workitem = qtail + 1;
+ qtail %= c->workitems_alloc;
+ req = c->workitems[qtail];
+ c->workitems[qtail] = NULL;
+ } while (NULL == req);
+ tickle_sem(c->accesslock);
+ /* <<<< ACCESS LOCKING ENDS <<<< */
+
+ } while (NULL == req);
- req = c->workitems[c->next_workeritem];
INSIST(NULL != req);
- c->workitems[c->next_workeritem] = NULL;
- c->next_workeritem = (1 + c->next_workeritem) %
- c->workitems_alloc;
-
if (CHILD_EXIT_REQ == req) { /* idled out */
send_blocking_resp_internal(c, CHILD_GONE_RESP);
req = NULL;
@@ -281,44 +295,74 @@ receive_blocking_req_internal(
return req;
}
-
+/* --------------------------------------------------------------------
+ * Push a response into the return queue and eventually tickle the
+ * receiver.
+ */
int
send_blocking_resp_internal(
blocking_child * c,
blocking_pipe_header * resp
)
{
- ensure_workresp_empty_slot(c);
-
- c->responses[c->next_response] = resp;
- c->next_response = (1 + c->next_response) % c->responses_alloc;
-
-#ifdef WORK_PIPE
- write(c->resp_write_pipe, "", 1);
-#else
- tickle_sem(c->blocking_response_ready);
-#endif
-
+ size_t qhead;
+ int empty;
+
+ /* >>>> ACCESS LOCKING STARTS >>>> */
+ wait_for_sem(c->accesslock, NULL);
+ empty = ensure_workresp_empty_slot(c);
+ qhead = c->head_response;
+ c->responses[qhead % c->responses_alloc] = resp;
+ c->head_response = 1 + qhead;
+ tickle_sem(c->accesslock);
+ /* <<<< ACCESS LOCKING ENDS <<<< */
+
+ /* queue consumer wake-up notification */
+ if (empty)
+ {
+# ifdef WORK_PIPE
+ write(c->resp_write_pipe, "", 1);
+# else
+ tickle_sem(c->responses_pending);
+# endif
+ }
return 0;
}
#ifndef WORK_PIPE
+
+/* --------------------------------------------------------------------
+ * Check if a (Windows-)hanndle to a semaphore is actually the same we
+ * are using inside the sema wrapper.
+ */
+static BOOL
+same_os_sema(
+ const sem_ref obj,
+ void* osh
+ )
+{
+ return obj && osh && (obj->shnd == (HANDLE)osh);
+}
+
+/* --------------------------------------------------------------------
+ * Find the shared context that associates to an OS handle and make sure
+ * the data is dequeued and processed.
+ */
void
handle_blocking_resp_sem(
void * context
)
{
- HANDLE ready;
blocking_child * c;
u_int idx;
- ready = (HANDLE)context;
c = NULL;
for (idx = 0; idx < blocking_children_alloc; idx++) {
c = blocking_children[idx];
- if (c != NULL && c->thread_ref != NULL &&
- ready == c->blocking_response_ready)
+ if (c != NULL &&
+ c->thread_ref != NULL &&
+ same_os_sema(c->responses_pending, context))
break;
}
if (idx < blocking_children_alloc)
@@ -326,26 +370,41 @@ handle_blocking_resp_sem(
}
#endif /* !WORK_PIPE */
-
+/* --------------------------------------------------------------------
+ * Fetch the next response from the return queue. In case of signalling
+ * via pipe, make sure the pipe is flushed, too.
+ */
blocking_pipe_header *
receive_blocking_resp_internal(
blocking_child * c
)
{
blocking_pipe_header * removed;
+ size_t qhead, qtail, slot;
+
#ifdef WORK_PIPE
int rc;
char scratch[32];
- do {
+ do
rc = read(c->resp_read_pipe, scratch, sizeof(scratch));
- } while (-1 == rc && EINTR == errno);
+ while (-1 == rc && EINTR == errno);
#endif
- removed = c->responses[c->next_workresp];
+
+ /* >>>> ACCESS LOCKING STARTS >>>> */
+ wait_for_sem(c->accesslock, NULL);
+ qhead = c->head_response;
+ qtail = c->tail_response;
+ for (removed = NULL; !removed && (qhead != qtail); ++qtail) {
+ slot = qtail % c->responses_alloc;
+ removed = c->responses[slot];
+ c->responses[slot] = NULL;
+ }
+ c->tail_response = qtail;
+ tickle_sem(c->accesslock);
+ /* <<<< ACCESS LOCKING ENDS <<<< */
+
if (NULL != removed) {
- c->responses[c->next_workresp] = NULL;
- c->next_workresp = (1 + c->next_workresp) %
- c->responses_alloc;
DEBUG_ENSURE(CHILD_GONE_RESP == removed ||
BLOCKING_RESP_MAGIC == removed->magic_sig);
}
@@ -357,7 +416,9 @@ receive_blocking_resp_internal(
return removed;
}
-
+/* --------------------------------------------------------------------
+ * Light up a new worker.
+ */
static void
start_blocking_thread(
blocking_child * c
@@ -370,40 +431,45 @@ start_blocking_thread(
start_blocking_thread_internal(c);
}
-
+/* --------------------------------------------------------------------
+ * Create a worker thread. There are several differences between POSIX
+ * and Windows, of course -- most notably the Windows thread is no
+ * detached thread, and we keep the handle around until we want to get
+ * rid of the thread. The notification scheme also differs: Windows
+ * makes use of semaphores in both directions, POSIX uses a pipe for
+ * integration with 'select()' or alike.
+ */
static void
start_blocking_thread_internal(
blocking_child * c
)
#ifdef SYS_WINNT
{
- thr_ref blocking_child_thread;
- u_int blocking_thread_id;
BOOL resumed;
- (*addremove_io_semaphore)(c->blocking_response_ready, FALSE);
- blocking_child_thread =
+ c->thread_ref = NULL;
+ (*addremove_io_semaphore)(c->responses_pending->shnd, FALSE);
+ c->thr_table[0].thnd =
(HANDLE)_beginthreadex(
NULL,
0,
&blocking_thread,
c,
CREATE_SUSPENDED,
- &blocking_thread_id);
+ NULL);
- if (NULL == blocking_child_thread) {
+ if (NULL == c->thr_table[0].thnd) {
msyslog(LOG_ERR, "start blocking thread failed: %m");
exit(-1);
}
- c->thread_id = blocking_thread_id;
- c->thread_ref = blocking_child_thread;
/* remember the thread priority is only within the process class */
- if (!SetThreadPriority(blocking_child_thread,
+ if (!SetThreadPriority(c->thr_table[0].thnd,
THREAD_PRIORITY_BELOW_NORMAL))
msyslog(LOG_ERR, "Error lowering blocking thread priority: %m");
- resumed = ResumeThread(blocking_child_thread);
+ resumed = ResumeThread(c->thr_table[0].thnd);
DEBUG_INSIST(resumed);
+ c->thread_ref = &c->thr_table[0];
}
#else /* pthreads start_blocking_thread_internal() follows */
{
@@ -419,6 +485,8 @@ start_blocking_thread_internal(
size_t stacksize;
sigset_t saved_sig_mask;
+ c->thread_ref = NULL;
+
# ifdef NEED_PTHREAD_INIT
/*
* from lib/isc/unix/app.c:
@@ -475,7 +543,7 @@ start_blocking_thread_internal(
#endif
c->thread_ref = emalloc_zero(sizeof(*c->thread_ref));
block_thread_signals(&saved_sig_mask);
- rc = pthread_create(c->thread_ref, &thr_attr,
+ rc = pthread_create(&c->thr_table[0], &thr_attr,
&blocking_thread, c);
saved_errno = errno;
pthread_sigmask(SIG_SETMASK, &saved_sig_mask, NULL);
@@ -485,11 +553,11 @@ start_blocking_thread_internal(
msyslog(LOG_ERR, "pthread_create() blocking child: %m");
exit(1);
}
+ c->thread_ref = &c->thr_table[0];
}
#endif
-
-/*
+/* --------------------------------------------------------------------
* block_thread_signals()
*
* Temporarily block signals used by ntpd main thread, so that signal
@@ -538,61 +606,101 @@ block_thread_signals(
#endif /* !SYS_WINNT */
-/*
+/* --------------------------------------------------------------------
+ * Create & destroy semaphores. This is sufficiently different between
+ * POSIX and Windows to warrant wrapper functions and close enough to
+ * use the concept of synchronization via semaphore for all platforms.
+ */
+static sem_ref
+create_sema(
+ sema_type* semptr,
+ u_int inival,
+ u_int maxval)
+{
+#ifdef SYS_WINNT
+
+ long svini, svmax;
+ if (NULL != semptr) {
+ svini = (inival < LONG_MAX)
+ ? (long)inival : LONG_MAX;
+ svmax = (maxval < LONG_MAX && maxval > 0)
+ ? (long)maxval : LONG_MAX;
+ semptr->shnd = CreateSemaphore(NULL, svini, svmax, NULL);
+ if (NULL == semptr->shnd)
+ semptr = NULL;
+ }
+
+#else
+
+ (void)maxval;
+ if (semptr && sem_init(semptr, FALSE, inival))
+ semptr = NULL;
+
+#endif
+
+ return semptr;
+}
+
+/* ------------------------------------------------------------------ */
+static sem_ref
+delete_sema(
+ sem_ref obj)
+{
+
+# ifdef SYS_WINNT
+
+ if (obj) {
+ if (obj->shnd)
+ CloseHandle(obj->shnd);
+ obj->shnd = NULL;
+ }
+
+# else
+
+ if (obj)
+ sem_destroy(obj);
+
+# endif
+
+ return NULL;
+}
+
+/* --------------------------------------------------------------------
* prepare_child_sems()
*
- * create sync events (semaphores)
- * child_is_blocking initially unset
- * blocking_req_ready initially unset
+ * create sync & access semaphores
*
- * Child waits for blocking_req_ready to be set after
- * setting child_is_blocking. blocking_req_ready and
- * blocking_response_ready are auto-reset, so wake one
- * waiter and become unset (unsignalled) in one operation.
+ * All semaphores are cleared, only the access semaphore has 1 unit.
+ * Childs wait on 'workitems_pending', then grabs 'sema_access'
+ * and dequeues jobs. When done, 'sema_access' is given one unit back.
+ *
+ * The producer grabs 'sema_access', manages the queue, restores
+ * 'sema_access' and puts one unit into 'workitems_pending'.
+ *
+ * The story goes the same for the response queue.
*/
static void
prepare_child_sems(
blocking_child *c
)
-#ifdef SYS_WINNT
-{
- if (NULL == c->blocking_req_ready) {
- /* manual reset using ResetEvent() */
- /* !!!! c->child_is_blocking = CreateEvent(NULL, TRUE, FALSE, NULL); */
- /* auto reset - one thread released from wait each set */
- c->blocking_req_ready = CreateEvent(NULL, FALSE, FALSE, NULL);
- c->blocking_response_ready = CreateEvent(NULL, FALSE, FALSE, NULL);
- c->wake_scheduled_sleep = CreateEvent(NULL, FALSE, FALSE, NULL);
- } else {
- /* !!!! ResetEvent(c->child_is_blocking); */
- /* ResetEvent(c->blocking_req_ready); */
- /* ResetEvent(c->blocking_response_ready); */
- /* ResetEvent(c->wake_scheduled_sleep); */
- }
-}
-#else /* pthreads prepare_child_sems() follows */
{
- size_t octets;
-
- if (NULL == c->blocking_req_ready) {
- octets = sizeof(*c->blocking_req_ready);
- octets += sizeof(*c->wake_scheduled_sleep);
- /* !!!! octets += sizeof(*c->child_is_blocking); */
- c->blocking_req_ready = emalloc_zero(octets);;
- c->wake_scheduled_sleep = 1 + c->blocking_req_ready;
- /* !!!! c->child_is_blocking = 1 + c->wake_scheduled_sleep; */
- } else {
- sem_destroy(c->blocking_req_ready);
- sem_destroy(c->wake_scheduled_sleep);
- /* !!!! sem_destroy(c->child_is_blocking); */
- }
- sem_init(c->blocking_req_ready, FALSE, 0);
- sem_init(c->wake_scheduled_sleep, FALSE, 0);
- /* !!!! sem_init(c->child_is_blocking, FALSE, 0); */
+ c->accesslock = create_sema(&c->sem_table[0], 1, 1);
+ c->workitems_pending = create_sema(&c->sem_table[1], 0, 0);
+ c->wake_scheduled_sleep = create_sema(&c->sem_table[2], 0, 1);
+# ifndef WORK_PIPE
+ c->responses_pending = create_sema(&c->sem_table[3], 0, 0);
+# endif
}
-#endif
-
+/* --------------------------------------------------------------------
+ * wait for semaphore. Where the wait can be interrupted, it will
+ * internally resume -- When this function returns, there is either no
+ * semaphore at all, a timeout occurred, or the caller could
+ * successfully take a token from the semaphore.
+ *
+ * For untimed wait, not checking the result of this function at all is
+ * definitely an option.
+ */
static int
wait_for_sem(
sem_ref sem,
@@ -605,6 +713,11 @@ wait_for_sem(
DWORD msec;
DWORD rc;
+ if (!(sem && sem->shnd)) {
+ errno = EINVAL;
+ return -1;
+ }
+
if (NULL == timeout) {
msec = INFINITE;
} else {
@@ -619,7 +732,7 @@ wait_for_sem(
msec += delta.tv_nsec / (1000 * 1000);
}
}
- rc = WaitForSingleObject(sem, msec);
+ rc = WaitForSingleObject(sem->shnd, msec);
if (WAIT_OBJECT_0 == rc)
return 0;
if (WAIT_TIMEOUT == rc) {
@@ -632,24 +745,28 @@ wait_for_sem(
}
#else /* pthreads wait_for_sem() follows */
{
- int rc;
-
- if (NULL == timeout)
- rc = sem_wait(sem);
+ int rc = -1;
+
+ if (sem) do {
+ if (NULL == timeout)
+ rc = sem_wait(sem);
+ else
+ rc = sem_timedwait(sem, timeout);
+ } while (rc == -1 && errno == EINTR);
else
- rc = sem_timedwait(sem, timeout);
-
+ errno = EINVAL;
+
return rc;
}
#endif
-
-/*
- * blocking_thread - thread functions have WINAPI calling convention
+/* --------------------------------------------------------------------
+ * blocking_thread - thread functions have WINAPI (aka 'stdcall')
+ * calling conventions under Windows and POSIX-defined signature
+ * otherwise.
*/
#ifdef SYS_WINNT
-u_int
-WINAPI
+u_int WINAPI
#else
void *
#endif
@@ -666,20 +783,28 @@ blocking_thread(
return 0;
}
-
-/*
+/* --------------------------------------------------------------------
* req_child_exit() runs in the parent.
+ *
+ * This function is called from from the idle timer, too, and possibly
+ * without a thread being there any longer. Since we have folded up our
+ * tent in that case and all the semaphores are already gone, we simply
+ * ignore this request in this case.
+ *
+ * Since the existence of the semaphores is controlled exclusively by
+ * the parent, there's no risk of data race here.
*/
int
req_child_exit(
blocking_child *c
)
{
- return queue_req_pointer(c, CHILD_EXIT_REQ);
+ return (c->accesslock)
+ ? queue_req_pointer(c, CHILD_EXIT_REQ)
+ : 0;
}
-
-/*
+/* --------------------------------------------------------------------
* cleanup_after_child() runs in parent.
*/
static void
@@ -687,17 +812,27 @@ cleanup_after_child(
blocking_child * c
)
{
- u_int idx;
-
DEBUG_INSIST(!c->reusable);
-#ifdef SYS_WINNT
- INSIST(CloseHandle(c->thread_ref));
-#else
- free(c->thread_ref);
-#endif
+
+# ifdef SYS_WINNT
+ /* The thread was not created in detached state, so we better
+ * clean up.
+ */
+ if (c->thread_ref && c->thread_ref->thnd) {
+ WaitForSingleObject(c->thread_ref->thnd, INFINITE);
+ INSIST(CloseHandle(c->thread_ref->thnd));
+ c->thread_ref->thnd = NULL;
+ }
+# endif
c->thread_ref = NULL;
- c->thread_id = 0;
-#ifdef WORK_PIPE
+
+ /* remove semaphores and (if signalling vi IO) pipes */
+
+ c->accesslock = delete_sema(c->accesslock);
+ c->workitems_pending = delete_sema(c->workitems_pending);
+ c->wake_scheduled_sleep = delete_sema(c->wake_scheduled_sleep);
+
+# ifdef WORK_PIPE
DEBUG_INSIST(-1 != c->resp_read_pipe);
DEBUG_INSIST(-1 != c->resp_write_pipe);
(*addremove_io_fd)(c->resp_read_pipe, c->ispipe, TRUE);
@@ -705,18 +840,22 @@ cleanup_after_child(
close(c->resp_read_pipe);
c->resp_write_pipe = -1;
c->resp_read_pipe = -1;
-#else
- DEBUG_INSIST(NULL != c->blocking_response_ready);
- (*addremove_io_semaphore)(c->blocking_response_ready, TRUE);
-#endif
- for (idx = 0; idx < c->workitems_alloc; idx++)
- c->workitems[idx] = NULL;
- c->next_workitem = 0;
- c->next_workeritem = 0;
- for (idx = 0; idx < c->responses_alloc; idx++)
- c->responses[idx] = NULL;
- c->next_response = 0;
- c->next_workresp = 0;
+# else
+ DEBUG_INSIST(NULL != c->responses_pending);
+ (*addremove_io_semaphore)(c->responses_pending->shnd, TRUE);
+ c->responses_pending = delete_sema(c->responses_pending);
+# endif
+
+ /* Is it necessary to check if there are pending requests and
+ * responses? If so, and if there are, what to do with them?
+ */
+
+ /* re-init buffer index sequencers */
+ c->head_workitem = 0;
+ c->tail_workitem = 0;
+ c->head_response = 0;
+ c->tail_response = 0;
+
c->reusable = TRUE;
}
diff --git a/contrib/ntp/libparse/clk_computime.c b/contrib/ntp/libparse/clk_computime.c
index 5026232..7273ac7 100644
--- a/contrib/ntp/libparse/clk_computime.c
+++ b/contrib/ntp/libparse/clk_computime.c
@@ -157,7 +157,7 @@ inp_computime(
{
unsigned int rtc;
- parseprintf(DD_PARSE, ("inp_computime(0x%lx, 0x%x, ...)\n", (long)parseio, ch));
+ parseprintf(DD_PARSE, ("inp_computime(0x%p, 0x%x, ...)\n", (void*)parseio, ch));
switch (ch)
{
diff --git a/contrib/ntp/libparse/clk_dcf7000.c b/contrib/ntp/libparse/clk_dcf7000.c
index f1da9ef..0621cd5 100644
--- a/contrib/ntp/libparse/clk_dcf7000.c
+++ b/contrib/ntp/libparse/clk_dcf7000.c
@@ -158,7 +158,7 @@ inp_dcf7000(
{
unsigned int rtc;
- parseprintf(DD_PARSE, ("inp_dcf7000(0x%lx, 0x%x, ...)\n", (long)parseio, ch));
+ parseprintf(DD_PARSE, ("inp_dcf7000(0x%p, 0x%x, ...)\n", (void*)parseio, ch));
switch (ch)
{
diff --git a/contrib/ntp/libparse/clk_hopf6021.c b/contrib/ntp/libparse/clk_hopf6021.c
index 357ac2e..2359628 100644
--- a/contrib/ntp/libparse/clk_hopf6021.c
+++ b/contrib/ntp/libparse/clk_hopf6021.c
@@ -227,7 +227,7 @@ inp_hopf6021(
{
unsigned int rtc;
- parseprintf(DD_PARSE, ("inp_hopf6021(0x%lx, 0x%x, ...)\n", (long)parseio, ch));
+ parseprintf(DD_PARSE, ("inp_hopf6021(0x%p, 0x%x, ...)\n", (void*)parseio, ch));
switch (ch)
{
diff --git a/contrib/ntp/libparse/clk_meinberg.c b/contrib/ntp/libparse/clk_meinberg.c
index 9d2b676..e4ebf0a 100644
--- a/contrib/ntp/libparse/clk_meinberg.c
+++ b/contrib/ntp/libparse/clk_meinberg.c
@@ -434,7 +434,7 @@ mbg_input(
{
unsigned int rtc;
- parseprintf(DD_PARSE, ("mbg_input(0x%lx, 0x%x, ...)\n", (long)parseio, ch));
+ parseprintf(DD_PARSE, ("mbg_input(0x%p, 0x%x, ...)\n", (void*)parseio, ch));
switch (ch)
{
@@ -602,7 +602,7 @@ gps_input(
msg_buf = (struct msg_buf *)parseio->parse_pdata;
- parseprintf(DD_PARSE, ("gps_input(0x%lx, 0x%x, ...)\n", (long)parseio, ch));
+ parseprintf(DD_PARSE, ("gps_input(0x%p, 0x%x, ...)\n", (void*)parseio, ch));
if (!msg_buf)
return PARSE_INP_SKIP;
diff --git a/contrib/ntp/libparse/clk_rawdcf.c b/contrib/ntp/libparse/clk_rawdcf.c
index ca43263..e22ebb0 100644
--- a/contrib/ntp/libparse/clk_rawdcf.c
+++ b/contrib/ntp/libparse/clk_rawdcf.c
@@ -627,7 +627,7 @@ inp_rawdcf(
{
static struct timeval timeout = { 1, 500000 }; /* 1.5 secongs denote second #60 */
- parseprintf(DD_PARSE, ("inp_rawdcf(0x%lx, 0x%x, ...)\n", (long)parseio, ch));
+ parseprintf(DD_PARSE, ("inp_rawdcf(0x%p, 0x%x, ...)\n", (void*)parseio, ch));
parseio->parse_dtime.parse_stime = *tstamp; /* collect timestamp */
diff --git a/contrib/ntp/libparse/clk_rcc8000.c b/contrib/ntp/libparse/clk_rcc8000.c
index a690e588..11d52ac 100644
--- a/contrib/ntp/libparse/clk_rcc8000.c
+++ b/contrib/ntp/libparse/clk_rcc8000.c
@@ -141,7 +141,7 @@ inp_rcc8000(
{
unsigned int rtc;
- parseprintf(DD_PARSE, ("inp_rcc8000(0x%lx, 0x%x, ...)\n", (long)parseio, ch));
+ parseprintf(DD_PARSE, ("inp_rcc8000(0x%p, 0x%x, ...)\n", (void*)parseio, ch));
switch (ch)
{
diff --git a/contrib/ntp/libparse/clk_schmid.c b/contrib/ntp/libparse/clk_schmid.c
index c4f02b0..d85b1a5 100644
--- a/contrib/ntp/libparse/clk_schmid.c
+++ b/contrib/ntp/libparse/clk_schmid.c
@@ -205,7 +205,7 @@ inp_schmid(
{
unsigned int rtc;
- parseprintf(DD_PARSE, ("inp_schmid(0x%lx, 0x%x, ...)\n", (long)parseio, ch));
+ parseprintf(DD_PARSE, ("inp_schmid(0x%p, 0x%x, ...)\n", (void*)parseio, ch));
switch ((uint8_t)ch)
{
diff --git a/contrib/ntp/libparse/clk_trimtaip.c b/contrib/ntp/libparse/clk_trimtaip.c
index 426e897..a60d01e 100644
--- a/contrib/ntp/libparse/clk_trimtaip.c
+++ b/contrib/ntp/libparse/clk_trimtaip.c
@@ -155,7 +155,7 @@ inp_trimtaip(
{
unsigned int rtc;
- parseprintf(DD_PARSE, ("inp_trimtaip(0x%lx, 0x%x, ...)\n", (long)parseio, ch));
+ parseprintf(DD_PARSE, ("inp_trimtaip(0x%p, 0x%x, ...)\n", (void*)parseio, ch));
switch (ch)
{
diff --git a/contrib/ntp/libparse/clk_varitext.c b/contrib/ntp/libparse/clk_varitext.c
index 022549e..0d83035 100644
--- a/contrib/ntp/libparse/clk_varitext.c
+++ b/contrib/ntp/libparse/clk_varitext.c
@@ -58,12 +58,12 @@
extern int printf (const char *, ...);
#endif
-static const u_char VT_INITIALISED = 0x01;
-static const u_char VT_SYNCHRONISED = 0x02;
-static const u_char VT_ALARM_STATE = 0x04;
+/* static const u_char VT_INITIALISED = 0x01; */
+/* static const u_char VT_SYNCHRONISED = 0x02; */
+/* static const u_char VT_ALARM_STATE = 0x04; */
static const u_char VT_BST = 0x08;
-static const u_char VT_SEASON_CHANGE = 0x10;
-static const u_char VT_LAST_TELEGRAM_OK = 0x20;
+/* static const u_char VT_SEASON_CHANGE = 0x10; */
+/* static const u_char VT_LAST_TELEGRAM_OK = 0x20; */
/*
* The Varitext receiver sends a datagram in the following format every minute
@@ -195,7 +195,7 @@ inp_varitext(
struct varitext *t = (struct varitext *)parseio->parse_pdata;
int rtc;
- parseprintf(DD_PARSE, ("inp_varitext(0x%lx, 0x%x, ...)\n", (long)parseio, ch));
+ parseprintf(DD_PARSE, ("inp_varitext(0x%p, 0x%x, ...)\n", (void*)parseio, ch));
if (!t)
return PARSE_INP_SKIP; /* local data not allocated - sigh! */
diff --git a/contrib/ntp/libparse/clk_wharton.c b/contrib/ntp/libparse/clk_wharton.c
index a65bc53..e9e3d84 100644
--- a/contrib/ntp/libparse/clk_wharton.c
+++ b/contrib/ntp/libparse/clk_wharton.c
@@ -137,7 +137,7 @@ inp_wharton_400a(
{
unsigned int rtc;
- parseprintf(DD_PARSE, ("inp_wharton_400a(0x%lx, 0x%x, ...)\n", (long)parseio, ch));
+ parseprintf(DD_PARSE, ("inp_wharton_400a(0x%p, 0x%x, ...)\n", (void*)parseio, ch));
switch (ch)
{
diff --git a/contrib/ntp/libparse/parse.c b/contrib/ntp/libparse/parse.c
index 64167f1..69395ac 100644
--- a/contrib/ntp/libparse/parse.c
+++ b/contrib/ntp/libparse/parse.c
@@ -288,7 +288,7 @@ parse_ioread(
break;
}
- parseprintf(DD_PARSE, ("parse_ioread(0x%lx, char=0x%x, ..., ...)\n", (unsigned long)parseio, ch & 0xFF));
+ parseprintf(DD_PARSE, ("parse_ioread(0x%p, char=0x%x, ..., ...)\n", (void*)parseio, ch & 0xFF));
if (!clockformats[parseio->parse_lformat]->convert)
{
diff --git a/contrib/ntp/ntpd/invoke-ntp.conf.texi b/contrib/ntp/ntpd/invoke-ntp.conf.texi
index 37427d6..32b41e6 100644
--- a/contrib/ntp/ntpd/invoke-ntp.conf.texi
+++ b/contrib/ntp/ntpd/invoke-ntp.conf.texi
@@ -6,7 +6,7 @@
#
# EDIT THIS FILE WITH CAUTION (invoke-ntp.conf.texi)
#
-# It has been AutoGen-ed October 21, 2015 at 12:38:16 PM by AutoGen 5.18.5
+# It has been AutoGen-ed January 7, 2016 at 11:30:49 PM by AutoGen 5.18.5
# From the definitions ntp.conf.def
# and the template file agtexi-file.tpl
@end ignore
diff --git a/contrib/ntp/ntpd/invoke-ntp.keys.texi b/contrib/ntp/ntpd/invoke-ntp.keys.texi
index 33fdb89..b755d97 100644
--- a/contrib/ntp/ntpd/invoke-ntp.keys.texi
+++ b/contrib/ntp/ntpd/invoke-ntp.keys.texi
@@ -6,7 +6,7 @@
#
# EDIT THIS FILE WITH CAUTION (invoke-ntp.keys.texi)
#
-# It has been AutoGen-ed October 21, 2015 at 12:38:19 PM by AutoGen 5.18.5
+# It has been AutoGen-ed January 7, 2016 at 11:30:52 PM by AutoGen 5.18.5
# From the definitions ntp.keys.def
# and the template file agtexi-file.tpl
@end ignore
diff --git a/contrib/ntp/ntpd/invoke-ntpd.texi b/contrib/ntp/ntpd/invoke-ntpd.texi
index a781b26..66ce19d 100644
--- a/contrib/ntp/ntpd/invoke-ntpd.texi
+++ b/contrib/ntp/ntpd/invoke-ntpd.texi
@@ -6,7 +6,7 @@
#
# EDIT THIS FILE WITH CAUTION (invoke-ntpd.texi)
#
-# It has been AutoGen-ed October 21, 2015 at 12:38:21 PM by AutoGen 5.18.5
+# It has been AutoGen-ed January 7, 2016 at 11:30:54 PM by AutoGen 5.18.5
# From the definitions ntpd-opts.def
# and the template file agtexi-cmd.tpl
@end ignore
@@ -142,7 +142,7 @@ with a status code of 0.
@exampleindent 0
@example
-ntpd - NTP daemon program - Ver. 4.2.8p4
+ntpd - NTP daemon program - Ver. 4.2.8p5
Usage: ntpd [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]... \
[ <server1> ... <serverN> ]
Flg Arg Option-Name Description
diff --git a/contrib/ntp/ntpd/ntp.conf.5man b/contrib/ntp/ntpd/ntp.conf.5man
index ee457df4..6e6aa32 100644
--- a/contrib/ntp/ntpd/ntp.conf.5man
+++ b/contrib/ntp/ntpd/ntp.conf.5man
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntp.conf 5man "21 Oct 2015" "4.2.8p4" "File Formats"
+.TH ntp.conf 5man "07 Jan 2016" "4.2.8p5" "File Formats"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-9oaqYI/ag-OpaiXI)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-8qayqp/ag-Vraqpp)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:38:01 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:30:35 PM by AutoGen 5.18.5
.\" From the definitions ntp.conf.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/ntpd/ntp.conf.5mdoc b/contrib/ntp/ntpd/ntp.conf.5mdoc
index a883aab..800e995 100644
--- a/contrib/ntp/ntpd/ntp.conf.5mdoc
+++ b/contrib/ntp/ntpd/ntp.conf.5mdoc
@@ -1,9 +1,9 @@
-.Dd October 21 2015
+.Dd January 7 2016
.Dt NTP_CONF 5mdoc File Formats
.Os
.\" EDIT THIS FILE WITH CAUTION (ntp.mdoc)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:38:24 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:30:57 PM by AutoGen 5.18.5
.\" From the definitions ntp.conf.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/ntpd/ntp.conf.html b/contrib/ntp/ntpd/ntp.conf.html
index 1f0c819..d10a88d 100644
--- a/contrib/ntp/ntpd/ntp.conf.html
+++ b/contrib/ntp/ntpd/ntp.conf.html
@@ -33,7 +33,7 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#dir">(dir)</a>
<p>This document describes the configuration file for the NTP Project's
<code>ntpd</code> program.
- <p>This document applies to version 4.2.8p4 of <code>ntp.conf</code>.
+ <p>This document applies to version 4.2.8p5 of <code>ntp.conf</code>.
<div class="shortcontents">
<h2>Short Contents</h2>
diff --git a/contrib/ntp/ntpd/ntp.conf.man.in b/contrib/ntp/ntpd/ntp.conf.man.in
index 7c8a39f..f701b41 100644
--- a/contrib/ntp/ntpd/ntp.conf.man.in
+++ b/contrib/ntp/ntpd/ntp.conf.man.in
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntp.conf 5 "21 Oct 2015" "4.2.8p4" "File Formats"
+.TH ntp.conf 5 "07 Jan 2016" "4.2.8p5" "File Formats"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-9oaqYI/ag-OpaiXI)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-8qayqp/ag-Vraqpp)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:38:01 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:30:35 PM by AutoGen 5.18.5
.\" From the definitions ntp.conf.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/ntpd/ntp.conf.mdoc.in b/contrib/ntp/ntpd/ntp.conf.mdoc.in
index 613ee7a..7ad4cc1 100644
--- a/contrib/ntp/ntpd/ntp.conf.mdoc.in
+++ b/contrib/ntp/ntpd/ntp.conf.mdoc.in
@@ -1,9 +1,9 @@
-.Dd October 21 2015
+.Dd January 7 2016
.Dt NTP_CONF 5 File Formats
.Os
.\" EDIT THIS FILE WITH CAUTION (ntp.mdoc)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:38:24 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:30:57 PM by AutoGen 5.18.5
.\" From the definitions ntp.conf.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/ntpd/ntp.keys.5man b/contrib/ntp/ntpd/ntp.keys.5man
index 3e5cb54..bb0028b 100644
--- a/contrib/ntp/ntpd/ntp.keys.5man
+++ b/contrib/ntp/ntpd/ntp.keys.5man
@@ -1,8 +1,8 @@
-.TH ntp.keys 5man "21 Oct 2015" "4.2.8p4" "File Formats"
+.TH ntp.keys 5man "07 Jan 2016" "4.2.8p5" "File Formats"
.\"
.\" EDIT THIS FILE WITH CAUTION (ntp.man)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:38:08 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:30:41 PM by AutoGen 5.18.5
.\" From the definitions ntp.keys.def
.\" and the template file agman-file.tpl
.Sh NAME
diff --git a/contrib/ntp/ntpd/ntp.keys.5mdoc b/contrib/ntp/ntpd/ntp.keys.5mdoc
index 6355a39..9524989 100644
--- a/contrib/ntp/ntpd/ntp.keys.5mdoc
+++ b/contrib/ntp/ntpd/ntp.keys.5mdoc
@@ -1,9 +1,9 @@
-.Dd October 21 2015
+.Dd January 7 2016
.Dt NTP_KEYS 5mdoc File Formats
.Os SunOS 5.10
.\" EDIT THIS FILE WITH CAUTION (ntp.mdoc)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:38:28 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:31:00 PM by AutoGen 5.18.5
.\" From the definitions ntp.keys.def
.\" and the template file agmdoc-file.tpl
.Sh NAME
diff --git a/contrib/ntp/ntpd/ntp.keys.html b/contrib/ntp/ntpd/ntp.keys.html
index 3671aaa..738f9e0 100644
--- a/contrib/ntp/ntpd/ntp.keys.html
+++ b/contrib/ntp/ntpd/ntp.keys.html
@@ -33,7 +33,7 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#dir">(dir)</a>
<p>This document describes the symmetric key file for the NTP Project's
<code>ntpd</code> program.
- <p>This document applies to version 4.2.8p4 of <code>ntp.keys</code>.
+ <p>This document applies to version 4.2.8p5 of <code>ntp.keys</code>.
<div class="shortcontents">
<h2>Short Contents</h2>
diff --git a/contrib/ntp/ntpd/ntp.keys.man.in b/contrib/ntp/ntpd/ntp.keys.man.in
index bd64756..78d5f09 100644
--- a/contrib/ntp/ntpd/ntp.keys.man.in
+++ b/contrib/ntp/ntpd/ntp.keys.man.in
@@ -1,8 +1,8 @@
-.TH ntp.keys 5 "21 Oct 2015" "4.2.8p4" "File Formats"
+.TH ntp.keys 5 "07 Jan 2016" "4.2.8p5" "File Formats"
.\"
.\" EDIT THIS FILE WITH CAUTION (ntp.man)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:38:08 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:30:41 PM by AutoGen 5.18.5
.\" From the definitions ntp.keys.def
.\" and the template file agman-file.tpl
.Sh NAME
diff --git a/contrib/ntp/ntpd/ntp.keys.mdoc.in b/contrib/ntp/ntpd/ntp.keys.mdoc.in
index 6600d57..40c821e 100644
--- a/contrib/ntp/ntpd/ntp.keys.mdoc.in
+++ b/contrib/ntp/ntpd/ntp.keys.mdoc.in
@@ -1,9 +1,9 @@
-.Dd October 21 2015
+.Dd January 7 2016
.Dt NTP_KEYS 5 File Formats
.Os SunOS 5.10
.\" EDIT THIS FILE WITH CAUTION (ntp.mdoc)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:38:28 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:31:00 PM by AutoGen 5.18.5
.\" From the definitions ntp.keys.def
.\" and the template file agmdoc-file.tpl
.Sh NAME
diff --git a/contrib/ntp/ntpd/ntp_control.c b/contrib/ntp/ntpd/ntp_control.c
index 7736311..2e174d0 100644
--- a/contrib/ntp/ntpd/ntp_control.c
+++ b/contrib/ntp/ntpd/ntp_control.c
@@ -846,7 +846,7 @@ ctl_error(
u_char errcode
)
{
- int maclen;
+ size_t maclen;
numctlerrors++;
DPRINTF(3, ("sending control error %u\n", errcode));
@@ -1248,10 +1248,10 @@ ctl_flushpkt(
)
{
size_t i;
- int dlen;
- int sendlen;
- int maclen;
- int totlen;
+ size_t dlen;
+ size_t sendlen;
+ size_t maclen;
+ size_t totlen;
keyid_t keyid;
dlen = datapt - rpkt.u.data;
diff --git a/contrib/ntp/ntpd/ntp_crypto.c b/contrib/ntp/ntpd/ntp_crypto.c
index 376b5b5..8574266 100644
--- a/contrib/ntp/ntpd/ntp_crypto.c
+++ b/contrib/ntp/ntpd/ntp_crypto.c
@@ -473,9 +473,9 @@ crypto_recv(
}
/* Check if the declared size fits into the remaining
- * buffer.
+ * buffer. We *know* 'macbytes' > 0 here!
*/
- if (len > macbytes) {
+ if (len > (u_int)macbytes) {
DPRINTF(1, ("crypto_recv: possible attack detected, associd %d\n",
associd));
return XEVNT_LEN;
diff --git a/contrib/ntp/ntpd/ntp_io.c b/contrib/ntp/ntpd/ntp_io.c
index 5fc6ed5..dd23459 100644
--- a/contrib/ntp/ntpd/ntp_io.c
+++ b/contrib/ntp/ntpd/ntp_io.c
@@ -41,6 +41,7 @@
#include "timevalops.h"
#include "timespecops.h"
#include "ntpd-opts.h"
+#include "safecast.h"
/* Don't include ISC's version of IPv6 variables and structures */
#define ISC_IPV6_H 1
@@ -772,7 +773,7 @@ is_ip_address(
hints.ai_flags |= AI_NUMERICHOST;
if (getaddrinfo(tmpbuf, NULL, &hints, &result) == 0) {
AF(addr) = AF_INET6;
- resaddr6 = (struct sockaddr_in6 *)result->ai_addr;
+ resaddr6 = UA_PTR(struct sockaddr_in6, result->ai_addr);
SET_ADDR6N(addr, resaddr6->sin6_addr);
SET_SCOPE(addr, resaddr6->sin6_scope_id);
@@ -3365,7 +3366,7 @@ fetch_timestamp(
#endif /* HAVE_BINTIME */
#ifdef HAVE_TIMESTAMPNS
case SCM_TIMESTAMPNS:
- tsp = (struct timespec *)CMSG_DATA(cmsghdr);
+ tsp = UA_PTR(struct timespec, CMSG_DATA(cmsghdr));
if (sys_tick > measured_tick &&
sys_tick > 1e-9) {
ticks = (unsigned long)((tsp->tv_nsec * 1e-9) /
@@ -3666,8 +3667,7 @@ input_handler(
fds = activefds;
tvzero.tv_sec = tvzero.tv_usec = 0;
- n = select(maxactivefd + 1, &fds, (fd_set *)0, (fd_set *)0,
- &tvzero);
+ n = select(maxactivefd + 1, &fds, NULL, NULL, &tvzero);
/*
* If there are no packets waiting just return
@@ -4447,7 +4447,7 @@ close_and_delete_fd_from_list(
break;
case FD_TYPE_FILE:
- closeserial(lsock->fd);
+ closeserial((int)lsock->fd);
break;
default:
@@ -4643,7 +4643,7 @@ process_routing_msgs(struct asyncio_reader *reader)
* process routing message
*/
#ifdef HAVE_RTNETLINK
- for (nh = (struct nlmsghdr *)buffer;
+ for (nh = UA_PTR(struct nlmsghdr, buffer);
NLMSG_OK(nh, cnt);
nh = NLMSG_NEXT(nh, cnt)) {
msg_type = nh->nlmsg_type;
diff --git a/contrib/ntp/ntpd/ntp_loopfilter.c b/contrib/ntp/ntpd/ntp_loopfilter.c
index 42c30de..4b38aa8 100644
--- a/contrib/ntp/ntpd/ntp_loopfilter.c
+++ b/contrib/ntp/ntpd/ntp_loopfilter.c
@@ -154,7 +154,6 @@ int hardpps_enable; /* kernel PPS discipline enabled */
int ext_enable; /* external clock enabled */
int pps_stratum; /* pps stratum */
int kernel_status; /* from ntp_adjtime */
-int allow_panic = FALSE; /* allow panic correction (-g) */
int force_step_once = FALSE; /* always step time once at startup (-G) */
int mode_ntpdate = FALSE; /* exit on first clock set (-q) */
int freq_cnt; /* initial frequency clamp */
@@ -459,16 +458,16 @@ local_clock(
double dtemp, etemp; /* double temps */
char tbuf[80]; /* report buffer */
+ (void)ntp_adj_ret; /* not always used below... */
/*
* If the loop is opened or the NIST LOCKCLOCK is in use,
* monitor and record the offsets anyway in order to determine
* the open-loop response and then go home.
*/
-#ifdef LOCKCLOCK
+#ifndef LOCKCLOCK
+ if (!ntp_enable)
+#endif /* not LOCKCLOCK */
{
-#else
- if (!ntp_enable) {
-#endif /* LOCKCLOCK */
record_loop_stats(fp_offset, drift_comp, clock_jitter,
clock_stability, sys_poll);
return (0);
@@ -493,6 +492,8 @@ local_clock(
return (-1);
}
+ allow_panic = FALSE;
+
/*
* This section simulates ntpdate. If the offset exceeds the
* step threshold (128 ms), step the clock to that time and
@@ -538,12 +539,8 @@ local_clock(
else
dtemp = (peer->delay - sys_mindly) / 2;
fp_offset += dtemp;
-#ifdef DEBUG
- if (debug)
- printf(
- "local_clock: size %d mindly %.6f huffpuff %.6f\n",
- sys_hufflen, sys_mindly, dtemp);
-#endif
+ DPRINTF(1, ("local_clock: size %d mindly %.6f huffpuff %.6f\n",
+ sys_hufflen, sys_mindly, dtemp));
}
/*
@@ -694,7 +691,6 @@ local_clock(
* startup until the initial transient has subsided.
*/
default:
- allow_panic = FALSE;
if (freq_cnt == 0) {
/*
@@ -921,15 +917,11 @@ local_clock(
*/
record_loop_stats(clock_offset, drift_comp, clock_jitter,
clock_stability, sys_poll);
-#ifdef DEBUG
- if (debug)
- printf(
- "local_clock: offset %.9f jit %.9f freq %.3f stab %.3f poll %d\n",
+ DPRINTF(1, ("local_clock: offset %.9f jit %.9f freq %.3f stab %.3f poll %d\n",
clock_offset, clock_jitter, drift_comp * 1e6,
- clock_stability * 1e6, sys_poll);
-#endif /* DEBUG */
+ clock_stability * 1e6, sys_poll));
return (rval);
-#endif /* LOCKCLOCK */
+#endif /* not LOCKCLOCK */
}
@@ -1005,7 +997,10 @@ adj_host_clock(
* but does not automatically stop slewing when an offset
* has decayed to zero.
*/
+ DEBUG_INSIST(enable_panic_check == TRUE);
+ enable_panic_check = FALSE;
adj_systime(offset_adj + freq_adj);
+ enable_panic_check = TRUE;
#endif /* LOCKCLOCK */
}
@@ -1019,12 +1014,9 @@ rstclock(
double offset /* new offset */
)
{
-#ifdef DEBUG
- if (debug > 1)
- printf("local_clock: mu %lu state %d poll %d count %d\n",
+ DPRINTF(2, ("rstclock: mu %lu state %d poll %d count %d\n",
current_time - clock_epoch, trans, sys_poll,
- tc_counter);
-#endif
+ tc_counter));
if (trans != state && trans != EVNT_FSET)
report_event(trans, NULL, NULL);
state = trans;
@@ -1075,6 +1067,7 @@ set_freq(
const char * loop_desc;
int ntp_adj_ret;
+ (void)ntp_adj_ret; /* not always used below... */
drift_comp = freq;
loop_desc = "ntpd";
#ifdef KERNEL_PLL
@@ -1236,10 +1229,7 @@ loop_config(
int i;
double ftemp;
-#ifdef DEBUG
- if (debug > 1)
- printf("loop_config: item %d freq %f\n", item, freq);
-#endif
+ DPRINTF(2, ("loop_config: item %d freq %f\n", item, freq));
switch (item) {
/*
diff --git a/contrib/ntp/ntpd/ntp_parser.c b/contrib/ntp/ntpd/ntp_parser.c
index 6235033..cc17950 100644
--- a/contrib/ntp/ntpd/ntp_parser.c
+++ b/contrib/ntp/ntpd/ntp_parser.c
@@ -889,21 +889,21 @@ static const yytype_uint16 yyrline[] =
872, 873, 874, 875, 876, 877, 878, 879, 880, 881,
882, 886, 891, 899, 904, 905, 906, 910, 915, 923,
928, 929, 930, 931, 932, 933, 934, 935, 943, 953,
- 958, 966, 968, 970, 972, 974, 979, 980, 984, 985,
- 986, 987, 995, 1000, 1005, 1013, 1018, 1019, 1020, 1029,
- 1031, 1036, 1041, 1049, 1051, 1068, 1069, 1070, 1071, 1072,
- 1073, 1077, 1078, 1086, 1091, 1096, 1104, 1109, 1110, 1111,
- 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1127, 1128, 1129,
- 1136, 1143, 1150, 1166, 1185, 1187, 1189, 1191, 1193, 1195,
- 1202, 1207, 1208, 1209, 1213, 1217, 1226, 1227, 1231, 1232,
- 1233, 1237, 1248, 1262, 1274, 1279, 1281, 1286, 1287, 1295,
- 1297, 1305, 1310, 1318, 1343, 1350, 1360, 1361, 1365, 1366,
- 1367, 1368, 1372, 1373, 1374, 1378, 1383, 1388, 1396, 1397,
- 1398, 1399, 1400, 1401, 1402, 1412, 1417, 1425, 1430, 1438,
- 1440, 1444, 1449, 1454, 1462, 1467, 1475, 1484, 1485, 1489,
- 1490, 1499, 1517, 1521, 1526, 1534, 1539, 1540, 1544, 1549,
- 1557, 1562, 1567, 1572, 1577, 1585, 1590, 1595, 1603, 1608,
- 1609, 1610, 1611, 1612
+ 958, 966, 968, 970, 979, 981, 986, 987, 991, 992,
+ 993, 994, 1002, 1007, 1012, 1020, 1025, 1026, 1027, 1036,
+ 1038, 1043, 1048, 1056, 1058, 1075, 1076, 1077, 1078, 1079,
+ 1080, 1084, 1085, 1093, 1098, 1103, 1111, 1116, 1117, 1118,
+ 1119, 1120, 1121, 1122, 1123, 1124, 1125, 1134, 1135, 1136,
+ 1143, 1150, 1157, 1173, 1192, 1194, 1196, 1198, 1200, 1202,
+ 1209, 1214, 1215, 1216, 1220, 1224, 1233, 1234, 1238, 1239,
+ 1240, 1244, 1255, 1269, 1281, 1286, 1288, 1293, 1294, 1302,
+ 1304, 1312, 1317, 1325, 1350, 1357, 1367, 1368, 1372, 1373,
+ 1374, 1375, 1379, 1380, 1381, 1385, 1390, 1395, 1403, 1404,
+ 1405, 1406, 1407, 1408, 1409, 1419, 1424, 1432, 1437, 1445,
+ 1447, 1451, 1456, 1461, 1469, 1474, 1482, 1491, 1492, 1496,
+ 1497, 1506, 1524, 1528, 1533, 1541, 1546, 1547, 1551, 1556,
+ 1564, 1569, 1574, 1579, 1584, 1592, 1597, 1602, 1610, 1615,
+ 1616, 1617, 1618, 1619
};
#endif
@@ -2684,90 +2684,97 @@ yyreduce:
case 173:
#line 971 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
- { (yyval.Attr_val) = create_attr_ival((yyvsp[-1].Integer), (yyvsp[0].Integer)); }
-#line 2689 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+ {
+ if ((yyvsp[0].Integer) >= 0 && (yyvsp[0].Integer) <= 16) {
+ (yyval.Attr_val) = create_attr_ival((yyvsp[-1].Integer), (yyvsp[0].Integer));
+ } else {
+ (yyval.Attr_val) = NULL;
+ yyerror("fudge factor: stratum value not in [0..16], ignored");
+ }
+ }
+#line 2696 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 174:
-#line 973 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 980 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{ (yyval.Attr_val) = create_attr_sval((yyvsp[-1].Integer), (yyvsp[0].String)); }
-#line 2695 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 2702 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 175:
-#line 975 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 982 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{ (yyval.Attr_val) = create_attr_sval((yyvsp[-1].Integer), (yyvsp[0].String)); }
-#line 2701 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 2708 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 182:
-#line 996 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1003 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{ CONCAT_G_FIFOS(cfgt.rlimit, (yyvsp[0].Attr_val_fifo)); }
-#line 2707 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 2714 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 183:
-#line 1001 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1008 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
(yyval.Attr_val_fifo) = (yyvsp[-1].Attr_val_fifo);
APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[0].Attr_val));
}
-#line 2716 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 2723 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 184:
-#line 1006 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1013 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
(yyval.Attr_val_fifo) = NULL;
APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[0].Attr_val));
}
-#line 2725 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 2732 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 185:
-#line 1014 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1021 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{ (yyval.Attr_val) = create_attr_ival((yyvsp[-1].Integer), (yyvsp[0].Integer)); }
-#line 2731 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 2738 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 189:
-#line 1030 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1037 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{ CONCAT_G_FIFOS(cfgt.enable_opts, (yyvsp[0].Attr_val_fifo)); }
-#line 2737 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 2744 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 190:
-#line 1032 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1039 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{ CONCAT_G_FIFOS(cfgt.disable_opts, (yyvsp[0].Attr_val_fifo)); }
-#line 2743 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 2750 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 191:
-#line 1037 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1044 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
(yyval.Attr_val_fifo) = (yyvsp[-1].Attr_val_fifo);
APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[0].Attr_val));
}
-#line 2752 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 2759 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 192:
-#line 1042 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1049 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
(yyval.Attr_val_fifo) = NULL;
APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[0].Attr_val));
}
-#line 2761 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 2768 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 193:
-#line 1050 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1057 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{ (yyval.Attr_val) = create_attr_ival(T_Flag, (yyvsp[0].Integer)); }
-#line 2767 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 2774 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 194:
-#line 1052 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1059 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
if (lex_from_file()) {
(yyval.Attr_val) = create_attr_ival(T_Flag, (yyvsp[0].Integer));
@@ -2781,74 +2788,74 @@ yyreduce:
yyerror(err_str);
}
}
-#line 2785 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 2792 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 203:
-#line 1087 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1094 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{ CONCAT_G_FIFOS(cfgt.tinker, (yyvsp[0].Attr_val_fifo)); }
-#line 2791 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 2798 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 204:
-#line 1092 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1099 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
(yyval.Attr_val_fifo) = (yyvsp[-1].Attr_val_fifo);
APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[0].Attr_val));
}
-#line 2800 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 2807 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 205:
-#line 1097 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1104 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
(yyval.Attr_val_fifo) = NULL;
APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[0].Attr_val));
}
-#line 2809 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 2816 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 206:
-#line 1105 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1112 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{ (yyval.Attr_val) = create_attr_dval((yyvsp[-1].Integer), (yyvsp[0].Double)); }
-#line 2815 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 2822 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 219:
-#line 1130 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1137 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
attr_val *av;
av = create_attr_dval((yyvsp[-1].Integer), (yyvsp[0].Double));
APPEND_G_FIFO(cfgt.vars, av);
}
-#line 2826 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 2833 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 220:
-#line 1137 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1144 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
attr_val *av;
av = create_attr_ival((yyvsp[-1].Integer), (yyvsp[0].Integer));
APPEND_G_FIFO(cfgt.vars, av);
}
-#line 2837 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 2844 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 221:
-#line 1144 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1151 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
attr_val *av;
av = create_attr_sval((yyvsp[-1].Integer), (yyvsp[0].String));
APPEND_G_FIFO(cfgt.vars, av);
}
-#line 2848 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 2855 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 222:
-#line 1151 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1158 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
char error_text[64];
attr_val *av;
@@ -2864,11 +2871,11 @@ yyreduce:
yyerror(error_text);
}
}
-#line 2868 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 2875 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 223:
-#line 1167 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1174 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
if (!lex_from_file()) {
YYFREE((yyvsp[-1].String)); /* avoid leak */
@@ -2887,68 +2894,68 @@ yyreduce:
}
YYFREE((yyvsp[-1].String)); /* avoid leak */
}
-#line 2891 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 2898 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 224:
-#line 1186 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1193 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{ lex_flush_stack(); }
-#line 2897 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 2904 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 225:
-#line 1188 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1195 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{ /* see drift_parm below for actions */ }
-#line 2903 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 2910 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 226:
-#line 1190 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1197 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{ CONCAT_G_FIFOS(cfgt.logconfig, (yyvsp[0].Attr_val_fifo)); }
-#line 2909 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 2916 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 227:
-#line 1192 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1199 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{ CONCAT_G_FIFOS(cfgt.phone, (yyvsp[0].String_fifo)); }
-#line 2915 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 2922 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 228:
-#line 1194 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1201 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{ APPEND_G_FIFO(cfgt.setvar, (yyvsp[0].Set_var)); }
-#line 2921 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 2928 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 229:
-#line 1196 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1203 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
addr_opts_node *aon;
aon = create_addr_opts_node((yyvsp[-1].Address_node), (yyvsp[0].Attr_val_fifo));
APPEND_G_FIFO(cfgt.trap, aon);
}
-#line 2932 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 2939 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 230:
-#line 1203 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1210 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{ CONCAT_G_FIFOS(cfgt.ttl, (yyvsp[0].Attr_val_fifo)); }
-#line 2938 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 2945 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 235:
-#line 1218 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1225 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
#ifndef LEAP_SMEAR
yyerror("Built without LEAP_SMEAR support.");
#endif
}
-#line 2948 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 2955 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 241:
-#line 1238 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1245 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
if (lex_from_file()) {
attr_val *av;
@@ -2959,11 +2966,11 @@ yyreduce:
yyerror("driftfile remote configuration ignored");
}
}
-#line 2963 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 2970 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 242:
-#line 1249 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1256 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
if (lex_from_file()) {
attr_val *av;
@@ -2976,11 +2983,11 @@ yyreduce:
yyerror("driftfile remote configuration ignored");
}
}
-#line 2980 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 2987 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 243:
-#line 1262 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1269 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
if (lex_from_file()) {
attr_val *av;
@@ -2990,71 +2997,71 @@ yyreduce:
yyerror("driftfile remote configuration ignored");
}
}
-#line 2994 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 3001 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 244:
-#line 1275 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1282 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{ (yyval.Set_var) = create_setvar_node((yyvsp[-3].String), (yyvsp[-1].String), (yyvsp[0].Integer)); }
-#line 3000 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 3007 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 246:
-#line 1281 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1288 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{ (yyval.Integer) = 0; }
-#line 3006 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 3013 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 247:
-#line 1286 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1293 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{ (yyval.Attr_val_fifo) = NULL; }
-#line 3012 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 3019 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 248:
-#line 1288 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1295 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
(yyval.Attr_val_fifo) = (yyvsp[-1].Attr_val_fifo);
APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[0].Attr_val));
}
-#line 3021 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 3028 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 249:
-#line 1296 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1303 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{ (yyval.Attr_val) = create_attr_ival((yyvsp[-1].Integer), (yyvsp[0].Integer)); }
-#line 3027 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 3034 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 250:
-#line 1298 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1305 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
(yyval.Attr_val) = create_attr_sval((yyvsp[-1].Integer), estrdup((yyvsp[0].Address_node)->address));
destroy_address_node((yyvsp[0].Address_node));
}
-#line 3036 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 3043 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 251:
-#line 1306 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1313 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
(yyval.Attr_val_fifo) = (yyvsp[-1].Attr_val_fifo);
APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[0].Attr_val));
}
-#line 3045 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 3052 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 252:
-#line 1311 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1318 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
(yyval.Attr_val_fifo) = NULL;
APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[0].Attr_val));
}
-#line 3054 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 3061 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 253:
-#line 1319 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1326 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
char prefix;
char * type;
@@ -3076,141 +3083,141 @@ yyreduce:
(yyval.Attr_val) = create_attr_sval(prefix, estrdup(type));
YYFREE((yyvsp[0].String));
}
-#line 3080 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 3087 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 254:
-#line 1344 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1351 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
nic_rule_node *nrn;
nrn = create_nic_rule_node((yyvsp[0].Integer), NULL, (yyvsp[-1].Integer));
APPEND_G_FIFO(cfgt.nic_rules, nrn);
}
-#line 3091 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 3098 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 255:
-#line 1351 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1358 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
nic_rule_node *nrn;
nrn = create_nic_rule_node(0, (yyvsp[0].String), (yyvsp[-1].Integer));
APPEND_G_FIFO(cfgt.nic_rules, nrn);
}
-#line 3102 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 3109 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 265:
-#line 1379 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1386 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{ CONCAT_G_FIFOS(cfgt.reset_counters, (yyvsp[0].Int_fifo)); }
-#line 3108 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 3115 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 266:
-#line 1384 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1391 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
(yyval.Int_fifo) = (yyvsp[-1].Int_fifo);
APPEND_G_FIFO((yyval.Int_fifo), create_int_node((yyvsp[0].Integer)));
}
-#line 3117 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 3124 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 267:
-#line 1389 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1396 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
(yyval.Int_fifo) = NULL;
APPEND_G_FIFO((yyval.Int_fifo), create_int_node((yyvsp[0].Integer)));
}
-#line 3126 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 3133 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 275:
-#line 1413 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1420 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
(yyval.Attr_val_fifo) = (yyvsp[-1].Attr_val_fifo);
APPEND_G_FIFO((yyval.Attr_val_fifo), create_int_node((yyvsp[0].Integer)));
}
-#line 3135 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 3142 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 276:
-#line 1418 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1425 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
(yyval.Attr_val_fifo) = NULL;
APPEND_G_FIFO((yyval.Attr_val_fifo), create_int_node((yyvsp[0].Integer)));
}
-#line 3144 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 3151 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 277:
-#line 1426 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1433 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
(yyval.Attr_val_fifo) = (yyvsp[-1].Attr_val_fifo);
APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[0].Attr_val));
}
-#line 3153 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 3160 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 278:
-#line 1431 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1438 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
(yyval.Attr_val_fifo) = NULL;
APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[0].Attr_val));
}
-#line 3162 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 3169 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 279:
-#line 1439 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1446 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{ (yyval.Attr_val) = create_attr_ival('i', (yyvsp[0].Integer)); }
-#line 3168 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 3175 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 281:
-#line 1445 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1452 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{ (yyval.Attr_val) = create_attr_rangeval('-', (yyvsp[-3].Integer), (yyvsp[-1].Integer)); }
-#line 3174 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 3181 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 282:
-#line 1450 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1457 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
(yyval.String_fifo) = (yyvsp[-1].String_fifo);
APPEND_G_FIFO((yyval.String_fifo), create_string_node((yyvsp[0].String)));
}
-#line 3183 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 3190 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 283:
-#line 1455 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1462 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
(yyval.String_fifo) = NULL;
APPEND_G_FIFO((yyval.String_fifo), create_string_node((yyvsp[0].String)));
}
-#line 3192 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 3199 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 284:
-#line 1463 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1470 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
(yyval.Address_fifo) = (yyvsp[-1].Address_fifo);
APPEND_G_FIFO((yyval.Address_fifo), (yyvsp[0].Address_node));
}
-#line 3201 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 3208 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 285:
-#line 1468 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1475 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
(yyval.Address_fifo) = NULL;
APPEND_G_FIFO((yyval.Address_fifo), (yyvsp[0].Address_node));
}
-#line 3210 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 3217 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 286:
-#line 1476 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1483 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
if ((yyvsp[0].Integer) != 0 && (yyvsp[0].Integer) != 1) {
yyerror("Integer value is not boolean (0 or 1). Assuming 1");
@@ -3219,29 +3226,29 @@ yyreduce:
(yyval.Integer) = (yyvsp[0].Integer);
}
}
-#line 3223 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 3230 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 287:
-#line 1484 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1491 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{ (yyval.Integer) = 1; }
-#line 3229 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 3236 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 288:
-#line 1485 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1492 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{ (yyval.Integer) = 0; }
-#line 3235 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 3242 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 289:
-#line 1489 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1496 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{ (yyval.Double) = (double)(yyvsp[0].Integer); }
-#line 3241 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 3248 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 291:
-#line 1500 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1507 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
sim_node *sn;
@@ -3251,125 +3258,125 @@ yyreduce:
/* Revert from ; to \n for end-of-command */
old_config_style = 1;
}
-#line 3255 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 3262 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 292:
-#line 1517 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1524 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{ old_config_style = 0; }
-#line 3261 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 3268 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 293:
-#line 1522 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1529 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
(yyval.Attr_val_fifo) = (yyvsp[-2].Attr_val_fifo);
APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[-1].Attr_val));
}
-#line 3270 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 3277 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 294:
-#line 1527 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1534 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
(yyval.Attr_val_fifo) = NULL;
APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[-1].Attr_val));
}
-#line 3279 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 3286 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 295:
-#line 1535 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1542 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{ (yyval.Attr_val) = create_attr_dval((yyvsp[-2].Integer), (yyvsp[0].Double)); }
-#line 3285 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 3292 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 298:
-#line 1545 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1552 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
(yyval.Sim_server_fifo) = (yyvsp[-1].Sim_server_fifo);
APPEND_G_FIFO((yyval.Sim_server_fifo), (yyvsp[0].Sim_server));
}
-#line 3294 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 3301 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 299:
-#line 1550 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1557 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
(yyval.Sim_server_fifo) = NULL;
APPEND_G_FIFO((yyval.Sim_server_fifo), (yyvsp[0].Sim_server));
}
-#line 3303 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 3310 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 300:
-#line 1558 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1565 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{ (yyval.Sim_server) = ONLY_SIM(create_sim_server((yyvsp[-4].Address_node), (yyvsp[-2].Double), (yyvsp[-1].Sim_script_fifo))); }
-#line 3309 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 3316 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 301:
-#line 1563 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1570 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{ (yyval.Double) = (yyvsp[-1].Double); }
-#line 3315 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 3322 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 302:
-#line 1568 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1575 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{ (yyval.Address_node) = (yyvsp[0].Address_node); }
-#line 3321 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 3328 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 303:
-#line 1573 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1580 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
(yyval.Sim_script_fifo) = (yyvsp[-1].Sim_script_fifo);
APPEND_G_FIFO((yyval.Sim_script_fifo), (yyvsp[0].Sim_script));
}
-#line 3330 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 3337 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 304:
-#line 1578 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1585 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
(yyval.Sim_script_fifo) = NULL;
APPEND_G_FIFO((yyval.Sim_script_fifo), (yyvsp[0].Sim_script));
}
-#line 3339 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 3346 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 305:
-#line 1586 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1593 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{ (yyval.Sim_script) = ONLY_SIM(create_sim_script_info((yyvsp[-3].Double), (yyvsp[-1].Attr_val_fifo))); }
-#line 3345 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 3352 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 306:
-#line 1591 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1598 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
(yyval.Attr_val_fifo) = (yyvsp[-2].Attr_val_fifo);
APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[-1].Attr_val));
}
-#line 3354 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 3361 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 307:
-#line 1596 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1603 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{
(yyval.Attr_val_fifo) = NULL;
APPEND_G_FIFO((yyval.Attr_val_fifo), (yyvsp[-1].Attr_val));
}
-#line 3363 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 3370 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
case 308:
-#line 1604 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
+#line 1611 "../../ntpd/ntp_parser.y" /* yacc.c:1646 */
{ (yyval.Attr_val) = create_attr_dval((yyvsp[-2].Integer), (yyvsp[0].Double)); }
-#line 3369 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 3376 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
break;
-#line 3373 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
+#line 3380 "../../ntpd/ntp_parser.c" /* yacc.c:1646 */
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
@@ -3597,7 +3604,7 @@ yyreturn:
#endif
return yyresult;
}
-#line 1615 "../../ntpd/ntp_parser.y" /* yacc.c:1906 */
+#line 1622 "../../ntpd/ntp_parser.y" /* yacc.c:1906 */
void
diff --git a/contrib/ntp/ntpd/ntp_proto.c b/contrib/ntp/ntpd/ntp_proto.c
index 2a15d72..f770472 100644
--- a/contrib/ntp/ntpd/ntp_proto.c
+++ b/contrib/ntp/ntpd/ntp_proto.c
@@ -15,6 +15,7 @@
#include "ntp_string.h"
#include "ntp_leapsec.h"
#include "refidsmear.h"
+#include "lib_strbuf.h"
#include <stdio.h>
#ifdef HAVE_LIBSCF_H
@@ -172,8 +173,14 @@ void pool_name_resolved (int, int, void *, const char *,
const struct addrinfo *);
#endif /* WORKER */
+const char * amtoa (int am);
+
+
void
-set_sys_leap(u_char new_sys_leap) {
+set_sys_leap(
+ u_char new_sys_leap
+ )
+{
sys_leap = new_sys_leap;
xmt_leap = sys_leap;
@@ -189,8 +196,9 @@ set_sys_leap(u_char new_sys_leap) {
#ifdef LEAP_SMEAR
else {
/*
- * If leap smear is enabled in general we must never send a leap second warning
- * to clients, so make sure we only send "in sync".
+ * If leap smear is enabled in general we must
+ * never send a leap second warning to clients,
+ * so make sure we only send "in sync".
*/
if (leap_smear.enabled)
xmt_leap = LEAP_NOWARNING;
@@ -199,34 +207,39 @@ set_sys_leap(u_char new_sys_leap) {
}
}
+
/*
* Kiss Code check
*/
-int kiss_code_check(u_char hisleap, u_char hisstratum, u_char hismode, u_int32 refid) {
+int
+kiss_code_check(
+ u_char hisleap,
+ u_char hisstratum,
+ u_char hismode,
+ u_int32 refid
+ )
+{
- if ( hismode == MODE_SERVER
- && hisleap == LEAP_NOTINSYNC
- && hisstratum == STRATUM_UNSPEC) {
- if(memcmp(&refid,"RATE", 4) == 0) {
- return (RATEKISS);
- }
- else if(memcmp(&refid,"DENY", 4) == 0) {
- return (DENYKISS);
- }
- else if(memcmp(&refid,"RSTR", 4) == 0) {
- return (RSTRKISS);
- }
- else if(memcmp(&refid,"X", 1) == 0) {
- return (XKISS);
- }
- else {
- return (UNKNOWNKISS);
- }
- }
- else {
- return (NOKISS);
+ if ( hismode == MODE_SERVER
+ && hisleap == LEAP_NOTINSYNC
+ && hisstratum == STRATUM_UNSPEC) {
+ if(memcmp(&refid,"RATE", 4) == 0) {
+ return (RATEKISS);
+ } else if(memcmp(&refid,"DENY", 4) == 0) {
+ return (DENYKISS);
+ } else if(memcmp(&refid,"RSTR", 4) == 0) {
+ return (RSTRKISS);
+ } else if(memcmp(&refid,"X", 1) == 0) {
+ return (XKISS);
+ } else {
+ return (UNKNOWNKISS);
}
+ } else {
+ return (NOKISS);
+ }
}
+
+
/*
* transmit - transmit procedure called by poll timeout
*/
@@ -303,7 +316,7 @@ transmit(
peer->outdate = current_time;
if ( (peer_associations <= 2 * sys_maxclock)
&& ( peer_associations < sys_maxclock
- || sys_survivors < sys_minclock))
+ || sys_survivors < sys_minclock))
pool_xmit(peer);
poll_update(peer, hpoll);
return;
@@ -416,6 +429,33 @@ transmit(
if (peer->hmode != MODE_BCLIENT)
peer_xmit(peer);
poll_update(peer, hpoll);
+
+ return;
+}
+
+
+const char *
+amtoa(
+ int am
+ )
+{
+ char *bp;
+
+ switch(am) {
+ case AM_ERR: return "AM_ERR";
+ case AM_NOMATCH: return "AM_NOMATCH";
+ case AM_PROCPKT: return "AM_PROCPKT";
+ case AM_BCST: return "AM_BCST";
+ case AM_FXMIT: return "AM_FXMIT";
+ case AM_MANYCAST: return "AM_MANYCAST";
+ case AM_NEWPASS: return "AM_NEWPASS";
+ case AM_NEWBCL: return "AM_NEWBCL";
+ case AM_POSSBCL: return "AM_POSSBCL";
+ default:
+ LIB_GETBUF(bp);
+ snprintf(bp, LIB_BUFLENGTH, "AM_#%d", am);
+ return bp;
+ }
}
@@ -434,16 +474,18 @@ receive(
u_char hismode; /* packet mode */
u_char hisstratum; /* packet stratum */
u_short restrict_mask; /* restrict bits */
- int kissCode = NOKISS; /* Kiss Code */
+ const char *hm_str; /* hismode string */
+ const char *am_str; /* association match string */
+ int kissCode = NOKISS; /* Kiss Code */
int has_mac; /* length of MAC field */
int authlen; /* offset of MAC field */
int is_authentic = 0; /* cryptosum ok */
int retcode = AM_NOMATCH; /* match code */
keyid_t skeyid = 0; /* key IDs */
u_int32 opcode = 0; /* extension field opcode */
- sockaddr_u *dstadr_sin; /* active runway */
+ sockaddr_u *dstadr_sin; /* active runway */
struct peer *peer2; /* aux peer structure pointer */
- endpt * match_ep; /* newpeer() local address */
+ endpt *match_ep; /* newpeer() local address */
l_fp p_org; /* origin timestamp */
l_fp p_rec; /* receive timestamp */
l_fp p_xmt; /* transmit timestamp */
@@ -474,11 +516,12 @@ receive(
return; /* bogus port */
}
restrict_mask = restrictions(&rbufp->recv_srcadr);
- DPRINTF(2, ("receive: at %ld %s<-%s flags %x restrict %03x\n",
- current_time, stoa(&rbufp->dstadr->sin),
- stoa(&rbufp->recv_srcadr),
- rbufp->dstadr->flags, restrict_mask));
pkt = &rbufp->recv_pkt;
+ DPRINTF(2, ("receive: at %ld %s<-%s flags %x restrict %03x org %#010x.%08x xmt %#010x.%08x\n",
+ current_time, stoa(&rbufp->dstadr->sin),
+ stoa(&rbufp->recv_srcadr), rbufp->dstadr->flags,
+ restrict_mask, ntohl(pkt->org.l_ui), ntohl(pkt->org.l_uf),
+ ntohl(pkt->xmt.l_ui), ntohl(pkt->xmt.l_uf)));
hisversion = PKT_VERSION(pkt->li_vn_mode);
hisleap = PKT_LEAP(pkt->li_vn_mode);
hismode = (int)PKT_MODE(pkt->li_vn_mode);
@@ -685,6 +728,8 @@ receive(
NTOHL_FP(&pkt->org, &p_org);
NTOHL_FP(&pkt->rec, &p_rec);
NTOHL_FP(&pkt->xmt, &p_xmt);
+ hm_str = modetoa(hismode);
+ am_str = amtoa(retcode);
/*
* Authentication is conditioned by three switches:
@@ -713,25 +758,21 @@ receive(
if (has_mac == 0) {
restrict_mask &= ~RES_MSSNTP;
is_authentic = AUTH_NONE; /* not required */
-#ifdef DEBUG
- if (debug)
- printf(
- "receive: at %ld %s<-%s mode %d len %d\n",
+ DPRINTF(2, ("receive: at %ld %s<-%s mode %d/%s:%s len %d org %#010x.%08x xmt %#010x.%08x NOMAC\n",
current_time, stoa(dstadr_sin),
- stoa(&rbufp->recv_srcadr), hismode,
- authlen);
-#endif
+ stoa(&rbufp->recv_srcadr), hismode, hm_str, am_str,
+ authlen,
+ ntohl(pkt->org.l_ui), ntohl(pkt->org.l_uf),
+ ntohl(pkt->xmt.l_ui), ntohl(pkt->xmt.l_uf)));
} else if (has_mac == 4) {
restrict_mask &= ~RES_MSSNTP;
is_authentic = AUTH_CRYPTO; /* crypto-NAK */
-#ifdef DEBUG
- if (debug)
- printf(
- "receive: at %ld %s<-%s mode %d keyid %08x len %d auth %d\n",
+ DPRINTF(2, ("receive: at %ld %s<-%s mode %d/%s:%s keyid %08x len %d auth %d org %#010x.%08x xmt %#010x.%08x MAC4\n",
current_time, stoa(dstadr_sin),
- stoa(&rbufp->recv_srcadr), hismode, skeyid,
- authlen + has_mac, is_authentic);
-#endif
+ stoa(&rbufp->recv_srcadr), hismode, hm_str, am_str,
+ skeyid, authlen + has_mac, is_authentic,
+ ntohl(pkt->org.l_ui), ntohl(pkt->org.l_uf),
+ ntohl(pkt->xmt.l_ui), ntohl(pkt->xmt.l_uf)));
#ifdef HAVE_NTP_SIGND
/*
@@ -747,7 +788,7 @@ receive(
&& (restrict_mask & RES_MSSNTP)
&& (retcode == AM_FXMIT || retcode == AM_NEWPASS)
&& (memcmp(zero_key, (char *)pkt + authlen + 4,
- MAX_MD5_LEN - 4) == 0)) {
+ MAX_MD5_LEN - 4) == 0)) {
is_authentic = AUTH_NONE;
#endif /* HAVE_NTP_SIGND */
@@ -856,14 +897,12 @@ receive(
if (crypto_flags && skeyid > NTP_MAXKEY)
authtrust(skeyid, 0);
#endif /* AUTOKEY */
-#ifdef DEBUG
- if (debug)
- printf(
- "receive: at %ld %s<-%s mode %d keyid %08x len %d auth %d\n",
+ DPRINTF(2, ("receive: at %ld %s<-%s mode %d/%s:%s keyid %08x len %d auth %d org %#010x.%08x xmt %#010x.%08x\n",
current_time, stoa(dstadr_sin),
- stoa(&rbufp->recv_srcadr), hismode, skeyid,
- authlen + has_mac, is_authentic);
-#endif
+ stoa(&rbufp->recv_srcadr), hismode, hm_str, am_str,
+ skeyid, authlen + has_mac, is_authentic,
+ ntohl(pkt->org.l_ui), ntohl(pkt->org.l_uf),
+ ntohl(pkt->xmt.l_ui), ntohl(pkt->xmt.l_uf)));
}
/*
@@ -1194,11 +1233,11 @@ receive(
* debug-printed and not logged to avoid log
* flooding.
*/
- DPRINTF(1, ("receive: at %ld refusing to mobilize passive association"
- " with unknown peer %s mode %d keyid %08x len %d auth %d\n",
+ DPRINTF(2, ("receive: at %ld refusing to mobilize passive association"
+ " with unknown peer %s mode %d/%s:%s keyid %08x len %d auth %d\n",
current_time, stoa(&rbufp->recv_srcadr),
- hismode, skeyid, (authlen + has_mac),
- is_authentic));
+ hismode, hm_str, am_str, skeyid,
+ (authlen + has_mac), is_authentic));
sys_declined++;
return;
}
@@ -1321,26 +1360,36 @@ receive(
}
/*
- * Check for bogus packet in basic mode. If found, switch to
- * interleaved mode and resynchronize, but only after confirming
- * the packet is not bogus in symmetric interleaved mode.
+ * Basic mode checks:
+ *
+ * If there is no origin timestamp, it's an initial packet.
+ *
+ * Otherwise, check for bogus packet in basic mode.
+ * If it is bogus, switch to interleaved mode and resynchronize,
+ * but only after confirming the packet is not bogus in
+ * symmetric interleaved mode.
*
* This could also mean somebody is forging packets claiming to
* be from us, attempting to cause our server to KoD us.
*/
} else if (peer->flip == 0) {
- if (!L_ISEQU(&p_org, &peer->aorg)) {
+ if (0 < hisstratum && L_ISZERO(&p_org)) {
+ L_CLR(&peer->aorg);
+ } else if (!L_ISEQU(&p_org, &peer->aorg)) {
peer->bogusorg++;
peer->flash |= TEST2; /* bogus */
msyslog(LOG_INFO,
- "receive: Unexpected origin timestamp from %s",
- ntoa(&peer->srcadr));
+ "receive: Unexpected origin timestamp %#010x.%08x from %s xmt %#010x.%08x",
+ ntohl(pkt->org.l_ui), ntohl(pkt->org.l_uf),
+ ntoa(&peer->srcadr),
+ ntohl(pkt->xmt.l_ui), ntohl(pkt->xmt.l_uf));
if ( !L_ISZERO(&peer->dst)
&& L_ISEQU(&p_org, &peer->dst)) {
+ /* Might be the start of an interleave */
peer->flip = 1;
report_event(PEVNT_XLEAVE, peer, NULL);
}
- return; /* Bogus packet, we are done */
+ return; /* Bogus or possible interleave packet */
} else {
L_CLR(&peer->aorg);
}
@@ -1694,11 +1743,8 @@ process_packet(
*/
if (peer->flash & PKT_TEST_MASK) {
peer->seldisptoolarge++;
-#ifdef DEBUG
- if (debug)
- printf("packet: flash header %04x\n",
- peer->flash);
-#endif
+ DPRINTF(1, ("packet: flash header %04x\n",
+ peer->flash));
return;
}
@@ -1871,15 +1917,12 @@ process_packet(
* the roundtrip delay. Then it calculates the correction as a
* fraction of d.
*/
- peer->t21 = t21;
+ peer->t21 = t21;
peer->t21_last = peer->t21_bytes;
peer->t34 = -t34;
peer->t34_bytes = len;
-#ifdef DEBUG
- if (debug > 1)
- printf("packet: t21 %.9lf %d t34 %.9lf %d\n", peer->t21,
- peer->t21_bytes, peer->t34, peer->t34_bytes);
-#endif
+ DPRINTF(2, ("packet: t21 %.9lf %d t34 %.9lf %d\n", peer->t21,
+ peer->t21_bytes, peer->t34, peer->t34_bytes));
if (peer->r21 > 0 && peer->r34 > 0 && p_del > 0) {
if (peer->pmode != MODE_BROADCAST)
td = (peer->r34 / (peer->r21 + peer->r34) -
@@ -1888,7 +1931,7 @@ process_packet(
td = 0;
/*
- * Unfortunately, in many cases the errors are
+ * Unfortunately, in many cases the errors are
* unacceptable, so for the present the rates are not
* used. In future, we might find conditions where the
* calculations are useful, so this should be considered
@@ -1896,12 +1939,9 @@ process_packet(
*/
t21 -= td;
t34 -= td;
-#ifdef DEBUG
- if (debug > 1)
- printf("packet: del %.6lf r21 %.1lf r34 %.1lf %.6lf\n",
+ DPRINTF(2, ("packet: del %.6lf r21 %.1lf r34 %.1lf %.6lf\n",
p_del, peer->r21 / 1e3, peer->r34 / 1e3,
- td);
-#endif
+ td));
}
#endif /* ASSYM */
@@ -1994,12 +2034,8 @@ clock_update(
sys_rootdelay = peer->delay + peer->rootdelay;
sys_reftime = peer->dst;
-#ifdef DEBUG
- if (debug)
- printf(
- "clock_update: at %lu sample %lu associd %d\n",
- current_time, peer->epoch, peer->associd);
-#endif
+ DPRINTF(1, ("clock_update: at %lu sample %lu associd %d\n",
+ current_time, peer->epoch, peer->associd));
/*
* Comes now the moment of truth. Crank the clock discipline and
@@ -2308,13 +2344,9 @@ peer_clear(
#ifdef AUTOKEY
peer->refresh = current_time + (1 << NTP_REFRESH);
#endif /* AUTOKEY */
-#ifdef DEBUG
- if (debug)
- printf(
- "peer_clear: at %ld next %ld associd %d refid %s\n",
+ DPRINTF(1, ("peer_clear: at %ld next %ld associd %d refid %s\n",
current_time, peer->nextdate, peer->associd,
- ident);
-#endif
+ ident));
}
@@ -2478,11 +2510,8 @@ clock_filter(
* packets.
*/
if (peer->filter_epoch[k] <= peer->epoch) {
-#if DEBUG
- if (debug > 1)
- printf("clock_filter: old sample %lu\n", current_time -
- peer->filter_epoch[k]);
-#endif
+ DPRINTF(2, ("clock_filter: old sample %lu\n", current_time -
+ peer->filter_epoch[k]));
return;
}
peer->epoch = peer->filter_epoch[k];
@@ -2494,13 +2523,9 @@ clock_filter(
*/
record_peer_stats(&peer->srcadr, ctlpeerstatus(peer),
peer->offset, peer->delay, peer->disp, peer->jitter);
-#ifdef DEBUG
- if (debug)
- printf(
- "clock_filter: n %d off %.6f del %.6f dsp %.6f jit %.6f\n",
+ DPRINTF(1, ("clock_filter: n %d off %.6f del %.6f dsp %.6f jit %.6f\n",
m, peer->offset, peer->delay, peer->disp,
- peer->jitter);
-#endif
+ peer->jitter));
if (peer->burst == 0 || sys_leap == LEAP_NOTINSYNC)
clock_select();
}
@@ -3004,7 +3029,7 @@ clock_select(void)
typesystem = typepps;
sys_clockhop = 0;
typesystem->new_status = CTL_PST_SEL_PPS;
- sys_offset = typesystem->offset;
+ sys_offset = typesystem->offset;
sys_jitter = typesystem->jitter;
DPRINTF(1, ("select: pps offset %.9f jitter %.9f\n",
sys_offset, sys_jitter));
@@ -3157,11 +3182,11 @@ peer_xmit(
* might not be usable.
*/
sendlen = LEN_PKT_NOMAC;
+ if (
#ifdef AUTOKEY
- if (!(peer->flags & FLAG_SKEY) && peer->keyid == 0) {
-#else /* !AUTOKEY follows */
- if (peer->keyid == 0) {
+ !(peer->flags & FLAG_SKEY) &&
#endif /* !AUTOKEY */
+ peer->keyid == 0) {
/*
* Transmit a-priori timestamps
@@ -3207,13 +3232,11 @@ peer_xmit(
}
L_SUB(&xmt_ty, &xmt_tx);
LFPTOD(&xmt_ty, peer->xleave);
-#ifdef DEBUG
- if (debug)
- printf("transmit: at %ld %s->%s mode %d len %zu\n",
- current_time, peer->dstadr ?
- stoa(&peer->dstadr->sin) : "-",
- stoa(&peer->srcadr), peer->hmode, sendlen);
-#endif
+ DPRINTF(1, ("peer_xmit: at %ld %s->%s mode %d len %zu xmt %#010x.%08x\n",
+ current_time,
+ peer->dstadr ? stoa(&peer->dstadr->sin) : "-",
+ stoa(&peer->srcadr), peer->hmode, sendlen,
+ xmt_tx.l_ui, xmt_tx.l_uf));
return;
}
@@ -3498,7 +3521,7 @@ peer_xmit(
authtrust(xkeyid, 0);
#endif /* AUTOKEY */
if (sendlen > sizeof(xpkt)) {
- msyslog(LOG_ERR, "proto: buffer overflow %zu", sendlen);
+ msyslog(LOG_ERR, "peer_xmit: buffer overflow %zu", sendlen);
exit (-1);
}
peer->t21_bytes = sendlen;
@@ -3521,30 +3544,33 @@ peer_xmit(
L_SUB(&xmt_ty, &xmt_tx);
LFPTOD(&xmt_ty, peer->xleave);
#ifdef AUTOKEY
-#ifdef DEBUG
- if (debug)
- printf("transmit: at %ld %s->%s mode %d keyid %08x len %zu index %d\n",
+ DPRINTF(1, ("peer_xmit: at %ld %s->%s mode %d keyid %08x len %zu index %d\n",
current_time, latoa(peer->dstadr),
ntoa(&peer->srcadr), peer->hmode, xkeyid, sendlen,
- peer->keynumber);
-#endif
+ peer->keynumber));
#else /* !AUTOKEY follows */
-#ifdef DEBUG
- if (debug)
- printf("transmit: at %ld %s->%s mode %d keyid %08x len %d\n",
+ DPRINTF(1, ("peer_xmit: at %ld %s->%s mode %d keyid %08x len %d\n",
current_time, peer->dstadr ?
ntoa(&peer->dstadr->sin) : "-",
- ntoa(&peer->srcadr), peer->hmode, xkeyid, sendlen);
-#endif
+ ntoa(&peer->srcadr), peer->hmode, xkeyid, sendlen));
#endif /* !AUTOKEY */
+
+ return;
}
#ifdef LEAP_SMEAR
static void
-leap_smear_add_offs(l_fp *t, l_fp *t_recv) {
+leap_smear_add_offs(
+ l_fp *t,
+ l_fp *t_recv
+ )
+{
+
L_ADD(t, &leap_smear.offset);
+
+ return;
}
#endif /* LEAP_SMEAR */
@@ -3565,7 +3591,7 @@ fast_xmit(
struct pkt xpkt; /* transmit packet structure */
struct pkt *rpkt; /* receive packet structure */
l_fp xmt_tx, xmt_ty;
- int sendlen;
+ size_t sendlen;
#ifdef AUTOKEY
u_int32 temp32;
#endif
@@ -3684,13 +3710,10 @@ fast_xmit(
if (rbufp->recv_length == sendlen) {
sendpkt(&rbufp->recv_srcadr, rbufp->dstadr, 0, &xpkt,
sendlen);
-#ifdef DEBUG
- if (debug)
- printf(
- "transmit: at %ld %s->%s mode %d len %d\n",
+ DPRINTF(1, ("fast_xmit: at %ld %s->%s mode %d len %lu\n",
current_time, stoa(&rbufp->dstadr->sin),
- stoa(&rbufp->recv_srcadr), xmode, sendlen);
-#endif
+ stoa(&rbufp->recv_srcadr), xmode,
+ (u_long)sendlen));
return;
}
@@ -3717,7 +3740,7 @@ fast_xmit(
*/
cookie = session_key(&rbufp->recv_srcadr,
&rbufp->dstadr->sin, 0, sys_private, 0);
- if (rbufp->recv_length > sendlen + (int)MAX_MAC_LEN) {
+ if ((size_t)rbufp->recv_length > sendlen + MAX_MAC_LEN) {
session_key(&rbufp->dstadr->sin,
&rbufp->recv_srcadr, xkeyid, 0, 2);
temp32 = CRYPTO_RESP;
@@ -3741,13 +3764,10 @@ fast_xmit(
get_systime(&xmt_ty);
L_SUB(&xmt_ty, &xmt_tx);
sys_authdelay = xmt_ty;
-#ifdef DEBUG
- if (debug)
- printf(
- "transmit: at %ld %s->%s mode %d keyid %08x len %d\n",
+ DPRINTF(1, ("fast_xmit: at %ld %s->%s mode %d keyid %08x len %lu\n",
current_time, ntoa(&rbufp->dstadr->sin),
- ntoa(&rbufp->recv_srcadr), xmode, xkeyid, sendlen);
-#endif
+ ntoa(&rbufp->recv_srcadr), xmode, xkeyid,
+ (u_long)sendlen));
}
@@ -3827,11 +3847,8 @@ pool_xmit(
LEN_PKT_NOMAC);
pool->sent++;
pool->throttle += (1 << pool->minpoll) - 2;
-#ifdef DEBUG
- if (debug)
- printf("transmit: at %ld %s->%s pool\n",
- current_time, latoa(lcladr), stoa(rmtadr));
-#endif
+ DPRINTF(1, ("pool_xmit: at %ld %s->%s pool\n",
+ current_time, latoa(lcladr), stoa(rmtadr)));
msyslog(LOG_INFO, "Soliciting pool server %s", stoa(rmtadr));
#endif /* WORKER */
}
@@ -3849,7 +3866,8 @@ pool_xmit(
* group different 1 ignore
* * ignore if notrust
*/
-int group_test(
+int
+group_test(
char *grp,
char *ident
)
@@ -3929,11 +3947,8 @@ key_expire(
value_free(&peer->sndval);
peer->keynumber = 0;
peer->flags &= ~FLAG_ASSOC;
-#ifdef DEBUG
- if (debug)
- printf("key_expire: at %lu associd %d\n", current_time,
- peer->associd);
-#endif
+ DPRINTF(1, ("key_expire: at %lu associd %d\n", current_time,
+ peer->associd));
}
#endif /* AUTOKEY */
diff --git a/contrib/ntp/ntpd/ntp_refclock.c b/contrib/ntp/ntpd/ntp_refclock.c
index 1f16ca7..d25cc2c 100644
--- a/contrib/ntp/ntpd/ntp_refclock.c
+++ b/contrib/ntp/ntpd/ntp_refclock.c
@@ -732,9 +732,9 @@ process_refclock_packet(
*/
int
refclock_open(
- char *dev, /* device name pointer */
- u_int speed, /* serial port speed (code) */
- u_int lflags /* line discipline flags */
+ const char *dev, /* device name pointer */
+ u_int speed, /* serial port speed (code) */
+ u_int lflags /* line discipline flags */
)
{
int fd;
diff --git a/contrib/ntp/ntpd/ntp_request.c b/contrib/ntp/ntpd/ntp_request.c
index 6073f99..fa78ce1 100644
--- a/contrib/ntp/ntpd/ntp_request.c
+++ b/contrib/ntp/ntpd/ntp_request.c
@@ -2006,11 +2006,11 @@ do_trustkey(
u_long trust
)
{
- register u_long *kp;
+ register uint32_t *kp;
register int items;
items = INFO_NITEMS(inpkt->err_nitems);
- kp = (u_long *)&inpkt->u;
+ kp = (uint32_t*)&inpkt->u;
while (items-- > 0) {
authtrust(*kp, trust);
kp++;
diff --git a/contrib/ntp/ntpd/ntp_restrict.c b/contrib/ntp/ntpd/ntp_restrict.c
index 82bbaef..0b5fa2e 100644
--- a/contrib/ntp/ntpd/ntp_restrict.c
+++ b/contrib/ntp/ntpd/ntp_restrict.c
@@ -160,7 +160,7 @@ alloc_res4(void)
const size_t count = INC_RESLIST4;
restrict_u * rl;
restrict_u * res;
- int i;
+ size_t i;
UNLINK_HEAD_SLIST(res, resfree4, link);
if (res != NULL)
@@ -186,7 +186,7 @@ alloc_res6(void)
const size_t count = INC_RESLIST6;
restrict_u * rl;
restrict_u * res;
- int i;
+ size_t i;
UNLINK_HEAD_SLIST(res, resfree6, link);
if (res != NULL)
diff --git a/contrib/ntp/ntpd/ntp_signd.c b/contrib/ntp/ntpd/ntp_signd.c
index 2ba11d0..857dcbf 100644
--- a/contrib/ntp/ntpd/ntp_signd.c
+++ b/contrib/ntp/ntpd/ntp_signd.c
@@ -66,7 +66,7 @@ write_all(int fd, const void *buf, size_t len)
while (len) {
int n = write(fd, buf, len);
if (n <= 0) return total;
- buf = n + (char *)buf;
+ buf = n + (const char *)buf;
len -= n;
total += n;
}
@@ -110,9 +110,10 @@ recv_packet(int fd, char **buf, uint32_t *len)
{
if (read_all(fd, len, sizeof(*len)) != sizeof(*len)) return -1;
*len = ntohl(*len);
- (*buf) = emalloc(*len);
+ *buf = emalloc(*len);
if (read_all(fd, *buf, *len) != *len) {
free(*buf);
+ *buf = NULL;
return -1;
}
return 0;
diff --git a/contrib/ntp/ntpd/ntp_timer.c b/contrib/ntp/ntpd/ntp_timer.c
index 828aa8c..03084a3 100644
--- a/contrib/ntp/ntpd/ntp_timer.c
+++ b/contrib/ntp/ntpd/ntp_timer.c
@@ -626,18 +626,19 @@ check_leapsec(
* announce the leap event has happened.
*/
const char *leapmsg = NULL;
- if (lsdata.warped < 0) {
+ double lswarp = lsdata.warped;
+ if (lswarp < 0.0) {
if (clock_max_back > 0.0 &&
- clock_max_back < fabs(lsdata.warped)) {
- step_systime(lsdata.warped);
+ clock_max_back < -lswarp) {
+ step_systime(lswarp);
leapmsg = leapmsg_p_step;
} else {
leapmsg = leapmsg_p_slew;
}
- } else if (lsdata.warped > 0) {
+ } else if (lswarp > 0.0) {
if (clock_max_fwd > 0.0 &&
- clock_max_fwd < fabs(lsdata.warped)) {
- step_systime(lsdata.warped);
+ clock_max_fwd < lswarp) {
+ step_systime(lswarp);
leapmsg = leapmsg_n_step;
} else {
leapmsg = leapmsg_n_slew;
diff --git a/contrib/ntp/ntpd/ntp_util.c b/contrib/ntp/ntpd/ntp_util.c
index c4bc901..3a95819 100644
--- a/contrib/ntp/ntpd/ntp_util.c
+++ b/contrib/ntp/ntpd/ntp_util.c
@@ -334,7 +334,7 @@ stats_config(
{
FILE *fp;
const char *value;
- int len;
+ size_t len;
double old_drift;
l_fp now;
time_t ttnow;
@@ -437,7 +437,7 @@ stats_config(
(int)sizeof(statsdir) - 2);
} else {
int add_dir_sep;
- int value_l;
+ size_t value_l;
/* Add a DIR_SEP unless we already have one. */
value_l = strlen(value);
@@ -933,7 +933,7 @@ getauthkeys(
const char *keyfile
)
{
- int len;
+ size_t len;
len = strlen(keyfile);
if (!len)
diff --git a/contrib/ntp/ntpd/ntpd-opts.c b/contrib/ntp/ntpd/ntpd-opts.c
index 1bbecfa..660884b 100644
--- a/contrib/ntp/ntpd/ntpd-opts.c
+++ b/contrib/ntp/ntpd/ntpd-opts.c
@@ -1,7 +1,7 @@
/*
* EDIT THIS FILE WITH CAUTION (ntpd-opts.c)
*
- * It has been AutoGen-ed October 21, 2015 at 12:36:00 PM by AutoGen 5.18.5
+ * It has been AutoGen-ed January 7, 2016 at 11:28:29 PM by AutoGen 5.18.5
* From the definitions ntpd-opts.def
* and the template file options
*
@@ -75,7 +75,7 @@ extern FILE * option_usage_fp;
* static const strings for ntpd options
*/
static char const ntpd_opt_strs[3129] =
-/* 0 */ "ntpd 4.2.8p4\n"
+/* 0 */ "ntpd 4.2.8p5\n"
"Copyright (C) 1992-2015 The University of Delaware and Network Time Foundation, all rights reserved.\n"
"This is free software. It is licensed for use, modification and\n"
"redistribution under the terms of the NTP License, copies of which\n"
@@ -205,12 +205,12 @@ static char const ntpd_opt_strs[3129] =
/* 2900 */ "output version information and exit\0"
/* 2936 */ "version\0"
/* 2944 */ "NTPD\0"
-/* 2949 */ "ntpd - NTP daemon program - Ver. 4.2.8p4\n"
+/* 2949 */ "ntpd - NTP daemon program - Ver. 4.2.8p5\n"
"Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \\\n"
"\t\t[ <server1> ... <serverN> ]\n\0"
/* 3080 */ "http://bugs.ntp.org, bugs@ntp.org\0"
/* 3114 */ "\n\0"
-/* 3116 */ "ntpd 4.2.8p4";
+/* 3116 */ "ntpd 4.2.8p5";
/**
* ipv4 option description with
@@ -1529,7 +1529,7 @@ static void bogus_function(void) {
translate option names.
*/
/* referenced via ntpdOptions.pzCopyright */
- puts(_("ntpd 4.2.8p4\n\
+ puts(_("ntpd 4.2.8p5\n\
Copyright (C) 1992-2015 The University of Delaware and Network Time Foundation, all rights reserved.\n\
This is free software. It is licensed for use, modification and\n\
redistribution under the terms of the NTP License, copies of which\n\
@@ -1670,7 +1670,7 @@ implied warranty.\n"));
puts(_("output version information and exit"));
/* referenced via ntpdOptions.pzUsageTitle */
- puts(_("ntpd - NTP daemon program - Ver. 4.2.8p4\n\
+ puts(_("ntpd - NTP daemon program - Ver. 4.2.8p5\n\
Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \\\n\
\t\t[ <server1> ... <serverN> ]\n"));
@@ -1678,7 +1678,7 @@ Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \\\n\
puts(_("\n"));
/* referenced via ntpdOptions.pzFullVersion */
- puts(_("ntpd 4.2.8p4"));
+ puts(_("ntpd 4.2.8p5"));
/* referenced via ntpdOptions.pzFullUsage */
puts(_("<<<NOT-FOUND>>>"));
diff --git a/contrib/ntp/ntpd/ntpd-opts.h b/contrib/ntp/ntpd/ntpd-opts.h
index d87c221..571fd34 100644
--- a/contrib/ntp/ntpd/ntpd-opts.h
+++ b/contrib/ntp/ntpd/ntpd-opts.h
@@ -1,7 +1,7 @@
/*
* EDIT THIS FILE WITH CAUTION (ntpd-opts.h)
*
- * It has been AutoGen-ed October 21, 2015 at 12:35:59 PM by AutoGen 5.18.5
+ * It has been AutoGen-ed January 7, 2016 at 11:28:28 PM by AutoGen 5.18.5
* From the definitions ntpd-opts.def
* and the template file options
*
@@ -106,9 +106,9 @@ typedef enum {
/** count of all options for ntpd */
#define OPTION_CT 38
/** ntpd version */
-#define NTPD_VERSION "4.2.8p4"
+#define NTPD_VERSION "4.2.8p5"
/** Full ntpd version text */
-#define NTPD_FULL_VERSION "ntpd 4.2.8p4"
+#define NTPD_FULL_VERSION "ntpd 4.2.8p5"
/**
* Interface defines for all options. Replace "n" with the UPPER_CASED
diff --git a/contrib/ntp/ntpd/ntpd.1ntpdman b/contrib/ntp/ntpd/ntpd.1ntpdman
index 187a79a..42d0caf 100644
--- a/contrib/ntp/ntpd/ntpd.1ntpdman
+++ b/contrib/ntp/ntpd/ntpd.1ntpdman
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntpd 1ntpdman "21 Oct 2015" "4.2.8p4" "User Commands"
+.TH ntpd 1ntpdman "07 Jan 2016" "4.2.8p5" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-dUaOfK/ag-qUaGeK)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-KDaWJq/ag-WDaOIq)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:38:11 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:30:44 PM by AutoGen 5.18.5
.\" From the definitions ntpd-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/ntpd/ntpd.1ntpdmdoc b/contrib/ntp/ntpd/ntpd.1ntpdmdoc
index 139de52..dc06f58 100644
--- a/contrib/ntp/ntpd/ntpd.1ntpdmdoc
+++ b/contrib/ntp/ntpd/ntpd.1ntpdmdoc
@@ -1,9 +1,9 @@
-.Dd October 21 2015
+.Dd January 7 2016
.Dt NTPD 1ntpdmdoc User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntpd-opts.mdoc)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:38:30 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:31:02 PM by AutoGen 5.18.5
.\" From the definitions ntpd-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/ntpd/ntpd.c b/contrib/ntp/ntpd/ntpd.c
index a517391..7630aee 100644
--- a/contrib/ntp/ntpd/ntpd.c
+++ b/contrib/ntp/ntpd/ntpd.c
@@ -27,12 +27,16 @@
#include "ntp_libopts.h"
#include "ntpd-opts.h"
-/* there's a short treatise below what the thread stuff is for */
+/* there's a short treatise below what the thread stuff is for.
+ * [Bug 2954] enable the threading warm-up only for Linux.
+ */
#if defined(HAVE_PTHREADS) && HAVE_PTHREADS && !defined(NO_THREADS)
# ifdef HAVE_PTHREAD_H
# include <pthread.h>
# endif
-# define NEED_PTHREAD_WARMUP
+# if defined(linux)
+# define NEED_PTHREAD_WARMUP
+# endif
#endif
#ifdef HAVE_UNISTD_H
@@ -269,6 +273,9 @@ static void library_unexpected_error(const char *, int,
* This uses only the standard pthread API and should work with all
* implementations of pthreads. It is not necessary everywhere, but it's
* cheap enough to go on nearly unnoticed.
+ *
+ * Addendum: Bug 2954 showed that the assumption that this should work
+ * with all OS is wrong -- at least FreeBSD bombs heavily.
*/
#ifdef NEED_PTHREAD_WARMUP
@@ -646,6 +653,9 @@ ntpdmain(
# endif
# ifdef HAVE_WORKING_FORK
+ /* make sure the FDs are initialised */
+ pipe_fds[0] = -1;
+ pipe_fds[1] = -1;
do { /* 'loop' once */
if (!HAVE_OPT( WAIT_SYNC ))
break;
diff --git a/contrib/ntp/ntpd/ntpd.html b/contrib/ntp/ntpd/ntpd.html
index 8d6f9d6..ae3e17c 100644
--- a/contrib/ntp/ntpd/ntpd.html
+++ b/contrib/ntp/ntpd/ntpd.html
@@ -39,7 +39,7 @@ The program can operate in any of several modes, including client/server,
symmetric and broadcast modes, and with both symmetric-key and public-key
cryptography.
- <p>This document applies to version 4.2.8p4 of <code>ntpd</code>.
+ <p>This document applies to version 4.2.8p5 of <code>ntpd</code>.
<ul class="menu">
<li><a accesskey="1" href="#ntpd-Description">ntpd Description</a>: Description
@@ -220,7 +220,7 @@ the usage text by passing it through a pager program.
used to select the program, defaulting to <span class="file">more</span>. Both will exit
with a status code of 0.
-<pre class="example">ntpd - NTP daemon program - Ver. 4.2.8p4-sec-RC2
+<pre class="example">ntpd - NTP daemon program - Ver. 4.2.8p4
Usage: ntpd [ -&lt;flag&gt; [&lt;val&gt;] | --&lt;name&gt;[{=| }&lt;val&gt;] ]... \
[ &lt;server1&gt; ... &lt;serverN&gt; ]
Flg Arg Option-Name Description
diff --git a/contrib/ntp/ntpd/ntpd.man.in b/contrib/ntp/ntpd/ntpd.man.in
index 21bd884..222f0b3 100644
--- a/contrib/ntp/ntpd/ntpd.man.in
+++ b/contrib/ntp/ntpd/ntpd.man.in
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntpd @NTPD_MS@ "21 Oct 2015" "4.2.8p4" "User Commands"
+.TH ntpd @NTPD_MS@ "07 Jan 2016" "4.2.8p5" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-dUaOfK/ag-qUaGeK)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-KDaWJq/ag-WDaOIq)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:38:11 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:30:44 PM by AutoGen 5.18.5
.\" From the definitions ntpd-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/ntpd/ntpd.mdoc.in b/contrib/ntp/ntpd/ntpd.mdoc.in
index ad71af9..e5be1ee 100644
--- a/contrib/ntp/ntpd/ntpd.mdoc.in
+++ b/contrib/ntp/ntpd/ntpd.mdoc.in
@@ -1,9 +1,9 @@
-.Dd October 21 2015
+.Dd January 7 2016
.Dt NTPD @NTPD_MS@ User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntpd-opts.mdoc)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:38:30 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:31:02 PM by AutoGen 5.18.5
.\" From the definitions ntpd-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/ntpd/refclock_local.c b/contrib/ntp/ntpd/refclock_local.c
index d816c55..8c0f74f 100644
--- a/contrib/ntp/ntpd/refclock_local.c
+++ b/contrib/ntp/ntpd/refclock_local.c
@@ -205,6 +205,7 @@ local_poll(
pp->disp = 0;
pp->jitter = 0;
#else /* KERNEL_PLL LOCKCLOCK */
+ pp->leap = LEAP_NOWARNING;
pp->disp = DISPERSION;
pp->jitter = 0;
#endif /* KERNEL_PLL LOCKCLOCK */
diff --git a/contrib/ntp/ntpd/refclock_parse.c b/contrib/ntp/ntpd/refclock_parse.c
index 8e90595..eb69dcb 100644
--- a/contrib/ntp/ntpd/refclock_parse.c
+++ b/contrib/ntp/ntpd/refclock_parse.c
@@ -1630,9 +1630,9 @@ list_err(
static char *
mkreadable(
char *buffer,
- long blen,
+ size_t blen,
const char *src,
- u_long srclen,
+ size_t srclen,
int hex
)
{
diff --git a/contrib/ntp/ntpd/refclock_shm.c b/contrib/ntp/ntpd/refclock_shm.c
index 6ab5d02..f3e7f51 100644
--- a/contrib/ntp/ntpd/refclock_shm.c
+++ b/contrib/ntp/ntpd/refclock_shm.c
@@ -381,7 +381,8 @@ static inline void memory_barrier(void)
static enum segstat_t shm_query(volatile struct shmTime *shm_in, struct shm_stat_t *shm_stat)
/* try to grab a sample from the specified SHM segment */
{
- volatile struct shmTime shmcopy, *shm = shm_in;
+ struct shmTime shmcopy;
+ volatile struct shmTime *shm = shm_in;
volatile int cnt;
unsigned int cns_new, rns_new;
@@ -418,7 +419,7 @@ static enum segstat_t shm_query(volatile struct shmTime *shm_in, struct shm_stat
* (b) memset compiles to an uninterruptible single-instruction bitblt.
*/
memory_barrier();
- memcpy((void *)&shmcopy, (void *)shm, sizeof(struct shmTime));
+ memcpy(&shmcopy, (void*)(uintptr_t)shm, sizeof(struct shmTime));
shm->valid = 0;
memory_barrier();
diff --git a/contrib/ntp/ntpd/refclock_true.c b/contrib/ntp/ntpd/refclock_true.c
index 67ba6df..2799f3e 100644
--- a/contrib/ntp/ntpd/refclock_true.c
+++ b/contrib/ntp/ntpd/refclock_true.c
@@ -637,7 +637,7 @@ true_send(
pp = peer->procptr;
if (!(pp->sloppyclockflag & CLK_FLAG1)) {
- int len = strlen(cmd);
+ size_t len = strlen(cmd);
true_debug(peer, "Send '%s'\n", cmd);
if (write(pp->io.fd, cmd, (unsigned)len) != len)
diff --git a/contrib/ntp/ntpd/refclock_tsyncpci.c b/contrib/ntp/ntpd/refclock_tsyncpci.c
index e70a7cf..e14a3fd 100644
--- a/contrib/ntp/ntpd/refclock_tsyncpci.c
+++ b/contrib/ntp/ntpd/refclock_tsyncpci.c
@@ -549,7 +549,7 @@ static void tsync_poll(int unit, struct peer *peer)
memcpy(ppsRef, pRefObj->pps, TSYNC_REF_LEN);
// Extract the Clock Service Time Scale and convert to correct byte order
- memcpy(&tmscl, ((TIME_SCALE*)(it1->payloads)), sizeof(tmscl));
+ memcpy(&tmscl, it1->payloads, sizeof(tmscl));
tmscl = ntohl(tmscl);
// Extract leap second info from ioctl payload and perform byte swapping
diff --git a/contrib/ntp/ntpdate/ntpdate.c b/contrib/ntp/ntpdate/ntpdate.c
index 9831929..a427160 100644
--- a/contrib/ntp/ntpdate/ntpdate.c
+++ b/contrib/ntp/ntpdate/ntpdate.c
@@ -561,8 +561,8 @@ ntpdatemain (
nfound = poll(rdfdes, (unsigned int)nbsock, timeout.tv_sec * 1000);
#else
- nfound = select(maxfd, &rdfdes, (fd_set *)0,
- (fd_set *)0, &timeout);
+ nfound = select(maxfd, &rdfdes, NULL, NULL,
+ &timeout);
#endif
if (nfound > 0)
input_handler();
@@ -696,7 +696,7 @@ transmit(
* If not, just timestamp it and send it away.
*/
if (sys_authenticate) {
- int len;
+ size_t len;
xpkt.exten[0] = htonl(sys_authkey);
get_systime(&server->xmt);
@@ -808,11 +808,11 @@ receive(
printf("receive: rpkt keyid=%ld sys_authkey=%ld decrypt=%ld\n",
(long int)ntohl(rpkt->exten[0]), (long int)sys_authkey,
(long int)authdecrypt(sys_authkey, (u_int32 *)rpkt,
- LEN_PKT_NOMAC, (int)(rbufp->recv_length - LEN_PKT_NOMAC)));
+ LEN_PKT_NOMAC, (size_t)(rbufp->recv_length - LEN_PKT_NOMAC)));
if (has_mac && ntohl(rpkt->exten[0]) == sys_authkey &&
authdecrypt(sys_authkey, (u_int32 *)rpkt, LEN_PKT_NOMAC,
- (int)(rbufp->recv_length - LEN_PKT_NOMAC)))
+ (size_t)(rbufp->recv_length - LEN_PKT_NOMAC)))
is_authentic = 1;
if (debug)
printf("receive: authentication %s\n",
@@ -1888,7 +1888,7 @@ input_handler(void)
#else
fd_set fds;
#endif
- int fdc = 0;
+ SOCKET fdc = 0;
/*
* Do a poll to see if we have data
@@ -1912,7 +1912,7 @@ input_handler(void)
#else
fds = fdmask;
- n = select(maxfd, &fds, (fd_set *)0, (fd_set *)0, &tvzero);
+ n = select(maxfd, &fds, NULL, NULL, &tvzero);
/*
* Determine which socket received data
diff --git a/contrib/ntp/ntpdc/invoke-ntpdc.texi b/contrib/ntp/ntpdc/invoke-ntpdc.texi
index 0146069..f8283de 100644
--- a/contrib/ntp/ntpdc/invoke-ntpdc.texi
+++ b/contrib/ntp/ntpdc/invoke-ntpdc.texi
@@ -6,7 +6,7 @@
#
# EDIT THIS FILE WITH CAUTION (invoke-ntpdc.texi)
#
-# It has been AutoGen-ed October 21, 2015 at 12:38:54 PM by AutoGen 5.18.5
+# It has been AutoGen-ed January 7, 2016 at 11:31:26 PM by AutoGen 5.18.5
# From the definitions ntpdc-opts.def
# and the template file agtexi-cmd.tpl
@end ignore
@@ -76,7 +76,7 @@ with a status code of 0.
@exampleindent 0
@example
-ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p4
+ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p5
Usage: ntpdc [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]... [ host ...]
Flg Arg Option-Name Description
-4 no ipv4 Force IPv4 DNS name resolution
diff --git a/contrib/ntp/ntpdc/ntpdc-opts.c b/contrib/ntp/ntpdc/ntpdc-opts.c
index 6b4617a..da89ee2 100644
--- a/contrib/ntp/ntpdc/ntpdc-opts.c
+++ b/contrib/ntp/ntpdc/ntpdc-opts.c
@@ -1,7 +1,7 @@
/*
* EDIT THIS FILE WITH CAUTION (ntpdc-opts.c)
*
- * It has been AutoGen-ed October 21, 2015 at 12:38:40 PM by AutoGen 5.18.5
+ * It has been AutoGen-ed January 7, 2016 at 11:31:12 PM by AutoGen 5.18.5
* From the definitions ntpdc-opts.def
* and the template file options
*
@@ -69,7 +69,7 @@ extern FILE * option_usage_fp;
* static const strings for ntpdc options
*/
static char const ntpdc_opt_strs[1911] =
-/* 0 */ "ntpdc 4.2.8p4\n"
+/* 0 */ "ntpdc 4.2.8p5\n"
"Copyright (C) 1992-2015 The University of Delaware and Network Time Foundation, all rights reserved.\n"
"This is free software. It is licensed for use, modification and\n"
"redistribution under the terms of the NTP License, copies of which\n"
@@ -128,14 +128,14 @@ static char const ntpdc_opt_strs[1911] =
/* 1694 */ "no-load-opts\0"
/* 1707 */ "no\0"
/* 1710 */ "NTPDC\0"
-/* 1716 */ "ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p4\n"
+/* 1716 */ "ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p5\n"
"Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [ host ...]\n\0"
/* 1846 */ "$HOME\0"
/* 1852 */ ".\0"
/* 1854 */ ".ntprc\0"
/* 1861 */ "http://bugs.ntp.org, bugs@ntp.org\0"
/* 1895 */ "\n\0"
-/* 1897 */ "ntpdc 4.2.8p4";
+/* 1897 */ "ntpdc 4.2.8p5";
/**
* ipv4 option description with
@@ -796,7 +796,7 @@ static void bogus_function(void) {
translate option names.
*/
/* referenced via ntpdcOptions.pzCopyright */
- puts(_("ntpdc 4.2.8p4\n\
+ puts(_("ntpdc 4.2.8p5\n\
Copyright (C) 1992-2015 The University of Delaware and Network Time Foundation, all rights reserved.\n\
This is free software. It is licensed for use, modification and\n\
redistribution under the terms of the NTP License, copies of which\n\
@@ -862,14 +862,14 @@ implied warranty.\n"));
puts(_("load options from a config file"));
/* referenced via ntpdcOptions.pzUsageTitle */
- puts(_("ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p4\n\
+ puts(_("ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p5\n\
Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [ host ...]\n"));
/* referenced via ntpdcOptions.pzExplain */
puts(_("\n"));
/* referenced via ntpdcOptions.pzFullVersion */
- puts(_("ntpdc 4.2.8p4"));
+ puts(_("ntpdc 4.2.8p5"));
/* referenced via ntpdcOptions.pzFullUsage */
puts(_("<<<NOT-FOUND>>>"));
diff --git a/contrib/ntp/ntpdc/ntpdc-opts.h b/contrib/ntp/ntpdc/ntpdc-opts.h
index d2494fe..d3326a7 100644
--- a/contrib/ntp/ntpdc/ntpdc-opts.h
+++ b/contrib/ntp/ntpdc/ntpdc-opts.h
@@ -1,7 +1,7 @@
/*
* EDIT THIS FILE WITH CAUTION (ntpdc-opts.h)
*
- * It has been AutoGen-ed October 21, 2015 at 12:38:39 PM by AutoGen 5.18.5
+ * It has been AutoGen-ed January 7, 2016 at 11:31:11 PM by AutoGen 5.18.5
* From the definitions ntpdc-opts.def
* and the template file options
*
@@ -83,9 +83,9 @@ typedef enum {
/** count of all options for ntpdc */
#define OPTION_CT 15
/** ntpdc version */
-#define NTPDC_VERSION "4.2.8p4"
+#define NTPDC_VERSION "4.2.8p5"
/** Full ntpdc version text */
-#define NTPDC_FULL_VERSION "ntpdc 4.2.8p4"
+#define NTPDC_FULL_VERSION "ntpdc 4.2.8p5"
/**
* Interface defines for all options. Replace "n" with the UPPER_CASED
diff --git a/contrib/ntp/ntpdc/ntpdc.1ntpdcman b/contrib/ntp/ntpdc/ntpdc.1ntpdcman
index 71fd545..3e78896 100644
--- a/contrib/ntp/ntpdc/ntpdc.1ntpdcman
+++ b/contrib/ntp/ntpdc/ntpdc.1ntpdcman
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntpdc 1ntpdcman "21 Oct 2015" "4.2.8p4" "User Commands"
+.TH ntpdc 1ntpdcman "07 Jan 2016" "4.2.8p5" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-Gvay7L/ag-Svaq6L)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-EXaGzs/ag-QXayys)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:38:51 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:31:22 PM by AutoGen 5.18.5
.\" From the definitions ntpdc-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/ntpdc/ntpdc.1ntpdcmdoc b/contrib/ntp/ntpdc/ntpdc.1ntpdcmdoc
index ff7656c..df53d89 100644
--- a/contrib/ntp/ntpdc/ntpdc.1ntpdcmdoc
+++ b/contrib/ntp/ntpdc/ntpdc.1ntpdcmdoc
@@ -1,9 +1,9 @@
-.Dd October 21 2015
+.Dd January 7 2016
.Dt NTPDC 1ntpdcmdoc User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntpdc-opts.mdoc)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:38:57 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:31:29 PM by AutoGen 5.18.5
.\" From the definitions ntpdc-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/ntpdc/ntpdc.c b/contrib/ntp/ntpdc/ntpdc.c
index ab17788..bef9ca3 100644
--- a/contrib/ntp/ntpdc/ntpdc.c
+++ b/contrib/ntp/ntpdc/ntpdc.c
@@ -32,6 +32,7 @@
#include "ntp_libopts.h"
#include "ntpdc-opts.h"
+#include "safecast.h"
#ifdef SYS_VXWORKS
/* vxWorks needs mode flag -casey*/
@@ -74,8 +75,8 @@ int ntpdcmain (int, char **);
static int openhost (const char *);
static int sendpkt (void *, size_t);
static void growpktdata (void);
-static int getresponse (int, int, int *, int *, char **, int);
-static int sendrequest (int, int, int, u_int, size_t, char *);
+static int getresponse (int, int, size_t *, size_t *, const char **, size_t);
+static int sendrequest (int, int, int, size_t, size_t, const char *);
static void getcmds (void);
static RETSIGTYPE abortcmd (int);
static void docmd (const char *);
@@ -526,10 +527,11 @@ openhost(
#ifdef SYS_VXWORKS
if (connect(sockfd, (struct sockaddr *)&hostaddr,
- sizeof(hostaddr)) == -1) {
+ sizeof(hostaddr)) == -1)
#else
- if (connect(sockfd, ai->ai_addr, ai->ai_addrlen) == -1) {
+ if (connect(sockfd, ai->ai_addr, ai->ai_addrlen) == -1)
#endif /* SYS_VXWORKS */
+ {
error("connect");
exit(-1);
}
@@ -582,18 +584,18 @@ static int
getresponse(
int implcode,
int reqcode,
- int *ritems,
- int *rsize,
- char **rdata,
- int esize
+ size_t *ritems,
+ size_t *rsize,
+ const char **rdata,
+ size_t esize
)
{
struct resp_pkt rpkt;
struct sock_timeval tvo;
- int items;
- int i;
- int size;
- int datasize;
+ size_t items;
+ size_t i;
+ size_t size;
+ size_t datasize;
char *datap;
char *tmp_data;
char haveseq[MAXSEQ+1];
@@ -603,7 +605,7 @@ getresponse(
int seq;
fd_set fds;
ssize_t n;
- int pad;
+ size_t pad;
/*
* This is pretty tricky. We may get between 1 and many packets
@@ -628,8 +630,7 @@ getresponse(
tvo = tvsout;
FD_SET(sockfd, &fds);
- n = select(sockfd+1, &fds, (fd_set *)0, (fd_set *)0, &tvo);
-
+ n = select(sockfd+1, &fds, NULL, NULL, &tvo);
if (n == -1) {
warning("select fails");
return -1;
@@ -640,7 +641,8 @@ getresponse(
*/
if (firstpkt) {
(void) fprintf(stderr,
- "%s: timed out, nothing received\n", currenthost);
+ "%s: timed out, nothing received\n",
+ currenthost);
return ERR_TIMEOUT;
} else {
(void) fprintf(stderr,
@@ -740,7 +742,7 @@ getresponse(
if ((size_t)datasize > (n-RESP_HEADER_SIZE)) {
if (debug)
printf(
- "Received items %d, size %d (total %d), data in packet is %zu\n",
+ "Received items %zu, size %zu (total %zu), data in packet is %zu\n",
items, size, datasize, n-RESP_HEADER_SIZE);
goto again;
}
@@ -751,7 +753,7 @@ getresponse(
*/
if (!firstpkt && size != *rsize) {
if (debug)
- printf("Received itemsize %d, previous %d\n",
+ printf("Received itemsize %zu, previous %zu\n",
size, *rsize);
goto again;
}
@@ -781,7 +783,7 @@ getresponse(
* So far, so good. Copy this data into the output array.
*/
if ((datap + datasize + (pad * items)) > (pktdata + pktdatasize)) {
- int offset = datap - pktdata;
+ size_t offset = datap - pktdata;
growpktdata();
*rdata = pktdata; /* might have been realloced ! */
datap = pktdata + offset;
@@ -844,9 +846,9 @@ sendrequest(
int implcode,
int reqcode,
int auth,
- u_int qitems,
+ size_t qitems,
size_t qsize,
- char *qdata
+ const char *qdata
)
{
struct req_pkt qpkt;
@@ -855,7 +857,7 @@ sendrequest(
u_long key_id;
l_fp ts;
l_fp * ptstamp;
- int maclen;
+ size_t maclen;
char * pass;
ZERO(qpkt);
@@ -918,13 +920,14 @@ sendrequest(
get_systime(&ts);
L_ADD(&ts, &delay_time);
HTONL_FP(&ts, ptstamp);
- maclen = authencrypt(info_auth_keyid, (void *)&qpkt, reqsize);
+ maclen = authencrypt(
+ info_auth_keyid, (void *)&qpkt, size2int_chk(reqsize));
if (!maclen) {
fprintf(stderr, "Key not found\n");
return 1;
} else if (maclen != (int)(info_auth_hashlen + sizeof(keyid_t))) {
fprintf(stderr,
- "%d octet MAC, %zu expected with %zu octet digest\n",
+ "%zu octet MAC, %zu expected with %zu octet digest\n",
maclen, (info_auth_hashlen + sizeof(keyid_t)),
info_auth_hashlen);
return 1;
@@ -941,12 +944,12 @@ doquery(
int implcode,
int reqcode,
int auth,
- int qitems,
- int qsize,
- char *qdata,
- int *ritems,
- int *rsize,
- char **rdata,
+ size_t qitems,
+ size_t qsize,
+ const char *qdata,
+ size_t *ritems,
+ size_t *rsize,
+ const char **rdata,
int quiet_mask,
int esize
)
@@ -972,8 +975,7 @@ again:
tvzero.tv_sec = tvzero.tv_usec = 0;
FD_ZERO(&fds);
FD_SET(sockfd, &fds);
- res = select(sockfd+1, &fds, (fd_set *)0, (fd_set *)0, &tvzero);
-
+ res = select(sockfd+1, &fds, NULL, NULL, &tvzero);
if (res == -1) {
warning("polling select");
return -1;
@@ -1271,7 +1273,7 @@ findcmd(
)
{
register struct xcmd *cl;
- register int clen;
+ size_t clen;
int nmatch;
struct xcmd *nearmatch = NULL;
struct xcmd *clist;
@@ -1384,7 +1386,7 @@ getarg(
return 0;
}
argp->uval *= 10;
- argp->uval += (cp - digits);
+ argp->uval += (u_long)(cp - digits);
} while (*(++np) != '\0');
if (isneg) {
diff --git a/contrib/ntp/ntpdc/ntpdc.h b/contrib/ntp/ntpdc/ntpdc.h
index 6da4a5c..4dfd1eb 100644
--- a/contrib/ntp/ntpdc/ntpdc.h
+++ b/contrib/ntp/ntpdc/ntpdc.h
@@ -63,5 +63,5 @@ extern int impl_ver;
extern int showhostnames;
extern int s_port;
-extern int doquery (int, int, int, int, int, char *, int *, int *, char **, int, int);
+extern int doquery (int, int, int, size_t, size_t, const char *, size_t *, size_t *, const char **, int, int);
extern const char * nntohost (sockaddr_u *);
diff --git a/contrib/ntp/ntpdc/ntpdc.html b/contrib/ntp/ntpdc/ntpdc.html
index cc552ca..107af9b 100644
--- a/contrib/ntp/ntpdc/ntpdc.html
+++ b/contrib/ntp/ntpdc/ntpdc.html
@@ -36,7 +36,7 @@ display the time offset of the system clock relative to the server
clock. Run as root, it can correct the system clock to this offset as
well. It can be run as an interactive command or from a cron job.
- <p>This document applies to version 4.2.8p4 of <code>ntpdc</code>.
+ <p>This document applies to version 4.2.8p5 of <code>ntpdc</code>.
<p>The program implements the SNTP protocol as defined by RFC 5905, the NTPv4
IETF specification.
@@ -152,7 +152,7 @@ the usage text by passing it through a pager program.
used to select the program, defaulting to <span class="file">more</span>. Both will exit
with a status code of 0.
-<pre class="example">ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p4
+<pre class="example">ntpdc - vendor-specific NTPD control program - Ver. 4.2.8p5
Usage: ntpdc [ -&lt;flag&gt; [&lt;val&gt;] | --&lt;name&gt;[{=| }&lt;val&gt;] ]... [ host ...]
Flg Arg Option-Name Description
-4 no ipv4 Force IPv4 DNS name resolution
diff --git a/contrib/ntp/ntpdc/ntpdc.man.in b/contrib/ntp/ntpdc/ntpdc.man.in
index f5df744..6662438 100644
--- a/contrib/ntp/ntpdc/ntpdc.man.in
+++ b/contrib/ntp/ntpdc/ntpdc.man.in
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntpdc @NTPDC_MS@ "21 Oct 2015" "4.2.8p4" "User Commands"
+.TH ntpdc @NTPDC_MS@ "07 Jan 2016" "4.2.8p5" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-Gvay7L/ag-Svaq6L)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-EXaGzs/ag-QXayys)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:38:51 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:31:22 PM by AutoGen 5.18.5
.\" From the definitions ntpdc-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/ntpdc/ntpdc.mdoc.in b/contrib/ntp/ntpdc/ntpdc.mdoc.in
index 5a6e292..2e2fd31 100644
--- a/contrib/ntp/ntpdc/ntpdc.mdoc.in
+++ b/contrib/ntp/ntpdc/ntpdc.mdoc.in
@@ -1,9 +1,9 @@
-.Dd October 21 2015
+.Dd January 7 2016
.Dt NTPDC @NTPDC_MS@ User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntpdc-opts.mdoc)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:38:57 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:31:29 PM by AutoGen 5.18.5
.\" From the definitions ntpdc-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/ntpdc/ntpdc_ops.c b/contrib/ntp/ntpdc/ntpdc_ops.c
index be8ffa2..2f57768 100644
--- a/contrib/ntp/ntpdc/ntpdc_ops.c
+++ b/contrib/ntp/ntpdc/ntpdc_ops.c
@@ -31,9 +31,9 @@
/*
* utility functions
*/
-static int checkitems (int, FILE *);
-static int checkitemsize (int, int);
-static int check1item (int, FILE *);
+static int checkitems (size_t, FILE *);
+static int checkitemsize (size_t, size_t);
+static int check1item (size_t, FILE *);
/*
* Declarations for command handlers in here
@@ -288,7 +288,7 @@ do { \
*/
static int
checkitems(
- int items,
+ size_t items,
FILE *fp
)
{
@@ -305,14 +305,14 @@ checkitems(
*/
static int
checkitemsize(
- int itemsize,
- int expected
+ size_t itemsize,
+ size_t expected
)
{
if (itemsize != expected) {
(void) fprintf(stderr,
- "***Incorrect item size returned by remote host (%d should be %d)\n",
- itemsize, expected);
+ "***Incorrect item size returned by remote host (%lu should be %lu)\n",
+ (u_long)itemsize, (u_long)expected);
return 0;
}
return 1;
@@ -324,7 +324,7 @@ checkitemsize(
*/
static int
check1item(
- int items,
+ size_t items,
FILE *fp
)
{
@@ -333,8 +333,8 @@ check1item(
return 0;
}
if (items > 1) {
- (void) fprintf(fp, "Expected one item in response, got %d\n",
- items);
+ (void) fprintf(fp, "Expected one item in response, got %lu\n",
+ (u_long)items);
return 0;
}
return 1;
@@ -353,8 +353,8 @@ peerlist(
{
struct info_peer_list *plist;
sockaddr_u paddr;
- int items;
- int itemsize;
+ size_t items;
+ size_t itemsize;
int res;
again:
@@ -430,8 +430,8 @@ dopeers(
struct info_peer_summary *plist;
sockaddr_u dstadr;
sockaddr_u srcadr;
- int items;
- int itemsize;
+ size_t items;
+ size_t itemsize;
int ntp_poll;
int res;
int c;
@@ -679,10 +679,10 @@ showpeer(
struct info_peer *pp;
/* 4 is the maximum number of peers which will fit in a packet */
struct info_peer_list *pl, plist[min(MAXARGS, 4)];
- int qitemlim;
- int qitems;
- int items;
- int itemsize;
+ size_t qitemlim;
+ size_t qitems;
+ size_t items;
+ size_t itemsize;
int res;
int sendsize;
@@ -753,12 +753,12 @@ peerstats(
/* 4 is the maximum number of peers which will fit in a packet */
struct info_peer_list *pl, plist[min(MAXARGS, 4)];
sockaddr_u src, dst;
- int qitemlim;
- int qitems;
- int items;
- int itemsize;
+ size_t qitemlim;
+ size_t qitems;
+ size_t items;
+ size_t itemsize;
int res;
- int sendsize;
+ size_t sendsize;
again:
if (impl_ver == IMPL_XNTPD)
@@ -871,8 +871,8 @@ loopinfo(
)
{
struct info_loop *il;
- int items;
- int itemsize;
+ size_t items;
+ size_t itemsize;
int oneline = 0;
int res;
l_fp tempts;
@@ -946,8 +946,8 @@ sysinfo(
{
struct info_sys *is;
sockaddr_u peeraddr;
- int items;
- int itemsize;
+ size_t items;
+ size_t itemsize;
int res;
l_fp tempts;
@@ -1035,8 +1035,8 @@ sysstats(
)
{
struct info_sys_stats *ss;
- int items;
- int itemsize;
+ size_t items;
+ size_t itemsize;
int res;
again:
@@ -1101,8 +1101,8 @@ iostats(
)
{
struct info_io_stats *io;
- int items;
- int itemsize;
+ size_t items;
+ size_t itemsize;
int res;
again:
@@ -1162,8 +1162,8 @@ memstats(
{
struct info_mem_stats *mem;
int i;
- int items;
- int itemsize;
+ size_t items;
+ size_t itemsize;
int res;
again:
@@ -1219,8 +1219,8 @@ timerstats(
)
{
struct info_timer_stats *tim;
- int items;
- int itemsize;
+ size_t items;
+ size_t itemsize;
int res;
again:
@@ -1314,9 +1314,9 @@ doconfig(
)
{
struct conf_peer cpeer;
- int items;
- int itemsize;
- char *dummy;
+ size_t items;
+ size_t itemsize;
+ const char *dummy;
u_long keyid;
u_int version;
u_char minpoll;
@@ -1480,13 +1480,13 @@ unconfig(
{
/* 8 is the maximum number of peers which will fit in a packet */
struct conf_unpeer *pl, plist[min(MAXARGS, 8)];
- int qitemlim;
- int qitems;
- int items;
- int itemsize;
- char *dummy;
+ size_t qitemlim;
+ size_t qitems;
+ size_t items;
+ size_t itemsize;
+ const char *dummy;
int res;
- int sendsize;
+ size_t sendsize;
again:
if (impl_ver == IMPL_XNTPD)
@@ -1564,9 +1564,9 @@ doset(
)
{
struct conf_sys_flags sys;
- int items;
- int itemsize;
- char *dummy;
+ size_t items;
+ size_t itemsize;
+ const char *dummy;
int res;
sys.flags = 0;
@@ -1675,8 +1675,8 @@ reslist(
struct info_restrict *rl;
sockaddr_u resaddr;
sockaddr_u maskaddr;
- int items;
- int itemsize;
+ size_t items;
+ size_t itemsize;
int res;
int skip;
const char *addr;
@@ -1827,9 +1827,9 @@ do_restrict(
)
{
struct conf_restrict cres;
- int items;
- int itemsize;
- char *dummy;
+ size_t items;
+ size_t itemsize;
+ const char *dummy;
u_int32 num;
u_long bit;
int i;
@@ -1946,14 +1946,14 @@ monlist(
FILE *fp
)
{
- char *struct_star;
- struct info_monitor *ml;
- struct info_monitor_1 *m1;
- struct old_info_monitor *oml;
+ const char *struct_star;
+ const struct info_monitor *ml;
+ const struct info_monitor_1 *m1;
+ const struct old_info_monitor *oml;
sockaddr_u addr;
sockaddr_u dstadr;
- int items;
- int itemsize;
+ size_t items;
+ size_t itemsize;
int res;
int version = -1;
@@ -1987,7 +1987,7 @@ again:
if (itemsize == sizeof(struct info_monitor_1) ||
itemsize == v4sizeof(struct info_monitor_1)) {
- m1 = (void *)struct_star;
+ m1 = (const void*)struct_star;
fprintf(fp,
"remote address port local address count m ver rstr avgint lstint\n");
fprintf(fp,
@@ -2014,7 +2014,7 @@ again:
} else if (itemsize == sizeof(struct info_monitor) ||
itemsize == v4sizeof(struct info_monitor)) {
- ml = (void *) struct_star;
+ ml = (const void *)struct_star;
fprintf(fp,
" address port count mode ver rstr avgint lstint\n");
fprintf(fp,
@@ -2039,7 +2039,7 @@ again:
}
} else if (itemsize == sizeof(struct old_info_monitor)) {
- oml = (void *)struct_star;
+ oml = (const void *)struct_star;
fprintf(fp,
" address port count mode version lasttime firsttime\n");
fprintf(fp,
@@ -2091,9 +2091,9 @@ reset(
)
{
struct reset_flags rflags;
- int items;
- int itemsize;
- char *dummy;
+ size_t items;
+ size_t itemsize;
+ const char *dummy;
int i;
size_t res;
int err;
@@ -2148,13 +2148,13 @@ preset(
{
/* 8 is the maximum number of peers which will fit in a packet */
struct conf_unpeer *pl, plist[min(MAXARGS, 8)];
- int qitemlim;
- int qitems;
- int items;
- int itemsize;
- char *dummy;
+ size_t qitemlim;
+ size_t qitems;
+ size_t items;
+ size_t itemsize;
+ const char *dummy;
int res;
- int sendsize;
+ size_t sendsize;
again:
if (impl_ver == IMPL_XNTPD)
@@ -2205,9 +2205,9 @@ readkeys(
FILE *fp
)
{
- int items;
- int itemsize;
- char *dummy;
+ size_t items;
+ size_t itemsize;
+ const char *dummy;
int res;
again:
@@ -2263,9 +2263,9 @@ do_trustkey(
{
u_long keyids[MAXARGS];
size_t i;
- int items;
- int itemsize;
- char *dummy;
+ size_t items;
+ size_t itemsize;
+ const char *dummy;
int ritems;
int res;
@@ -2302,8 +2302,8 @@ authinfo(
)
{
struct info_auth *ia;
- int items;
- int itemsize;
+ size_t items;
+ size_t itemsize;
int res;
again:
@@ -2356,11 +2356,11 @@ traps(
FILE *fp
)
{
- int i;
+ size_t i;
struct info_trap *it;
sockaddr_u trap_addr, local_addr;
- int items;
- int itemsize;
+ size_t items;
+ size_t itemsize;
int res;
again:
@@ -2446,9 +2446,9 @@ do_addclr_trap(
)
{
struct conf_trap ctrap;
- int items;
- int itemsize;
- char *dummy;
+ size_t items;
+ size_t itemsize;
+ const char *dummy;
int res;
int sendsize;
@@ -2545,9 +2545,9 @@ do_changekey(
)
{
u_long key;
- int items;
- int itemsize;
- char *dummy;
+ size_t items;
+ size_t itemsize;
+ const char *dummy;
int res;
@@ -2581,8 +2581,8 @@ ctlstats(
)
{
struct info_control *ic;
- int items;
- int itemsize;
+ size_t items;
+ size_t itemsize;
int res;
again:
@@ -2648,10 +2648,10 @@ clockstat(
struct info_clock *cl;
/* 8 is the maximum number of clocks which will fit in a packet */
u_long clist[min(MAXARGS, 8)];
- int qitemlim;
- int qitems;
- int items;
- int itemsize;
+ size_t qitemlim;
+ size_t qitems;
+ size_t items;
+ size_t itemsize;
int res;
l_fp ts;
struct clktype *clk;
@@ -2735,9 +2735,9 @@ fudge(
)
{
struct conf_fudge fudgedata;
- int items;
- int itemsize;
- char *dummy;
+ size_t items;
+ size_t itemsize;
+ const char *dummy;
l_fp ts;
int res;
long val;
@@ -2822,10 +2822,10 @@ clkbug(
/* 8 is the maximum number of clocks which will fit in a packet */
u_long clist[min(MAXARGS, 8)];
u_int32 ltemp;
- int qitemlim;
- int qitems;
- int items;
- int itemsize;
+ size_t qitemlim;
+ size_t qitems;
+ size_t items;
+ size_t itemsize;
int res;
int needsp;
l_fp ts;
@@ -2916,8 +2916,8 @@ kerninfo(
)
{
struct info_kernel *ik;
- int items;
- int itemsize;
+ size_t items;
+ size_t itemsize;
int res;
unsigned status;
double tscale = 1e-6;
@@ -3050,8 +3050,8 @@ static void
iflist(
FILE *fp,
struct info_if_stats *ifs,
- int items,
- int itemsize,
+ size_t items,
+ size_t itemsize,
int res
)
{
@@ -3113,8 +3113,8 @@ get_if_stats(
)
{
struct info_if_stats *ifs;
- int items;
- int itemsize;
+ size_t items;
+ size_t itemsize;
int res;
res = doquery(impl_ver, REQ_IF_STATS, 1, 0, 0, (char *)NULL, &items,
@@ -3131,8 +3131,8 @@ do_if_reload(
)
{
struct info_if_stats *ifs;
- int items;
- int itemsize;
+ size_t items;
+ size_t itemsize;
int res;
res = doquery(impl_ver, REQ_IF_RELOAD, 1, 0, 0, (char *)NULL, &items,
diff --git a/contrib/ntp/ntpq/invoke-ntpq.texi b/contrib/ntp/ntpq/invoke-ntpq.texi
index fa0f5d7..b01127c 100644
--- a/contrib/ntp/ntpq/invoke-ntpq.texi
+++ b/contrib/ntp/ntpq/invoke-ntpq.texi
@@ -6,7 +6,7 @@
#
# EDIT THIS FILE WITH CAUTION (invoke-ntpq.texi)
#
-# It has been AutoGen-ed October 21, 2015 at 12:39:27 PM by AutoGen 5.18.5
+# It has been AutoGen-ed January 7, 2016 at 11:32:00 PM by AutoGen 5.18.5
# From the definitions ntpq-opts.def
# and the template file agtexi-cmd.tpl
@end ignore
@@ -847,7 +847,7 @@ with a status code of 0.
@exampleindent 0
@example
-ntpq - standard NTP query program - Ver. 4.2.8p4
+ntpq - standard NTP query program - Ver. 4.2.8p5
Usage: ntpq [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]... [ host ...]
Flg Arg Option-Name Description
-4 no ipv4 Force IPv4 DNS name resolution
diff --git a/contrib/ntp/ntpq/libntpq.c b/contrib/ntp/ntpq/libntpq.c
index becd956..3070e47 100644
--- a/contrib/ntp/ntpq/libntpq.c
+++ b/contrib/ntp/ntpq/libntpq.c
@@ -132,7 +132,7 @@ ntpq_getvar(
{
char * name;
char * value;
- int idatalen;
+ size_t idatalen;
value = NULL;
idatalen = (int)datalen;
@@ -181,8 +181,8 @@ int ntpq_queryhost(unsigned short VARSET, unsigned short association, char *resu
{
const char *datap;
int res;
- int dsize;
- u_short rstatus;
+ size_t dsize;
+ u_short rstatus;
if ( numhosts > 0 )
res = doquery(VARSET,association,0,0, (char *)0, &rstatus, &dsize, &datap);
@@ -417,7 +417,7 @@ ntpq_read_assoc_peervars(
{
const char * datap;
int res;
- int dsize;
+ size_t dsize;
u_short rstatus;
res = doquery(CTL_OP_READVAR, associd, 0, 0, NULL, &rstatus,
@@ -474,24 +474,22 @@ ntpq_read_sysvars(
{
const char * datap;
int res;
- int i_dsize;
size_t dsize;
u_short rstatus;
res = doquery(CTL_OP_READVAR, 0, 0, 0, NULL, &rstatus,
- &i_dsize, &datap);
+ &dsize, &datap);
if (res != 0)
return 0;
- if (i_dsize == 0) {
+ if (dsize == 0) {
if (numhosts > 1)
fprintf(stderr, "server=%s ", currenthost);
fprintf(stderr, "***No sysvar information returned\n");
return 0;
} else {
- dsize = max(0, i_dsize);
dsize = min(dsize, maxsize);
memcpy(resultbuf, datap, dsize);
}
@@ -661,7 +659,7 @@ ntpq_read_assoc_clockvars(
{
const char *datap;
int res;
- int dsize;
+ size_t dsize;
u_short rstatus;
res = ntpq_doquerylist(ntpq_varlist, CTL_OP_READCLOCK, associd,
diff --git a/contrib/ntp/ntpq/libntpq.h b/contrib/ntp/ntpq/libntpq.h
index 84a622b..74caf27 100644
--- a/contrib/ntp/ntpq/libntpq.h
+++ b/contrib/ntp/ntpq/libntpq.h
@@ -106,4 +106,4 @@ extern int ntpq_read_assoc_clockvars( associd_t associd, char *resultbuf, int ma
extern int ntpq_dogetassoc(void);
extern char ntpq_decodeaddrtype(sockaddr_u *sock);
extern int ntpq_doquerylist(struct ntpq_varlist *, int, associd_t, int,
- u_short *, int *, const char **datap);
+ u_short *, size_t *, const char **datap);
diff --git a/contrib/ntp/ntpq/libntpq_subs.c b/contrib/ntp/ntpq/libntpq_subs.c
index e53b419..b232065 100644
--- a/contrib/ntp/ntpq/libntpq_subs.c
+++ b/contrib/ntp/ntpq/libntpq_subs.c
@@ -42,7 +42,7 @@ ntpq_doquerylist(
associd_t associd,
int auth,
u_short *rstatus,
- int *dsize,
+ size_t *dsize,
const char **datap
)
{
diff --git a/contrib/ntp/ntpq/ntpq-opts.c b/contrib/ntp/ntpq/ntpq-opts.c
index 2232928..69f4881 100644
--- a/contrib/ntp/ntpq/ntpq-opts.c
+++ b/contrib/ntp/ntpq/ntpq-opts.c
@@ -1,7 +1,7 @@
/*
* EDIT THIS FILE WITH CAUTION (ntpq-opts.c)
*
- * It has been AutoGen-ed October 21, 2015 at 12:39:00 PM by AutoGen 5.18.5
+ * It has been AutoGen-ed January 7, 2016 at 11:31:32 PM by AutoGen 5.18.5
* From the definitions ntpq-opts.def
* and the template file options
*
@@ -69,7 +69,7 @@ extern FILE * option_usage_fp;
* static const strings for ntpq options
*/
static char const ntpq_opt_strs[1925] =
-/* 0 */ "ntpq 4.2.8p4\n"
+/* 0 */ "ntpq 4.2.8p5\n"
"Copyright (C) 1992-2015 The University of Delaware and Network Time Foundation, all rights reserved.\n"
"This is free software. It is licensed for use, modification and\n"
"redistribution under the terms of the NTP License, copies of which\n"
@@ -129,13 +129,13 @@ static char const ntpq_opt_strs[1925] =
/* 1723 */ "no-load-opts\0"
/* 1736 */ "no\0"
/* 1739 */ "NTPQ\0"
-/* 1744 */ "ntpq - standard NTP query program - Ver. 4.2.8p4\n"
+/* 1744 */ "ntpq - standard NTP query program - Ver. 4.2.8p5\n"
"Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [ host ...]\n\0"
/* 1863 */ "$HOME\0"
/* 1869 */ ".\0"
/* 1871 */ ".ntprc\0"
/* 1878 */ "http://bugs.ntp.org, bugs@ntp.org\0"
-/* 1912 */ "ntpq 4.2.8p4";
+/* 1912 */ "ntpq 4.2.8p5";
/**
* ipv4 option description with
@@ -786,7 +786,7 @@ static void bogus_function(void) {
translate option names.
*/
/* referenced via ntpqOptions.pzCopyright */
- puts(_("ntpq 4.2.8p4\n\
+ puts(_("ntpq 4.2.8p5\n\
Copyright (C) 1992-2015 The University of Delaware and Network Time Foundation, all rights reserved.\n\
This is free software. It is licensed for use, modification and\n\
redistribution under the terms of the NTP License, copies of which\n\
@@ -852,11 +852,11 @@ implied warranty.\n"));
puts(_("load options from a config file"));
/* referenced via ntpqOptions.pzUsageTitle */
- puts(_("ntpq - standard NTP query program - Ver. 4.2.8p4\n\
+ puts(_("ntpq - standard NTP query program - Ver. 4.2.8p5\n\
Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [ host ...]\n"));
/* referenced via ntpqOptions.pzFullVersion */
- puts(_("ntpq 4.2.8p4"));
+ puts(_("ntpq 4.2.8p5"));
/* referenced via ntpqOptions.pzFullUsage */
puts(_("<<<NOT-FOUND>>>"));
diff --git a/contrib/ntp/ntpq/ntpq-opts.h b/contrib/ntp/ntpq/ntpq-opts.h
index f82ccae..758817f 100644
--- a/contrib/ntp/ntpq/ntpq-opts.h
+++ b/contrib/ntp/ntpq/ntpq-opts.h
@@ -1,7 +1,7 @@
/*
* EDIT THIS FILE WITH CAUTION (ntpq-opts.h)
*
- * It has been AutoGen-ed October 21, 2015 at 12:39:00 PM by AutoGen 5.18.5
+ * It has been AutoGen-ed January 7, 2016 at 11:31:32 PM by AutoGen 5.18.5
* From the definitions ntpq-opts.def
* and the template file options
*
@@ -83,9 +83,9 @@ typedef enum {
/** count of all options for ntpq */
#define OPTION_CT 15
/** ntpq version */
-#define NTPQ_VERSION "4.2.8p4"
+#define NTPQ_VERSION "4.2.8p5"
/** Full ntpq version text */
-#define NTPQ_FULL_VERSION "ntpq 4.2.8p4"
+#define NTPQ_FULL_VERSION "ntpq 4.2.8p5"
/**
* Interface defines for all options. Replace "n" with the UPPER_CASED
diff --git a/contrib/ntp/ntpq/ntpq-subs.c b/contrib/ntp/ntpq/ntpq-subs.c
index 78143b3..438c7ca 100644
--- a/contrib/ntp/ntpq/ntpq-subs.c
+++ b/contrib/ntp/ntpq/ntpq-subs.c
@@ -22,9 +22,9 @@ static struct varlist *findlistvar (struct varlist *, char *);
static void doaddvlist (struct varlist *, const char *);
static void dormvlist (struct varlist *, const char *);
static void doclearvlist (struct varlist *);
-static void makequerydata (struct varlist *, int *, char *);
+static void makequerydata (struct varlist *, size_t *, char *);
static int doquerylist (struct varlist *, int, associd_t, int,
- u_short *, int *, const char **);
+ u_short *, size_t *, const char **);
static void doprintvlist (struct varlist *, FILE *);
static void addvars (struct parse *, FILE *);
static void rmvars (struct parse *, FILE *);
@@ -56,7 +56,7 @@ static void authinfo (struct parse *, FILE *);
static void pstats (struct parse *, FILE *);
static long when (l_fp *, l_fp *, l_fp *);
static char * prettyinterval (char *, size_t, long);
-static int doprintpeers (struct varlist *, int, int, int, const char *, FILE *, int);
+static int doprintpeers (struct varlist *, int, int, size_t, const char *, FILE *, int);
static int dogetpeers (struct varlist *, associd_t, FILE *, int);
static void dopeers (int, FILE *, int);
static void peers (struct parse *, FILE *);
@@ -343,7 +343,7 @@ typedef struct var_display_collection_tag {
/*
* other local function prototypes
*/
-void mrulist_ctrl_c_hook(void);
+static int mrulist_ctrl_c_hook(void);
static mru * add_mru(mru *);
static int collect_mru_list(const char *, l_fp *);
static int fetch_nonce(char *, size_t);
@@ -440,7 +440,7 @@ doaddvlist(
)
{
struct varlist *vl;
- int len;
+ size_t len;
char *name;
char *value;
@@ -475,7 +475,7 @@ dormvlist(
)
{
struct varlist *vl;
- int len;
+ size_t len;
char *name;
char *value;
@@ -527,14 +527,14 @@ doclearvlist(
static void
makequerydata(
struct varlist *vlist,
- int *datalen,
+ size_t *datalen,
char *data
)
{
register struct varlist *vl;
register char *cp, *cpend;
- register int namelen, valuelen;
- register int totallen;
+ register size_t namelen, valuelen;
+ register size_t totallen;
cp = data;
cpend = data + *datalen;
@@ -563,7 +563,7 @@ makequerydata(
cp += valuelen;
}
}
- *datalen = cp - data;
+ *datalen = (size_t)(cp - data);
}
@@ -577,12 +577,12 @@ doquerylist(
associd_t associd,
int auth,
u_short *rstatus,
- int *dsize,
+ size_t *dsize,
const char **datap
)
{
char data[CTL_MAX_DATA_LEN];
- int datalen;
+ size_t datalen;
datalen = sizeof(data);
makequerydata(vlist, &datalen, data);
@@ -686,7 +686,7 @@ dolist(
{
const char *datap;
int res;
- int dsize;
+ size_t dsize;
u_short rstatus;
int quiet;
@@ -766,7 +766,7 @@ writelist(
const char *datap;
int res;
associd_t associd;
- int dsize;
+ size_t dsize;
u_short rstatus;
if (pcmd->nargs == 0) {
@@ -808,8 +808,8 @@ readvar(
)
{
associd_t associd;
- u_int tmpcount;
- u_int u;
+ size_t tmpcount;
+ size_t u;
int type;
struct varlist tmplist[MAXLIST];
@@ -849,7 +849,7 @@ writevar(
int res;
associd_t associd;
int type;
- int dsize;
+ size_t dsize;
u_short rstatus;
struct varlist tmplist[MAXLIST];
@@ -1071,7 +1071,7 @@ dogetassoc(
const char *datap;
const u_short *pus;
int res;
- int dsize;
+ size_t dsize;
u_short rstatus;
res = doquery(CTL_OP_READSTAT, 0, 0, 0, (char *)0, &rstatus,
@@ -1091,7 +1091,7 @@ dogetassoc(
if (numhosts > 1)
fprintf(stderr, "server=%s ", currenthost);
fprintf(stderr,
- "***Server returned %d octets, should be multiple of 4\n",
+ "***Server returned %zu octets, should be multiple of 4\n",
dsize);
return 0;
}
@@ -1379,7 +1379,7 @@ saveconfig(
{
const char *datap;
int res;
- int dsize;
+ size_t dsize;
u_short rstatus;
if (0 == pcmd->nargs)
@@ -1396,7 +1396,7 @@ saveconfig(
if (0 == dsize)
fprintf(fp, "(no response message, curiously)");
else
- fprintf(fp, "%.*s", dsize, datap);
+ fprintf(fp, "%.*s", (int)dsize, datap); /* cast is wobbly */
}
@@ -1593,7 +1593,7 @@ doprintpeers(
struct varlist *pvl,
int associd,
int rstatus,
- int datalen,
+ size_t datalen,
const char *data,
FILE *fp,
int af
@@ -1602,7 +1602,7 @@ doprintpeers(
char *name;
char *value = NULL;
int c;
- int len;
+ size_t len;
int have_srchost;
int have_dstadr;
int have_da_rid;
@@ -1881,7 +1881,7 @@ dogetpeers(
{
const char *datap;
int res;
- int dsize;
+ size_t dsize;
u_short rstatus;
#ifdef notdef
@@ -2186,7 +2186,7 @@ config (
{
const char *cfgcmd;
u_short rstatus;
- int rsize;
+ size_t rsize;
const char *rdata;
char *resp;
int res;
@@ -2201,7 +2201,8 @@ config (
"Keyword = %s\n"
"Command = %s\n", pcmd->keyword, cfgcmd);
- res = doquery(CTL_OP_CONFIGURE, 0, 1, strlen(cfgcmd), cfgcmd,
+ res = doquery(CTL_OP_CONFIGURE, 0, 1,
+ strlen(cfgcmd), cfgcmd,
&rstatus, &rsize, &rdata);
if (res != 0)
@@ -2251,7 +2252,7 @@ config_from_file (
)
{
u_short rstatus;
- int rsize;
+ size_t rsize;
const char *rdata;
int res;
FILE *config_fd;
@@ -2302,7 +2303,7 @@ config_from_file (
rsize--;
if (rsize > 0 && '\r' == rdata[rsize - 1])
rsize--;
- printf("Line No: %d %.*s: %s", i, rsize, rdata,
+ printf("Line No: %d %.*s: %s", i, (int)rsize, rdata, /* cast is wobbly */
config_cmd);
}
printf("Done sending file\n");
@@ -2319,9 +2320,9 @@ fetch_nonce(
const char nonce_eq[] = "nonce=";
int qres;
u_short rstatus;
- int rsize;
+ size_t rsize;
const char * rdata;
- int chars;
+ size_t chars;
/*
* Retrieve a nonce specific to this client to demonstrate to
@@ -2338,7 +2339,7 @@ fetch_nonce(
if ((size_t)rsize <= sizeof(nonce_eq) - 1 ||
strncmp(rdata, nonce_eq, sizeof(nonce_eq) - 1)) {
fprintf(stderr, "unexpected nonce response format: %.*s\n",
- rsize, rdata);
+ (int)rsize, rdata); /* cast is wobbly */
return FALSE;
}
chars = rsize - (sizeof(nonce_eq) - 1);
@@ -2421,10 +2422,11 @@ add_mru(
} while (0)
-void
+int
mrulist_ctrl_c_hook(void)
{
mrulist_interrupted = TRUE;
+ return TRUE;
}
@@ -2449,10 +2451,10 @@ collect_mru_list(
char req_buf[CTL_MAX_DATA_LEN];
char *req;
char *req_end;
- int chars;
+ size_t chars;
int qres;
u_short rstatus;
- int rsize;
+ size_t rsize;
const char *rdata;
int limit;
int frags;
@@ -2495,11 +2497,6 @@ collect_mru_list(
mon = emalloc_zero(cb);
ZERO(*pnow);
ZERO(last_older);
- mrulist_interrupted = FALSE;
- set_ctrl_c_hook(&mrulist_ctrl_c_hook);
- fprintf(stderr,
- "Ctrl-C will stop MRU retrieval and display partial results.\n");
- fflush(stderr);
next_report = time(NULL) + MRU_REPORT_SECS;
limit = min(3 * MAXFRAGS, ntpd_row_limit);
@@ -2512,8 +2509,9 @@ collect_mru_list(
if (debug)
fprintf(stderr, "READ_MRU parms: %s\n", req_buf);
- qres = doqueryex(CTL_OP_READ_MRU, 0, 0, strlen(req_buf),
- req_buf, &rstatus, &rsize, &rdata, TRUE);
+ qres = doqueryex(CTL_OP_READ_MRU, 0, 0,
+ strlen(req_buf), req_buf,
+ &rstatus, &rsize, &rdata, TRUE);
if (CERR_UNKNOWNVAR == qres && ri > 0) {
/*
@@ -2863,14 +2861,13 @@ collect_mru_list(
ri, sptoa(&recent->addr), ri,
recent->last.l_ui, recent->last.l_uf);
chars = strlen(buf);
- if (REQ_ROOM - chars < 1)
+ if (REQ_ROOM <= chars)
break;
memcpy(req, buf, chars + 1);
req += chars;
}
}
- set_ctrl_c_hook(NULL);
c_mru_l_rc = TRUE;
goto retain_hash_table;
@@ -3080,6 +3077,12 @@ mrulist(
int lstint;
size_t i;
+ mrulist_interrupted = FALSE;
+ push_ctrl_c_handler(&mrulist_ctrl_c_hook);
+ fprintf(stderr,
+ "Ctrl-C will stop MRU retrieval and display partial results.\n");
+ fflush(stderr);
+
order = MRUSORT_DEF;
parms_buf[0] = '\0';
parms = parms_buf;
@@ -3220,6 +3223,8 @@ cleanup_return:
free(hash_table);
hash_table = NULL;
INIT_DLIST(mru_list, mlink);
+
+ pop_ctrl_c_handler(&mrulist_ctrl_c_hook);
}
@@ -3317,7 +3322,7 @@ ifstats(
const char up_fmt[] = "up.%u"; /* uptime */
const char * datap;
int qres;
- int dsize;
+ size_t dsize;
u_short rstatus;
char * tag;
char * val;
@@ -3533,7 +3538,7 @@ reslist(
const int qdata_chars = COUNTOF(qdata) - 1;
const char * datap;
int qres;
- int dsize;
+ size_t dsize;
u_short rstatus;
char * tag;
char * val;
@@ -3632,7 +3637,7 @@ collect_display_vdc(
char tagbuf[32];
vdc *pvdc;
u_short rstatus;
- int rsize;
+ size_t rsize;
const char *rdata;
int qres;
char *tag;
diff --git a/contrib/ntp/ntpq/ntpq.1ntpqman b/contrib/ntp/ntpq/ntpq.1ntpqman
index b4e45b2..1c26076 100644
--- a/contrib/ntp/ntpq/ntpq.1ntpqman
+++ b/contrib/ntp/ntpq/ntpq.1ntpqman
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntpq 1ntpqman "21 Oct 2015" "4.2.8p4" "User Commands"
+.TH ntpq 1ntpqman "07 Jan 2016" "4.2.8p5" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-joa4fN/ag-voaWeN)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-4VaaKt/ag-eWa4It)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:39:23 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:31:55 PM by AutoGen 5.18.5
.\" From the definitions ntpq-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/ntpq/ntpq.1ntpqmdoc b/contrib/ntp/ntpq/ntpq.1ntpqmdoc
index 8239434..bf8d101 100644
--- a/contrib/ntp/ntpq/ntpq.1ntpqmdoc
+++ b/contrib/ntp/ntpq/ntpq.1ntpqmdoc
@@ -1,9 +1,9 @@
-.Dd October 21 2015
+.Dd January 7 2016
.Dt NTPQ 1ntpqmdoc User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntpq-opts.mdoc)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:39:29 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:32:02 PM by AutoGen 5.18.5
.\" From the definitions ntpq-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/ntpq/ntpq.c b/contrib/ntp/ntpq/ntpq.c
index c8d5ece..5b3c9cb 100644
--- a/contrib/ntp/ntpq/ntpq.c
+++ b/contrib/ntp/ntpq/ntpq.c
@@ -39,6 +39,7 @@
#include "ntp_libopts.h"
#include "ntpq-opts.h"
+#include "safecast.h"
#ifdef SYS_VXWORKS /* vxWorks needs mode flag -casey*/
# define open(name, flags) open(name, flags, 0777)
@@ -168,13 +169,13 @@ int ntpqmain (int, char **);
static int openhost (const char *, int);
static void dump_hex_printable(const void *, size_t);
static int sendpkt (void *, size_t);
-static int getresponse (int, int, u_short *, int *, const char **, int);
-static int sendrequest (int, associd_t, int, int, const char *);
+static int getresponse (int, int, u_short *, size_t *, const char **, int);
+static int sendrequest (int, associd_t, int, size_t, const char *);
static char * tstflags (u_long);
#ifndef BUILD_AS_LIB
static void getcmds (void);
#ifndef SYS_WINNT
-static RETSIGTYPE abortcmd (int);
+static int abortcmd (void);
#endif /* SYS_WINNT */
static void docmd (const char *);
static void tokenize (const char *, char **, int *);
@@ -208,13 +209,14 @@ static void error (const char *, ...)
__attribute__((__format__(__printf__, 1, 2)));
static u_long getkeyid (const char *);
static void atoascii (const char *, size_t, char *, size_t);
-static void cookedprint (int, int, const char *, int, int, FILE *);
-static void rawprint (int, int, const char *, int, int, FILE *);
+static void cookedprint (int, size_t, const char *, int, int, FILE *);
+static void rawprint (int, size_t, const char *, int, int, FILE *);
static void startoutput (void);
static void output (FILE *, const char *, const char *);
static void endoutput (FILE *);
static void outputarr (FILE *, char *, int, l_fp *);
static int assoccmp (const void *, const void *);
+static void on_ctrlc (void);
u_short varfmt (const char *);
void ntpq_custom_opt_handler (tOptions *, tOptDesc *);
@@ -558,9 +560,10 @@ ntpqmain(
interactive = 1;
}
+ set_ctrl_c_hook(on_ctrlc);
#ifndef SYS_WINNT /* Under NT cannot handle SIGINT, WIN32 spawns a handler */
if (interactive)
- (void) signal_no_reset(SIGINT, abortcmd);
+ push_ctrl_c_handler(abortcmd);
#endif /* SYS_WINNT */
if (numcmds == 0) {
@@ -739,9 +742,9 @@ openhost(
sizeof(hostaddr)) == -1)
#else
(connect(sockfd, (struct sockaddr *)ai->ai_addr,
- ai->ai_addrlen) == -1)
+ ai->ai_addrlen) == -1)
#endif /* SYS_VXWORKS */
- {
+ {
error("connect");
freeaddrinfo(ai);
return 0;
@@ -802,7 +805,7 @@ sendpkt(
if (debug >= 3)
printf("Sending %zu octets\n", xdatalen);
- if (send(sockfd, xdata, (size_t)xdatalen, 0) == -1) {
+ if (send(sockfd, xdata, xdatalen, 0) == -1) {
warning("write to %s failed", currenthost);
return -1;
}
@@ -822,7 +825,7 @@ getresponse(
int opcode,
int associd,
u_short *rstatus,
- int *rsize,
+ size_t *rsize,
const char **rdata,
int timeo
)
@@ -871,8 +874,7 @@ getresponse(
tvo = tvsout;
FD_SET(sockfd, &fds);
- n = select(sockfd + 1, &fds, NULL, NULL, &tvo);
-
+ n = select(sockfd+1, &fds, NULL, NULL, &tvo);
if (n == -1) {
warning("select fails");
return -1;
@@ -1171,22 +1173,22 @@ sendrequest(
int opcode,
associd_t associd,
int auth,
- int qsize,
+ size_t qsize,
const char *qdata
)
{
struct ntp_control qpkt;
- int pktsize;
+ size_t pktsize;
u_long key_id;
char * pass;
- int maclen;
+ size_t maclen;
/*
* Check to make sure the data will fit in one packet
*/
if (qsize > CTL_MAX_DATA_LEN) {
fprintf(stderr,
- "***Internal error! qsize (%d) too large\n",
+ "***Internal error! qsize (%zu) too large\n",
qsize);
return 1;
}
@@ -1265,7 +1267,7 @@ sendrequest(
return 1;
} else if ((size_t)maclen != (info_auth_hashlen + sizeof(keyid_t))) {
fprintf(stderr,
- "%d octet MAC, %zu expected with %zu octet digest\n",
+ "%zu octet MAC, %zu expected with %zu octet digest\n",
maclen, (info_auth_hashlen + sizeof(keyid_t)),
info_auth_hashlen);
return 1;
@@ -1355,10 +1357,10 @@ doquery(
int opcode,
associd_t associd,
int auth,
- int qsize,
+ size_t qsize,
const char *qdata,
u_short *rstatus,
- int *rsize,
+ size_t *rsize,
const char **rdata
)
{
@@ -1376,10 +1378,10 @@ doqueryex(
int opcode,
associd_t associd,
int auth,
- int qsize,
+ size_t qsize,
const char *qdata,
u_short *rstatus,
- int *rsize,
+ size_t *rsize,
const char **rdata,
int quiet
)
@@ -1460,16 +1462,18 @@ getcmds(void)
/*
* abortcmd - catch interrupts and abort the current command
*/
-static RETSIGTYPE
-abortcmd(
- int sig
- )
+static int
+abortcmd(void)
{
if (current_output == stdout)
- (void) fflush(stdout);
+ (void) fflush(stdout);
putc('\n', stderr);
(void) fflush(stderr);
- if (jump) longjmp(interrupt_buf, 1);
+ if (jump) {
+ jump = 0;
+ longjmp(interrupt_buf, 1);
+ }
+ return TRUE;
}
#endif /* !SYS_WINNT && !BUILD_AS_LIB */
@@ -1743,7 +1747,7 @@ findcmd(
)
{
struct xcmd *cl;
- int clen;
+ size_t clen;
int nmatch;
struct xcmd *nearmatch = NULL;
struct xcmd *clist;
@@ -2665,7 +2669,7 @@ vwarning(const char *fmt, va_list ap)
int serrno = errno;
(void) fprintf(stderr, "%s: ", progname);
vfprintf(stderr, fmt, ap);
- (void) fprintf(stderr, ": %s", strerror(serrno));
+ (void) fprintf(stderr, ": %s\n", strerror(serrno));
}
/*
@@ -2800,7 +2804,7 @@ do { \
*/
void
makeascii(
- int length,
+ size_t length,
const char *data,
FILE *fp
)
@@ -2916,7 +2920,7 @@ int nextcb = 0;
*/
int
nextvar(
- int *datalen,
+ size_t *datalen,
const char **datap,
char **vname,
char **vvalue
@@ -2963,7 +2967,7 @@ nextvar(
if (cp < cpend)
cp++;
*datap = cp;
- *datalen = cpend - cp;
+ *datalen = size2int_sat(cpend - cp);
*vvalue = NULL;
return 1;
}
@@ -3003,7 +3007,7 @@ nextvar(
if (np < cpend && ',' == *np)
np++;
*datap = np;
- *datalen = cpend - np;
+ *datalen = size2int_sat(cpend - np);
*vvalue = value;
return 1;
}
@@ -3027,7 +3031,7 @@ varfmt(const char * varname)
*/
void
printvars(
- int length,
+ size_t length,
const char *data,
int status,
int sttype,
@@ -3048,7 +3052,7 @@ printvars(
static void
rawprint(
int datatype,
- int length,
+ size_t length,
const char *data,
int status,
int quiet,
@@ -3113,10 +3117,10 @@ output(
const char *value
)
{
- size_t len;
+ int len;
/* strlen of "name=value" */
- len = strlen(name) + 1 + strlen(value);
+ len = size2int_sat(strlen(name) + 1 + strlen(value));
if (out_chars != 0) {
out_chars += 2;
@@ -3161,10 +3165,10 @@ outputarr(
l_fp *lfp
)
{
- register char *bp;
- register char *cp;
- register int i;
- register int len;
+ char *bp;
+ char *cp;
+ size_t i;
+ size_t len;
char buf[256];
bp = buf;
@@ -3246,7 +3250,7 @@ tstflags(
static void
cookedprint(
int datatype,
- int length,
+ size_t length,
const char *data,
int status,
int quiet,
@@ -3430,7 +3434,7 @@ grow_assoc_cache(void)
}
assoc_cache = erealloc_zero(assoc_cache, new_sz, prior_sz);
prior_sz = new_sz;
- assoc_cache_slots = new_sz / sizeof(assoc_cache[0]);
+ assoc_cache_slots = (u_int)(new_sz / sizeof(assoc_cache[0]));
}
@@ -3566,3 +3570,48 @@ static char *list_digest_names(void)
return list;
}
+
+#define CTRLC_STACK_MAX 4
+static volatile size_t ctrlc_stack_len = 0;
+static volatile Ctrl_C_Handler ctrlc_stack[CTRLC_STACK_MAX];
+
+
+
+int/*BOOL*/
+push_ctrl_c_handler(
+ Ctrl_C_Handler func
+ )
+{
+ size_t size = ctrlc_stack_len;
+ if (func && (size < CTRLC_STACK_MAX)) {
+ ctrlc_stack[size] = func;
+ ctrlc_stack_len = size + 1;
+ return TRUE;
+ }
+ return FALSE;
+}
+
+int/*BOOL*/
+pop_ctrl_c_handler(
+ Ctrl_C_Handler func
+ )
+{
+ size_t size = ctrlc_stack_len;
+ if (size) {
+ --size;
+ if (func == NULL || func == ctrlc_stack[size]) {
+ ctrlc_stack_len = size;
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+static void
+on_ctrlc(void)
+{
+ size_t size = ctrlc_stack_len;
+ while (size)
+ if ((*ctrlc_stack[--size])())
+ break;
+}
diff --git a/contrib/ntp/ntpq/ntpq.h b/contrib/ntp/ntpq/ntpq.h
index 2575b88..55ea0fb 100644
--- a/contrib/ntp/ntpq/ntpq.h
+++ b/contrib/ntp/ntpq/ntpq.h
@@ -136,19 +136,23 @@ extern int getnetnum (const char *, sockaddr_u *, char *, int);
extern void sortassoc (void);
extern void show_error_msg (int, associd_t);
extern int dogetassoc (FILE *);
-extern int doquery (int, associd_t, int, int, const char *,
- u_short *, int *, const char **);
-extern int doqueryex (int, associd_t, int, int, const char *,
- u_short *, int *, const char **, int);
+extern int doquery (int, associd_t, int, size_t, const char *,
+ u_short *, size_t *, const char **);
+extern int doqueryex (int, associd_t, int, size_t, const char *,
+ u_short *, size_t *, const char **, int);
extern const char * nntohost (sockaddr_u *);
extern const char * nntohost_col (sockaddr_u *, size_t, int);
extern const char * nntohostp (sockaddr_u *);
extern int decodets (char *, l_fp *);
extern int decodeuint (char *, u_long *);
-extern int nextvar (int *, const char **, char **, char **);
+extern int nextvar (size_t *, const char **, char **, char **);
extern int decodetime (char *, l_fp *);
-extern void printvars (int, const char *, int, int, int, FILE *);
+extern void printvars (size_t, const char *, int, int, int, FILE *);
extern int decodeint (char *, long *);
-extern void makeascii (int, const char *, FILE *);
+extern void makeascii (size_t, const char *, FILE *);
extern const char * trunc_left (const char *, size_t);
extern const char * trunc_right(const char *, size_t);
+
+typedef int/*BOOL*/ (*Ctrl_C_Handler)(void);
+extern int/*BOOL*/ push_ctrl_c_handler(Ctrl_C_Handler);
+extern int/*BOOL*/ pop_ctrl_c_handler(Ctrl_C_Handler);
diff --git a/contrib/ntp/ntpq/ntpq.html b/contrib/ntp/ntpq/ntpq.html
index e2c3740..16f2597 100644
--- a/contrib/ntp/ntpq/ntpq.html
+++ b/contrib/ntp/ntpq/ntpq.html
@@ -44,7 +44,7 @@ monitor the operational status
and determine the performance of
<code>ntpd</code>, the NTP daemon.
- <p>This document applies to version 4.2.8p4 of <code>ntpq</code>.
+ <p>This document applies to version 4.2.8p5 of <code>ntpq</code>.
<ul class="menu">
<li><a accesskey="1" href="#ntpq-Description">ntpq Description</a>
@@ -769,7 +769,7 @@ the usage text by passing it through a pager program.
used to select the program, defaulting to <span class="file">more</span>. Both will exit
with a status code of 0.
-<pre class="example">ntpq - standard NTP query program - Ver. 4.2.8p4-sec-RC2
+<pre class="example">ntpq - standard NTP query program - Ver. 4.2.8p4
Usage: ntpq [ -&lt;flag&gt; [&lt;val&gt;] | --&lt;name&gt;[{=| }&lt;val&gt;] ]... [ host ...]
Flg Arg Option-Name Description
-4 no ipv4 Force IPv4 DNS name resolution
diff --git a/contrib/ntp/ntpq/ntpq.man.in b/contrib/ntp/ntpq/ntpq.man.in
index 0c0af5b..17ccb1c 100644
--- a/contrib/ntp/ntpq/ntpq.man.in
+++ b/contrib/ntp/ntpq/ntpq.man.in
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntpq @NTPQ_MS@ "21 Oct 2015" "4.2.8p4" "User Commands"
+.TH ntpq @NTPQ_MS@ "07 Jan 2016" "4.2.8p5" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-joa4fN/ag-voaWeN)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-4VaaKt/ag-eWa4It)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:39:23 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:31:55 PM by AutoGen 5.18.5
.\" From the definitions ntpq-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/ntpq/ntpq.mdoc.in b/contrib/ntp/ntpq/ntpq.mdoc.in
index 2b20ddc..9214a66 100644
--- a/contrib/ntp/ntpq/ntpq.mdoc.in
+++ b/contrib/ntp/ntpq/ntpq.mdoc.in
@@ -1,9 +1,9 @@
-.Dd October 21 2015
+.Dd January 7 2016
.Dt NTPQ @NTPQ_MS@ User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntpq-opts.mdoc)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:39:29 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:32:02 PM by AutoGen 5.18.5
.\" From the definitions ntpq-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/ntpsnmpd/invoke-ntpsnmpd.texi b/contrib/ntp/ntpsnmpd/invoke-ntpsnmpd.texi
index ac8e69c..1185316 100644
--- a/contrib/ntp/ntpsnmpd/invoke-ntpsnmpd.texi
+++ b/contrib/ntp/ntpsnmpd/invoke-ntpsnmpd.texi
@@ -6,7 +6,7 @@
#
# EDIT THIS FILE WITH CAUTION (invoke-ntpsnmpd.texi)
#
-# It has been AutoGen-ed October 21, 2015 at 12:39:43 PM by AutoGen 5.18.5
+# It has been AutoGen-ed January 7, 2016 at 11:32:15 PM by AutoGen 5.18.5
# From the definitions ntpsnmpd-opts.def
# and the template file agtexi-cmd.tpl
@end ignore
@@ -47,7 +47,7 @@ with a status code of 0.
@exampleindent 0
@example
-ntpsnmpd - NTP SNMP MIB agent - Ver. 4.2.8p4
+ntpsnmpd - NTP SNMP MIB agent - Ver. 4.2.8p5
Usage: ntpsnmpd [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]...
Flg Arg Option-Name Description
-n no nofork Do not fork
diff --git a/contrib/ntp/ntpsnmpd/ntpsnmpd-opts.c b/contrib/ntp/ntpsnmpd/ntpsnmpd-opts.c
index 01013fb..cb48b16 100644
--- a/contrib/ntp/ntpsnmpd/ntpsnmpd-opts.c
+++ b/contrib/ntp/ntpsnmpd/ntpsnmpd-opts.c
@@ -1,7 +1,7 @@
/*
* EDIT THIS FILE WITH CAUTION (ntpsnmpd-opts.c)
*
- * It has been AutoGen-ed October 21, 2015 at 12:39:32 PM by AutoGen 5.18.5
+ * It has been AutoGen-ed January 7, 2016 at 11:32:05 PM by AutoGen 5.18.5
* From the definitions ntpsnmpd-opts.def
* and the template file options
*
@@ -61,7 +61,7 @@ extern FILE * option_usage_fp;
* static const strings for ntpsnmpd options
*/
static char const ntpsnmpd_opt_strs[1610] =
-/* 0 */ "ntpsnmpd 4.2.8p4\n"
+/* 0 */ "ntpsnmpd 4.2.8p5\n"
"Copyright (C) 1992-2015 The University of Delaware and Network Time Foundation, all rights reserved.\n"
"This is free software. It is licensed for use, modification and\n"
"redistribution under the terms of the NTP License, copies of which\n"
@@ -101,14 +101,14 @@ static char const ntpsnmpd_opt_strs[1610] =
/* 1414 */ "no-load-opts\0"
/* 1427 */ "no\0"
/* 1430 */ "NTPSNMPD\0"
-/* 1439 */ "ntpsnmpd - NTP SNMP MIB agent - Ver. 4.2.8p4\n"
+/* 1439 */ "ntpsnmpd - NTP SNMP MIB agent - Ver. 4.2.8p5\n"
"Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]...\n\0"
/* 1542 */ "$HOME\0"
/* 1548 */ ".\0"
/* 1550 */ ".ntprc\0"
/* 1557 */ "http://bugs.ntp.org, bugs@ntp.org\0"
/* 1591 */ "\n\0"
-/* 1593 */ "ntpsnmpd 4.2.8p4";
+/* 1593 */ "ntpsnmpd 4.2.8p5";
/**
* nofork option description:
@@ -554,7 +554,7 @@ static void bogus_function(void) {
translate option names.
*/
/* referenced via ntpsnmpdOptions.pzCopyright */
- puts(_("ntpsnmpd 4.2.8p4\n\
+ puts(_("ntpsnmpd 4.2.8p5\n\
Copyright (C) 1992-2015 The University of Delaware and Network Time Foundation, all rights reserved.\n\
This is free software. It is licensed for use, modification and\n\
redistribution under the terms of the NTP License, copies of which\n\
@@ -599,14 +599,14 @@ implied warranty.\n"));
puts(_("load options from a config file"));
/* referenced via ntpsnmpdOptions.pzUsageTitle */
- puts(_("ntpsnmpd - NTP SNMP MIB agent - Ver. 4.2.8p4\n\
+ puts(_("ntpsnmpd - NTP SNMP MIB agent - Ver. 4.2.8p5\n\
Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]...\n"));
/* referenced via ntpsnmpdOptions.pzExplain */
puts(_("\n"));
/* referenced via ntpsnmpdOptions.pzFullVersion */
- puts(_("ntpsnmpd 4.2.8p4"));
+ puts(_("ntpsnmpd 4.2.8p5"));
/* referenced via ntpsnmpdOptions.pzFullUsage */
puts(_("<<<NOT-FOUND>>>"));
diff --git a/contrib/ntp/ntpsnmpd/ntpsnmpd-opts.h b/contrib/ntp/ntpsnmpd/ntpsnmpd-opts.h
index 07756dd..8146eb9 100644
--- a/contrib/ntp/ntpsnmpd/ntpsnmpd-opts.h
+++ b/contrib/ntp/ntpsnmpd/ntpsnmpd-opts.h
@@ -1,7 +1,7 @@
/*
* EDIT THIS FILE WITH CAUTION (ntpsnmpd-opts.h)
*
- * It has been AutoGen-ed October 21, 2015 at 12:39:32 PM by AutoGen 5.18.5
+ * It has been AutoGen-ed January 7, 2016 at 11:32:04 PM by AutoGen 5.18.5
* From the definitions ntpsnmpd-opts.def
* and the template file options
*
@@ -76,9 +76,9 @@ typedef enum {
/** count of all options for ntpsnmpd */
#define OPTION_CT 8
/** ntpsnmpd version */
-#define NTPSNMPD_VERSION "4.2.8p4"
+#define NTPSNMPD_VERSION "4.2.8p5"
/** Full ntpsnmpd version text */
-#define NTPSNMPD_FULL_VERSION "ntpsnmpd 4.2.8p4"
+#define NTPSNMPD_FULL_VERSION "ntpsnmpd 4.2.8p5"
/**
* Interface defines for all options. Replace "n" with the UPPER_CASED
diff --git a/contrib/ntp/ntpsnmpd/ntpsnmpd.1ntpsnmpdman b/contrib/ntp/ntpsnmpd/ntpsnmpd.1ntpsnmpdman
index 1a5dff3..e7fc2eb 100644
--- a/contrib/ntp/ntpsnmpd/ntpsnmpd.1ntpsnmpdman
+++ b/contrib/ntp/ntpsnmpd/ntpsnmpd.1ntpsnmpdman
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntpsnmpd 1ntpsnmpdman "21 Oct 2015" "4.2.8p4" "User Commands"
+.TH ntpsnmpd 1ntpsnmpdman "07 Jan 2016" "4.2.8p5" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-Xna4nO/ag-9naWmO)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-dZaaSu/ag-qZa4Qu)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:39:39 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:32:12 PM by AutoGen 5.18.5
.\" From the definitions ntpsnmpd-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/ntpsnmpd/ntpsnmpd.1ntpsnmpdmdoc b/contrib/ntp/ntpsnmpd/ntpsnmpd.1ntpsnmpdmdoc
index e13b816..ba8d82a 100644
--- a/contrib/ntp/ntpsnmpd/ntpsnmpd.1ntpsnmpdmdoc
+++ b/contrib/ntp/ntpsnmpd/ntpsnmpd.1ntpsnmpdmdoc
@@ -1,9 +1,9 @@
-.Dd October 21 2015
+.Dd January 7 2016
.Dt NTPSNMPD 1ntpsnmpdmdoc User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntpsnmpd-opts.mdoc)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:39:45 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:32:18 PM by AutoGen 5.18.5
.\" From the definitions ntpsnmpd-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/ntpsnmpd/ntpsnmpd.html b/contrib/ntp/ntpsnmpd/ntpsnmpd.html
index 1ad4ffc..94df056 100644
--- a/contrib/ntp/ntpsnmpd/ntpsnmpd.html
+++ b/contrib/ntp/ntpsnmpd/ntpsnmpd.html
@@ -42,7 +42,7 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#dir">(dir)</a>
<p>The <code>ntpsnmpd</code> utility program is used to monitor NTP daemon <code>ntpd</code>
operations and determine performance. It uses the standard NTP mode 6 control
- <p>This document applies to version 4.2.8p4 of <code>ntpsnmpd</code>.
+ <p>This document applies to version 4.2.8p5 of <code>ntpsnmpd</code>.
<ul class="menu">
<li><a accesskey="1" href="#ntpsnmpd-Description">ntpsnmpd Description</a>: Description
diff --git a/contrib/ntp/ntpsnmpd/ntpsnmpd.man.in b/contrib/ntp/ntpsnmpd/ntpsnmpd.man.in
index 0da76ff..b5fe93d 100644
--- a/contrib/ntp/ntpsnmpd/ntpsnmpd.man.in
+++ b/contrib/ntp/ntpsnmpd/ntpsnmpd.man.in
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntpsnmpd @NTPSNMPD_MS@ "21 Oct 2015" "4.2.8p4" "User Commands"
+.TH ntpsnmpd @NTPSNMPD_MS@ "07 Jan 2016" "4.2.8p5" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-Xna4nO/ag-9naWmO)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-dZaaSu/ag-qZa4Qu)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:39:39 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:32:12 PM by AutoGen 5.18.5
.\" From the definitions ntpsnmpd-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/ntpsnmpd/ntpsnmpd.mdoc.in b/contrib/ntp/ntpsnmpd/ntpsnmpd.mdoc.in
index d2cebc4..9349c2f 100644
--- a/contrib/ntp/ntpsnmpd/ntpsnmpd.mdoc.in
+++ b/contrib/ntp/ntpsnmpd/ntpsnmpd.mdoc.in
@@ -1,9 +1,9 @@
-.Dd October 21 2015
+.Dd January 7 2016
.Dt NTPSNMPD @NTPSNMPD_MS@ User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntpsnmpd-opts.mdoc)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:39:45 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:32:18 PM by AutoGen 5.18.5
.\" From the definitions ntpsnmpd-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/packageinfo.sh b/contrib/ntp/packageinfo.sh
index 1e0a228..9b94198 100644
--- a/contrib/ntp/packageinfo.sh
+++ b/contrib/ntp/packageinfo.sh
@@ -83,7 +83,7 @@ CLTAG=NTP_4_2_0
# - Numeric values increment
# - empty 'increments' to 1
# - NEW 'increments' to empty
-point=4
+point=5
### betapoint is normally modified by script.
# ntp-stable Beta number (betapoint)
diff --git a/contrib/ntp/scripts/calc_tickadj/Makefile.am b/contrib/ntp/scripts/calc_tickadj/Makefile.am
index b98bc87..473b6e3 100644
--- a/contrib/ntp/scripts/calc_tickadj/Makefile.am
+++ b/contrib/ntp/scripts/calc_tickadj/Makefile.am
@@ -60,6 +60,8 @@ noinst_DATA = \
$(manpage_HACK) \
$(NULL)
+BUILT_SOURCES = $(noinst_DATA)
+
calc_tickadj: $(srcdir)/calc_tickadj-opts
$(srcdir)/calc_tickadj-opts: $(srcdir)/calc_tickadj-opts.def
diff --git a/contrib/ntp/scripts/calc_tickadj/Makefile.in b/contrib/ntp/scripts/calc_tickadj/Makefile.in
index c68c31d..18c5dae 100644
--- a/contrib/ntp/scripts/calc_tickadj/Makefile.in
+++ b/contrib/ntp/scripts/calc_tickadj/Makefile.in
@@ -516,7 +516,9 @@ noinst_DATA = \
$(manpage_HACK) \
$(NULL)
-all: all-am
+BUILT_SOURCES = $(noinst_DATA)
+all: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) all-am
.SUFFIXES:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@@ -785,13 +787,15 @@ distdir: $(DISTFILES)
fi; \
done
check-am: all-am
-check: check-am
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-am
all-am: Makefile $(SCRIPTS) $(MANS) $(DATA)
installdirs:
for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man8dir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
-install: install-am
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
@@ -822,6 +826,7 @@ distclean-generic:
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
@@ -892,7 +897,7 @@ uninstall-am: uninstall-binSCRIPTS uninstall-libexecSCRIPTS \
uninstall-man: uninstall-man1 uninstall-man8
-.MAKE: install-am install-strip
+.MAKE: all check install install-am install-strip
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
cscopelist-am ctags-am distclean distclean-generic \
diff --git a/contrib/ntp/scripts/calc_tickadj/calc_tickadj.1calc_tickadjman b/contrib/ntp/scripts/calc_tickadj/calc_tickadj.1calc_tickadjman
index 9057b89..cfeca4d 100644
--- a/contrib/ntp/scripts/calc_tickadj/calc_tickadj.1calc_tickadjman
+++ b/contrib/ntp/scripts/calc_tickadj/calc_tickadj.1calc_tickadjman
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH calc_tickadj 1calc_tickadjman "21 Oct 2015" "ntp (4.2.8p4)" "User Commands"
+.TH calc_tickadj 1calc_tickadjman "07 Jan 2016" "ntp (4.2.8p5)" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-3baGnz/ag-dcaOmz)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-nyaOMf/ag-AyaWLf)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:33:58 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:26:26 PM by AutoGen 5.18.5
.\" From the definitions calc_tickadj-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/scripts/calc_tickadj/calc_tickadj.1calc_tickadjmdoc b/contrib/ntp/scripts/calc_tickadj/calc_tickadj.1calc_tickadjmdoc
index 9c1245b..8aed38f 100644
--- a/contrib/ntp/scripts/calc_tickadj/calc_tickadj.1calc_tickadjmdoc
+++ b/contrib/ntp/scripts/calc_tickadj/calc_tickadj.1calc_tickadjmdoc
@@ -1,9 +1,9 @@
-.Dd October 21 2015
+.Dd January 7 2016
.Dt CALC_TICKADJ 1calc_tickadjmdoc User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (calc_tickadj-opts.mdoc)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:34:02 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:26:28 PM by AutoGen 5.18.5
.\" From the definitions calc_tickadj-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/scripts/calc_tickadj/calc_tickadj.html b/contrib/ntp/scripts/calc_tickadj/calc_tickadj.html
index a88e28f..484e112 100644
--- a/contrib/ntp/scripts/calc_tickadj/calc_tickadj.html
+++ b/contrib/ntp/scripts/calc_tickadj/calc_tickadj.html
@@ -31,7 +31,7 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#dir">(dir)</a>
<h2 class="unnumbered">calc_tickadj User's Manual</h2>
<p>This document describes the use of the NTP Project's <code>calc_tickadj</code> program.
-This document applies to version 4.2.8p4 of <code>calc_tickadj</code>.
+This document applies to version 4.2.8p5 of <code>calc_tickadj</code>.
<div class="shortcontents">
<h2>Short Contents</h2>
diff --git a/contrib/ntp/scripts/calc_tickadj/calc_tickadj.man.in b/contrib/ntp/scripts/calc_tickadj/calc_tickadj.man.in
index 9057b89..cfeca4d 100644
--- a/contrib/ntp/scripts/calc_tickadj/calc_tickadj.man.in
+++ b/contrib/ntp/scripts/calc_tickadj/calc_tickadj.man.in
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH calc_tickadj 1calc_tickadjman "21 Oct 2015" "ntp (4.2.8p4)" "User Commands"
+.TH calc_tickadj 1calc_tickadjman "07 Jan 2016" "ntp (4.2.8p5)" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-3baGnz/ag-dcaOmz)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-nyaOMf/ag-AyaWLf)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:33:58 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:26:26 PM by AutoGen 5.18.5
.\" From the definitions calc_tickadj-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/scripts/calc_tickadj/calc_tickadj.mdoc.in b/contrib/ntp/scripts/calc_tickadj/calc_tickadj.mdoc.in
index 9c1245b..8aed38f 100644
--- a/contrib/ntp/scripts/calc_tickadj/calc_tickadj.mdoc.in
+++ b/contrib/ntp/scripts/calc_tickadj/calc_tickadj.mdoc.in
@@ -1,9 +1,9 @@
-.Dd October 21 2015
+.Dd January 7 2016
.Dt CALC_TICKADJ 1calc_tickadjmdoc User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (calc_tickadj-opts.mdoc)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:34:02 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:26:28 PM by AutoGen 5.18.5
.\" From the definitions calc_tickadj-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/scripts/calc_tickadj/invoke-calc_tickadj.texi b/contrib/ntp/scripts/calc_tickadj/invoke-calc_tickadj.texi
index 2c66634..c78d53d 100644
--- a/contrib/ntp/scripts/calc_tickadj/invoke-calc_tickadj.texi
+++ b/contrib/ntp/scripts/calc_tickadj/invoke-calc_tickadj.texi
@@ -6,7 +6,7 @@
#
# EDIT THIS FILE WITH CAUTION (invoke-calc_tickadj.texi)
#
-# It has been AutoGen-ed October 21, 2015 at 12:34:04 PM by AutoGen 5.18.5
+# It has been AutoGen-ed January 7, 2016 at 11:26:30 PM by AutoGen 5.18.5
# From the definitions calc_tickadj-opts.def
# and the template file agtexi-cmd.tpl
@end ignore
diff --git a/contrib/ntp/scripts/invoke-plot_summary.texi b/contrib/ntp/scripts/invoke-plot_summary.texi
index 914c37b..93cc07a 100644
--- a/contrib/ntp/scripts/invoke-plot_summary.texi
+++ b/contrib/ntp/scripts/invoke-plot_summary.texi
@@ -6,7 +6,7 @@
#
# EDIT THIS FILE WITH CAUTION (invoke-plot_summary.texi)
#
-# It has been AutoGen-ed October 21, 2015 at 12:34:48 PM by AutoGen 5.18.5
+# It has been AutoGen-ed January 7, 2016 at 11:27:16 PM by AutoGen 5.18.5
# From the definitions plot_summary-opts.def
# and the template file agtexi-cmd.tpl
@end ignore
@@ -41,7 +41,7 @@ with a status code of 0.
@exampleindent 0
@example
-plot_summary - plot statistics generated by summary script - Ver. 4.2.8p4
+plot_summary - plot statistics generated by summary script - Ver. 4.2.8p5
USAGE: plot_summary [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]...
--directory=str Where the summary files are
diff --git a/contrib/ntp/scripts/invoke-summary.texi b/contrib/ntp/scripts/invoke-summary.texi
index dc0dca7..521a7ff 100644
--- a/contrib/ntp/scripts/invoke-summary.texi
+++ b/contrib/ntp/scripts/invoke-summary.texi
@@ -6,7 +6,7 @@
#
# EDIT THIS FILE WITH CAUTION (invoke-summary.texi)
#
-# It has been AutoGen-ed October 21, 2015 at 12:34:54 PM by AutoGen 5.18.5
+# It has been AutoGen-ed January 7, 2016 at 11:27:22 PM by AutoGen 5.18.5
# From the definitions summary-opts.def
# and the template file agtexi-cmd.tpl
@end ignore
@@ -42,7 +42,7 @@ with a status code of 0.
@exampleindent 0
@example
-summary - compute various stastics from NTP stat files - Ver. 4.2.8p4
+summary - compute various stastics from NTP stat files - Ver. 4.2.8p5
USAGE: summary [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]...
--directory=str Directory containing stat files
diff --git a/contrib/ntp/scripts/ntp-wait/invoke-ntp-wait.texi b/contrib/ntp/scripts/ntp-wait/invoke-ntp-wait.texi
index f626f33..f2de360 100644
--- a/contrib/ntp/scripts/ntp-wait/invoke-ntp-wait.texi
+++ b/contrib/ntp/scripts/ntp-wait/invoke-ntp-wait.texi
@@ -6,7 +6,7 @@
#
# EDIT THIS FILE WITH CAUTION (invoke-ntp-wait.texi)
#
-# It has been AutoGen-ed October 21, 2015 at 12:34:12 PM by AutoGen 5.18.5
+# It has been AutoGen-ed January 7, 2016 at 11:26:39 PM by AutoGen 5.18.5
# From the definitions ntp-wait-opts.def
# and the template file agtexi-cmd.tpl
@end ignore
@@ -61,7 +61,7 @@ with a status code of 0.
@exampleindent 0
@example
-ntp-wait - Wait for ntpd to stabilize the system clock - Ver. 4.2.8p4
+ntp-wait - Wait for ntpd to stabilize the system clock - Ver. 4.2.8p5
USAGE: ntp-wait [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]...
-n, --tries=num Number of times to check ntpd
diff --git a/contrib/ntp/scripts/ntp-wait/ntp-wait-opts b/contrib/ntp/scripts/ntp-wait/ntp-wait-opts
index e2e2897..24db0a3 100644
--- a/contrib/ntp/scripts/ntp-wait/ntp-wait-opts
+++ b/contrib/ntp/scripts/ntp-wait/ntp-wait-opts
@@ -1,6 +1,6 @@
# EDIT THIS FILE WITH CAUTION (ntp-wait-opts)
#
-# It has been AutoGen-ed October 21, 2015 at 12:34:06 PM by AutoGen 5.18.5
+# It has been AutoGen-ed January 7, 2016 at 11:26:33 PM by AutoGen 5.18.5
# From the definitions ntp-wait-opts.def
# and the template file perlopt
@@ -40,7 +40,7 @@ sub processOptions {
'help|?', 'more-help'));
$usage = <<'USAGE';
-ntp-wait - Wait for ntpd to stabilize the system clock - Ver. 4.2.8p4
+ntp-wait - Wait for ntpd to stabilize the system clock - Ver. 4.2.8p5
USAGE: ntp-wait [ -<flag> [<val>] | --<name>[{=| }<val>] ]...
-n, --tries=num Number of times to check ntpd
diff --git a/contrib/ntp/scripts/ntp-wait/ntp-wait.1ntp-waitman b/contrib/ntp/scripts/ntp-wait/ntp-wait.1ntp-waitman
index 5a0d3cc..b49cd94 100644
--- a/contrib/ntp/scripts/ntp-wait/ntp-wait.1ntp-waitman
+++ b/contrib/ntp/scripts/ntp-wait/ntp-wait.1ntp-waitman
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntp-wait 1ntp-waitman "21 Oct 2015" "ntp (4.2.8p4)" "User Commands"
+.TH ntp-wait 1ntp-waitman "07 Jan 2016" "ntp (4.2.8p5)" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-fzaONA/ag-rzaWMA)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-7OaOah/ag-iPaW_g)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:34:08 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:26:35 PM by AutoGen 5.18.5
.\" From the definitions ntp-wait-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/scripts/ntp-wait/ntp-wait.1ntp-waitmdoc b/contrib/ntp/scripts/ntp-wait/ntp-wait.1ntp-waitmdoc
index aedeec8..293bb0e 100644
--- a/contrib/ntp/scripts/ntp-wait/ntp-wait.1ntp-waitmdoc
+++ b/contrib/ntp/scripts/ntp-wait/ntp-wait.1ntp-waitmdoc
@@ -1,9 +1,9 @@
-.Dd October 21 2015
+.Dd January 7 2016
.Dt NTP_WAIT 1ntp-waitmdoc User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntp-wait-opts.mdoc)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:34:14 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:26:41 PM by AutoGen 5.18.5
.\" From the definitions ntp-wait-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/scripts/ntp-wait/ntp-wait.html b/contrib/ntp/scripts/ntp-wait/ntp-wait.html
index 1a9ca50..e8f08d4 100644
--- a/contrib/ntp/scripts/ntp-wait/ntp-wait.html
+++ b/contrib/ntp/scripts/ntp-wait/ntp-wait.html
@@ -39,7 +39,7 @@ until the system's time has stabilized and synchronized,
and only then start any applicaitons (like database servers) that require
accurate and stable time.
- <p>This document applies to version 4.2.8p4 of <code>ntp-wait</code>.
+ <p>This document applies to version 4.2.8p5 of <code>ntp-wait</code>.
<div class="shortcontents">
<h2>Short Contents</h2>
@@ -114,7 +114,7 @@ the usage text by passing it through a pager program.
used to select the program, defaulting to <span class="file">more</span>. Both will exit
with a status code of 0.
-<pre class="example">ntp-wait - Wait for ntpd to stabilize the system clock - Ver. 4.2.8p4
+<pre class="example">ntp-wait - Wait for ntpd to stabilize the system clock - Ver. 4.2.8p5
USAGE: ntp-wait [ -&lt;flag&gt; [&lt;val&gt;] | --&lt;name&gt;[{=| }&lt;val&gt;] ]...
-n, --tries=num Number of times to check ntpd
diff --git a/contrib/ntp/scripts/ntp-wait/ntp-wait.man.in b/contrib/ntp/scripts/ntp-wait/ntp-wait.man.in
index 12395fc..f7326de 100644
--- a/contrib/ntp/scripts/ntp-wait/ntp-wait.man.in
+++ b/contrib/ntp/scripts/ntp-wait/ntp-wait.man.in
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntp-wait @NTP_WAIT_MS@ "21 Oct 2015" "ntp (4.2.8p4)" "User Commands"
+.TH ntp-wait @NTP_WAIT_MS@ "07 Jan 2016" "ntp (4.2.8p5)" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-fzaONA/ag-rzaWMA)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-7OaOah/ag-iPaW_g)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:34:08 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:26:35 PM by AutoGen 5.18.5
.\" From the definitions ntp-wait-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/scripts/ntp-wait/ntp-wait.mdoc.in b/contrib/ntp/scripts/ntp-wait/ntp-wait.mdoc.in
index 0798282..d3562ba 100644
--- a/contrib/ntp/scripts/ntp-wait/ntp-wait.mdoc.in
+++ b/contrib/ntp/scripts/ntp-wait/ntp-wait.mdoc.in
@@ -1,9 +1,9 @@
-.Dd October 21 2015
+.Dd January 7 2016
.Dt NTP_WAIT @NTP_WAIT_MS@ User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntp-wait-opts.mdoc)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:34:14 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:26:41 PM by AutoGen 5.18.5
.\" From the definitions ntp-wait-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/scripts/ntpsweep/invoke-ntpsweep.texi b/contrib/ntp/scripts/ntpsweep/invoke-ntpsweep.texi
index 5a2112d..0556da8 100644
--- a/contrib/ntp/scripts/ntpsweep/invoke-ntpsweep.texi
+++ b/contrib/ntp/scripts/ntpsweep/invoke-ntpsweep.texi
@@ -6,7 +6,7 @@
#
# EDIT THIS FILE WITH CAUTION (invoke-ntpsweep.texi)
#
-# It has been AutoGen-ed October 21, 2015 at 12:34:18 PM by AutoGen 5.18.5
+# It has been AutoGen-ed January 7, 2016 at 11:26:45 PM by AutoGen 5.18.5
# From the definitions ntpsweep-opts.def
# and the template file agtexi-cmd.tpl
@end ignore
@@ -45,7 +45,7 @@ with a status code of 0.
@exampleindent 0
@example
-ntpsweep - Print various informations about given ntp servers - Ver. 4.2.8p4
+ntpsweep - Print various informations about given ntp servers - Ver. 4.2.8p5
USAGE: ntpsweep [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]... [hostfile]
-l, --host-list=str Host to execute actions on
diff --git a/contrib/ntp/scripts/ntpsweep/ntpsweep-opts b/contrib/ntp/scripts/ntpsweep/ntpsweep-opts
index 54d7f0d..2629d29 100644
--- a/contrib/ntp/scripts/ntpsweep/ntpsweep-opts
+++ b/contrib/ntp/scripts/ntpsweep/ntpsweep-opts
@@ -1,6 +1,6 @@
# EDIT THIS FILE WITH CAUTION (ntpsweep-opts)
#
-# It has been AutoGen-ed October 21, 2015 at 12:34:16 PM by AutoGen 5.18.5
+# It has been AutoGen-ed January 7, 2016 at 11:26:43 PM by AutoGen 5.18.5
# From the definitions ntpsweep-opts.def
# and the template file perlopt
@@ -43,7 +43,7 @@ sub processOptions {
'help|?', 'more-help'));
$usage = <<'USAGE';
-ntpsweep - Print various informations about given ntp servers - Ver. 4.2.8p4
+ntpsweep - Print various informations about given ntp servers - Ver. 4.2.8p5
USAGE: ntpsweep [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [hostfile]
-l, --host-list=str Host to execute actions on
diff --git a/contrib/ntp/scripts/ntpsweep/ntpsweep.1ntpsweepman b/contrib/ntp/scripts/ntpsweep/ntpsweep.1ntpsweepman
index 66deeba..0f61f64 100644
--- a/contrib/ntp/scripts/ntpsweep/ntpsweep.1ntpsweepman
+++ b/contrib/ntp/scripts/ntpsweep/ntpsweep.1ntpsweepman
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntpsweep 1ntpsweepman "21 Oct 2015" "ntp (4.2.8p4)" "User Commands"
+.TH ntpsweep 1ntpsweepman "07 Jan 2016" "ntp (4.2.8p5)" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-kqaGdC/ag-xqaOcC)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-eHaGCi/ag-rHaOBi)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:34:20 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:26:47 PM by AutoGen 5.18.5
.\" From the definitions ntpsweep-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/scripts/ntpsweep/ntpsweep.1ntpsweepmdoc b/contrib/ntp/scripts/ntpsweep/ntpsweep.1ntpsweepmdoc
index a0f7e87..6d0c357 100644
--- a/contrib/ntp/scripts/ntpsweep/ntpsweep.1ntpsweepmdoc
+++ b/contrib/ntp/scripts/ntpsweep/ntpsweep.1ntpsweepmdoc
@@ -1,9 +1,9 @@
-.Dd October 21 2015
+.Dd January 7 2016
.Dt NTPSWEEP 1ntpsweepmdoc User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntpsweep-opts.mdoc)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:34:23 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:26:50 PM by AutoGen 5.18.5
.\" From the definitions ntpsweep-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/scripts/ntpsweep/ntpsweep.html b/contrib/ntp/scripts/ntpsweep/ntpsweep.html
index fed2e2a..aba6b5f 100644
--- a/contrib/ntp/scripts/ntpsweep/ntpsweep.html
+++ b/contrib/ntp/scripts/ntpsweep/ntpsweep.html
@@ -30,7 +30,7 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#dir">(dir)</a>
<p>This document describes the use of the NTP Project's <code>ntpsweep</code> program.
- <p>This document applies to version 4.2.8p4 of <code>ntpsweep</code>.
+ <p>This document applies to version 4.2.8p5 of <code>ntpsweep</code>.
<div class="shortcontents">
<h2>Short Contents</h2>
@@ -90,7 +90,7 @@ the usage text by passing it through a pager program.
used to select the program, defaulting to <span class="file">more</span>. Both will exit
with a status code of 0.
-<pre class="example">ntpsweep - Print various informations about given ntp servers - Ver. 4.2.8p4
+<pre class="example">ntpsweep - Print various informations about given ntp servers - Ver. 4.2.8p5
USAGE: ntpsweep [ -&lt;flag&gt; [&lt;val&gt;] | --&lt;name&gt;[{=| }&lt;val&gt;] ]... [hostfile]
-l, --host-list=str Host to execute actions on
diff --git a/contrib/ntp/scripts/ntpsweep/ntpsweep.man.in b/contrib/ntp/scripts/ntpsweep/ntpsweep.man.in
index 66deeba..0f61f64 100644
--- a/contrib/ntp/scripts/ntpsweep/ntpsweep.man.in
+++ b/contrib/ntp/scripts/ntpsweep/ntpsweep.man.in
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntpsweep 1ntpsweepman "21 Oct 2015" "ntp (4.2.8p4)" "User Commands"
+.TH ntpsweep 1ntpsweepman "07 Jan 2016" "ntp (4.2.8p5)" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-kqaGdC/ag-xqaOcC)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-eHaGCi/ag-rHaOBi)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:34:20 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:26:47 PM by AutoGen 5.18.5
.\" From the definitions ntpsweep-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/scripts/ntpsweep/ntpsweep.mdoc.in b/contrib/ntp/scripts/ntpsweep/ntpsweep.mdoc.in
index a0f7e87..6d0c357 100644
--- a/contrib/ntp/scripts/ntpsweep/ntpsweep.mdoc.in
+++ b/contrib/ntp/scripts/ntpsweep/ntpsweep.mdoc.in
@@ -1,9 +1,9 @@
-.Dd October 21 2015
+.Dd January 7 2016
.Dt NTPSWEEP 1ntpsweepmdoc User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntpsweep-opts.mdoc)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:34:23 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:26:50 PM by AutoGen 5.18.5
.\" From the definitions ntpsweep-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/scripts/ntptrace/invoke-ntptrace.texi b/contrib/ntp/scripts/ntptrace/invoke-ntptrace.texi
index 4360728..29f48f4 100644
--- a/contrib/ntp/scripts/ntptrace/invoke-ntptrace.texi
+++ b/contrib/ntp/scripts/ntptrace/invoke-ntptrace.texi
@@ -6,7 +6,7 @@
#
# EDIT THIS FILE WITH CAUTION (invoke-ntptrace.texi)
#
-# It has been AutoGen-ed October 21, 2015 at 12:34:30 PM by AutoGen 5.18.5
+# It has been AutoGen-ed January 7, 2016 at 11:26:58 PM by AutoGen 5.18.5
# From the definitions ntptrace-opts.def
# and the template file agtexi-cmd.tpl
@end ignore
@@ -62,7 +62,7 @@ with a status code of 0.
@exampleindent 0
@example
-ntptrace - Trace peers of an NTP server - Ver. 4.2.8p4
+ntptrace - Trace peers of an NTP server - Ver. 4.2.8p5
USAGE: ntptrace [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]... [host]
-n, --numeric Print IP addresses instead of hostnames
diff --git a/contrib/ntp/scripts/ntptrace/ntptrace-opts b/contrib/ntp/scripts/ntptrace/ntptrace-opts
index d6dbc53..d1cecf8 100644
--- a/contrib/ntp/scripts/ntptrace/ntptrace-opts
+++ b/contrib/ntp/scripts/ntptrace/ntptrace-opts
@@ -1,6 +1,6 @@
# EDIT THIS FILE WITH CAUTION (ntptrace-opts)
#
-# It has been AutoGen-ed October 21, 2015 at 12:34:25 PM by AutoGen 5.18.5
+# It has been AutoGen-ed January 7, 2016 at 11:26:52 PM by AutoGen 5.18.5
# From the definitions ntptrace-opts.def
# and the template file perlopt
@@ -40,7 +40,7 @@ sub processOptions {
'help|?', 'more-help'));
$usage = <<'USAGE';
-ntptrace - Trace peers of an NTP server - Ver. 4.2.8p4
+ntptrace - Trace peers of an NTP server - Ver. 4.2.8p5
USAGE: ntptrace [ -<flag> [<val>] | --<name>[{=| }<val>] ]... [host]
-n, --numeric Print IP addresses instead of hostnames
diff --git a/contrib/ntp/scripts/ntptrace/ntptrace.1ntptraceman b/contrib/ntp/scripts/ntptrace/ntptrace.1ntptraceman
index c2362b7..33854e6 100644
--- a/contrib/ntp/scripts/ntptrace/ntptrace.1ntptraceman
+++ b/contrib/ntp/scripts/ntptrace/ntptrace.1ntptraceman
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntptrace 1ntptraceman "21 Oct 2015" "ntp (4.2.8p4)" "User Commands"
+.TH ntptrace 1ntptraceman "07 Jan 2016" "ntp (4.2.8p5)" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-h.aOvD/ag-u.aWuD)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-tqaWUj/ag-Gqa4Tj)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:34:27 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:26:54 PM by AutoGen 5.18.5
.\" From the definitions ntptrace-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/scripts/ntptrace/ntptrace.1ntptracemdoc b/contrib/ntp/scripts/ntptrace/ntptrace.1ntptracemdoc
index 1734bcc..eea1d62 100644
--- a/contrib/ntp/scripts/ntptrace/ntptrace.1ntptracemdoc
+++ b/contrib/ntp/scripts/ntptrace/ntptrace.1ntptracemdoc
@@ -1,9 +1,9 @@
-.Dd October 21 2015
+.Dd January 7 2016
.Dt NTPTRACE 1ntptracemdoc User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntptrace-opts.mdoc)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:34:32 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:27:00 PM by AutoGen 5.18.5
.\" From the definitions ntptrace-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/scripts/ntptrace/ntptrace.html b/contrib/ntp/scripts/ntptrace/ntptrace.html
index 4a4b746..fb96e71 100644
--- a/contrib/ntp/scripts/ntptrace/ntptrace.html
+++ b/contrib/ntp/scripts/ntptrace/ntptrace.html
@@ -31,7 +31,7 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#dir">(dir)</a>
<h2 class="unnumbered">Simple Network Time Protocol User Manual</h2>
<p>This document describes the use of the NTP Project's <code>ntptrace</code> program.
-This document applies to version 4.2.8p4 of <code>ntptrace</code>.
+This document applies to version 4.2.8p5 of <code>ntptrace</code>.
<div class="shortcontents">
<h2>Short Contents</h2>
@@ -107,7 +107,7 @@ the usage text by passing it through a pager program.
used to select the program, defaulting to <span class="file">more</span>. Both will exit
with a status code of 0.
-<pre class="example">ntptrace - Trace peers of an NTP server - Ver. 4.2.8p4
+<pre class="example">ntptrace - Trace peers of an NTP server - Ver. 4.2.8p5
USAGE: ntptrace [ -&lt;flag&gt; [&lt;val&gt;] | --&lt;name&gt;[{=| }&lt;val&gt;] ]... [host]
-n, --numeric Print IP addresses instead of hostnames
diff --git a/contrib/ntp/scripts/ntptrace/ntptrace.man.in b/contrib/ntp/scripts/ntptrace/ntptrace.man.in
index 5aca455..04c8c91 100644
--- a/contrib/ntp/scripts/ntptrace/ntptrace.man.in
+++ b/contrib/ntp/scripts/ntptrace/ntptrace.man.in
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntptrace @NTPTRACE_MS@ "21 Oct 2015" "ntp (4.2.8p4)" "User Commands"
+.TH ntptrace @NTPTRACE_MS@ "07 Jan 2016" "ntp (4.2.8p5)" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-h.aOvD/ag-u.aWuD)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-tqaWUj/ag-Gqa4Tj)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:34:27 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:26:54 PM by AutoGen 5.18.5
.\" From the definitions ntptrace-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/scripts/ntptrace/ntptrace.mdoc.in b/contrib/ntp/scripts/ntptrace/ntptrace.mdoc.in
index 34be2a5..6e8b389 100644
--- a/contrib/ntp/scripts/ntptrace/ntptrace.mdoc.in
+++ b/contrib/ntp/scripts/ntptrace/ntptrace.mdoc.in
@@ -1,9 +1,9 @@
-.Dd October 21 2015
+.Dd January 7 2016
.Dt NTPTRACE @NTPTRACE_MS@ User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntptrace-opts.mdoc)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:34:32 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:27:00 PM by AutoGen 5.18.5
.\" From the definitions ntptrace-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/scripts/plot_summary-opts b/contrib/ntp/scripts/plot_summary-opts
index 2cb86c4..28ea583 100644
--- a/contrib/ntp/scripts/plot_summary-opts
+++ b/contrib/ntp/scripts/plot_summary-opts
@@ -1,6 +1,6 @@
# EDIT THIS FILE WITH CAUTION (plot_summary-opts)
#
-# It has been AutoGen-ed October 21, 2015 at 12:34:45 PM by AutoGen 5.18.5
+# It has been AutoGen-ed January 7, 2016 at 11:27:12 PM by AutoGen 5.18.5
# From the definitions plot_summary-opts.def
# and the template file perlopt
@@ -46,7 +46,7 @@ sub processOptions {
'help|?', 'more-help'));
$usage = <<'USAGE';
-plot_summary - plot statistics generated by summary script - Ver. 4.2.8p4
+plot_summary - plot statistics generated by summary script - Ver. 4.2.8p5
USAGE: plot_summary [ -<flag> [<val>] | --<name>[{=| }<val>] ]...
--directory=str Where the summary files are
diff --git a/contrib/ntp/scripts/plot_summary.1plot_summaryman b/contrib/ntp/scripts/plot_summary.1plot_summaryman
index fea03df..9094f8e 100644
--- a/contrib/ntp/scripts/plot_summary.1plot_summaryman
+++ b/contrib/ntp/scripts/plot_summary.1plot_summaryman
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH plot_summary 1plot_summaryman "21 Oct 2015" "ntp (4.2.8p4)" "User Commands"
+.TH plot_summary 1plot_summaryman "07 Jan 2016" "ntp (4.2.8p5)" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-EXaylG/ag-RXaGkG)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-xiaqKm/ag-KiayJm)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:34:51 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:27:18 PM by AutoGen 5.18.5
.\" From the definitions plot_summary-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/scripts/plot_summary.1plot_summarymdoc b/contrib/ntp/scripts/plot_summary.1plot_summarymdoc
index 0eff78f..99c5d8c 100644
--- a/contrib/ntp/scripts/plot_summary.1plot_summarymdoc
+++ b/contrib/ntp/scripts/plot_summary.1plot_summarymdoc
@@ -1,9 +1,9 @@
-.Dd October 21 2015
+.Dd January 7 2016
.Dt PLOT_SUMMARY 1plot_summarymdoc User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (plot_summary-opts.mdoc)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:34:53 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:27:20 PM by AutoGen 5.18.5
.\" From the definitions plot_summary-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/scripts/plot_summary.html b/contrib/ntp/scripts/plot_summary.html
index 7f0a594..3cb2ed4 100644
--- a/contrib/ntp/scripts/plot_summary.html
+++ b/contrib/ntp/scripts/plot_summary.html
@@ -31,7 +31,7 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#dir">(dir)</a>
<h2 class="unnumbered">Plot_summary User Manual</h2>
<p>This document describes the use of the NTP Project's <code>plot_summary</code> program.
-This document applies to version 4.2.8p4 of <code>plot_summary</code>.
+This document applies to version 4.2.8p5 of <code>plot_summary</code>.
<div class="shortcontents">
<h2>Short Contents</h2>
@@ -89,7 +89,7 @@ the usage text by passing it through a pager program.
used to select the program, defaulting to <span class="file">more</span>. Both will exit
with a status code of 0.
-<pre class="example">plot_summary - plot statistics generated by summary script - Ver. 4.2.8p4
+<pre class="example">plot_summary - plot statistics generated by summary script - Ver. 4.2.8p5
USAGE: plot_summary [ -&lt;flag&gt; [&lt;val&gt;] | --&lt;name&gt;[{=| }&lt;val&gt;] ]...
--directory=str Where the summary files are
diff --git a/contrib/ntp/scripts/plot_summary.man.in b/contrib/ntp/scripts/plot_summary.man.in
index fea03df..9094f8e 100644
--- a/contrib/ntp/scripts/plot_summary.man.in
+++ b/contrib/ntp/scripts/plot_summary.man.in
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH plot_summary 1plot_summaryman "21 Oct 2015" "ntp (4.2.8p4)" "User Commands"
+.TH plot_summary 1plot_summaryman "07 Jan 2016" "ntp (4.2.8p5)" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-EXaylG/ag-RXaGkG)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-xiaqKm/ag-KiayJm)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:34:51 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:27:18 PM by AutoGen 5.18.5
.\" From the definitions plot_summary-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/scripts/plot_summary.mdoc.in b/contrib/ntp/scripts/plot_summary.mdoc.in
index 0eff78f..99c5d8c 100644
--- a/contrib/ntp/scripts/plot_summary.mdoc.in
+++ b/contrib/ntp/scripts/plot_summary.mdoc.in
@@ -1,9 +1,9 @@
-.Dd October 21 2015
+.Dd January 7 2016
.Dt PLOT_SUMMARY 1plot_summarymdoc User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (plot_summary-opts.mdoc)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:34:53 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:27:20 PM by AutoGen 5.18.5
.\" From the definitions plot_summary-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/scripts/summary-opts b/contrib/ntp/scripts/summary-opts
index 22f2c49..47661ee 100644
--- a/contrib/ntp/scripts/summary-opts
+++ b/contrib/ntp/scripts/summary-opts
@@ -1,6 +1,6 @@
# EDIT THIS FILE WITH CAUTION (summary-opts)
#
-# It has been AutoGen-ed October 21, 2015 at 12:34:47 PM by AutoGen 5.18.5
+# It has been AutoGen-ed January 7, 2016 at 11:27:14 PM by AutoGen 5.18.5
# From the definitions summary-opts.def
# and the template file perlopt
@@ -44,7 +44,7 @@ sub processOptions {
'help|?', 'more-help'));
$usage = <<'USAGE';
-summary - compute various stastics from NTP stat files - Ver. 4.2.8p4
+summary - compute various stastics from NTP stat files - Ver. 4.2.8p5
USAGE: summary [ -<flag> [<val>] | --<name>[{=| }<val>] ]...
--directory=str Directory containing stat files
diff --git a/contrib/ntp/scripts/summary.1summaryman b/contrib/ntp/scripts/summary.1summaryman
index 65b0eec..0573b11 100644
--- a/contrib/ntp/scripts/summary.1summaryman
+++ b/contrib/ntp/scripts/summary.1summaryman
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH summary 1summaryman "21 Oct 2015" "ntp (4.2.8p4)" "User Commands"
+.TH summary 1summaryman "07 Jan 2016" "ntp (4.2.8p5)" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-ghaazG/ag-shaiyG)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-.Ca4Xm/ag-lDaaXm)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:34:56 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:27:24 PM by AutoGen 5.18.5
.\" From the definitions summary-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/scripts/summary.1summarymdoc b/contrib/ntp/scripts/summary.1summarymdoc
index 8bb1dfb..5e28a57 100644
--- a/contrib/ntp/scripts/summary.1summarymdoc
+++ b/contrib/ntp/scripts/summary.1summarymdoc
@@ -1,9 +1,9 @@
-.Dd October 21 2015
+.Dd January 7 2016
.Dt SUMMARY 1summarymdoc User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (summary-opts.mdoc)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:34:58 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:27:25 PM by AutoGen 5.18.5
.\" From the definitions summary-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/scripts/summary.html b/contrib/ntp/scripts/summary.html
index 1329905..566531e 100644
--- a/contrib/ntp/scripts/summary.html
+++ b/contrib/ntp/scripts/summary.html
@@ -31,7 +31,7 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#dir">(dir)</a>
<h2 class="unnumbered">Summary User Manual</h2>
<p>This document describes the use of the NTP Project's <code>summary</code> program.
-This document applies to version 4.2.8p4 of <code>summary</code>.
+This document applies to version 4.2.8p5 of <code>summary</code>.
<div class="shortcontents">
<h2>Short Contents</h2>
@@ -88,7 +88,7 @@ the usage text by passing it through a pager program.
used to select the program, defaulting to <span class="file">more</span>. Both will exit
with a status code of 0.
-<pre class="example">summary - compute various stastics from NTP stat files - Ver. 4.2.8p4
+<pre class="example">summary - compute various stastics from NTP stat files - Ver. 4.2.8p5
USAGE: summary [ -&lt;flag&gt; [&lt;val&gt;] | --&lt;name&gt;[{=| }&lt;val&gt;] ]...
--directory=str Directory containing stat files
diff --git a/contrib/ntp/scripts/summary.man.in b/contrib/ntp/scripts/summary.man.in
index 65b0eec..0573b11 100644
--- a/contrib/ntp/scripts/summary.man.in
+++ b/contrib/ntp/scripts/summary.man.in
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH summary 1summaryman "21 Oct 2015" "ntp (4.2.8p4)" "User Commands"
+.TH summary 1summaryman "07 Jan 2016" "ntp (4.2.8p5)" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-ghaazG/ag-shaiyG)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-.Ca4Xm/ag-lDaaXm)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:34:56 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:27:24 PM by AutoGen 5.18.5
.\" From the definitions summary-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/scripts/summary.mdoc.in b/contrib/ntp/scripts/summary.mdoc.in
index 8bb1dfb..5e28a57 100644
--- a/contrib/ntp/scripts/summary.mdoc.in
+++ b/contrib/ntp/scripts/summary.mdoc.in
@@ -1,9 +1,9 @@
-.Dd October 21 2015
+.Dd January 7 2016
.Dt SUMMARY 1summarymdoc User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (summary-opts.mdoc)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:34:58 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:27:25 PM by AutoGen 5.18.5
.\" From the definitions summary-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/scripts/update-leap/invoke-update-leap.texi b/contrib/ntp/scripts/update-leap/invoke-update-leap.texi
index da6df52..4231979 100644
--- a/contrib/ntp/scripts/update-leap/invoke-update-leap.texi
+++ b/contrib/ntp/scripts/update-leap/invoke-update-leap.texi
@@ -6,7 +6,7 @@
#
# EDIT THIS FILE WITH CAUTION (invoke-update-leap.texi)
#
-# It has been AutoGen-ed October 21, 2015 at 12:34:38 PM by AutoGen 5.18.5
+# It has been AutoGen-ed January 7, 2016 at 11:27:05 PM by AutoGen 5.18.5
# From the definitions update-leap-opts.def
# and the template file agtexi-cmd.tpl
@end ignore
diff --git a/contrib/ntp/scripts/update-leap/update-leap-opts b/contrib/ntp/scripts/update-leap/update-leap-opts
index debf333..506a746 100644
--- a/contrib/ntp/scripts/update-leap/update-leap-opts
+++ b/contrib/ntp/scripts/update-leap/update-leap-opts
@@ -1,6 +1,6 @@
# EDIT THIS FILE WITH CAUTION (update-leap-opts)
#
-# It has been AutoGen-ed October 21, 2015 at 12:34:44 PM by AutoGen 5.18.5
+# It has been AutoGen-ed January 7, 2016 at 11:27:11 PM by AutoGen 5.18.5
# From the definitions update-leap-opts.def
# and the template file perlopt
@@ -46,7 +46,7 @@ sub processOptions {
'help|?', 'more-help'));
$usage = <<'USAGE';
-update-leap - leap-seconds file manager/updater - Ver. 4.2.8p4
+update-leap - leap-seconds file manager/updater - Ver. 4.2.8p5
USAGE: update-leap [ -<flag> [<val>] | --<name>[{=| }<val>] ]...
-s, --source-url=str The URL of the master copy of the leapseconds file
diff --git a/contrib/ntp/scripts/update-leap/update-leap.1update-leapman b/contrib/ntp/scripts/update-leap/update-leap.1update-leapman
index dbe113c..4fdf467 100644
--- a/contrib/ntp/scripts/update-leap/update-leap.1update-leapman
+++ b/contrib/ntp/scripts/update-leap/update-leap.1update-leapman
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH update-leap 1update-leapman "21 Oct 2015" "ntp (4.2.8p4)" "User Commands"
+.TH update-leap 1update-leapman "07 Jan 2016" "ntp (4.2.8p5)" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-tXaylE/ag-FXaGkE)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-9hayKk/ag-kiaGJk)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:34:34 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:27:02 PM by AutoGen 5.18.5
.\" From the definitions update-leap-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/scripts/update-leap/update-leap.1update-leapmdoc b/contrib/ntp/scripts/update-leap/update-leap.1update-leapmdoc
index cfbe34a..8827df7 100644
--- a/contrib/ntp/scripts/update-leap/update-leap.1update-leapmdoc
+++ b/contrib/ntp/scripts/update-leap/update-leap.1update-leapmdoc
@@ -1,9 +1,9 @@
-.Dd October 21 2015
+.Dd January 7 2016
.Dt UPDATE_LEAP 1update-leapmdoc User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (update-leap-opts.mdoc)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:34:42 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:27:10 PM by AutoGen 5.18.5
.\" From the definitions update-leap-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/scripts/update-leap/update-leap.html b/contrib/ntp/scripts/update-leap/update-leap.html
index bea57b8..a7d2a70 100644
--- a/contrib/ntp/scripts/update-leap/update-leap.html
+++ b/contrib/ntp/scripts/update-leap/update-leap.html
@@ -30,7 +30,7 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#dir">(dir)</a>
<p>This document describes the use of the NTP Project's <code>update-leap</code> program.
- <p>This document applies to version 4.2.8p4 of <code>update-leap</code>.
+ <p>This document applies to version 4.2.8p5 of <code>update-leap</code>.
<div class="shortcontents">
<h2>Short Contents</h2>
diff --git a/contrib/ntp/scripts/update-leap/update-leap.man.in b/contrib/ntp/scripts/update-leap/update-leap.man.in
index dbe113c..4fdf467 100644
--- a/contrib/ntp/scripts/update-leap/update-leap.man.in
+++ b/contrib/ntp/scripts/update-leap/update-leap.man.in
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH update-leap 1update-leapman "21 Oct 2015" "ntp (4.2.8p4)" "User Commands"
+.TH update-leap 1update-leapman "07 Jan 2016" "ntp (4.2.8p5)" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-tXaylE/ag-FXaGkE)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-9hayKk/ag-kiaGJk)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:34:34 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:27:02 PM by AutoGen 5.18.5
.\" From the definitions update-leap-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/scripts/update-leap/update-leap.mdoc.in b/contrib/ntp/scripts/update-leap/update-leap.mdoc.in
index cfbe34a..8827df7 100644
--- a/contrib/ntp/scripts/update-leap/update-leap.mdoc.in
+++ b/contrib/ntp/scripts/update-leap/update-leap.mdoc.in
@@ -1,9 +1,9 @@
-.Dd October 21 2015
+.Dd January 7 2016
.Dt UPDATE_LEAP 1update-leapmdoc User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (update-leap-opts.mdoc)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:34:42 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:27:10 PM by AutoGen 5.18.5
.\" From the definitions update-leap-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/sntp/configure b/contrib/ntp/sntp/configure
index 74d0587..ce397ef 100755
--- a/contrib/ntp/sntp/configure
+++ b/contrib/ntp/sntp/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for sntp 4.2.8p4.
+# Generated by GNU Autoconf 2.69 for sntp 4.2.8p5.
#
# Report bugs to <http://bugs.ntp.org./>.
#
@@ -590,8 +590,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='sntp'
PACKAGE_TARNAME='sntp'
-PACKAGE_VERSION='4.2.8p4'
-PACKAGE_STRING='sntp 4.2.8p4'
+PACKAGE_VERSION='4.2.8p5'
+PACKAGE_STRING='sntp 4.2.8p5'
PACKAGE_BUGREPORT='http://bugs.ntp.org./'
PACKAGE_URL='http://www.ntp.org./'
@@ -1491,7 +1491,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures sntp 4.2.8p4 to adapt to many kinds of systems.
+\`configure' configures sntp 4.2.8p5 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1561,7 +1561,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of sntp 4.2.8p4:";;
+ short | recursive ) echo "Configuration of sntp 4.2.8p5:";;
esac
cat <<\_ACEOF
@@ -1706,7 +1706,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-sntp configure 4.2.8p4
+sntp configure 4.2.8p5
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2536,7 +2536,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by sntp $as_me 4.2.8p4, which was
+It was created by sntp $as_me 4.2.8p5, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -3533,7 +3533,7 @@ fi
# Define the identity of the package.
PACKAGE='sntp'
- VERSION='4.2.8p4'
+ VERSION='4.2.8p5'
cat >>confdefs.h <<_ACEOF
@@ -25155,9 +25155,10 @@ $as_echo "$as_me: Using the installed libevent" >&6;}
# LDADD_LIBEVENT=`$PKG_CONFIG --libs libevent | sed 's:-levent::'`
# So now we dance...
LDADD_LIBEVENT=
- for i in `$PKG_CONFIG --libs libevent`
+ for i in `$PKG_CONFIG --libs libevent` `$PKG_CONFIG --cflags-only-other libevent_pthreads`
do
case "$i" in
+ -D*) ;;
-levent*) ;;
*) case "$LDADD_LIBEVENT" in
'') LDADD_LIBEVENT="$i" ;;
@@ -31109,7 +31110,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by sntp $as_me 4.2.8p4, which was
+This file was extended by sntp $as_me 4.2.8p5, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -31176,7 +31177,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-sntp config.status 4.2.8p4
+sntp config.status 4.2.8p5
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/contrib/ntp/sntp/include/version.def b/contrib/ntp/sntp/include/version.def
index 9f1ca6b..ddc02d4 100644
--- a/contrib/ntp/sntp/include/version.def
+++ b/contrib/ntp/sntp/include/version.def
@@ -1 +1 @@
-version = '4.2.8p4';
+version = '4.2.8p5';
diff --git a/contrib/ntp/sntp/include/version.texi b/contrib/ntp/sntp/include/version.texi
index 64f037b..28b9357 100644
--- a/contrib/ntp/sntp/include/version.texi
+++ b/contrib/ntp/sntp/include/version.texi
@@ -1,3 +1,3 @@
-@set UPDATED 21 October 2015
-@set EDITION 4.2.8p4
-@set VERSION 4.2.8p4
+@set UPDATED 07 January 2016
+@set EDITION 4.2.8p5
+@set VERSION 4.2.8p5
diff --git a/contrib/ntp/sntp/invoke-sntp.texi b/contrib/ntp/sntp/invoke-sntp.texi
index 9a726fa..6ca3b06 100644
--- a/contrib/ntp/sntp/invoke-sntp.texi
+++ b/contrib/ntp/sntp/invoke-sntp.texi
@@ -6,7 +6,7 @@
#
# EDIT THIS FILE WITH CAUTION (invoke-sntp.texi)
#
-# It has been AutoGen-ed October 21, 2015 at 12:30:56 PM by AutoGen 5.18.5
+# It has been AutoGen-ed January 7, 2016 at 11:23:24 PM by AutoGen 5.18.5
# From the definitions sntp-opts.def
# and the template file agtexi-cmd.tpl
@end ignore
@@ -101,7 +101,7 @@ with a status code of 0.
@exampleindent 0
@example
-sntp - standard Simple Network Time Protocol client program - Ver. 4.2.8p4
+sntp - standard Simple Network Time Protocol client program - Ver. 4.2.8p5
Usage: sntp [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]... \
[ hostname-or-IP ...]
Flg Arg Option-Name Description
diff --git a/contrib/ntp/sntp/m4/ntp_libevent.m4 b/contrib/ntp/sntp/m4/ntp_libevent.m4
index 895360e..a465d9b 100644
--- a/contrib/ntp/sntp/m4/ntp_libevent.m4
+++ b/contrib/ntp/sntp/m4/ntp_libevent.m4
@@ -89,9 +89,10 @@ case "$ntp_use_local_libevent" in
# LDADD_LIBEVENT=`$PKG_CONFIG --libs libevent | sed 's:-levent::'`
# So now we dance...
LDADD_LIBEVENT=
- for i in `$PKG_CONFIG --libs libevent`
+ for i in `$PKG_CONFIG --libs libevent` `$PKG_CONFIG --cflags-only-other libevent_pthreads`
do
case "$i" in
+ -D*) ;;
-levent*) ;;
*) case "$LDADD_LIBEVENT" in
'') LDADD_LIBEVENT="$i" ;;
diff --git a/contrib/ntp/sntp/m4/ntp_problemtests.m4 b/contrib/ntp/sntp/m4/ntp_problemtests.m4
index 4596e85..7cc14c9 100644
--- a/contrib/ntp/sntp/m4/ntp_problemtests.m4
+++ b/contrib/ntp/sntp/m4/ntp_problemtests.m4
@@ -28,8 +28,9 @@ AC_MSG_RESULT([$ntp_ept])
AC_MSG_CHECKING([if we can run test-ntp_restrict])
ntp_test_ntp_restrict="no"
case "$ntp_ept:$cross:$host" in
+ no:0:*-*-freebsd6.4) ;;
+ no:0:*-*-hpux11.23*) ;;
no:0:*-*-solaris*) ;;
- no:0:*-*-hpux-11.23*) ;;
*) ntp_test_ntp_restrict="yes" ;;
esac
AC_MSG_RESULT([$ntp_test_ntp_restrict])
@@ -38,6 +39,7 @@ AM_CONDITIONAL([BUILD_TEST_NTP_RESTRICT], [test x$ntp_test_ntp_restrict = xyes])
AC_MSG_CHECKING([if we can run test-ntp_scanner])
ntp_test_ntp_scanner="no"
case "$ntp_ept:$cross:$host" in
+ no:0:*-*-freebsd6.4) ;;
no:0:*-*-solaris*) ;;
*) ntp_test_ntp_scanner="yes" ;;
esac
@@ -47,6 +49,7 @@ AM_CONDITIONAL([BUILD_TEST_NTP_SCANNER], [test x$ntp_test_ntp_scanner = xyes])
AC_MSG_CHECKING([if we can run test-ntp_signd])
ntp_test_ntp_signd="no"
case "$ntp_ept:$cross:$host" in
+ no:0:*-*-freebsd6.4) ;;
no:0:*-*-solaris*) ;;
*) ntp_test_ntp_signd="yes" ;;
esac
diff --git a/contrib/ntp/sntp/m4/version.m4 b/contrib/ntp/sntp/m4/version.m4
index 7d51426..b8f98b5 100644
--- a/contrib/ntp/sntp/m4/version.m4
+++ b/contrib/ntp/sntp/m4/version.m4
@@ -1 +1 @@
-m4_define([VERSION_NUMBER],[4.2.8p4])
+m4_define([VERSION_NUMBER],[4.2.8p5])
diff --git a/contrib/ntp/sntp/networking.c b/contrib/ntp/sntp/networking.c
index ddd45ef..6a176c5 100644
--- a/contrib/ntp/sntp/networking.c
+++ b/contrib/ntp/sntp/networking.c
@@ -136,7 +136,7 @@ process_pkt (
return PACKET_UNUSEABLE;
}
/* Note: pkt_len must be a multiple of 4 at this point! */
- packet_end = (u_int32*)((char*)rpkt + pkt_len);
+ packet_end = (void*)((char*)rpkt + pkt_len);
exten_end = skip_efields(rpkt->exten, packet_end);
if (NULL == exten_end) {
msyslog(LOG_ERR,
diff --git a/contrib/ntp/sntp/sntp-opts.c b/contrib/ntp/sntp/sntp-opts.c
index e46a80c..69fb786 100644
--- a/contrib/ntp/sntp/sntp-opts.c
+++ b/contrib/ntp/sntp/sntp-opts.c
@@ -1,7 +1,7 @@
/*
* EDIT THIS FILE WITH CAUTION (sntp-opts.c)
*
- * It has been AutoGen-ed October 21, 2015 at 12:30:23 PM by AutoGen 5.18.5
+ * It has been AutoGen-ed January 7, 2016 at 11:22:49 PM by AutoGen 5.18.5
* From the definitions sntp-opts.def
* and the template file options
*
@@ -70,7 +70,7 @@ extern FILE * option_usage_fp;
* static const strings for sntp options
*/
static char const sntp_opt_strs[2549] =
-/* 0 */ "sntp 4.2.8p4\n"
+/* 0 */ "sntp 4.2.8p5\n"
"Copyright (C) 1992-2015 The University of Delaware and Network Time Foundation, all rights reserved.\n"
"This is free software. It is licensed for use, modification and\n"
"redistribution under the terms of the NTP License, copies of which\n"
@@ -155,7 +155,7 @@ static char const sntp_opt_strs[2549] =
/* 2298 */ "LOAD_OPTS\0"
/* 2308 */ "no-load-opts\0"
/* 2321 */ "SNTP\0"
-/* 2326 */ "sntp - standard Simple Network Time Protocol client program - Ver. 4.2.8p4\n"
+/* 2326 */ "sntp - standard Simple Network Time Protocol client program - Ver. 4.2.8p5\n"
"Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \\\n"
"\t\t[ hostname-or-IP ...]\n\0"
/* 2485 */ "$HOME\0"
@@ -163,7 +163,7 @@ static char const sntp_opt_strs[2549] =
/* 2493 */ ".ntprc\0"
/* 2500 */ "http://bugs.ntp.org, bugs@ntp.org\0"
/* 2534 */ "\n\0"
-/* 2536 */ "sntp 4.2.8p4";
+/* 2536 */ "sntp 4.2.8p5";
/**
* ipv4 option description with
@@ -1173,7 +1173,7 @@ static void bogus_function(void) {
translate option names.
*/
/* referenced via sntpOptions.pzCopyright */
- puts(_("sntp 4.2.8p4\n\
+ puts(_("sntp 4.2.8p5\n\
Copyright (C) 1992-2015 The University of Delaware and Network Time Foundation, all rights reserved.\n\
This is free software. It is licensed for use, modification and\n\
redistribution under the terms of the NTP License, copies of which\n\
@@ -1263,7 +1263,7 @@ implied warranty.\n"));
puts(_("load options from a config file"));
/* referenced via sntpOptions.pzUsageTitle */
- puts(_("sntp - standard Simple Network Time Protocol client program - Ver. 4.2.8p4\n\
+ puts(_("sntp - standard Simple Network Time Protocol client program - Ver. 4.2.8p5\n\
Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \\\n\
\t\t[ hostname-or-IP ...]\n"));
@@ -1271,7 +1271,7 @@ Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \\\n\
puts(_("\n"));
/* referenced via sntpOptions.pzFullVersion */
- puts(_("sntp 4.2.8p4"));
+ puts(_("sntp 4.2.8p5"));
/* referenced via sntpOptions.pzFullUsage */
puts(_("<<<NOT-FOUND>>>"));
diff --git a/contrib/ntp/sntp/sntp-opts.h b/contrib/ntp/sntp/sntp-opts.h
index 895421e..78951ab 100644
--- a/contrib/ntp/sntp/sntp-opts.h
+++ b/contrib/ntp/sntp/sntp-opts.h
@@ -1,7 +1,7 @@
/*
* EDIT THIS FILE WITH CAUTION (sntp-opts.h)
*
- * It has been AutoGen-ed October 21, 2015 at 12:30:22 PM by AutoGen 5.18.5
+ * It has been AutoGen-ed January 7, 2016 at 11:22:48 PM by AutoGen 5.18.5
* From the definitions sntp-opts.def
* and the template file options
*
@@ -91,9 +91,9 @@ typedef enum {
/** count of all options for sntp */
#define OPTION_CT 23
/** sntp version */
-#define SNTP_VERSION "4.2.8p4"
+#define SNTP_VERSION "4.2.8p5"
/** Full sntp version text */
-#define SNTP_FULL_VERSION "sntp 4.2.8p4"
+#define SNTP_FULL_VERSION "sntp 4.2.8p5"
/**
* Interface defines for all options. Replace "n" with the UPPER_CASED
diff --git a/contrib/ntp/sntp/sntp.1sntpman b/contrib/ntp/sntp/sntp.1sntpman
index 89facc6..792fc52 100644
--- a/contrib/ntp/sntp/sntp.1sntpman
+++ b/contrib/ntp/sntp/sntp.1sntpman
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH sntp 1sntpman "21 Oct 2015" "4.2.8p4" "User Commands"
+.TH sntp 1sntpman "07 Jan 2016" "4.2.8p5" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-hEaqbg/ag-UEaiag)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-e.aO3S/ag-r.aG2S)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:30:52 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:23:20 PM by AutoGen 5.18.5
.\" From the definitions sntp-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/sntp/sntp.1sntpmdoc b/contrib/ntp/sntp/sntp.1sntpmdoc
index b1b3940..8005e9a 100644
--- a/contrib/ntp/sntp/sntp.1sntpmdoc
+++ b/contrib/ntp/sntp/sntp.1sntpmdoc
@@ -1,9 +1,9 @@
-.Dd October 21 2015
+.Dd January 7 2016
.Dt SNTP 1sntpmdoc User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (sntp-opts.mdoc)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:30:59 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:23:27 PM by AutoGen 5.18.5
.\" From the definitions sntp-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/sntp/sntp.html b/contrib/ntp/sntp/sntp.html
index 5ea532e..6aa66fb 100644
--- a/contrib/ntp/sntp/sntp.html
+++ b/contrib/ntp/sntp/sntp.html
@@ -36,7 +36,7 @@ display the time offset of the system clock relative to the server
clock. Run as root, it can correct the system clock to this offset as
well. It can be run as an interactive command or from a cron job.
- <p>This document applies to version 4.2.8p4 of <code>sntp</code>.
+ <p>This document applies to version 4.2.8p5 of <code>sntp</code>.
<p>The program implements the SNTP protocol as defined by RFC 5905, the NTPv4
IETF specification.
@@ -176,7 +176,7 @@ the usage text by passing it through a pager program.
used to select the program, defaulting to <span class="file">more</span>. Both will exit
with a status code of 0.
-<pre class="example">sntp - standard Simple Network Time Protocol client program - Ver. 4.2.8p4
+<pre class="example">sntp - standard Simple Network Time Protocol client program - Ver. 4.2.8p5
Usage: sntp [ -&lt;flag&gt; [&lt;val&gt;] | --&lt;name&gt;[{=| }&lt;val&gt;] ]... \
[ hostname-or-IP ...]
Flg Arg Option-Name Description
diff --git a/contrib/ntp/sntp/sntp.man.in b/contrib/ntp/sntp/sntp.man.in
index 84afa7e..1d5e571 100644
--- a/contrib/ntp/sntp/sntp.man.in
+++ b/contrib/ntp/sntp/sntp.man.in
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH sntp @SNTP_MS@ "21 Oct 2015" "4.2.8p4" "User Commands"
+.TH sntp @SNTP_MS@ "07 Jan 2016" "4.2.8p5" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-hEaqbg/ag-UEaiag)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-e.aO3S/ag-r.aG2S)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:30:52 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:23:20 PM by AutoGen 5.18.5
.\" From the definitions sntp-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/sntp/sntp.mdoc.in b/contrib/ntp/sntp/sntp.mdoc.in
index 0313e5e..5168a99 100644
--- a/contrib/ntp/sntp/sntp.mdoc.in
+++ b/contrib/ntp/sntp/sntp.mdoc.in
@@ -1,9 +1,9 @@
-.Dd October 21 2015
+.Dd January 7 2016
.Dt SNTP @SNTP_MS@ User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (sntp-opts.mdoc)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:30:59 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:23:27 PM by AutoGen 5.18.5
.\" From the definitions sntp-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/sntp/tests/keyFile.c b/contrib/ntp/sntp/tests/keyFile.c
index 77dfee7..883658a 100644
--- a/contrib/ntp/sntp/tests/keyFile.c
+++ b/contrib/ntp/sntp/tests/keyFile.c
@@ -62,20 +62,27 @@ CompareKeysAlternative(int key_id,
void
test_ReadEmptyKeyFile(void) {
struct key* keys = NULL;
+ const char *path = CreatePath("key-test-empty", INPUT_DIR);
- TEST_ASSERT_EQUAL(0, auth_init(CreatePath("key-test-empty", INPUT_DIR), &keys));
+ TEST_ASSERT_NOT_NULL(path);
+ TEST_ASSERT_EQUAL(0, auth_init(path, &keys));
TEST_ASSERT_NULL(keys);
+
+ free((void *)path);
}
void
test_ReadASCIIKeys(void) {
struct key* keys = NULL;
+ const char *path = CreatePath("key-test-ascii", INPUT_DIR);
- TEST_ASSERT_EQUAL(2, auth_init(CreatePath("key-test-ascii", INPUT_DIR), &keys));
-
+ TEST_ASSERT_NOT_NULL(path);
+ TEST_ASSERT_EQUAL(2, auth_init(path, &keys));
TEST_ASSERT_NOT_NULL(keys);
+ free((void *)path);
+
struct key* result = NULL;
get_key(40, &result);
TEST_ASSERT_NOT_NULL(result);
@@ -91,10 +98,12 @@ test_ReadASCIIKeys(void) {
void
test_ReadHexKeys(void) {
struct key* keys = NULL;
+ const char *path = CreatePath("key-test-hex", INPUT_DIR);
- TEST_ASSERT_EQUAL(3, auth_init(CreatePath("key-test-hex", INPUT_DIR), &keys));
-
+ TEST_ASSERT_NOT_NULL(path);
+ TEST_ASSERT_EQUAL(3, auth_init(path, &keys));
TEST_ASSERT_NOT_NULL(keys);
+ free((void *)path);
struct key* result = NULL;
get_key(10, &result);
@@ -119,10 +128,12 @@ test_ReadHexKeys(void) {
void
test_ReadKeyFileWithComments(void) {
struct key* keys = NULL;
+ const char *path = CreatePath("key-test-comments", INPUT_DIR);
- TEST_ASSERT_EQUAL(2, auth_init(CreatePath("key-test-comments", INPUT_DIR), &keys));
-
+ TEST_ASSERT_NOT_NULL(path);
+ TEST_ASSERT_EQUAL(2, auth_init(path, &keys));
TEST_ASSERT_NOT_NULL(keys);
+ free((void *)path);
struct key* result = NULL;
get_key(10, &result);
@@ -140,10 +151,12 @@ test_ReadKeyFileWithComments(void) {
void
test_ReadKeyFileWithInvalidHex(void) {
struct key* keys = NULL;
+ const char *path = CreatePath("key-test-invalid-hex", INPUT_DIR);
- TEST_ASSERT_EQUAL(1, auth_init(CreatePath("key-test-invalid-hex", INPUT_DIR), &keys));
-
+ TEST_ASSERT_NOT_NULL(path);
+ TEST_ASSERT_EQUAL(1, auth_init(path, &keys));
TEST_ASSERT_NOT_NULL(keys);
+ free((void *)path);
struct key* result = NULL;
get_key(10, &result);
diff --git a/contrib/ntp/sntp/tests/kodDatabase.c b/contrib/ntp/sntp/tests/kodDatabase.c
index 0c3615d..3c05694 100644
--- a/contrib/ntp/sntp/tests/kodDatabase.c
+++ b/contrib/ntp/sntp/tests/kodDatabase.c
@@ -1,5 +1,6 @@
#include "config.h"
+#include "ntp_workimpl.h"
#include "ntp_types.h"
#include "sntptest.h"
#include "ntp_stdlib.h"
@@ -20,6 +21,7 @@ void test_DeleteEntry(void);
void
setUp(void) {
kod_init_kod_db("/dev/null", TRUE);
+ init_lib();
}
diff --git a/contrib/ntp/sntp/tests/kodFile.c b/contrib/ntp/sntp/tests/kodFile.c
index 6eb0971..f99d8cf 100644
--- a/contrib/ntp/sntp/tests/kodFile.c
+++ b/contrib/ntp/sntp/tests/kodFile.c
@@ -28,6 +28,7 @@ void
setUp(void) {
kod_db_cnt = 0;
kod_db = NULL;
+ init_lib();
}
diff --git a/contrib/ntp/sntp/tests/run-kodDatabase.c b/contrib/ntp/sntp/tests/run-kodDatabase.c
index e5bf3d7..f655a6a 100644
--- a/contrib/ntp/sntp/tests/run-kodDatabase.c
+++ b/contrib/ntp/sntp/tests/run-kodDatabase.c
@@ -23,6 +23,7 @@
#include <setjmp.h>
#include <stdio.h>
#include "config.h"
+#include "ntp_workimpl.h"
#include "ntp_types.h"
#include "sntptest.h"
#include "ntp_stdlib.h"
@@ -56,11 +57,11 @@ int main(int argc, char *argv[])
{
progname = argv[0];
UnityBegin("kodDatabase.c");
- RUN_TEST(test_SingleEntryHandling, 13);
- RUN_TEST(test_MultipleEntryHandling, 14);
- RUN_TEST(test_NoMatchInSearch, 15);
- RUN_TEST(test_AddDuplicate, 16);
- RUN_TEST(test_DeleteEntry, 17);
+ RUN_TEST(test_SingleEntryHandling, 14);
+ RUN_TEST(test_MultipleEntryHandling, 15);
+ RUN_TEST(test_NoMatchInSearch, 16);
+ RUN_TEST(test_AddDuplicate, 17);
+ RUN_TEST(test_DeleteEntry, 18);
return (UnityEnd());
}
diff --git a/contrib/ntp/sntp/tests/run-t-log.c b/contrib/ntp/sntp/tests/run-t-log.c
index dc9fa04..8d12345 100644
--- a/contrib/ntp/sntp/tests/run-t-log.c
+++ b/contrib/ntp/sntp/tests/run-t-log.c
@@ -49,9 +49,9 @@ int main(int argc, char *argv[])
{
progname = argv[0];
UnityBegin("t-log.c");
- RUN_TEST(testChangePrognameInMysyslog, 9);
- RUN_TEST(testOpenLogfileTest, 10);
- RUN_TEST(testWriteInCustomLogfile, 35);
+ RUN_TEST(testChangePrognameInMysyslog, 10);
+ RUN_TEST(testOpenLogfileTest, 11);
+ RUN_TEST(testWriteInCustomLogfile, 12);
return (UnityEnd());
}
diff --git a/contrib/ntp/sntp/tests/t-log.c b/contrib/ntp/sntp/tests/t-log.c
index 1546584..08d4b6c 100644
--- a/contrib/ntp/sntp/tests/t-log.c
+++ b/contrib/ntp/sntp/tests/t-log.c
@@ -6,63 +6,82 @@
//#include "log.h"
#include "log.c"
+void setUp(void);
void testChangePrognameInMysyslog(void);
void testOpenLogfileTest(void);
+void testWriteInCustomLogfile(void);
+
+
+void
+setUp(void) {
+ init_lib();
+}
//in var/log/syslog (may differ depending on your OS), logged name of the program will be "TEST_PROGNAME".
-void testChangePrognameInMysyslog(void){
+void
+testChangePrognameInMysyslog(void)
+{
sntp_init_logging("TEST_PROGNAME");
- msyslog(LOG_ERR, "TESTING sntp_init_logging()"); //%m will print the last errno?
+ msyslog(LOG_ERR, "TESTING sntp_init_logging()");
+
+ return;
}
//writes log files in your own file instead of syslog! (MAY BE USEFUL TO SUPPRESS ERROR MESSAGES!)
-void testOpenLogfileTest(void){
+void
+testOpenLogfileTest(void)
+{
sntp_init_logging("TEST_PROGNAME2"); //this name is consistent through the entire program unless changed
- open_logfile("testLogfile.log");
+ open_logfile("testLogfile.log");
//open_logfile("/var/log/syslog"); //this gives me "Permission Denied" when i do %m
-
+
msyslog(LOG_ERR, "Cannot open log file %s","abcXX");
//cleanup_log(); //unnecessary after log.c fix!
-
+
+ return;
}
//multiple cleanup_log() causes segfault. Probably the reason it's static. Opening multiple open_logfile(name) will cause segfault x.x I'm guessing it's not intended to be changed. Cleanup after unity test doesn't fix it, looks like. Calling in tearDown() also causes issues.
-void testWriteInCustomLogfile(void){
+void
+testWriteInCustomLogfile(void)
+{
char testString[256] = "12345 ABC";
char testName[256] = "TEST_PROGNAME3";
- remove("testLogfile2.log");
+ (void)remove("testLogfile2.log");
sntp_init_logging(testName);
open_logfile("testLogfile2.log"); // ./ causing issues
//sntp_init_logging(testName);
-
- msyslog(LOG_ERR, testString);
+
+ msyslog(LOG_ERR, "%s", testString);
FILE * f = fopen("testLogfile2.log","r");
char line[256];
+ TEST_ASSERT_TRUE( f != NULL);
+
//should be only 1 line
- while (fgets(line, sizeof(line), f)) {
- printf("%s", line);
- }
-
+ while (fgets(line, sizeof(line), f)) {
+ printf("%s", line);
+ }
+
char* x = strstr(line,testName);
-
+
TEST_ASSERT_TRUE( x != NULL);
x = strstr(line,testString);
TEST_ASSERT_TRUE( x != NULL);
//cleanup_log();
- fclose(f); //using this will also cause segfault, because at the end, log.c will call (using atexit(func) function) cleanup_log(void)-> fclose(syslog_file);
+ fclose(f); //using this will also cause segfault, because at the end, log.c will call (using atexit(func) function) cleanup_log(void)-> fclose(syslog_file);
//After the 1st fclose, syslog_file = NULL, and is never reset -> hopefully fixed by editing log.c
//TEST_ASSERT_EQUAL_STRING(testString,line); //doesn't work, line is dynamic because the process name is random.
-}
-
+ return;
+}
diff --git a/contrib/ntp/sntp/tests/utilities.c b/contrib/ntp/sntp/tests/utilities.c
index 39d22d6..a68aaac 100644
--- a/contrib/ntp/sntp/tests/utilities.c
+++ b/contrib/ntp/sntp/tests/utilities.c
@@ -96,12 +96,12 @@ test_IPv4Address(void) {
void
test_IPv6Address(void) {
- const struct in6_addr address = {
+ const struct in6_addr address = { { {
0x20, 0x01, 0x0d, 0xb8,
0x85, 0xa3, 0x08, 0xd3,
0x13, 0x19, 0x8a, 0x2e,
0x03, 0x70, 0x73, 0x34
- };
+ } } };
const char * expected = "2001:db8:85a3:8d3:1319:8a2e:370:7334";
sockaddr_u input;
struct addrinfo inputA;
diff --git a/contrib/ntp/sntp/unity/unity_internals.h b/contrib/ntp/sntp/unity/unity_internals.h
index c2aabc3..bf1bf3d 100644
--- a/contrib/ntp/sntp/unity/unity_internals.h
+++ b/contrib/ntp/sntp/unity/unity_internals.h
@@ -305,6 +305,18 @@ extern int UNITY_OUTPUT_CHAR(int);
# undef UNITY_WEAK_PRAGMA
#endif
+#if !defined(UNITY_NORETURN_ATTRIBUTE)
+# ifdef __GNUC__ // includes clang
+# if !(defined(__WIN32__) && defined(__clang__))
+# define UNITY_NORETURN_ATTRIBUTE __attribute__((noreturn))
+# endif
+# endif
+#endif
+
+#ifndef UNITY_NORETURN_ATTRIBUTE
+# define UNITY_NORETURN_ATTRIBUTE
+#endif
+
//-------------------------------------------------------
// Internal Structs Needed
@@ -465,7 +477,7 @@ void UnityAssertNumbersWithin(const _U_SINT delta,
const UNITY_LINE_TYPE lineNumber,
const UNITY_DISPLAY_STYLE_T style);
-void UnityFail(const char* message, const UNITY_LINE_TYPE line);
+void UnityFail(const char* message, const UNITY_LINE_TYPE line) UNITY_NORETURN_ATTRIBUTE;
void UnityIgnore(const char* message, const UNITY_LINE_TYPE line);
diff --git a/contrib/ntp/sntp/version.c b/contrib/ntp/sntp/version.c
index 4c87128..eb0e92b 100644
--- a/contrib/ntp/sntp/version.c
+++ b/contrib/ntp/sntp/version.c
@@ -2,4 +2,4 @@
* version file for sntp
*/
#include <config.h>
-const char * Version = "sntp 4.2.8p4@1.3265-o Wed Oct 21 16:41:07 UTC 2015 (25)";
+const char * Version = "sntp 4.2.8p4@1.3265-o Thu Jan 7 23:23:18 UTC 2016 (26)";
diff --git a/contrib/ntp/tests/bug-2803/bug-2803.c b/contrib/ntp/tests/bug-2803/bug-2803.c
index 4ee6f02..df9dcde 100644
--- a/contrib/ntp/tests/bug-2803/bug-2803.c
+++ b/contrib/ntp/tests/bug-2803/bug-2803.c
@@ -15,7 +15,7 @@
int simpleTest(void);
void setUp(void);
void tearDown(void);
-//void test_main(void);
+void test_main(void);
static int verbose = 1; // if not 0, also print results if test passed
static int exit_on_err = 0; // if not 0, exit if test failed
diff --git a/contrib/ntp/tests/bug-2803/run-bug-2803.c b/contrib/ntp/tests/bug-2803/run-bug-2803.c
index 05e6a5d..f4066f2 100644
--- a/contrib/ntp/tests/bug-2803/run-bug-2803.c
+++ b/contrib/ntp/tests/bug-2803/run-bug-2803.c
@@ -31,6 +31,7 @@
//=======External Functions This Runner Calls=====
extern void setUp(void);
extern void tearDown(void);
+extern void test_main(void);
extern void test_main(void );
@@ -51,6 +52,7 @@ int main(int argc, char *argv[])
progname = argv[0];
UnityBegin("bug-2803.c");
RUN_TEST(test_main, 18);
+ RUN_TEST(test_main, 18);
return (UnityEnd());
}
diff --git a/contrib/ntp/tests/libntp/a_md5encrypt.c b/contrib/ntp/tests/libntp/a_md5encrypt.c
index f46376e..d8e7ab9 100644
--- a/contrib/ntp/tests/libntp/a_md5encrypt.c
+++ b/contrib/ntp/tests/libntp/a_md5encrypt.c
@@ -16,14 +16,25 @@ u_long current_time = 4;
* Example packet with MD5 hash calculated manually.
*/
const int keytype = KEY_TYPE_MD5;
-const char *key = "abcdefgh";
+const u_char *key = (const u_char*)"abcdefgh";
const u_short keyLength = 8;
-const char *packet = "ijklmnopqrstuvwx";
+const u_char *packet = (const u_char*)"ijklmnopqrstuvwx";
#define packetLength 16
#define keyIdLength 4
#define digestLength 16
-const int totalLength = packetLength + keyIdLength + digestLength;
-const char *expectedPacket = "ijklmnopqrstuvwx\0\0\0\0\x0c\x0e\x84\xcf\x0b\xb7\xa8\x68\x8e\x52\x38\xdb\xbc\x1c\x39\x53";
+#define totalLength (packetLength + keyIdLength + digestLength)
+union {
+ u_char u8 [totalLength];
+ uint32_t u32[1];
+} expectedPacket = {
+ "ijklmnopqrstuvwx\0\0\0\0\x0c\x0e\x84\xcf\x0b\xb7\xa8\x68\x8e\x52\x38\xdb\xbc\x1c\x39\x53"
+};
+union {
+ u_char u8 [totalLength];
+ uint32_t u32[1];
+} invalidPacket = {
+ "ijklmnopqrstuvwx\0\0\0\0\x0c\x0e\x84\xcf\x0b\xb7\xa8\x68\x8e\x52\x38\xdb\xbc\x1c\x39\x54"
+};
void test_Encrypt(void);
@@ -35,7 +46,7 @@ void test_IPv6AddressToRefId(void);
void
test_Encrypt(void) {
- char *packetPtr;
+ u_int32 *packetPtr;
int length;
packetPtr = emalloc(totalLength * sizeof(*packetPtr));
@@ -45,12 +56,12 @@ test_Encrypt(void) {
cache_secretsize = keyLength;
- length = MD5authencrypt(keytype, (u_char*)key, (u_int32*)packetPtr, packetLength);
+ length = MD5authencrypt(keytype, key, packetPtr, packetLength);
- TEST_ASSERT_TRUE(MD5authdecrypt(keytype, (u_char*)key, (u_int32*)packetPtr, packetLength, length));
+ TEST_ASSERT_TRUE(MD5authdecrypt(keytype, key, packetPtr, packetLength, length));
TEST_ASSERT_EQUAL(20, length);
- TEST_ASSERT_EQUAL_MEMORY(expectedPacket, packetPtr, totalLength);
+ TEST_ASSERT_EQUAL_MEMORY(expectedPacket.u8, packetPtr, totalLength);
free(packetPtr);
}
@@ -58,17 +69,13 @@ test_Encrypt(void) {
void
test_DecryptValid(void) {
cache_secretsize = keyLength;
-
- TEST_ASSERT_TRUE(MD5authdecrypt(keytype, (u_char*)key, (u_int32*)expectedPacket, packetLength, 20));
+ TEST_ASSERT_TRUE(MD5authdecrypt(keytype, key, expectedPacket.u32, packetLength, 20));
}
void
test_DecryptInvalid(void) {
cache_secretsize = keyLength;
-
- const char *invalidPacket = "ijklmnopqrstuvwx\0\0\0\0\x0c\x0e\x84\xcf\x0b\xb7\xa8\x68\x8e\x52\x38\xdb\xbc\x1c\x39\x54";
-
- TEST_ASSERT_FALSE(MD5authdecrypt(keytype, (u_char*)key, (u_int32*)invalidPacket, packetLength, 20));
+ TEST_ASSERT_FALSE(MD5authdecrypt(keytype, key, invalidPacket.u32, packetLength, 20));
}
void
@@ -87,23 +94,24 @@ test_IPv4AddressToRefId(void) {
void
test_IPv6AddressToRefId(void) {
- const struct in6_addr address = {
+ const int expected = 0x75cffd52;
+ const struct in6_addr address = { { {
0x20, 0x01, 0x0d, 0xb8,
0x85, 0xa3, 0x08, 0xd3,
0x13, 0x19, 0x8a, 0x2e,
0x03, 0x70, 0x73, 0x34
- };
+ } } };
sockaddr_u addr;
addr.sa6.sin6_family = AF_INET6;
addr.sa6.sin6_addr = address;
- const int expected = 0x75cffd52;
#if 0
TEST_ASSERT_EQUAL(expected, addr2refid(&addr));
#else
+ (void)expected;
TEST_IGNORE_MESSAGE("Skipping because of big endian problem?");
#endif
}
diff --git a/contrib/ntp/tests/libntp/authkeys.c b/contrib/ntp/tests/libntp/authkeys.c
index 6a10c01..2ddbce5 100644
--- a/contrib/ntp/tests/libntp/authkeys.c
+++ b/contrib/ntp/tests/libntp/authkeys.c
@@ -51,18 +51,21 @@ setUp(void)
cache_flags = 0;
cache_secret = NULL;
cache_secretsize = 0;
+
+ return;
}
void
tearDown(void)
{
-
+ return;
}
static const int KEYTYPE = KEY_TYPE_MD5;
void
-AddTrustedKey(keyid_t keyno) {
+AddTrustedKey(keyid_t keyno)
+{
/*
* We need to add a MD5-key in addition to setting the
* trust, because authhavekey() requires type != 0.
@@ -70,15 +73,21 @@ AddTrustedKey(keyid_t keyno) {
MD5auth_setkey(keyno, KEYTYPE, NULL, 0);
authtrust(keyno, TRUE);
+
+ return;
}
void
-AddUntrustedKey(keyid_t keyno) {
+AddUntrustedKey(keyid_t keyno)
+{
authtrust(keyno, FALSE);
+
+ return;
}
void
-test_AddTrustedKeys(void) {
+test_AddTrustedKeys(void)
+{
const keyid_t KEYNO1 = 5;
const keyid_t KEYNO2 = 8;
@@ -87,48 +96,65 @@ test_AddTrustedKeys(void) {
TEST_ASSERT_TRUE(authistrusted(KEYNO1));
TEST_ASSERT_TRUE(authistrusted(KEYNO2));
+
+ return;
}
void
-test_AddUntrustedKey(void) {
+test_AddUntrustedKey(void)
+{
const keyid_t KEYNO = 3;
AddUntrustedKey(KEYNO);
TEST_ASSERT_FALSE(authistrusted(KEYNO));
+
+ return;
}
void
-test_HaveKeyCorrect(void) {
+test_HaveKeyCorrect(void)
+{
const keyid_t KEYNO = 3;
AddTrustedKey(KEYNO);
TEST_ASSERT_TRUE(auth_havekey(KEYNO));
TEST_ASSERT_TRUE(authhavekey(KEYNO));
+
+ return;
}
void
-test_HaveKeyIncorrect(void) {
+test_HaveKeyIncorrect(void)
+{
const keyid_t KEYNO = 2;
TEST_ASSERT_FALSE(auth_havekey(KEYNO));
TEST_ASSERT_FALSE(authhavekey(KEYNO));
+
+ return;
}
void
-test_AddWithAuthUseKey(void) {
+test_AddWithAuthUseKey(void)
+{
const keyid_t KEYNO = 5;
const char* KEY = "52a";
- TEST_ASSERT_TRUE(authusekey(KEYNO, KEYTYPE, (u_char*)KEY));
+ TEST_ASSERT_TRUE(authusekey(KEYNO, KEYTYPE, (const u_char*)KEY));
+
+ return;
}
void
-test_EmptyKey(void) {
+test_EmptyKey(void)
+{
const keyid_t KEYNO = 3;
const char* KEY = "";
- TEST_ASSERT_FALSE(authusekey(KEYNO, KEYTYPE, (u_char*)KEY));
+ TEST_ASSERT_FALSE(authusekey(KEYNO, KEYTYPE, (const u_char*)KEY));
+
+ return;
}
diff --git a/contrib/ntp/tests/libntp/buftvtots.c b/contrib/ntp/tests/libntp/buftvtots.c
index efde009..b6b81a2 100644
--- a/contrib/ntp/tests/libntp/buftvtots.c
+++ b/contrib/ntp/tests/libntp/buftvtots.c
@@ -18,7 +18,8 @@ void test_AlwaysFalseOnWindows(void);
void
-test_ZeroBuffer(void) {
+test_ZeroBuffer(void)
+{
#ifndef SYS_WINNT
const struct timeval input = {0, 0};
const l_fp expected = {{0 + JAN_1970}, 0};
@@ -30,10 +31,14 @@ test_ZeroBuffer(void) {
#else
TEST_IGNORE_MESSAGE("Test only for Windows, skipping...");
#endif
+
+ return;
}
+
void
-test_IntegerAndFractionalBuffer(void) {
+test_IntegerAndFractionalBuffer(void)
+{
#ifndef SYS_WINNT
const struct timeval input = {5, 500000}; /* 5.5 */
const l_fp expected = {{5 + JAN_1970}, HALF};
@@ -53,24 +58,30 @@ test_IntegerAndFractionalBuffer(void) {
#else
TEST_IGNORE_MESSAGE("Test only for Windows, skipping...");
#endif
+
+ return;
}
void
-test_IllegalMicroseconds(void) {
+test_IllegalMicroseconds(void)
+{
#ifndef SYS_WINNT
const struct timeval input = {0, 1100000}; /* > 999 999 microseconds. */
-
+
l_fp actual;
TEST_ASSERT_FALSE(buftvtots((const char*)(&input), &actual));
#else
TEST_IGNORE_MESSAGE("Test only for Windows, skipping...");
#endif
+
+ return;
}
void
-test_AlwaysFalseOnWindows(void) {
+test_AlwaysFalseOnWindows(void)
+{
#ifdef SYS_WINNT
/*
* Under Windows, buftvtots will just return
@@ -81,5 +92,6 @@ test_AlwaysFalseOnWindows(void) {
#else
TEST_IGNORE_MESSAGE("Non-Windows test, skipping...");
#endif
-}
+ return;
+}
diff --git a/contrib/ntp/tests/libntp/calendar.c b/contrib/ntp/tests/libntp/calendar.c
index 2c8a2d5..9d25c41 100644
--- a/contrib/ntp/tests/libntp/calendar.c
+++ b/contrib/ntp/tests/libntp/calendar.c
@@ -8,31 +8,42 @@
static int leapdays(int year);
-int isGT(int first, int second);
-int leapdays(int year);
-char * CalendarFromCalToString(const struct calendar *cal);
-char * CalendarFromIsoToString(const struct isodate *iso);
-int IsEqualCal(const struct calendar *expected, const struct calendar *actual);
-int IsEqualIso(const struct isodate *expected, const struct isodate *actual);
-char * DateFromCalToString(const struct calendar *cal);
-char * DateFromIsoToString(const struct isodate *iso);
-int IsEqualDateCal(const struct calendar *expected, const struct calendar *actual);
-int IsEqualDateIso(const struct isodate *expected, const struct isodate *actual);
-void test_DaySplitMerge(void);
-void test_SplitYearDays1(void);
-void test_SplitYearDays2(void);
-void test_RataDie1(void);
-void test_LeapYears1(void);
-void test_LeapYears2(void);
-void test_RoundTripDate(void);
-void test_RoundTripYearStart(void);
-void test_RoundTripMonthStart(void);
-void test_RoundTripWeekStart(void);
-void test_RoundTripDayStart(void);
-void test_IsoCalYearsToWeeks(void);
-void test_IsoCalWeeksToYearStart(void);
-void test_IsoCalWeeksToYearEnd(void);
-void test_DaySecToDate(void);
+void setUp(void);
+int isGT(int first, int second);
+int leapdays(int year);
+char * CalendarFromCalToString(const struct calendar *cal);
+char * CalendarFromIsoToString(const struct isodate *iso);
+int IsEqualCal(const struct calendar *expected, const struct calendar *actual);
+int IsEqualIso(const struct isodate *expected, const struct isodate *actual);
+char * DateFromCalToString(const struct calendar *cal);
+char * DateFromIsoToString(const struct isodate *iso);
+int IsEqualDateCal(const struct calendar *expected, const struct calendar *actual);
+int IsEqualDateIso(const struct isodate *expected, const struct isodate *actual);
+void test_DaySplitMerge(void);
+void test_SplitYearDays1(void);
+void test_SplitYearDays2(void);
+void test_RataDie1(void);
+void test_LeapYears1(void);
+void test_LeapYears2(void);
+void test_RoundTripDate(void);
+void test_RoundTripYearStart(void);
+void test_RoundTripMonthStart(void);
+void test_RoundTripWeekStart(void);
+void test_RoundTripDayStart(void);
+void test_IsoCalYearsToWeeks(void);
+void test_IsoCalWeeksToYearStart(void);
+void test_IsoCalWeeksToYearEnd(void);
+void test_DaySecToDate(void);
+
+
+void
+setUp(void)
+{
+ init_lib();
+
+ return;
+}
+
/*
* ---------------------------------------------------------------------
@@ -42,7 +53,7 @@ void test_DaySecToDate(void);
int
isGT(int first, int second)
{
- if(first > second) {
+ if(first > second) {
return TRUE;
} else {
return FALSE;
@@ -100,9 +111,14 @@ IsEqualCal(
expected->second == actual->second) {
return TRUE;
} else {
- printf("expected: %s but was %s",
- CalendarFromCalToString(expected),
- CalendarFromCalToString(actual));
+ char *p_exp = CalendarFromCalToString(expected);
+ char *p_act = CalendarFromCalToString(actual);
+
+ printf("expected: %s but was %s", p_exp, p_act);
+
+ free(p_exp);
+ free(p_act);
+
return FALSE;
}
}
@@ -215,8 +231,10 @@ static const u_short real_month_days[2][14] = {
* the 'vint64' is definitely needed.
*/
void
-test_DaySplitMerge(void) {
+test_DaySplitMerge(void)
+{
int32 day,sec;
+
for (day = -1000000; day <= 1000000; day += 100) {
for (sec = -100000; sec <= 186400; sec += 10000) {
vint64 merge;
@@ -242,11 +260,15 @@ test_DaySplitMerge(void) {
TEST_ASSERT_EQUAL(esec, split.lo);
}
}
+
+ return;
}
void
-test_SplitYearDays1(void) {
+test_SplitYearDays1(void)
+{
int32 eyd;
+
for (eyd = -1; eyd <= 365; eyd++) {
ntpcal_split split = ntpcal_split_yeardays(eyd, 0);
if (split.lo >= 0 && split.hi >= 0) {
@@ -257,11 +279,15 @@ test_SplitYearDays1(void) {
} else
TEST_ASSERT_TRUE(eyd < 0 || eyd > 364);
}
+
+ return;
}
-
+
void
-test_SplitYearDays2(void) {
+test_SplitYearDays2(void)
+{
int32 eyd;
+
for (eyd = -1; eyd <= 366; eyd++) {
ntpcal_split split = ntpcal_split_yeardays(eyd, 1);
if (split.lo >= 0 && split.hi >= 0) {
@@ -274,21 +300,27 @@ test_SplitYearDays2(void) {
} else
TEST_ASSERT_TRUE(eyd < 0 || eyd > 365);
}
+
+ return;
}
-
+
void
-test_RataDie1(void) {
+test_RataDie1(void)
+{
int32 testDate = 1; /* 0001-01-01 (proleptic date) */
struct calendar expected = { 1, 1, 1, 1 };
struct calendar actual;
ntpcal_rd_to_date(&actual, testDate);
TEST_ASSERT_TRUE(IsEqualDateCal(&expected, &actual));
+
+ return;
}
/* check last day of february for first 10000 years */
void
-test_LeapYears1(void) {
+test_LeapYears1(void)
+{
struct calendar dateIn, dateOut;
for (dateIn.year = 1; dateIn.year < 10000; ++dateIn.year) {
@@ -300,11 +332,14 @@ test_LeapYears1(void) {
TEST_ASSERT_TRUE(IsEqualDateCal(&dateIn, &dateOut));
}
+
+ return;
}
/* check first day of march for first 10000 years */
void
-test_LeapYears2(void) {
+test_LeapYears2(void)
+{
struct calendar dateIn, dateOut;
for (dateIn.year = 1; dateIn.year < 10000; ++dateIn.year) {
@@ -315,6 +350,8 @@ test_LeapYears2(void) {
ntpcal_rd_to_date(&dateOut, ntpcal_date_to_rd(&dateIn));
TEST_ASSERT_TRUE(IsEqualDateCal(&dateIn, &dateOut));
}
+
+ return;
}
/* Full roundtrip from 1601-01-01 to 2400-12-31
@@ -324,7 +361,8 @@ test_LeapYears2(void) {
* invalid output can occur.)
*/
void
-test_RoundTripDate(void) {
+test_RoundTripDate(void)
+{
struct calendar truDate, expDate = { 1600, 0, 12, 31 };;
int leaps;
int32 truRdn, expRdn = ntpcal_date_to_rd(&expDate);
@@ -335,7 +373,7 @@ test_RoundTripDate(void) {
expDate.yearday = 0;
leaps = leapdays(expDate.year);
while (expDate.month < 12) {
- expDate.month++;
+ expDate.month++;
expDate.monthday = 0;
while (expDate.monthday < real_month_days[leaps][expDate.month]) {
expDate.monthday++;
@@ -350,11 +388,14 @@ test_RoundTripDate(void) {
}
}
}
+
+ return;
}
/* Roundtrip testing on calyearstart */
void
-test_RoundTripYearStart(void) {
+test_RoundTripYearStart(void)
+{
static const time_t pivot = 0;
u_int32 ntp, expys, truys;
struct calendar date;
@@ -367,11 +408,14 @@ test_RoundTripYearStart(void) {
expys = ntpcal_date_to_ntp(&date);
TEST_ASSERT_EQUAL(expys, truys);
}
-}
+
+ return;
+}
/* Roundtrip testing on calmonthstart */
void
-test_RoundTripMonthStart(void) {
+test_RoundTripMonthStart(void)
+{
static const time_t pivot = 0;
u_int32 ntp, expms, trums;
struct calendar date;
@@ -384,11 +428,14 @@ test_RoundTripMonthStart(void) {
expms = ntpcal_date_to_ntp(&date);
TEST_ASSERT_EQUAL(expms, trums);
}
-}
+
+ return;
+}
/* Roundtrip testing on calweekstart */
void
-test_RoundTripWeekStart(void) {
+test_RoundTripWeekStart(void)
+{
static const time_t pivot = 0;
u_int32 ntp, expws, truws;
struct isodate date;
@@ -401,11 +448,14 @@ test_RoundTripWeekStart(void) {
expws = isocal_date_to_ntp(&date);
TEST_ASSERT_EQUAL(expws, truws);
}
-}
+
+ return;
+}
/* Roundtrip testing on caldaystart */
void
-test_RoundTripDayStart(void) {
+test_RoundTripDayStart(void)
+{
static const time_t pivot = 0;
u_int32 ntp, expds, truds;
struct calendar date;
@@ -417,6 +467,8 @@ test_RoundTripDayStart(void) {
expds = ntpcal_date_to_ntp(&date);
TEST_ASSERT_EQUAL(expds, truds);
}
+
+ return;
}
/* ---------------------------------------------------------------------
@@ -444,6 +496,7 @@ refimpl_WeeksInIsoYears(
int32_t years)
{
int32_t days, weeks;
+
days = ntpcal_weekday_close(
ntpcal_days_in_years(years) + 1,
CAL_MONDAY) - 1;
@@ -455,6 +508,7 @@ refimpl_WeeksInIsoYears(
weeks = days / 7;
days = days % 7;
TEST_ASSERT_EQUAL(0, days); /* paranoia check... */
+
return weeks;
}
@@ -462,9 +516,11 @@ refimpl_WeeksInIsoYears(
* they are not, the calendar needs a better implementation...
*/
void
-test_IsoCalYearsToWeeks(void) {
+test_IsoCalYearsToWeeks(void)
+{
int32_t years;
int32_t wref, wcal;
+
for (years = -1000; years < 4000; ++years) {
/* get number of weeks before years (reference) */
wref = refimpl_WeeksInIsoYears(years);
@@ -472,13 +528,17 @@ test_IsoCalYearsToWeeks(void) {
wcal = isocal_weeks_in_years(years);
TEST_ASSERT_EQUAL(wref, wcal);
}
+
+ return;
}
void
-test_IsoCalWeeksToYearStart(void) {
+test_IsoCalWeeksToYearStart(void)
+{
int32_t years;
int32_t wref;
ntpcal_split ysplit;
+
for (years = -1000; years < 4000; ++years) {
/* get number of weeks before years (reference) */
wref = refimpl_WeeksInIsoYears(years);
@@ -488,13 +548,17 @@ test_IsoCalWeeksToYearStart(void) {
TEST_ASSERT_EQUAL(years, ysplit.hi);
TEST_ASSERT_EQUAL(0, ysplit.lo);
}
+
+ return;
}
void
-test_IsoCalWeeksToYearEnd(void) {
+test_IsoCalWeeksToYearEnd(void)
+{
int32_t years;
int32_t wref;
ntpcal_split ysplit;
+
for (years = -1000; years < 4000; ++years) {
/* get last week of previous year */
wref = refimpl_WeeksInIsoYears(years) - 1;
@@ -504,10 +568,13 @@ test_IsoCalWeeksToYearEnd(void) {
TEST_ASSERT_EQUAL(years-1, ysplit.hi);
TEST_ASSERT(ysplit.lo == 51 || ysplit.lo == 52);
}
+
+ return;
}
void
-test_DaySecToDate(void) {
+test_DaySecToDate(void)
+{
struct calendar cal;
int32_t days;
@@ -538,4 +605,6 @@ test_DaySecToDate(void) {
days = ntpcal_daysec_to_date(&cal, 86400);
TEST_ASSERT_MESSAGE((days==1 && cal.hour==0 && cal.minute==0 && cal.second==0),
"failed for 86400");
+
+ return;
}
diff --git a/contrib/ntp/tests/libntp/caljulian.c b/contrib/ntp/tests/libntp/caljulian.c
index ecf5d9255..b25f8ac 100644
--- a/contrib/ntp/tests/libntp/caljulian.c
+++ b/contrib/ntp/tests/libntp/caljulian.c
@@ -20,10 +20,12 @@ void test_uLongWrapped(void);
char *
-CalendarToString(const struct calendar cal) {
+CalendarToString(const struct calendar cal)
+{
char * str = emalloc (sizeof (char) * 100);
-
char buffer[100] ="";
+
+ *str = '\0';
snprintf(buffer, 100, "%u", cal.year);
strcat(str, buffer);
strcat(str, "-");
@@ -48,19 +50,25 @@ CalendarToString(const struct calendar cal) {
}
int // technically boolean
-IsEqual(const struct calendar expected, const struct calendar actual) {
- if (expected.year == actual.year &&
- (expected.yearday == actual.yearday ||
- (expected.month == actual.month &&
- expected.monthday == actual.monthday)) &&
- expected.hour == actual.hour &&
- expected.minute == actual.minute &&
- expected.second == actual.second) {
+IsEqual(const struct calendar expected, const struct calendar actual)
+{
+ if ( expected.year == actual.year
+ && ( expected.yearday == actual.yearday
+ || ( expected.month == actual.month
+ && expected.monthday == actual.monthday))
+ && expected.hour == actual.hour
+ && expected.minute == actual.minute
+ && expected.second == actual.second) {
return TRUE;
} else {
- printf("expected: %s but was %s", CalendarToString(expected) ,CalendarToString(actual));
+ char *p_exp, *p_act;
+
+ p_exp = CalendarToString(expected);
+ p_act = CalendarToString(actual);
+ printf("expected: %s but was %s", p_exp, p_act);
+ free(p_exp);
+ free(p_act);
return FALSE;
-
}
}
@@ -70,17 +78,23 @@ setUp()
{
ntpcal_set_timefunc(timefunc);
settime(1970, 1, 1, 0, 0, 0);
+ init_lib();
+
+ return;
}
void
tearDown()
{
ntpcal_set_timefunc(NULL);
+
+ return;
}
void
-test_RegularTime(void) {
+test_RegularTime(void)
+{
u_long testDate = 3485080800UL; // 2010-06-09 14:00:00
struct calendar expected = {2010,160,6,9,14,0,0};
@@ -89,10 +103,13 @@ test_RegularTime(void) {
caljulian(testDate, &actual);
TEST_ASSERT_TRUE(IsEqual(expected, actual));
+
+ return;
}
void
-test_LeapYear(void) {
+test_LeapYear(void)
+{
u_long input = 3549902400UL; // 2012-06-28 20:00:00Z
struct calendar expected = {2012, 179, 6, 28, 20, 0, 0};
@@ -101,28 +118,36 @@ test_LeapYear(void) {
caljulian(input, &actual);
TEST_ASSERT_TRUE(IsEqual(expected, actual));
+
+ return;
}
void
-test_uLongBoundary(void) {
- u_long time = 4294967295UL; // 2036-02-07 6:28:15
+test_uLongBoundary(void)
+{
+ u_long enc_time = 4294967295UL; // 2036-02-07 6:28:15
struct calendar expected = {2036,0,2,7,6,28,15};
struct calendar actual;
- caljulian(time, &actual);
+ caljulian(enc_time, &actual);
TEST_ASSERT_TRUE(IsEqual(expected, actual));
+
+ return;
}
void
-test_uLongWrapped(void) {
- u_long time = 0;
+test_uLongWrapped(void)
+{
+ u_long enc_time = 0;
struct calendar expected = {2036,0,2,7,6,28,16};
struct calendar actual;
- caljulian(time, &actual);
+ caljulian(enc_time, &actual);
TEST_ASSERT_TRUE(IsEqual(expected, actual));
+
+ return;
}
diff --git a/contrib/ntp/tests/libntp/clocktime.c b/contrib/ntp/tests/libntp/clocktime.c
index 67ca401..ed2d4b2 100644
--- a/contrib/ntp/tests/libntp/clocktime.c
+++ b/contrib/ntp/tests/libntp/clocktime.c
@@ -30,14 +30,18 @@ void test_AlwaysInLimit(void);
void
setUp()
{
- ntpcal_set_timefunc(timefunc);
- settime(2000, 1, 1, 0, 0, 0);
+ ntpcal_set_timefunc(timefunc);
+ settime(2000, 1, 1, 0, 0, 0);
+
+ return;
}
void
tearDown()
{
- ntpcal_set_timefunc(NULL);
+ ntpcal_set_timefunc(NULL);
+
+ return;
}
/* ---------------------------------------------------------------------
@@ -45,23 +49,27 @@ tearDown()
*/
void
-test_CurrentYear(void) {
+test_CurrentYear(void)
+{
/* Timestamp: 2010-06-24 12:50:00Z */
const u_int32 timestamp = 3486372600UL;
const u_int32 expected = timestamp; /* exactly the same. */
const int yday=175, hour=12, minute=50, second=0, tzoff=0;
- u_long yearstart=0;
+ u_long yearstart = 0;
u_int32 actual;
- TEST_ASSERT_TRUE(clocktime(yday, hour, minute, second, tzoff, timestamp,
- &yearstart, &actual));
+ TEST_ASSERT_TRUE(clocktime(yday, hour, minute, second, tzoff,
+ timestamp, &yearstart, &actual));
TEST_ASSERT_EQUAL(expected, actual);
+
+ return;
}
void
-test_CurrentYearFuzz(void) {
+test_CurrentYearFuzz(void)
+{
/*
* Timestamp (rec_ui) is: 2010-06-24 12:50:00
* Time sent into function is 12:00:00.
@@ -78,13 +86,16 @@ test_CurrentYearFuzz(void) {
u_long yearstart=0;
u_int32 actual;
- TEST_ASSERT_TRUE(clocktime(yday, hour, minute, second, tzoff, timestamp,
- &yearstart, &actual));
+ TEST_ASSERT_TRUE(clocktime(yday, hour, minute, second, tzoff,
+ timestamp, &yearstart, &actual));
TEST_ASSERT_EQUAL(expected, actual);
+
+ return;
}
void
-test_TimeZoneOffset(void) {
+test_TimeZoneOffset(void)
+{
/*
* Timestamp (rec_ui) is: 2010-06-24 12:00:00 +0800
* (which is 2010-06-24 04:00:00Z)
@@ -105,7 +116,8 @@ test_TimeZoneOffset(void) {
}
void
-test_WrongYearStart(void) {
+test_WrongYearStart(void)
+{
/*
* Timestamp (rec_ui) is: 2010-01-02 11:00:00Z
* Time sent into function is 11:00:00.
@@ -125,7 +137,8 @@ test_WrongYearStart(void) {
}
void
-test_PreviousYear(void) {
+test_PreviousYear(void)
+{
/*
* Timestamp is: 2010-01-01 01:00:00Z
* Time sent into function is 23:00:00
@@ -145,7 +158,8 @@ test_PreviousYear(void) {
}
void
-test_NextYear(void) {
+test_NextYear(void)
+{
/*
* Timestamp is: 2009-12-31 23:00:00Z
* Time sent into function is 01:00:00
@@ -158,28 +172,35 @@ test_NextYear(void) {
u_long yearstart = 0;
u_int32 actual;
- TEST_ASSERT_TRUE(clocktime(yday, hour, minute, second, tzoff, timestamp,
- &yearstart, &actual));
+ TEST_ASSERT_TRUE(clocktime(yday, hour, minute, second, tzoff,
+ timestamp, &yearstart, &actual));
TEST_ASSERT_EQUAL(expected, actual);
+
+ return;
}
void
-test_NoReasonableConversion(void) {
+test_NoReasonableConversion(void)
+{
/* Timestamp is: 2010-01-02 11:00:00Z */
const u_int32 timestamp = 3471418800UL;
-
+
const int yday=100, hour=12, minute=0, second=0, tzoff=0;
u_long yearstart = 0;
u_int32 actual;
- TEST_ASSERT_FALSE(clocktime(yday, hour, minute, second, tzoff, timestamp,
- &yearstart, &actual));
+ TEST_ASSERT_FALSE(clocktime(yday, hour, minute, second, tzoff,
+ timestamp, &yearstart, &actual));
+
+ return;
}
int/*BOOL*/
-isLE(u_int32 diff,u_int32 actual){
- if(diff <= actual){
+isLE(u_int32 diff,u_int32 actual)
+{
+
+ if (diff <= actual) {
return TRUE;
}
else return FALSE;
@@ -187,7 +208,8 @@ isLE(u_int32 diff,u_int32 actual){
void
-test_AlwaysInLimit(void) {
+test_AlwaysInLimit(void)
+{
/* Timestamp is: 2010-01-02 11:00:00Z */
const u_int32 timestamp = 3471418800UL;
const u_short prime_incs[] = { 127, 151, 163, 179 };
@@ -210,7 +232,8 @@ test_AlwaysInLimit(void) {
for (hour = -204; hour < 204; hour += 2) {
for (minute = -60; minute < 60; minute++) {
clocktime(yday, hour, minute, 30, 0,
- timestamp, &yearstart, &actual);
+ timestamp, &yearstart,
+ &actual);
diff = actual - timestamp;
if (diff >= 0x80000000UL)
diff = ~diff + 1;
@@ -219,4 +242,5 @@ test_AlwaysInLimit(void) {
}
}
}
+ return;
}
diff --git a/contrib/ntp/tests/libntp/decodenetnum.c b/contrib/ntp/tests/libntp/decodenetnum.c
index 0e9bc34..0d2b0b5 100644
--- a/contrib/ntp/tests/libntp/decodenetnum.c
+++ b/contrib/ntp/tests/libntp/decodenetnum.c
@@ -4,6 +4,7 @@
#include "unity.h"
+void setUp(void);
extern void test_IPv4AddressOnly(void);
extern void test_IPv4AddressWithPort(void);
//#ifdef ISC_PLATFORM_HAVEIPV6
@@ -15,6 +16,15 @@ extern void test_IllegalCharInPort(void);
void
+setUp(void)
+{
+ init_lib();
+
+ return;
+}
+
+
+void
test_IPv4AddressOnly(void) {
const char *str = "192.0.2.1";
sockaddr_u actual;
diff --git a/contrib/ntp/tests/libntp/humandate.c b/contrib/ntp/tests/libntp/humandate.c
index 3a28f59..de3c751 100644
--- a/contrib/ntp/tests/libntp/humandate.c
+++ b/contrib/ntp/tests/libntp/humandate.c
@@ -5,11 +5,21 @@
#include "unity.h"
+void setUp(void);
void test_RegularTime(void);
void test_CurrentTime(void);
void
+setUp(void)
+{
+ init_lib();
+
+ return;
+}
+
+
+void
test_RegularTime(void)
{
time_t sample = 1276601278;
@@ -17,11 +27,13 @@ test_RegularTime(void)
struct tm* tm;
tm = localtime(&sample);
- TEST_ASSERT_TRUE(time != NULL);
+ TEST_ASSERT_TRUE(tm != NULL);
snprintf(expected, 15, "%02d:%02d:%02d", tm->tm_hour, tm->tm_min, tm->tm_sec);
TEST_ASSERT_EQUAL_STRING(expected, humantime(sample));
+
+ return;
}
void
@@ -34,9 +46,11 @@ test_CurrentTime(void)
time(&sample);
tm = localtime(&sample);
- TEST_ASSERT_TRUE(time != NULL);
+ TEST_ASSERT_TRUE(tm != NULL);
snprintf(expected, 15, "%02d:%02d:%02d", tm->tm_hour, tm->tm_min, tm->tm_sec);
TEST_ASSERT_EQUAL_STRING(expected, humantime(sample));
+
+ return;
}
diff --git a/contrib/ntp/tests/libntp/lfpfunc.c b/contrib/ntp/tests/libntp/lfpfunc.c
index 1a13f37..cedbb60 100644
--- a/contrib/ntp/tests/libntp/lfpfunc.c
+++ b/contrib/ntp/tests/libntp/lfpfunc.c
@@ -9,17 +9,18 @@
#include <math.h>
-/* replaced TEST_ASSERT_EQUAL_MEMORY(&a, &b, sizeof(a)) with TEST_ASSERT_EQUAL_l_fp(a, b).
- It's safer this way, because structs can be compared even if they aren't initiated
- with memset (due to padding bytes).
+/*
+ replaced: TEST_ASSERT_EQUAL_MEMORY(&a, &b, sizeof(a))
+ with: TEST_ASSERT_EQUAL_l_fp(a, b).
+ It's safer this way, because structs can be compared even if they
+ aren't initiated with memset (due to padding bytes).
*/
-#define TEST_ASSERT_EQUAL_l_fp(a, b) { \
- TEST_ASSERT_EQUAL_MESSAGE(a.l_i, b.l_i, "Field l_i"); \
- TEST_ASSERT_EQUAL_UINT_MESSAGE(a.l_uf, b.l_uf, "Field l_uf"); \
+#define TEST_ASSERT_EQUAL_l_fp(a, b) { \
+ TEST_ASSERT_EQUAL_MESSAGE(a.l_i, b.l_i, "Field l_i"); \
+ TEST_ASSERT_EQUAL_UINT_MESSAGE(a.l_uf, b.l_uf, "Field l_uf"); \
}
-
typedef int bool; // typedef enum { FALSE, TRUE } boolean; -> can't use this because TRUE and FALSE are already defined
@@ -28,23 +29,23 @@ typedef struct {
} lfp_hl;
-int l_fp_scmp(const l_fp first, const l_fp second);
-int l_fp_ucmp(const l_fp first, l_fp second );
-l_fp l_fp_init(int32 i, u_int32 f);
-l_fp l_fp_add(const l_fp first, const l_fp second);
-l_fp l_fp_subtract(const l_fp first, const l_fp second);
-l_fp l_fp_negate(const l_fp first);
-l_fp l_fp_abs(const l_fp first);
-int l_fp_signum(const l_fp first);
-double l_fp_convert_to_double(const l_fp first);
-l_fp l_fp_init_from_double( double rhs);
-void l_fp_swap(l_fp * first, l_fp *second);
-bool l_isgt(const l_fp first, const l_fp second);
-bool l_isgtu(const l_fp first, const l_fp second);
-bool l_ishis(const l_fp first, const l_fp second);
-bool l_isgeq(const l_fp first, const l_fp second);
-bool l_isequ(const l_fp first, const l_fp second);
-double eps(double d);
+int l_fp_scmp(const l_fp first, const l_fp second);
+int l_fp_ucmp(const l_fp first, l_fp second);
+l_fp l_fp_init(int32 i, u_int32 f);
+l_fp l_fp_add(const l_fp first, const l_fp second);
+l_fp l_fp_subtract(const l_fp first, const l_fp second);
+l_fp l_fp_negate(const l_fp first);
+l_fp l_fp_abs(const l_fp first);
+int l_fp_signum(const l_fp first);
+double l_fp_convert_to_double(const l_fp first);
+l_fp l_fp_init_from_double( double rhs);
+void l_fp_swap(l_fp * first, l_fp *second);
+bool l_isgt(const l_fp first, const l_fp second);
+bool l_isgtu(const l_fp first, const l_fp second);
+bool l_ishis(const l_fp first, const l_fp second);
+bool l_isgeq(const l_fp first, const l_fp second);
+bool l_isequ(const l_fp first, const l_fp second);
+double eps(double d);
void test_AdditionLR(void);
@@ -58,7 +59,6 @@ void test_SignedRelOps(void);
void test_UnsignedRelOps(void);
-
static int cmp_work(u_int32 a[3], u_int32 b[3]);
//----------------------------------------------------------------------
@@ -72,10 +72,10 @@ int
l_fp_scmp(const l_fp first, const l_fp second)
{
u_int32 a[3], b[3];
-
+
const l_fp op1 = first;
const l_fp op2 = second;
-
+
a[0] = op1.l_uf; a[1] = op1.l_ui; a[2] = 0;
b[0] = op2.l_uf; b[1] = op2.l_ui; b[2] = 0;
@@ -86,12 +86,12 @@ l_fp_scmp(const l_fp first, const l_fp second)
}
int
-l_fp_ucmp(const l_fp first, l_fp second )
+l_fp_ucmp(const l_fp first, l_fp second)
{
u_int32 a[3], b[3];
const l_fp op1 = first;
const l_fp op2 = second;
-
+
a[0] = op1.l_uf; a[1] = op1.l_ui; a[2] = 0;
b[0] = op2.l_uf; b[1] = op2.l_ui; b[2] = 0;
@@ -142,7 +142,7 @@ l_fp_subtract(const l_fp first, const l_fp second)
{
l_fp temp = first;
L_SUB(&temp, &second);
-
+
return temp;
}
@@ -151,7 +151,7 @@ l_fp_negate(const l_fp first)
{
l_fp temp = first;
L_NEG(&temp);
-
+
return temp;
}
@@ -189,11 +189,14 @@ l_fp_init_from_double( double rhs)
}
void
-l_fp_swap(l_fp * first, l_fp *second){
+l_fp_swap(l_fp * first, l_fp *second)
+{
l_fp temp = *second;
*second = *first;
*first = temp;
+
+ return;
}
//----------------------------------------------------------------------
@@ -204,27 +207,37 @@ l_fp_swap(l_fp * first, l_fp *second){
bool
-l_isgt (const l_fp first, const l_fp second) {
+l_isgt (const l_fp first, const l_fp second)
+{
+
return L_ISGT(&first, &second);
}
bool
-l_isgtu(const l_fp first, const l_fp second) {
+l_isgtu(const l_fp first, const l_fp second)
+{
+
return L_ISGTU(&first, &second);
}
bool
-l_ishis(const l_fp first, const l_fp second) {
+l_ishis(const l_fp first, const l_fp second)
+{
+
return L_ISHIS(&first, &second);
}
bool
-l_isgeq(const l_fp first, const l_fp second) {
+l_isgeq(const l_fp first, const l_fp second)
+{
+
return L_ISGEQ(&first, &second);
}
bool
-l_isequ(const l_fp first, const l_fp second) {
+l_isequ(const l_fp first, const l_fp second)
+{
+
return L_ISEQU(&first, &second);
}
@@ -275,6 +288,7 @@ static const size_t addsub_tot = (sizeof(addsub_tab)/sizeof(addsub_tab[0][0]));
double
eps(double d)
{
+
return fmax(ldexp(1.0, -31), ldexp(fabs(d), -53));
}
@@ -282,61 +296,71 @@ eps(double d)
// test addition
//----------------------------------------------------------------------
void
-test_AdditionLR(void) {
-
+test_AdditionLR(void)
+{
size_t idx = 0;
+
for (idx = 0; idx < addsub_cnt; ++idx) {
l_fp op1 = l_fp_init(addsub_tab[idx][0].h, addsub_tab[idx][0].l);
l_fp op2 = l_fp_init(addsub_tab[idx][1].h, addsub_tab[idx][1].l);
- l_fp exp = l_fp_init(addsub_tab[idx][2].h, addsub_tab[idx][2].l);
- l_fp res = l_fp_add(op1, op2);
+ l_fp e_res = l_fp_init(addsub_tab[idx][2].h, addsub_tab[idx][2].l);
+ l_fp res = l_fp_add(op1, op2);
- TEST_ASSERT_EQUAL_l_fp(exp, res);
- }
+ TEST_ASSERT_EQUAL_l_fp(e_res, res);
+ }
+ return;
}
void
-test_AdditionRL(void) {
+test_AdditionRL(void)
+{
size_t idx = 0;
+
for (idx = 0; idx < addsub_cnt; ++idx) {
l_fp op2 = l_fp_init(addsub_tab[idx][0].h, addsub_tab[idx][0].l);
l_fp op1 = l_fp_init(addsub_tab[idx][1].h, addsub_tab[idx][1].l);
- l_fp exp = l_fp_init(addsub_tab[idx][2].h, addsub_tab[idx][2].l);
+ l_fp e_res = l_fp_init(addsub_tab[idx][2].h, addsub_tab[idx][2].l);
l_fp res = l_fp_add(op1, op2);
- TEST_ASSERT_EQUAL_l_fp(exp, res);
- }
+ TEST_ASSERT_EQUAL_l_fp(e_res, res);
+ }
+ return;
}
-
//----------------------------------------------------------------------
// test subtraction
//----------------------------------------------------------------------
void
-test_SubtractionLR(void) {
+test_SubtractionLR(void)
+{
size_t idx = 0;
+
for (idx = 0; idx < addsub_cnt; ++idx) {
l_fp op2 = l_fp_init(addsub_tab[idx][0].h, addsub_tab[idx][0].l);
- l_fp exp = l_fp_init(addsub_tab[idx][1].h, addsub_tab[idx][1].l);
+ l_fp e_res = l_fp_init(addsub_tab[idx][1].h, addsub_tab[idx][1].l);
l_fp op1 = l_fp_init(addsub_tab[idx][2].h, addsub_tab[idx][2].l);
l_fp res = l_fp_subtract(op1, op2);
-
- TEST_ASSERT_EQUAL_l_fp(exp, res);
- }
+
+ TEST_ASSERT_EQUAL_l_fp(e_res, res);
+ }
+ return;
}
void
-test_SubtractionRL(void) {
+test_SubtractionRL(void)
+{
size_t idx = 0;
+
for (idx = 0; idx < addsub_cnt; ++idx) {
- l_fp exp = l_fp_init(addsub_tab[idx][0].h, addsub_tab[idx][0].l);
+ l_fp e_res = l_fp_init(addsub_tab[idx][0].h, addsub_tab[idx][0].l);
l_fp op2 = l_fp_init(addsub_tab[idx][1].h, addsub_tab[idx][1].l);
l_fp op1 = l_fp_init(addsub_tab[idx][2].h, addsub_tab[idx][2].l);
l_fp res = l_fp_subtract(op1, op2);
- TEST_ASSERT_EQUAL_l_fp(exp, res);
- }
+ TEST_ASSERT_EQUAL_l_fp(e_res, res);
+ }
+ return;
}
//----------------------------------------------------------------------
@@ -344,18 +368,20 @@ test_SubtractionRL(void) {
//----------------------------------------------------------------------
void
-test_Negation(void) {
-
+test_Negation(void)
+{
size_t idx = 0;
+
for (idx = 0; idx < addsub_cnt; ++idx) {
l_fp op1 = l_fp_init(addsub_tab[idx][0].h, addsub_tab[idx][0].l);
l_fp op2 = l_fp_negate(op1);
l_fp sum = l_fp_add(op1, op2);
-
+
l_fp zero = l_fp_init(0, 0);
TEST_ASSERT_EQUAL_l_fp(zero, sum);
- }
+ }
+ return;
}
@@ -364,21 +390,23 @@ test_Negation(void) {
// test absolute value
//----------------------------------------------------------------------
void
-test_Absolute(void) {
+test_Absolute(void)
+{
size_t idx = 0;
+
for (idx = 0; idx < addsub_cnt; ++idx) {
l_fp op1 = l_fp_init(addsub_tab[idx][0].h, addsub_tab[idx][0].l);
l_fp op2 = l_fp_abs(op1);
- TEST_ASSERT_TRUE(l_fp_signum(op2) >= 0);
+ TEST_ASSERT_TRUE(l_fp_signum(op2) >= 0);
if (l_fp_signum(op1) >= 0)
- op1 = l_fp_subtract(op1, op2);
+ op1 = l_fp_subtract(op1, op2);
else
op1 = l_fp_add(op1, op2);
-
+
l_fp zero = l_fp_init(0, 0);
-
+
TEST_ASSERT_EQUAL_l_fp(zero, op1);
}
@@ -390,6 +418,8 @@ test_Absolute(void) {
TEST_ASSERT_EQUAL(-1, l_fp_signum(minVal));
TEST_ASSERT_EQUAL_l_fp(minVal, minAbs);
+
+ return;
}
@@ -397,14 +427,17 @@ test_Absolute(void) {
// fp -> double -> fp rountrip test
//----------------------------------------------------------------------
void
-test_FDF_RoundTrip(void) {
+test_FDF_RoundTrip(void)
+{
+ size_t idx = 0;
+
// since a l_fp has 64 bits in it's mantissa and a double has
// only 54 bits available (including the hidden '1') we have to
// make a few concessions on the roundtrip precision. The 'eps()'
// function makes an educated guess about the avilable precision
// and checks the difference in the two 'l_fp' values against
// that limit.
- size_t idx = 0;
+
for (idx = 0; idx < addsub_cnt; ++idx) {
l_fp op1 = l_fp_init(addsub_tab[idx][0].h, addsub_tab[idx][0].l);
double op2 = l_fp_convert_to_double(op1);
@@ -412,8 +445,10 @@ test_FDF_RoundTrip(void) {
l_fp temp = l_fp_subtract(op1, op3);
double d = l_fp_convert_to_double(temp);
- TEST_ASSERT_DOUBLE_WITHIN(eps(op2), 0.0, fabs(d));
- }
+ TEST_ASSERT_DOUBLE_WITHIN(eps(op2), 0.0, fabs(d));
+ }
+
+ return;
}
@@ -424,14 +459,16 @@ test_FDF_RoundTrip(void) {
// macros in 'ntp_fp.h' produce mathing results.
// ----------------------------------------------------------------------
void
-test_SignedRelOps(void) {
+test_SignedRelOps(void)
+{
const lfp_hl * tv = (&addsub_tab[0][0]);
size_t lc ;
+
for (lc = addsub_tot - 1; lc; --lc, ++tv) {
l_fp op1 = l_fp_init(tv[0].h, tv[0].l);
l_fp op2 = l_fp_init(tv[1].h, tv[1].l);
- int cmp = l_fp_scmp(op1, op2);
-
+ int cmp = l_fp_scmp(op1, op2);
+
switch (cmp) {
case -1:
//printf("op1:%d %d, op2:%d %d\n",op1.l_uf,op1.l_ui,op2.l_uf,op2.l_ui);
@@ -458,15 +495,19 @@ test_SignedRelOps(void) {
TEST_ASSERT_TRUE (l_isequ(op2, op1));
break;
default:
- TEST_FAIL_MESSAGE("unexpected UCMP result: " );
+ TEST_FAIL_MESSAGE("unexpected UCMP result: ");
}
}
+
+ return;
}
void
-test_UnsignedRelOps(void) {
- const lfp_hl * tv =(&addsub_tab[0][0]);
+test_UnsignedRelOps(void)
+{
+ const lfp_hl * tv =(&addsub_tab[0][0]);
size_t lc;
+
for (lc = addsub_tot - 1; lc; --lc, ++tv) {
l_fp op1 = l_fp_init(tv[0].h, tv[0].l);
l_fp op2 = l_fp_init(tv[1].h, tv[1].l);
@@ -492,10 +533,13 @@ test_UnsignedRelOps(void) {
TEST_ASSERT_TRUE (l_ishis(op2, op1));
break;
default:
- TEST_FAIL_MESSAGE("unexpected UCMP result: " );
+ TEST_FAIL_MESSAGE("unexpected UCMP result: ");
}
}
+
+ return;
}
+
/*
*/
diff --git a/contrib/ntp/tests/libntp/lfptostr.c b/contrib/ntp/tests/libntp/lfptostr.c
index 142e6c7..ed32853 100644
--- a/contrib/ntp/tests/libntp/lfptostr.c
+++ b/contrib/ntp/tests/libntp/lfptostr.c
@@ -20,6 +20,7 @@ static const int HALF_PROMILLE_UP = 2147484; /* slightly more than 0.0005 */
static const int HALF_PROMILLE_DOWN = 2147483; /* slightly less than 0.0005 */
+void setUp(void);
void test_PositiveInteger(void);
void test_NegativeInteger(void);
void test_PositiveIntegerWithFraction(void);
@@ -33,6 +34,14 @@ void test_MillisecondsRoundingDown(void);
void test_UnsignedInteger(void);
+void
+setUp(void)
+{
+ init_lib();
+
+ return;
+}
+
void
test_PositiveInteger(void) {
diff --git a/contrib/ntp/tests/libntp/modetoa.c b/contrib/ntp/tests/libntp/modetoa.c
index 267b44e..03b384c 100644
--- a/contrib/ntp/tests/libntp/modetoa.c
+++ b/contrib/ntp/tests/libntp/modetoa.c
@@ -4,11 +4,21 @@
#include "unity.h"
+void setUp(void);
void test_KnownMode(void);
void test_UnknownMode(void);
void
+setUp(void)
+{
+ init_lib();
+
+ return;
+}
+
+
+void
test_KnownMode(void) {
const int MODE = 3; // Should be "client"
diff --git a/contrib/ntp/tests/libntp/msyslog.c b/contrib/ntp/tests/libntp/msyslog.c
index dec8d85..987c814 100644
--- a/contrib/ntp/tests/libntp/msyslog.c
+++ b/contrib/ntp/tests/libntp/msyslog.c
@@ -10,6 +10,7 @@ void format_errmsg(char *, size_t, const char *, int);
#endif
+void setUp(void);
void test_msnprintf(void);
void test_msnprintfLiteralPercentm(void);
void test_msnprintfBackslashLiteralPercentm(void);
@@ -21,6 +22,15 @@ void test_msnprintfTruncate(void);
void
+setUp(void)
+{
+ init_lib();
+
+ return;
+}
+
+
+void
test_msnprintf(void) {
#define FMT_PREFIX "msyslog.cpp ENOENT: "
char exp_buf[512];
diff --git a/contrib/ntp/tests/libntp/netof.c b/contrib/ntp/tests/libntp/netof.c
index 2fde6cc..59dd709 100644
--- a/contrib/ntp/tests/libntp/netof.c
+++ b/contrib/ntp/tests/libntp/netof.c
@@ -8,14 +8,25 @@
#include "sockaddrtest.h"
+void setUp(void);
void test_ClassBAddress(void);
void test_ClassCAddress(void);
void test_ClassAAddress(void);
void test_IPv6Address(void);
+void
+setUp(void)
+{
+ init_lib();
-void test_ClassBAddress(void) {
+ return;
+}
+
+
+void
+test_ClassBAddress(void)
+{
sockaddr_u input = CreateSockaddr4("172.16.2.1", NTP_PORT);
sockaddr_u expected = CreateSockaddr4("172.16.0.0", NTP_PORT);
@@ -23,9 +34,13 @@ void test_ClassBAddress(void) {
TEST_ASSERT_TRUE(actual != NULL);
TEST_ASSERT_TRUE(IsEqual(expected, *actual));
+
+ return;
}
-void test_ClassCAddress(void) {
+void
+test_ClassCAddress(void)
+{
sockaddr_u input = CreateSockaddr4("192.0.2.255", NTP_PORT);
sockaddr_u expected = CreateSockaddr4("192.0.2.0", NTP_PORT);
@@ -33,9 +48,14 @@ void test_ClassCAddress(void) {
TEST_ASSERT_TRUE(actual != NULL);
TEST_ASSERT_TRUE(IsEqual(expected, *actual));
+
+ return;
}
-void test_ClassAAddress(void) {
+
+void
+test_ClassAAddress(void)
+{
/* Class A addresses are assumed to be classless,
* thus the same address should be returned.
*/
@@ -46,24 +66,28 @@ void test_ClassAAddress(void) {
TEST_ASSERT_TRUE(actual != NULL);
TEST_ASSERT_TRUE(IsEqual(expected, *actual));
+
+ return;
}
-void test_IPv6Address(void) {
+void
+test_IPv6Address(void)
+{
/* IPv6 addresses are assumed to have 64-bit host- and 64-bit network parts. */
- const struct in6_addr input_address = {
+ const struct in6_addr input_address = { { {
0x20, 0x01, 0x0d, 0xb8,
- 0x85, 0xa3, 0x08, 0xd3,
- 0x13, 0x19, 0x8a, 0x2e,
- 0x03, 0x70, 0x73, 0x34
- }; // 2001:0db8:85a3:08d3:1319:8a2e:0370:7334
+ 0x85, 0xa3, 0x08, 0xd3,
+ 0x13, 0x19, 0x8a, 0x2e,
+ 0x03, 0x70, 0x73, 0x34
+ } } }; // 2001:0db8:85a3:08d3:1319:8a2e:0370:7334
- const struct in6_addr expected_address = {
+ const struct in6_addr expected_address = { { {
0x20, 0x01, 0x0d, 0xb8,
- 0x85, 0xa3, 0x08, 0xd3,
- 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00
- }; // 2001:0db8:85a3:08d3:0000:0000:0000:0000
-
+ 0x85, 0xa3, 0x08, 0xd3,
+ 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00
+ } } }; // 2001:0db8:85a3:08d3:0000:0000:0000:0000
+
sockaddr_u input;
input.sa6.sin6_family = AF_INET6;
input.sa6.sin6_addr = input_address;
@@ -78,5 +102,6 @@ void test_IPv6Address(void) {
TEST_ASSERT_TRUE(actual != NULL);
TEST_ASSERT_TRUE(IsEqual(expected, *actual));
-}
+ return;
+}
diff --git a/contrib/ntp/tests/libntp/numtoa.c b/contrib/ntp/tests/libntp/numtoa.c
index 5c7a663..42638b6 100644
--- a/contrib/ntp/tests/libntp/numtoa.c
+++ b/contrib/ntp/tests/libntp/numtoa.c
@@ -5,9 +5,20 @@
#include "unity.h"
+void setUp(void);
void test_Address(void);
void test_Netmask(void);
+
+void
+setUp(void)
+{
+ init_lib();
+
+ return;
+}
+
+
void
test_Address(void) {
const u_int32 input = htonl(3221225472UL + 512UL + 1UL); // 192.0.2.1
diff --git a/contrib/ntp/tests/libntp/numtohost.c b/contrib/ntp/tests/libntp/numtohost.c
index cfce2d8..1c095eb 100644
--- a/contrib/ntp/tests/libntp/numtohost.c
+++ b/contrib/ntp/tests/libntp/numtohost.c
@@ -5,8 +5,19 @@
#include "unity.h"
+void setUp(void);
void test_LoopbackNetNonResolve(void);
+
+void
+setUp(void)
+{
+ init_lib();
+
+ return;
+}
+
+
void
test_LoopbackNetNonResolve(void) {
/* A loopback address in 127.0.0.0/8 is chosen, and
@@ -15,6 +26,6 @@ test_LoopbackNetNonResolve(void) {
*/
const u_int32 input = 127*256*256*256 + 1*256 + 1; // 127.0.1.1
-
+
TEST_ASSERT_EQUAL_STRING("127.0.1.1", numtohost(htonl(input)));
}
diff --git a/contrib/ntp/tests/libntp/octtoint.c b/contrib/ntp/tests/libntp/octtoint.c
index 5c03d6d..83a1c99 100644
--- a/contrib/ntp/tests/libntp/octtoint.c
+++ b/contrib/ntp/tests/libntp/octtoint.c
@@ -14,61 +14,83 @@ void test_IllegalCharacter(void);
void test_IllegalDigit(void);
-void test_SingleDigit(void) {
+void
+test_SingleDigit(void)
+{
const char* str = "5";
u_long actual;
- TEST_ASSERT_TRUE(octtoint(str, &actual) );
+ TEST_ASSERT_TRUE(octtoint(str, &actual));
TEST_ASSERT_EQUAL(5, actual);
+
+ return;
}
-void test_MultipleDigits(void){
+void
+test_MultipleDigits(void)
+{
const char* str = "271";
u_long actual;
- TEST_ASSERT_TRUE(octtoint(str, &actual) );
+ TEST_ASSERT_TRUE(octtoint(str, &actual));
TEST_ASSERT_EQUAL(185, actual);
+ return;
}
-void test_Zero(void){
+void
+test_Zero(void)
+{
const char* str = "0";
u_long actual;
- TEST_ASSERT_TRUE(octtoint(str, &actual) );
+ TEST_ASSERT_TRUE(octtoint(str, &actual));
TEST_ASSERT_EQUAL(0, actual);
+ return;
}
-void test_MaximumUnsigned32bit(void){
+void
+test_MaximumUnsigned32bit(void)
+{
const char* str = "37777777777";
u_long actual;
- TEST_ASSERT_TRUE(octtoint(str, &actual) );
+ TEST_ASSERT_TRUE(octtoint(str, &actual));
TEST_ASSERT_EQUAL(4294967295UL, actual);
+ return;
}
-void test_Overflow(void){
+void
+test_Overflow(void)
+{
const char* str = "40000000000";
u_long actual;
- TEST_ASSERT_FALSE(octtoint(str, &actual) );
+ TEST_ASSERT_FALSE(octtoint(str, &actual));
+ return;
}
-void test_IllegalCharacter(void){
+void
+test_IllegalCharacter(void)
+{
const char* str = "5ac2";
u_long actual;
- TEST_ASSERT_FALSE(octtoint(str, &actual) );
+ TEST_ASSERT_FALSE(octtoint(str, &actual));
+ return;
}
-void test_IllegalDigit(void){
+void
+test_IllegalDigit(void)
+{
const char* str = "5283";
u_long actual;
- TEST_ASSERT_FALSE(octtoint(str, &actual) );
+ TEST_ASSERT_FALSE(octtoint(str, &actual));
+ return;
}
diff --git a/contrib/ntp/tests/libntp/prettydate.c b/contrib/ntp/tests/libntp/prettydate.c
index e1292bf..c940e2a 100644
--- a/contrib/ntp/tests/libntp/prettydate.c
+++ b/contrib/ntp/tests/libntp/prettydate.c
@@ -6,15 +6,26 @@
#include "unity.h"
+void setUp(void);
void test_ConstantDate(void);
void
+setUp(void)
+{
+ init_lib();
+
+ return;
+}
+
+
+void
test_ConstantDate(void) {
const u_int32 HALF = 2147483648UL;
- l_fp time = {{3485080800UL}, HALF}; /* 2010-06-09 14:00:00.5 */
+ l_fp e_time = {{3485080800UL}, HALF}; /* 2010-06-09 14:00:00.5 */
TEST_ASSERT_EQUAL_STRING("cfba1ce0.80000000 Wed, Jun 9 2010 14:00:00.500",
- gmprettydate(&time));
+ gmprettydate(&e_time));
+ return;
}
diff --git a/contrib/ntp/tests/libntp/recvbuff.c b/contrib/ntp/tests/libntp/recvbuff.c
index 6d6cf8e..6c089bb 100644
--- a/contrib/ntp/tests/libntp/recvbuff.c
+++ b/contrib/ntp/tests/libntp/recvbuff.c
@@ -13,6 +13,9 @@ void
setUp(void)
{
init_recvbuff(RECV_INIT);
+ init_lib();
+
+ return;
}
void
@@ -36,7 +39,7 @@ test_GetAndFree(void) {
void
test_GetAndFill(void) {
- int initial = free_recvbuffs();
+ // int initial = free_recvbuffs();
recvbuf_t* buf = get_free_recv_buffer();
add_full_recv_buffer(buf);
diff --git a/contrib/ntp/tests/libntp/refidsmear.c b/contrib/ntp/tests/libntp/refidsmear.c
index 04f396c..da1ebff 100644
--- a/contrib/ntp/tests/libntp/refidsmear.c
+++ b/contrib/ntp/tests/libntp/refidsmear.c
@@ -29,12 +29,21 @@
*/
-
+void setUp(void);
void rtol(uint32_t r, char *es);
void rtoltor(uint32_t er, char *es);
void ltor(l_fp l, char *er);
void test_refidsmear(void);
+
+void
+setUp(void)
+{
+ init_lib();
+
+ return;
+}
+
void
rtol(uint32_t r, char *es)
{
@@ -48,7 +57,7 @@ rtol(uint32_t r, char *es)
l = convertRefIDToLFP(htonl(r));
as = lfptoa(&l, 8);
-
+
//printf("refid %#x, smear %s\n", r, as);
TEST_ASSERT_NOT_NULL_MESSAGE(as, msg);
@@ -58,8 +67,6 @@ rtol(uint32_t r, char *es)
}
-
-
void
rtoltor(uint32_t er, char *es)
{
diff --git a/contrib/ntp/tests/libntp/refnumtoa.c b/contrib/ntp/tests/libntp/refnumtoa.c
index 33ad3aa..9db5fb1 100644
--- a/contrib/ntp/tests/libntp/refnumtoa.c
+++ b/contrib/ntp/tests/libntp/refnumtoa.c
@@ -9,11 +9,21 @@
/* Might need to be updated if a new refclock gets this id. */
static const int UNUSED_REFCLOCK_ID = 250;
+void setUp(void);
void test_LocalClock(void);
void test_UnknownId(void);
void
+setUp(void)
+{
+ init_lib();
+
+ return;
+}
+
+
+void
test_LocalClock(void) {
#ifdef REFCLOCK /* clockname() is useless otherwise */
/* We test with a refclock address of type LOCALCLOCK.
@@ -26,7 +36,7 @@ test_LocalClock(void) {
sockaddr_u address;
address.sa4.sin_family = AF_INET;
address.sa4.sin_addr.s_addr = htonl(addr);
-
+
char stringStart[100]= "";
strcat(stringStart, clockname(REFCLK_LOCALCLOCK));
@@ -35,7 +45,7 @@ test_LocalClock(void) {
char * expected = stringStart;
TEST_ASSERT_EQUAL_STRING(expected, refnumtoa(&address));
-#else
+#else
TEST_IGNORE_MESSAGE("REFCLOCK NOT DEFINED, SKIPPING TEST");
#endif /* REFCLOCK */
}
@@ -51,16 +61,16 @@ test_UnknownId(void) {
sockaddr_u address;
address.sa4.sin_family = AF_INET;
address.sa4.sin_addr.s_addr = htonl(addr);
-
+
char stringStart[100]= "REFCLK(";
- char value[100] ;
+ char value[100] ;
snprintf(value, sizeof(value), "%d", UNUSED_REFCLOCK_ID);
strcat(stringStart,value);
strcat(stringStart,",4)");
char * expected = stringStart;
TEST_ASSERT_EQUAL_STRING(expected, refnumtoa(&address));
-#else
+#else
TEST_IGNORE_MESSAGE("REFCLOCK NOT DEFINED, SKIPPING TEST");
#endif /* REFCLOCK */
}
diff --git a/contrib/ntp/tests/libntp/run-a_md5encrypt.c b/contrib/ntp/tests/libntp/run-a_md5encrypt.c
index 122ed93..a4bfa36 100644
--- a/contrib/ntp/tests/libntp/run-a_md5encrypt.c
+++ b/contrib/ntp/tests/libntp/run-a_md5encrypt.c
@@ -52,11 +52,11 @@ int main(int argc, char *argv[])
{
progname = argv[0];
UnityBegin("a_md5encrypt.c");
- RUN_TEST(test_Encrypt, 29);
- RUN_TEST(test_DecryptValid, 30);
- RUN_TEST(test_DecryptInvalid, 31);
- RUN_TEST(test_IPv4AddressToRefId, 32);
- RUN_TEST(test_IPv6AddressToRefId, 33);
+ RUN_TEST(test_Encrypt, 40);
+ RUN_TEST(test_DecryptValid, 41);
+ RUN_TEST(test_DecryptInvalid, 42);
+ RUN_TEST(test_IPv4AddressToRefId, 43);
+ RUN_TEST(test_IPv6AddressToRefId, 44);
return (UnityEnd());
}
diff --git a/contrib/ntp/tests/libntp/run-calendar.c b/contrib/ntp/tests/libntp/run-calendar.c
index 50c5b20..555f3ba 100644
--- a/contrib/ntp/tests/libntp/run-calendar.c
+++ b/contrib/ntp/tests/libntp/run-calendar.c
@@ -63,21 +63,21 @@ int main(int argc, char *argv[])
{
progname = argv[0];
UnityBegin("calendar.c");
- RUN_TEST(test_DaySplitMerge, 21);
- RUN_TEST(test_SplitYearDays1, 22);
- RUN_TEST(test_SplitYearDays2, 23);
- RUN_TEST(test_RataDie1, 24);
- RUN_TEST(test_LeapYears1, 25);
- RUN_TEST(test_LeapYears2, 26);
- RUN_TEST(test_RoundTripDate, 27);
- RUN_TEST(test_RoundTripYearStart, 28);
- RUN_TEST(test_RoundTripMonthStart, 29);
- RUN_TEST(test_RoundTripWeekStart, 30);
- RUN_TEST(test_RoundTripDayStart, 31);
- RUN_TEST(test_IsoCalYearsToWeeks, 32);
- RUN_TEST(test_IsoCalWeeksToYearStart, 33);
- RUN_TEST(test_IsoCalWeeksToYearEnd, 34);
- RUN_TEST(test_DaySecToDate, 35);
+ RUN_TEST(test_DaySplitMerge, 22);
+ RUN_TEST(test_SplitYearDays1, 23);
+ RUN_TEST(test_SplitYearDays2, 24);
+ RUN_TEST(test_RataDie1, 25);
+ RUN_TEST(test_LeapYears1, 26);
+ RUN_TEST(test_LeapYears2, 27);
+ RUN_TEST(test_RoundTripDate, 28);
+ RUN_TEST(test_RoundTripYearStart, 29);
+ RUN_TEST(test_RoundTripMonthStart, 30);
+ RUN_TEST(test_RoundTripWeekStart, 31);
+ RUN_TEST(test_RoundTripDayStart, 32);
+ RUN_TEST(test_IsoCalYearsToWeeks, 33);
+ RUN_TEST(test_IsoCalWeeksToYearStart, 34);
+ RUN_TEST(test_IsoCalWeeksToYearEnd, 35);
+ RUN_TEST(test_DaySecToDate, 36);
return (UnityEnd());
}
diff --git a/contrib/ntp/tests/libntp/run-decodenetnum.c b/contrib/ntp/tests/libntp/run-decodenetnum.c
index 014151e..57b955c 100644
--- a/contrib/ntp/tests/libntp/run-decodenetnum.c
+++ b/contrib/ntp/tests/libntp/run-decodenetnum.c
@@ -53,12 +53,12 @@ int main(int argc, char *argv[])
{
progname = argv[0];
UnityBegin("decodenetnum.c");
- RUN_TEST(test_IPv4AddressOnly, 7);
- RUN_TEST(test_IPv4AddressWithPort, 8);
- RUN_TEST(test_IPv6AddressOnly, 10);
- RUN_TEST(test_IPv6AddressWithPort, 11);
- RUN_TEST(test_IllegalAddress, 13);
- RUN_TEST(test_IllegalCharInPort, 14);
+ RUN_TEST(test_IPv4AddressOnly, 8);
+ RUN_TEST(test_IPv4AddressWithPort, 9);
+ RUN_TEST(test_IPv6AddressOnly, 11);
+ RUN_TEST(test_IPv6AddressWithPort, 12);
+ RUN_TEST(test_IllegalAddress, 14);
+ RUN_TEST(test_IllegalCharInPort, 15);
return (UnityEnd());
}
diff --git a/contrib/ntp/tests/libntp/run-humandate.c b/contrib/ntp/tests/libntp/run-humandate.c
index 1f2e717..690895f 100644
--- a/contrib/ntp/tests/libntp/run-humandate.c
+++ b/contrib/ntp/tests/libntp/run-humandate.c
@@ -49,8 +49,8 @@ int main(int argc, char *argv[])
{
progname = argv[0];
UnityBegin("humandate.c");
- RUN_TEST(test_RegularTime, 8);
- RUN_TEST(test_CurrentTime, 9);
+ RUN_TEST(test_RegularTime, 9);
+ RUN_TEST(test_CurrentTime, 10);
return (UnityEnd());
}
diff --git a/contrib/ntp/tests/libntp/run-lfpfunc.c b/contrib/ntp/tests/libntp/run-lfpfunc.c
index ac6700f..83f9668 100644
--- a/contrib/ntp/tests/libntp/run-lfpfunc.c
+++ b/contrib/ntp/tests/libntp/run-lfpfunc.c
@@ -58,15 +58,15 @@ int main(int argc, char *argv[])
{
progname = argv[0];
UnityBegin("lfpfunc.c");
- RUN_TEST(test_AdditionLR, 50);
- RUN_TEST(test_AdditionRL, 51);
- RUN_TEST(test_SubtractionLR, 52);
- RUN_TEST(test_SubtractionRL, 53);
- RUN_TEST(test_Negation, 54);
- RUN_TEST(test_Absolute, 55);
- RUN_TEST(test_FDF_RoundTrip, 56);
- RUN_TEST(test_SignedRelOps, 57);
- RUN_TEST(test_UnsignedRelOps, 58);
+ RUN_TEST(test_AdditionLR, 51);
+ RUN_TEST(test_AdditionRL, 52);
+ RUN_TEST(test_SubtractionLR, 53);
+ RUN_TEST(test_SubtractionRL, 54);
+ RUN_TEST(test_Negation, 55);
+ RUN_TEST(test_Absolute, 56);
+ RUN_TEST(test_FDF_RoundTrip, 57);
+ RUN_TEST(test_SignedRelOps, 58);
+ RUN_TEST(test_UnsignedRelOps, 59);
return (UnityEnd());
}
diff --git a/contrib/ntp/tests/libntp/run-lfptostr.c b/contrib/ntp/tests/libntp/run-lfptostr.c
index bae0f85..fbdeb7a 100644
--- a/contrib/ntp/tests/libntp/run-lfptostr.c
+++ b/contrib/ntp/tests/libntp/run-lfptostr.c
@@ -58,17 +58,17 @@ int main(int argc, char *argv[])
{
progname = argv[0];
UnityBegin("lfptostr.c");
- RUN_TEST(test_PositiveInteger, 23);
- RUN_TEST(test_NegativeInteger, 24);
- RUN_TEST(test_PositiveIntegerWithFraction, 25);
- RUN_TEST(test_NegativeIntegerWithFraction, 26);
- RUN_TEST(test_RoundingDownToInteger, 27);
- RUN_TEST(test_RoundingMiddleToInteger, 28);
- RUN_TEST(test_RoundingUpToInteger, 29);
- RUN_TEST(test_SingleDecimal, 30);
- RUN_TEST(test_MillisecondsRoundingUp, 31);
- RUN_TEST(test_MillisecondsRoundingDown, 32);
- RUN_TEST(test_UnsignedInteger, 33);
+ RUN_TEST(test_PositiveInteger, 24);
+ RUN_TEST(test_NegativeInteger, 25);
+ RUN_TEST(test_PositiveIntegerWithFraction, 26);
+ RUN_TEST(test_NegativeIntegerWithFraction, 27);
+ RUN_TEST(test_RoundingDownToInteger, 28);
+ RUN_TEST(test_RoundingMiddleToInteger, 29);
+ RUN_TEST(test_RoundingUpToInteger, 30);
+ RUN_TEST(test_SingleDecimal, 31);
+ RUN_TEST(test_MillisecondsRoundingUp, 32);
+ RUN_TEST(test_MillisecondsRoundingDown, 33);
+ RUN_TEST(test_UnsignedInteger, 34);
return (UnityEnd());
}
diff --git a/contrib/ntp/tests/libntp/run-modetoa.c b/contrib/ntp/tests/libntp/run-modetoa.c
index 20e2d95..0c1558e 100644
--- a/contrib/ntp/tests/libntp/run-modetoa.c
+++ b/contrib/ntp/tests/libntp/run-modetoa.c
@@ -48,8 +48,8 @@ int main(int argc, char *argv[])
{
progname = argv[0];
UnityBegin("modetoa.c");
- RUN_TEST(test_KnownMode, 7);
- RUN_TEST(test_UnknownMode, 8);
+ RUN_TEST(test_KnownMode, 8);
+ RUN_TEST(test_UnknownMode, 9);
return (UnityEnd());
}
diff --git a/contrib/ntp/tests/libntp/run-msyslog.c b/contrib/ntp/tests/libntp/run-msyslog.c
index 544fbc1..ff264f8 100644
--- a/contrib/ntp/tests/libntp/run-msyslog.c
+++ b/contrib/ntp/tests/libntp/run-msyslog.c
@@ -54,14 +54,14 @@ int main(int argc, char *argv[])
{
progname = argv[0];
UnityBegin("msyslog.c");
- RUN_TEST(test_msnprintf, 13);
- RUN_TEST(test_msnprintfLiteralPercentm, 14);
- RUN_TEST(test_msnprintfBackslashLiteralPercentm, 15);
- RUN_TEST(test_msnprintfBackslashPercent, 16);
- RUN_TEST(test_msnprintfHangingPercent, 17);
- RUN_TEST(test_format_errmsgHangingPercent, 18);
- RUN_TEST(test_msnprintfNullTarget, 19);
- RUN_TEST(test_msnprintfTruncate, 20);
+ RUN_TEST(test_msnprintf, 14);
+ RUN_TEST(test_msnprintfLiteralPercentm, 15);
+ RUN_TEST(test_msnprintfBackslashLiteralPercentm, 16);
+ RUN_TEST(test_msnprintfBackslashPercent, 17);
+ RUN_TEST(test_msnprintfHangingPercent, 18);
+ RUN_TEST(test_format_errmsgHangingPercent, 19);
+ RUN_TEST(test_msnprintfNullTarget, 20);
+ RUN_TEST(test_msnprintfTruncate, 21);
return (UnityEnd());
}
diff --git a/contrib/ntp/tests/libntp/run-netof.c b/contrib/ntp/tests/libntp/run-netof.c
index 7a714f5..9301b84 100644
--- a/contrib/ntp/tests/libntp/run-netof.c
+++ b/contrib/ntp/tests/libntp/run-netof.c
@@ -52,10 +52,10 @@ int main(int argc, char *argv[])
{
progname = argv[0];
UnityBegin("netof.c");
- RUN_TEST(test_ClassBAddress, 11);
- RUN_TEST(test_ClassCAddress, 12);
- RUN_TEST(test_ClassAAddress, 13);
- RUN_TEST(test_IPv6Address, 14);
+ RUN_TEST(test_ClassBAddress, 12);
+ RUN_TEST(test_ClassCAddress, 13);
+ RUN_TEST(test_ClassAAddress, 14);
+ RUN_TEST(test_IPv6Address, 15);
return (UnityEnd());
}
diff --git a/contrib/ntp/tests/libntp/run-numtoa.c b/contrib/ntp/tests/libntp/run-numtoa.c
index 640e61c..f3368a7 100644
--- a/contrib/ntp/tests/libntp/run-numtoa.c
+++ b/contrib/ntp/tests/libntp/run-numtoa.c
@@ -49,8 +49,8 @@ int main(int argc, char *argv[])
{
progname = argv[0];
UnityBegin("numtoa.c");
- RUN_TEST(test_Address, 8);
- RUN_TEST(test_Netmask, 9);
+ RUN_TEST(test_Address, 9);
+ RUN_TEST(test_Netmask, 10);
return (UnityEnd());
}
diff --git a/contrib/ntp/tests/libntp/run-numtohost.c b/contrib/ntp/tests/libntp/run-numtohost.c
index 5ebe15b..49b5264 100644
--- a/contrib/ntp/tests/libntp/run-numtohost.c
+++ b/contrib/ntp/tests/libntp/run-numtohost.c
@@ -48,7 +48,7 @@ int main(int argc, char *argv[])
{
progname = argv[0];
UnityBegin("numtohost.c");
- RUN_TEST(test_LoopbackNetNonResolve, 8);
+ RUN_TEST(test_LoopbackNetNonResolve, 9);
return (UnityEnd());
}
diff --git a/contrib/ntp/tests/libntp/run-prettydate.c b/contrib/ntp/tests/libntp/run-prettydate.c
index e6c5ff3..e034cc2 100644
--- a/contrib/ntp/tests/libntp/run-prettydate.c
+++ b/contrib/ntp/tests/libntp/run-prettydate.c
@@ -49,7 +49,7 @@ int main(int argc, char *argv[])
{
progname = argv[0];
UnityBegin("prettydate.c");
- RUN_TEST(test_ConstantDate, 9);
+ RUN_TEST(test_ConstantDate, 10);
return (UnityEnd());
}
diff --git a/contrib/ntp/tests/libntp/run-refnumtoa.c b/contrib/ntp/tests/libntp/run-refnumtoa.c
index bb9fb60..d829580 100644
--- a/contrib/ntp/tests/libntp/run-refnumtoa.c
+++ b/contrib/ntp/tests/libntp/run-refnumtoa.c
@@ -49,8 +49,8 @@ int main(int argc, char *argv[])
{
progname = argv[0];
UnityBegin("refnumtoa.c");
- RUN_TEST(test_LocalClock, 12);
- RUN_TEST(test_UnknownId, 13);
+ RUN_TEST(test_LocalClock, 13);
+ RUN_TEST(test_UnknownId, 14);
return (UnityEnd());
}
diff --git a/contrib/ntp/tests/libntp/run-sfptostr.c b/contrib/ntp/tests/libntp/run-sfptostr.c
index 1ebe43c..1dba912 100644
--- a/contrib/ntp/tests/libntp/run-sfptostr.c
+++ b/contrib/ntp/tests/libntp/run-sfptostr.c
@@ -24,6 +24,7 @@
#include <stdio.h>
#include "config.h"
#include "ntp_fp.h"
+#include "ntp_stdlib.h"
//=======External Functions This Runner Calls=====
extern void setUp(void);
@@ -54,14 +55,14 @@ int main(int argc, char *argv[])
{
progname = argv[0];
UnityBegin("sfptostr.c");
- RUN_TEST(test_PositiveInteger, 11);
- RUN_TEST(test_NegativeInteger, 12);
- RUN_TEST(test_PositiveIntegerPositiveFraction, 13);
- RUN_TEST(test_NegativeIntegerNegativeFraction, 14);
- RUN_TEST(test_PositiveIntegerNegativeFraction, 15);
- RUN_TEST(test_NegativeIntegerPositiveFraction, 16);
- RUN_TEST(test_SingleDecimalInteger, 17);
- RUN_TEST(test_SingleDecimalRounding, 18);
+ RUN_TEST(test_PositiveInteger, 13);
+ RUN_TEST(test_NegativeInteger, 14);
+ RUN_TEST(test_PositiveIntegerPositiveFraction, 15);
+ RUN_TEST(test_NegativeIntegerNegativeFraction, 16);
+ RUN_TEST(test_PositiveIntegerNegativeFraction, 17);
+ RUN_TEST(test_NegativeIntegerPositiveFraction, 18);
+ RUN_TEST(test_SingleDecimalInteger, 19);
+ RUN_TEST(test_SingleDecimalRounding, 20);
return (UnityEnd());
}
diff --git a/contrib/ntp/tests/libntp/run-socktoa.c b/contrib/ntp/tests/libntp/run-socktoa.c
index a5066e3..df6ec9c 100644
--- a/contrib/ntp/tests/libntp/run-socktoa.c
+++ b/contrib/ntp/tests/libntp/run-socktoa.c
@@ -54,12 +54,12 @@ int main(int argc, char *argv[])
{
progname = argv[0];
UnityBegin("socktoa.c");
- RUN_TEST(test_IPv4AddressWithPort, 10);
- RUN_TEST(test_IPv6AddressWithPort, 12);
- RUN_TEST(test_IgnoreIPv6Fields, 13);
- RUN_TEST(test_ScopedIPv6AddressWithPort, 15);
- RUN_TEST(test_HashEqual, 16);
- RUN_TEST(test_HashNotEqual, 17);
+ RUN_TEST(test_IPv4AddressWithPort, 11);
+ RUN_TEST(test_IPv6AddressWithPort, 13);
+ RUN_TEST(test_IgnoreIPv6Fields, 14);
+ RUN_TEST(test_ScopedIPv6AddressWithPort, 16);
+ RUN_TEST(test_HashEqual, 17);
+ RUN_TEST(test_HashNotEqual, 18);
return (UnityEnd());
}
diff --git a/contrib/ntp/tests/libntp/run-statestr.c b/contrib/ntp/tests/libntp/run-statestr.c
index 9cfe0bc..f0f9386 100644
--- a/contrib/ntp/tests/libntp/run-statestr.c
+++ b/contrib/ntp/tests/libntp/run-statestr.c
@@ -52,10 +52,10 @@ int main(int argc, char *argv[])
{
progname = argv[0];
UnityBegin("statestr.c");
- RUN_TEST(test_PeerRestart, 9);
- RUN_TEST(test_SysUnspecified, 10);
- RUN_TEST(test_ClockCodeExists, 11);
- RUN_TEST(test_ClockCodeUnknown, 12);
+ RUN_TEST(test_PeerRestart, 10);
+ RUN_TEST(test_SysUnspecified, 11);
+ RUN_TEST(test_ClockCodeExists, 12);
+ RUN_TEST(test_ClockCodeUnknown, 13);
return (UnityEnd());
}
diff --git a/contrib/ntp/tests/libntp/run-strtolfp.c b/contrib/ntp/tests/libntp/run-strtolfp.c
index 7472319..404f57f 100644
--- a/contrib/ntp/tests/libntp/run-strtolfp.c
+++ b/contrib/ntp/tests/libntp/run-strtolfp.c
@@ -55,13 +55,13 @@ int main(int argc, char *argv[])
{
progname = argv[0];
UnityBegin("strtolfp.c");
- RUN_TEST(test_PositiveInteger, 11);
- RUN_TEST(test_NegativeInteger, 12);
- RUN_TEST(test_PositiveFraction, 13);
- RUN_TEST(test_NegativeFraction, 14);
- RUN_TEST(test_PositiveMsFraction, 15);
- RUN_TEST(test_NegativeMsFraction, 16);
- RUN_TEST(test_InvalidChars, 17);
+ RUN_TEST(test_PositiveInteger, 12);
+ RUN_TEST(test_NegativeInteger, 13);
+ RUN_TEST(test_PositiveFraction, 14);
+ RUN_TEST(test_NegativeFraction, 15);
+ RUN_TEST(test_PositiveMsFraction, 16);
+ RUN_TEST(test_NegativeMsFraction, 17);
+ RUN_TEST(test_InvalidChars, 18);
return (UnityEnd());
}
diff --git a/contrib/ntp/tests/libntp/run-timespecops.c b/contrib/ntp/tests/libntp/run-timespecops.c
index 6c26521..badc84a 100644
--- a/contrib/ntp/tests/libntp/run-timespecops.c
+++ b/contrib/ntp/tests/libntp/run-timespecops.c
@@ -78,34 +78,34 @@ int main(int argc, char *argv[])
{
progname = argv[0];
UnityBegin("timespecops.c");
- RUN_TEST(test_Helpers1, 36);
- RUN_TEST(test_Normalise, 37);
- RUN_TEST(test_SignNoFrac, 38);
- RUN_TEST(test_SignWithFrac, 39);
- RUN_TEST(test_CmpFracEQ, 40);
- RUN_TEST(test_CmpFracGT, 41);
- RUN_TEST(test_CmpFracLT, 42);
- RUN_TEST(test_AddFullNorm, 43);
- RUN_TEST(test_AddFullOflow1, 44);
- RUN_TEST(test_AddNsecNorm, 45);
- RUN_TEST(test_AddNsecOflow1, 46);
- RUN_TEST(test_SubFullNorm, 47);
- RUN_TEST(test_SubFullOflow, 48);
- RUN_TEST(test_SubNsecNorm, 49);
- RUN_TEST(test_SubNsecOflow, 50);
- RUN_TEST(test_Neg, 51);
- RUN_TEST(test_AbsNoFrac, 52);
- RUN_TEST(test_AbsWithFrac, 53);
- RUN_TEST(test_Helpers2, 54);
- RUN_TEST(test_ToLFPbittest, 55);
- RUN_TEST(test_ToLFPrelPos, 56);
- RUN_TEST(test_ToLFPrelNeg, 57);
- RUN_TEST(test_ToLFPabs, 58);
- RUN_TEST(test_FromLFPbittest, 59);
- RUN_TEST(test_FromLFPrelPos, 60);
- RUN_TEST(test_FromLFPrelNeg, 61);
- RUN_TEST(test_LFProundtrip, 62);
- RUN_TEST(test_ToString, 63);
+ RUN_TEST(test_Helpers1, 37);
+ RUN_TEST(test_Normalise, 38);
+ RUN_TEST(test_SignNoFrac, 39);
+ RUN_TEST(test_SignWithFrac, 40);
+ RUN_TEST(test_CmpFracEQ, 41);
+ RUN_TEST(test_CmpFracGT, 42);
+ RUN_TEST(test_CmpFracLT, 43);
+ RUN_TEST(test_AddFullNorm, 44);
+ RUN_TEST(test_AddFullOflow1, 45);
+ RUN_TEST(test_AddNsecNorm, 46);
+ RUN_TEST(test_AddNsecOflow1, 47);
+ RUN_TEST(test_SubFullNorm, 48);
+ RUN_TEST(test_SubFullOflow, 49);
+ RUN_TEST(test_SubNsecNorm, 50);
+ RUN_TEST(test_SubNsecOflow, 51);
+ RUN_TEST(test_Neg, 52);
+ RUN_TEST(test_AbsNoFrac, 53);
+ RUN_TEST(test_AbsWithFrac, 54);
+ RUN_TEST(test_Helpers2, 55);
+ RUN_TEST(test_ToLFPbittest, 56);
+ RUN_TEST(test_ToLFPrelPos, 57);
+ RUN_TEST(test_ToLFPrelNeg, 58);
+ RUN_TEST(test_ToLFPabs, 59);
+ RUN_TEST(test_FromLFPbittest, 60);
+ RUN_TEST(test_FromLFPrelPos, 61);
+ RUN_TEST(test_FromLFPrelNeg, 62);
+ RUN_TEST(test_LFProundtrip, 63);
+ RUN_TEST(test_ToString, 64);
return (UnityEnd());
}
diff --git a/contrib/ntp/tests/libntp/run-timevalops.c b/contrib/ntp/tests/libntp/run-timevalops.c
index 4a9351c..df39ab9 100644
--- a/contrib/ntp/tests/libntp/run-timevalops.c
+++ b/contrib/ntp/tests/libntp/run-timevalops.c
@@ -77,34 +77,34 @@ int main(int argc, char *argv[])
{
progname = argv[0];
UnityBegin("timevalops.c");
- RUN_TEST(test_Helpers1, 38);
- RUN_TEST(test_Normalise, 39);
- RUN_TEST(test_SignNoFrac, 40);
- RUN_TEST(test_SignWithFrac, 41);
- RUN_TEST(test_CmpFracEQ, 42);
- RUN_TEST(test_CmpFracGT, 43);
- RUN_TEST(test_CmpFracLT, 44);
- RUN_TEST(test_AddFullNorm, 45);
- RUN_TEST(test_AddFullOflow1, 46);
- RUN_TEST(test_AddUsecNorm, 47);
- RUN_TEST(test_AddUsecOflow1, 48);
- RUN_TEST(test_SubFullNorm, 49);
- RUN_TEST(test_SubFullOflow, 50);
- RUN_TEST(test_SubUsecNorm, 51);
- RUN_TEST(test_SubUsecOflow, 52);
- RUN_TEST(test_Neg, 53);
- RUN_TEST(test_AbsNoFrac, 54);
- RUN_TEST(test_AbsWithFrac, 55);
- RUN_TEST(test_Helpers2, 56);
- RUN_TEST(test_ToLFPbittest, 57);
- RUN_TEST(test_ToLFPrelPos, 58);
- RUN_TEST(test_ToLFPrelNeg, 59);
- RUN_TEST(test_ToLFPabs, 60);
- RUN_TEST(test_FromLFPbittest, 61);
- RUN_TEST(test_FromLFPrelPos, 62);
- RUN_TEST(test_FromLFPrelNeg, 63);
- RUN_TEST(test_LFProundtrip, 64);
- RUN_TEST(test_ToString, 65);
+ RUN_TEST(test_Helpers1, 39);
+ RUN_TEST(test_Normalise, 40);
+ RUN_TEST(test_SignNoFrac, 41);
+ RUN_TEST(test_SignWithFrac, 42);
+ RUN_TEST(test_CmpFracEQ, 43);
+ RUN_TEST(test_CmpFracGT, 44);
+ RUN_TEST(test_CmpFracLT, 45);
+ RUN_TEST(test_AddFullNorm, 46);
+ RUN_TEST(test_AddFullOflow1, 47);
+ RUN_TEST(test_AddUsecNorm, 48);
+ RUN_TEST(test_AddUsecOflow1, 49);
+ RUN_TEST(test_SubFullNorm, 50);
+ RUN_TEST(test_SubFullOflow, 51);
+ RUN_TEST(test_SubUsecNorm, 52);
+ RUN_TEST(test_SubUsecOflow, 53);
+ RUN_TEST(test_Neg, 54);
+ RUN_TEST(test_AbsNoFrac, 55);
+ RUN_TEST(test_AbsWithFrac, 56);
+ RUN_TEST(test_Helpers2, 57);
+ RUN_TEST(test_ToLFPbittest, 58);
+ RUN_TEST(test_ToLFPrelPos, 59);
+ RUN_TEST(test_ToLFPrelNeg, 60);
+ RUN_TEST(test_ToLFPabs, 61);
+ RUN_TEST(test_FromLFPbittest, 62);
+ RUN_TEST(test_FromLFPrelPos, 63);
+ RUN_TEST(test_FromLFPrelNeg, 64);
+ RUN_TEST(test_LFProundtrip, 65);
+ RUN_TEST(test_ToString, 66);
return (UnityEnd());
}
diff --git a/contrib/ntp/tests/libntp/run-uglydate.c b/contrib/ntp/tests/libntp/run-uglydate.c
index 6ec50f6..5667b70 100644
--- a/contrib/ntp/tests/libntp/run-uglydate.c
+++ b/contrib/ntp/tests/libntp/run-uglydate.c
@@ -48,7 +48,7 @@ int main(int argc, char *argv[])
{
progname = argv[0];
UnityBegin("uglydate.c");
- RUN_TEST(test_ConstantDateTime, 8);
+ RUN_TEST(test_ConstantDateTime, 9);
return (UnityEnd());
}
diff --git a/contrib/ntp/tests/libntp/sfptostr.c b/contrib/ntp/tests/libntp/sfptostr.c
index b115ae1..c7616c7 100644
--- a/contrib/ntp/tests/libntp/sfptostr.c
+++ b/contrib/ntp/tests/libntp/sfptostr.c
@@ -4,10 +4,12 @@
*/
#include "config.h"
#include "ntp_fp.h"
+#include "ntp_stdlib.h"
#include "unity.h"
#define SFP_MAX_PRECISION 6
+void setUp(void);
void test_PositiveInteger(void);
void test_NegativeInteger(void);
void test_PositiveIntegerPositiveFraction(void);
@@ -18,6 +20,15 @@ void test_SingleDecimalInteger(void);
void test_SingleDecimalRounding(void);
+void
+setUp(void)
+{
+ init_lib();
+
+ return;
+}
+
+
void test_PositiveInteger(void)
{
s_fp test = 300 << 16; // exact 300.000000
diff --git a/contrib/ntp/tests/libntp/socktoa.c b/contrib/ntp/tests/libntp/socktoa.c
index 6661fa5..8423106 100644
--- a/contrib/ntp/tests/libntp/socktoa.c
+++ b/contrib/ntp/tests/libntp/socktoa.c
@@ -7,6 +7,7 @@
#include "sockaddrtest.h"
+void setUp(void);
void test_IPv4AddressWithPort(void);
//#ifdef ISC_PLATFORM_HAVEIPV6
void test_IPv6AddressWithPort(void);
@@ -16,6 +17,16 @@ void test_ScopedIPv6AddressWithPort(void);
void test_HashEqual(void);
void test_HashNotEqual(void);
+
+void
+setUp(void)
+{
+ init_lib();
+
+ return;
+}
+
+
void
test_IPv4AddressWithPort(void) {
sockaddr_u input = CreateSockaddr4("192.0.2.10", 123);
@@ -62,12 +73,12 @@ test_IPv6AddressWithPort(void) {
void
test_ScopedIPv6AddressWithPort(void) {
#ifdef ISC_PLATFORM_HAVESCOPEID
- const struct in6_addr address = {
+ const struct in6_addr address = { { {
0xfe, 0x80, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x02, 0x12, 0x3f, 0xff,
0xfe, 0x29, 0xff, 0xfa
- };
+ } } };
const char* expected =
"fe80::212:3fff:fe29:fffa%5";
diff --git a/contrib/ntp/tests/libntp/statestr.c b/contrib/ntp/tests/libntp/statestr.c
index 810ee6b..e7a1bd7 100644
--- a/contrib/ntp/tests/libntp/statestr.c
+++ b/contrib/ntp/tests/libntp/statestr.c
@@ -6,11 +6,22 @@
#include "unity.h"
+void setUp(void);
void test_PeerRestart(void);
void test_SysUnspecified(void);
void test_ClockCodeExists(void);
void test_ClockCodeUnknown(void);
+
+void
+setUp(void)
+{
+ init_lib();
+
+ return;
+}
+
+
// eventstr()
void
test_PeerRestart(void) {
diff --git a/contrib/ntp/tests/libntp/strtolfp.c b/contrib/ntp/tests/libntp/strtolfp.c
index f40ab50..6855d9b 100644
--- a/contrib/ntp/tests/libntp/strtolfp.c
+++ b/contrib/ntp/tests/libntp/strtolfp.c
@@ -8,6 +8,7 @@
/* This file tests both atolfp and mstolfp */
+void setUp(void);
void test_PositiveInteger(void);
void test_NegativeInteger(void);
void test_PositiveFraction(void);
@@ -17,6 +18,15 @@ void test_NegativeMsFraction(void);
void test_InvalidChars(void);
+void
+setUp(void)
+{
+ init_lib();
+
+ return;
+}
+
+
void test_PositiveInteger(void) {
const char *str = "500";
const char *str_ms = "500000";
diff --git a/contrib/ntp/tests/libntp/timespecops.c b/contrib/ntp/tests/libntp/timespecops.c
index 86df7a1..68a472a 100644
--- a/contrib/ntp/tests/libntp/timespecops.c
+++ b/contrib/ntp/tests/libntp/timespecops.c
@@ -10,14 +10,14 @@
#include <string.h>
-#define TEST_ASSERT_EQUAL_timespec(a, b) { \
- TEST_ASSERT_EQUAL_MESSAGE(a.tv_sec, b.tv_sec, "Field tv_sec"); \
+#define TEST_ASSERT_EQUAL_timespec(a, b) { \
+ TEST_ASSERT_EQUAL_MESSAGE(a.tv_sec, b.tv_sec, "Field tv_sec"); \
TEST_ASSERT_EQUAL_MESSAGE(a.tv_nsec, b.tv_nsec, "Field tv_nsec"); \
}
-#define TEST_ASSERT_EQUAL_l_fp(a, b) { \
- TEST_ASSERT_EQUAL_MESSAGE(a.l_i, b.l_i, "Field l_i"); \
+#define TEST_ASSERT_EQUAL_l_fp(a, b) { \
+ TEST_ASSERT_EQUAL_MESSAGE(a.l_i, b.l_i, "Field l_i"); \
TEST_ASSERT_EQUAL_UINT_MESSAGE(a.l_uf, b.l_uf, "Field l_uf"); \
}
@@ -33,6 +33,7 @@ struct lfpfracdata {
};
+void setUp(void);
void test_Helpers1(void);
void test_Normalise(void);
void test_SignNoFrac(void);
@@ -64,35 +65,52 @@ void test_ToString(void);
typedef int bool;
-const bool timespec_isValid(struct timespec V);
+const bool timespec_isValid(struct timespec V);
struct timespec timespec_init(time_t hi, long lo);
-l_fp l_fp_init(int32 i, u_int32 f);
-bool AssertFpClose(const l_fp m, const l_fp n, const l_fp limit);
-bool AssertTimespecClose(const struct timespec m, const struct timespec n, const struct timespec limit);
+l_fp l_fp_init(int32 i, u_int32 f);
+bool AssertFpClose(const l_fp m, const l_fp n, const l_fp limit);
+bool AssertTimespecClose(const struct timespec m,
+ const struct timespec n,
+ const struct timespec limit);
-//******************************************MY CUSTOM FUNCTIONS*******************************
+//***************************MY CUSTOM FUNCTIONS***************************
+void
+setUp(void)
+{
+ init_lib();
+
+ return;
+}
+
const bool
-timespec_isValid(struct timespec V) {
+timespec_isValid(struct timespec V)
+{
+
return V.tv_nsec >= 0 && V.tv_nsec < 1000000000;
}
struct timespec
-timespec_init(time_t hi, long lo) {
- struct timespec V;
+timespec_init(time_t hi, long lo)
+{
+ struct timespec V;
+
V.tv_sec = hi;
V.tv_nsec = lo;
+
return V;
}
l_fp
-l_fp_init(int32 i, u_int32 f) {
+l_fp_init(int32 i, u_int32 f)
+{
l_fp temp;
+
temp.l_i = i;
temp.l_uf = f;
@@ -101,7 +119,8 @@ l_fp_init(int32 i, u_int32 f) {
bool
-AssertFpClose(const l_fp m, const l_fp n, const l_fp limit) {
+AssertFpClose(const l_fp m, const l_fp n, const l_fp limit)
+{
l_fp diff;
if (L_ISGEQ(&m, &n)) {
@@ -111,7 +130,7 @@ AssertFpClose(const l_fp m, const l_fp n, const l_fp limit) {
diff = n;
L_SUB(&diff, &m);
}
- if (L_ISGEQ(&limit, &diff)){
+ if (L_ISGEQ(&limit, &diff)) {
return TRUE;
}
else {
@@ -122,7 +141,9 @@ AssertFpClose(const l_fp m, const l_fp n, const l_fp limit) {
bool
-AssertTimespecClose(const struct timespec m, const struct timespec n, const struct timespec limit) {
+AssertTimespecClose(const struct timespec m, const struct timespec n,
+ const struct timespec limit)
+{
struct timespec diff;
diff = abs_tspec(sub_tspec(m, n));
@@ -156,11 +177,13 @@ static const struct lfpfracdata fdata[] = {
u_int32
-my_tick_to_tsf(u_int32 ticks) {
+my_tick_to_tsf(u_int32 ticks)
+{
// convert nanoseconds to l_fp fractional units, using double
// precision float calculations or, if available, 64bit integer
// arithmetic. This should give the precise fraction, rounded to
// the nearest representation.
+
#ifdef HAVE_U_INT64
return (u_int32)((( ((u_int64)(ticks)) << 32) + 500000000) / 1000000000);
#else
@@ -172,7 +195,9 @@ my_tick_to_tsf(u_int32 ticks) {
u_int32
-my_tsf_to_tick(u_int32 tsf) {
+my_tsf_to_tick(u_int32 tsf)
+{
+
// Inverse operation: converts fraction to microseconds.
#ifdef HAVE_U_INT64
return (u_int32)(( ((u_int64)(tsf)) * 1000000000 + 0x80000000) >> 32);
@@ -189,7 +214,8 @@ my_tsf_to_tick(u_int32 tsf) {
// ---------------------------------------------------------------------
void
-test_Helpers1(void) {
+test_Helpers1(void)
+{
struct timespec x;
for (x.tv_sec = -2; x.tv_sec < 3; x.tv_sec++) {
@@ -202,6 +228,8 @@ test_Helpers1(void) {
x.tv_nsec = 1000000000;
TEST_ASSERT_FALSE(timespec_isValid(x));
}
+
+ return;
}
@@ -210,14 +238,18 @@ test_Helpers1(void) {
//----------------------------------------------------------------------
void
-test_Normalise(void) {
+test_Normalise(void)
+{
long ns;
+
for ( ns = -2000000000; ns <= 2000000000; ns += 10000000) {
struct timespec x = timespec_init(0, ns);
x = normalize_tspec(x);
TEST_ASSERT_TRUE(timespec_isValid(x));
}
+
+ return;
}
//----------------------------------------------------------------------
@@ -225,9 +257,11 @@ test_Normalise(void) {
//----------------------------------------------------------------------
void
-test_SignNoFrac(void) {
+test_SignNoFrac(void)
+{
// sign test, no fraction
int i;
+
for (i = -4; i <= 4; ++i) {
struct timespec a = timespec_init(i, 0);
int E = (i > 0) - (i < 0);
@@ -235,26 +269,34 @@ test_SignNoFrac(void) {
TEST_ASSERT_EQUAL(E, r);
}
+
+ return;
}
void
-test_SignWithFrac(void) {
+test_SignWithFrac(void)
+{
// sign test, with fraction
int i;
+
for (i = -4; i <= 4; ++i) {
struct timespec a = timespec_init(i, 10);
int E = (i >= 0) - (i < 0);
int r = test_tspec(a);
+
TEST_ASSERT_EQUAL(E, r);
}
+
+ return;
}
//----------------------------------------------------------------------
// test compare
//----------------------------------------------------------------------
void
-test_CmpFracEQ(void) {
+test_CmpFracEQ(void)
+{
// fractions are equal
int i, j;
for (i = -4; i <= 4; ++i)
@@ -263,38 +305,51 @@ test_CmpFracEQ(void) {
struct timespec b = timespec_init( j , 200);
int E = (i > j) - (i < j);
int r = cmp_tspec_denorm(a, b);
+
TEST_ASSERT_EQUAL(E, r);
}
+
+ return;
}
void
-test_CmpFracGT(void) {
+test_CmpFracGT(void)
+{
// fraction a bigger fraction b
int i, j;
+
for (i = -4; i <= 4; ++i)
for (j = -4; j <= 4; ++j) {
struct timespec a = timespec_init(i, 999999800);
struct timespec b = timespec_init(j, 200);
int E = (i >= j) - (i < j);
int r = cmp_tspec_denorm(a, b);
+
TEST_ASSERT_EQUAL(E, r);
}
+
+ return;
}
void
-test_CmpFracLT(void) {
+test_CmpFracLT(void)
+{
// fraction a less fraction b
int i, j;
+
for (i = -4; i <= 4; ++i)
for (j = -4; j <= 4; ++j) {
struct timespec a = timespec_init(i, 200);
struct timespec b = timespec_init(j, 999999800);
int E = (i > j) - (i <= j);
int r = cmp_tspec_denorm(a, b);
+
TEST_ASSERT_EQUAL(E, r);
}
+
+ return;
}
//----------------------------------------------------------------------
@@ -302,8 +357,10 @@ test_CmpFracLT(void) {
//----------------------------------------------------------------------
void
-test_AddFullNorm(void) {
+test_AddFullNorm(void)
+{
int i, j;
+
for (i = -4; i <= 4; ++i)
for (j = -4; j <= 4; ++j) {
struct timespec a = timespec_init(i, 200);
@@ -314,12 +371,16 @@ test_AddFullNorm(void) {
c = add_tspec(a, b);
TEST_ASSERT_EQUAL_timespec(E, c);
}
+
+ return;
}
void
-test_AddFullOflow1(void) {
+test_AddFullOflow1(void)
+{
int i, j;
+
for (i = -4; i <= 4; ++i)
for (j = -4; j <= 4; ++j) {
struct timespec a = timespec_init(i, 200);
@@ -330,12 +391,15 @@ test_AddFullOflow1(void) {
c = add_tspec(a, b);
TEST_ASSERT_EQUAL_timespec(E, c);
}
+
+ return;
}
void
test_AddNsecNorm(void) {
int i;
+
for (i = -4; i <= 4; ++i) {
struct timespec a = timespec_init(i, 200);
struct timespec E = timespec_init(i, 600);
@@ -344,12 +408,16 @@ test_AddNsecNorm(void) {
c = add_tspec_ns(a, 600 - 200);
TEST_ASSERT_EQUAL_timespec(E, c);
}
+
+ return;
}
void
-test_AddNsecOflow1(void) {
+test_AddNsecOflow1(void)
+{
int i;
+
for (i = -4; i <= 4; ++i) {
struct timespec a = timespec_init(i, 200);
struct timespec E = timespec_init(i + 1, 100);
@@ -358,6 +426,8 @@ test_AddNsecOflow1(void) {
c = add_tspec_ns(a, NANOSECONDS - 100);
TEST_ASSERT_EQUAL_timespec(E, c);
}
+
+ return;
}
//----------------------------------------------------------------------
@@ -365,8 +435,10 @@ test_AddNsecOflow1(void) {
//----------------------------------------------------------------------
void
-test_SubFullNorm(void) {
+test_SubFullNorm(void)
+{
int i, j;
+
for (i = -4; i <= 4; ++i)
for (j = -4; j <= 4; ++j) {
struct timespec a = timespec_init( i , 600);
@@ -377,12 +449,16 @@ test_SubFullNorm(void) {
c = sub_tspec(a, b);
TEST_ASSERT_EQUAL_timespec(E, c);
}
+
+ return;
}
void
-test_SubFullOflow(void) {
+test_SubFullOflow(void)
+{
int i, j;
+
for (i = -4; i <= 4; ++i)
for (j = -4; j <= 4; ++j) {
struct timespec a = timespec_init(i, 100);
@@ -393,12 +469,16 @@ test_SubFullOflow(void) {
c = sub_tspec(a, b);
TEST_ASSERT_EQUAL_timespec(E, c);
}
+
+ return;
}
void
-test_SubNsecNorm(void) {
+test_SubNsecNorm(void)
+{
int i;
+
for (i = -4; i <= 4; ++i) {
struct timespec a = timespec_init(i, 600);
struct timespec E = timespec_init(i, 200);
@@ -407,12 +487,16 @@ test_SubNsecNorm(void) {
c = sub_tspec_ns(a, 600 - 200);
TEST_ASSERT_EQUAL_timespec(E, c);
}
+
+ return;
}
void
-test_SubNsecOflow(void) {
+test_SubNsecOflow(void)
+{
int i;
+
for (i = -4; i <= 4; ++i) {
struct timespec a = timespec_init( i , 100);
struct timespec E = timespec_init(i-1, 200);
@@ -421,6 +505,8 @@ test_SubNsecOflow(void) {
c = sub_tspec_ns(a, NANOSECONDS - 100);
TEST_ASSERT_EQUAL_timespec(E, c);
}
+
+ return;
}
//----------------------------------------------------------------------
@@ -429,8 +515,10 @@ test_SubNsecOflow(void) {
void
-test_Neg(void) {
+test_Neg(void)
+{
int i;
+
for (i = -4; i <= 4; ++i) {
struct timespec a = timespec_init(i, 100);
struct timespec b;
@@ -440,6 +528,8 @@ test_Neg(void) {
c = add_tspec(a, b);
TEST_ASSERT_EQUAL(0, test_tspec(c));
}
+
+ return;
}
//----------------------------------------------------------------------
@@ -447,8 +537,10 @@ test_Neg(void) {
//----------------------------------------------------------------------
void
-test_AbsNoFrac(void) {
+test_AbsNoFrac(void)
+{
int i;
+
for (i = -4; i <= 4; ++i) {
struct timespec a = timespec_init(i , 0);
struct timespec b;
@@ -456,12 +548,16 @@ test_AbsNoFrac(void) {
b = abs_tspec(a);
TEST_ASSERT_EQUAL((i != 0), test_tspec(b));
}
+
+ return;
}
void
-test_AbsWithFrac(void) {
+test_AbsWithFrac(void)
+{
int i;
+
for (i = -4; i <= 4; ++i) {
struct timespec a = timespec_init(i, 100);
struct timespec b;
@@ -469,6 +565,8 @@ test_AbsWithFrac(void) {
b = abs_tspec(a);
TEST_ASSERT_EQUAL(1, test_tspec(b));
}
+
+ return;
}
// ---------------------------------------------------------------------
@@ -476,9 +574,9 @@ test_AbsWithFrac(void) {
// ---------------------------------------------------------------------
void
-test_Helpers2(void) {
+test_Helpers2(void)
+{
struct timespec limit = timespec_init(0, 2);
-
struct timespec x, y;
long i;
@@ -489,7 +587,7 @@ test_Helpers2(void) {
for (i = -4; i < 5; ++i) {
y = x;
y.tv_nsec += i;
- if (i >= -2 && i <= 2){
+ if (i >= -2 && i <= 2) {
TEST_ASSERT_TRUE(AssertTimespecClose(x, y, limit));
}
else
@@ -498,6 +596,8 @@ test_Helpers2(void) {
}
}
}
+
+ return;
}
//----------------------------------------------------------------------
@@ -505,9 +605,11 @@ test_Helpers2(void) {
//----------------------------------------------------------------------
void
-test_ToLFPbittest(void) {
+test_ToLFPbittest(void)
+{
l_fp lfpClose = l_fp_init(0, 1);
u_int32 i;
+
for (i = 0; i < 1000000000; i+=1000) {
struct timespec a = timespec_init(1, i);
l_fp E= l_fp_init(1, my_tick_to_tsf(i));
@@ -516,12 +618,16 @@ test_ToLFPbittest(void) {
r = tspec_intv_to_lfp(a);
TEST_ASSERT_TRUE(AssertFpClose(E, r, lfpClose));
}
+
+ return;
}
void
-test_ToLFPrelPos(void) {
+test_ToLFPrelPos(void)
+{
int i;
+
for (i = 0; i < COUNTOF(fdata); ++i) {
struct timespec a = timespec_init(1, fdata[i].nsec);
l_fp E = l_fp_init(1, fdata[i].frac);
@@ -530,12 +636,16 @@ test_ToLFPrelPos(void) {
r = tspec_intv_to_lfp(a);
TEST_ASSERT_EQUAL_l_fp(E, r);
}
+
+ return;
}
void
-test_ToLFPrelNeg(void) {
+test_ToLFPrelNeg(void)
+{
int i;
+
for (i = 0; i < COUNTOF(fdata); ++i) {
struct timespec a = timespec_init(-1, fdata[i].nsec);
l_fp E = l_fp_init(~0, fdata[i].frac);
@@ -544,12 +654,16 @@ test_ToLFPrelNeg(void) {
r = tspec_intv_to_lfp(a);
TEST_ASSERT_EQUAL_l_fp(E, r);
}
+
+ return;
}
void
-test_ToLFPabs(void) {
+test_ToLFPabs(void)
+{
int i;
+
for (i = 0; i < COUNTOF(fdata); ++i) {
struct timespec a = timespec_init(1, fdata[i].nsec);
l_fp E = l_fp_init(1 + JAN_1970, fdata[i].frac);
@@ -558,6 +672,8 @@ test_ToLFPabs(void) {
r = tspec_stamp_to_lfp(a);
TEST_ASSERT_EQUAL_l_fp(E, r);
}
+
+ return;
}
//----------------------------------------------------------------------
@@ -565,7 +681,8 @@ test_ToLFPabs(void) {
//----------------------------------------------------------------------
void
-test_FromLFPbittest(void) {
+test_FromLFPbittest(void)
+{
struct timespec limit = timespec_init(0, 2);
// Not *exactly* a bittest, because 2**32 tests would take a
@@ -582,13 +699,17 @@ test_FromLFPbittest(void) {
// comparing to calculated value.
TEST_ASSERT_TRUE(AssertTimespecClose(E, r, limit));
}
+
+ return;
}
void
-test_FromLFPrelPos(void) {
+test_FromLFPrelPos(void)
+{
struct timespec limit = timespec_init(0, 2);
int i;
+
for (i = 0; i < COUNTOF(fdata); ++i) {
l_fp a = l_fp_init(1, fdata[i].frac);
struct timespec E = timespec_init(1, fdata[i].nsec);
@@ -597,13 +718,17 @@ test_FromLFPrelPos(void) {
r = lfp_intv_to_tspec(a);
TEST_ASSERT_TRUE(AssertTimespecClose(E, r, limit));
}
+
+ return;
}
void
-test_FromLFPrelNeg(void) {
+test_FromLFPrelNeg(void)
+{
struct timespec limit = timespec_init(0, 2);
int i;
+
for (i = 0; i < COUNTOF(fdata); ++i) {
l_fp a = l_fp_init(~0, fdata[i].frac);
struct timespec E = timespec_init(-1, fdata[i].nsec);
@@ -612,14 +737,18 @@ test_FromLFPrelNeg(void) {
r = lfp_intv_to_tspec(a);
TEST_ASSERT_TRUE(AssertTimespecClose(E, r, limit));
}
+
+ return;
}
// nsec -> frac -> nsec roundtrip, using a prime start and increment
void
-test_LFProundtrip(void) {
+test_LFProundtrip(void)
+{
int32_t t;
u_int32 i;
+
for (t = -1; t < 2; ++t)
for (i = 4999; i < 1000000000; i += 10007) {
struct timespec E = timespec_init(t, i);
@@ -630,6 +759,8 @@ test_LFProundtrip(void) {
r = lfp_intv_to_tspec(a);
TEST_ASSERT_EQUAL_timespec(E, r);
}
+
+ return;
}
//----------------------------------------------------------------------
@@ -637,7 +768,8 @@ test_LFProundtrip(void) {
//----------------------------------------------------------------------
void
-test_ToString(void) {
+test_ToString(void)
+{
static const struct {
time_t sec;
long nsec;
@@ -653,12 +785,15 @@ test_ToString(void) {
{-1,-1, "-1.000000001" },
};
int i;
+
for (i = 0; i < COUNTOF(data); ++i) {
struct timespec a = timespec_init(data[i].sec, data[i].nsec);
const char * E = data[i].repr;
const char * r = tspectoa(a);
TEST_ASSERT_EQUAL_STRING(E, r);
}
+
+ return;
}
// -*- EOF -*-
diff --git a/contrib/ntp/tests/libntp/timevalops.c b/contrib/ntp/tests/libntp/timevalops.c
index a2d9358..99a48eb 100644
--- a/contrib/ntp/tests/libntp/timevalops.c
+++ b/contrib/ntp/tests/libntp/timevalops.c
@@ -11,8 +11,8 @@
#include "unity.h"
-#define TEST_ASSERT_EQUAL_timeval(a, b) { \
- TEST_ASSERT_EQUAL_MESSAGE(a.tv_sec, b.tv_sec, "Field tv_sec"); \
+#define TEST_ASSERT_EQUAL_timeval(a, b) { \
+ TEST_ASSERT_EQUAL_MESSAGE(a.tv_sec, b.tv_sec, "Field tv_sec"); \
TEST_ASSERT_EQUAL_MESSAGE(a.tv_usec, b.tv_usec, "Field tv_usec"); \
}
@@ -35,6 +35,7 @@ l_fp l_fp_init(int32 i, u_int32 f);
bool AssertTimevalClose(const struct timeval m, const struct timeval n, const struct timeval limit);
bool AssertFpClose(const l_fp m, const l_fp n, const l_fp limit);
+void setUp(void);
void test_Helpers1(void);
void test_Normalise(void);
void test_SignNoFrac(void);
@@ -65,28 +66,43 @@ void test_LFProundtrip(void);
void test_ToString(void);
-//******************************************MY CUSTOM FUNCTIONS*******************************
+//**********************************MY CUSTOM FUNCTIONS***********************
+void
+setUp(void)
+{
+ init_lib();
+
+ return;
+}
+
struct timeval
-timeval_init( time_t hi, long lo){
+timeval_init(time_t hi, long lo)
+{
struct timeval V;
+
V.tv_sec = hi;
V.tv_usec = lo;
+
return V;
}
const bool
-timeval_isValid(struct timeval V) {
+timeval_isValid(struct timeval V)
+{
+
return V.tv_usec >= 0 && V.tv_usec < 1000000;
}
l_fp
-l_fp_init(int32 i, u_int32 f) {
+l_fp_init(int32 i, u_int32 f)
+{
l_fp temp;
+
temp.l_i = i;
temp.l_uf = f;
@@ -95,25 +111,26 @@ l_fp_init(int32 i, u_int32 f) {
bool
-AssertTimevalClose(const struct timeval m, const struct timeval n, const struct timeval limit) {
+AssertTimevalClose(const struct timeval m, const struct timeval n, const struct timeval limit)
+{
struct timeval diff;
diff = abs_tval(sub_tval(m, n));
if (cmp_tval(limit, diff) >= 0)
return TRUE;
-
else
{
printf("m_expr which is %ld.%lu \nand\nn_expr which is %ld.%lu\nare not close; diff=%ld.%luusec\n", m.tv_sec, m.tv_usec, n.tv_sec, n.tv_usec, diff.tv_sec, diff.tv_usec);
//I don't have variables m_expr and n_expr in unity, those are command line arguments which only getst has!!!
-
+
return FALSE;
}
}
bool
-AssertFpClose(const l_fp m, const l_fp n, const l_fp limit) {
+AssertFpClose(const l_fp m, const l_fp n, const l_fp limit)
+{
l_fp diff;
if (L_ISGEQ(&m, &n)) {
@@ -123,7 +140,7 @@ AssertFpClose(const l_fp m, const l_fp n, const l_fp limit) {
diff = n;
L_SUB(&diff, &m);
}
- if (L_ISGEQ(&limit, &diff)){
+ if (L_ISGEQ(&limit, &diff)) {
return TRUE;
}
else {
@@ -155,11 +172,13 @@ static const lfpfracdata fdata[] = {
u_int32
-my_tick_to_tsf(u_int32 ticks) {
+my_tick_to_tsf(u_int32 ticks)
+{
// convert microseconds to l_fp fractional units, using double
// precision float calculations or, if available, 64bit integer
// arithmetic. This should give the precise fraction, rounded to
// the nearest representation.
+
#ifdef HAVE_U_INT64
return (u_int32)((( ((u_int64)(ticks)) << 32) + 500000) / 1000000); //I put too much () when casting just to be safe
#else
@@ -171,7 +190,8 @@ my_tick_to_tsf(u_int32 ticks) {
u_int32
-my_tsf_to_tick(u_int32 tsf) {
+my_tsf_to_tick(u_int32 tsf)
+{
// Inverse operation: converts fraction to microseconds.
#ifdef HAVE_U_INT64
return (u_int32)( ((u_int64)(tsf) * 1000000 + 0x80000000) >> 32); //CHECK ME!!!
@@ -182,7 +202,7 @@ my_tsf_to_tick(u_int32 tsf) {
}
-//***************************************END OF CUSTOM FUNCTIONS*****************************
+//*******************************END OF CUSTOM FUNCTIONS*********************
// ---------------------------------------------------------------------
@@ -190,7 +210,8 @@ my_tsf_to_tick(u_int32 tsf) {
// ---------------------------------------------------------------------
void
-test_Helpers1(void) {
+test_Helpers1(void)
+{
struct timeval x;
for (x.tv_sec = -2; x.tv_sec < 3; x.tv_sec++) {
@@ -203,6 +224,8 @@ test_Helpers1(void) {
x.tv_usec = 1000000;
TEST_ASSERT_FALSE(timeval_isValid(x));
}
+
+ return;
}
@@ -211,14 +234,18 @@ test_Helpers1(void) {
//----------------------------------------------------------------------
void
-test_Normalise(void) {
+test_Normalise(void)
+{
long ns;
+
for (ns = -2000000000; ns <= 2000000000; ns += 10000000) {
struct timeval x = timeval_init(0, ns);
-
+
x = normalize_tval(x);
TEST_ASSERT_TRUE(timeval_isValid(x));
}
+
+ return;
}
//----------------------------------------------------------------------
@@ -226,8 +253,10 @@ test_Normalise(void) {
//----------------------------------------------------------------------
void
-test_SignNoFrac(void) {
+test_SignNoFrac(void)
+{
int i;
+
// sign test, no fraction
for (i = -4; i <= 4; ++i) {
struct timeval a = timeval_init(i, 0);
@@ -236,13 +265,17 @@ test_SignNoFrac(void) {
TEST_ASSERT_EQUAL(E, r);
}
+
+ return;
}
void
-test_SignWithFrac(void) {
+test_SignWithFrac(void)
+{
// sign test, with fraction
int i;
+
for (i = -4; i <= 4; ++i) {
struct timeval a = timeval_init(i, 10);
int E = (i >= 0) - (i < 0);
@@ -250,14 +283,18 @@ test_SignWithFrac(void) {
TEST_ASSERT_EQUAL(E, r);
}
+
+ return;
}
//----------------------------------------------------------------------
// test compare
//----------------------------------------------------------------------
void
-test_CmpFracEQ(void) {
+test_CmpFracEQ(void)
+{
int i, j;
+
// fractions are equal
for (i = -4; i <= 4; ++i)
for (j = -4; j <= 4; ++j) {
@@ -268,13 +305,17 @@ test_CmpFracEQ(void) {
TEST_ASSERT_EQUAL(E, r);
}
+
+ return;
}
void
-test_CmpFracGT(void) {
+test_CmpFracGT(void)
+{
// fraction a bigger fraction b
int i, j;
+
for (i = -4; i <= 4; ++i)
for (j = -4; j <= 4; ++j) {
struct timeval a = timeval_init( i , 999800);
@@ -284,13 +325,17 @@ test_CmpFracGT(void) {
TEST_ASSERT_EQUAL(E, r);
}
+
+ return;
}
void
-test_CmpFracLT(void) {
+test_CmpFracLT(void)
+{
// fraction a less fraction b
int i, j;
+
for (i = -4; i <= 4; ++i)
for (j = -4; j <= 4; ++j) {
struct timeval a = timeval_init(i, 200);
@@ -300,6 +345,8 @@ test_CmpFracLT(void) {
TEST_ASSERT_EQUAL(E, r);
}
+
+ return;
}
//----------------------------------------------------------------------
@@ -307,8 +354,10 @@ test_CmpFracLT(void) {
//----------------------------------------------------------------------
void
-test_AddFullNorm(void) {
+test_AddFullNorm(void)
+{
int i, j;
+
for (i = -4; i <= 4; ++i)
for (j = -4; j <= 4; ++j) {
struct timeval a = timeval_init(i, 200);
@@ -319,12 +368,16 @@ test_AddFullNorm(void) {
c = add_tval(a, b);
TEST_ASSERT_EQUAL_timeval(E, c);
}
+
+ return;
}
void
-test_AddFullOflow1(void) {
+test_AddFullOflow1(void)
+{
int i, j;
+
for (i = -4; i <= 4; ++i)
for (j = -4; j <= 4; ++j) {
struct timeval a = timeval_init(i, 200);
@@ -335,12 +388,16 @@ test_AddFullOflow1(void) {
c = add_tval(a, b);
TEST_ASSERT_EQUAL_timeval(E, c);
}
+
+ return;
}
void
-test_AddUsecNorm(void) {
+test_AddUsecNorm(void)
+{
int i;
+
for (i = -4; i <= 4; ++i) {
struct timeval a = timeval_init(i, 200);
struct timeval E = timeval_init(i, 600);
@@ -349,12 +406,16 @@ test_AddUsecNorm(void) {
c = add_tval_us(a, 600 - 200);
TEST_ASSERT_EQUAL_timeval(E, c);
}
+
+ return;
}
void
-test_AddUsecOflow1(void) {
+test_AddUsecOflow1(void)
+{
int i;
+
for (i = -4; i <= 4; ++i) {
struct timeval a = timeval_init(i, 200);
struct timeval E = timeval_init(i + 1, 100);
@@ -363,6 +424,8 @@ test_AddUsecOflow1(void) {
c = add_tval_us(a, MICROSECONDS - 100);
TEST_ASSERT_EQUAL_timeval(E, c);
}
+
+ return;
}
//----------------------------------------------------------------------
@@ -370,8 +433,10 @@ test_AddUsecOflow1(void) {
//----------------------------------------------------------------------
void
-test_SubFullNorm(void) {
+test_SubFullNorm(void)
+{
int i, j;
+
for (i = -4; i <= 4; ++i)
for (j = -4; j <= 4; ++j) {
struct timeval a = timeval_init(i, 600);
@@ -382,12 +447,16 @@ test_SubFullNorm(void) {
c = sub_tval(a, b);
TEST_ASSERT_EQUAL_timeval(E, c);
}
+
+ return;
}
void
-test_SubFullOflow(void) {
+test_SubFullOflow(void)
+{
int i, j;
+
for (i = -4; i <= 4; ++i)
for (j = -4; j <= 4; ++j) {
struct timeval a = timeval_init(i, 100);
@@ -398,12 +467,16 @@ test_SubFullOflow(void) {
c = sub_tval(a, b);
TEST_ASSERT_EQUAL_timeval(E, c);
}
+
+ return;
}
void
-test_SubUsecNorm(void) {
+test_SubUsecNorm(void)
+{
int i = -4;
+
for (i = -4; i <= 4; ++i) {
struct timeval a = timeval_init(i, 600);
struct timeval E = timeval_init(i, 200);
@@ -412,12 +485,16 @@ test_SubUsecNorm(void) {
c = sub_tval_us(a, 600 - 200);
TEST_ASSERT_EQUAL_timeval(E, c);
}
+
+ return;
}
void
-test_SubUsecOflow(void) {
+test_SubUsecOflow(void)
+{
int i = -4;
+
for (i = -4; i <= 4; ++i) {
struct timeval a = timeval_init(i, 100);
struct timeval E = timeval_init(i - 1, 200);
@@ -426,6 +503,8 @@ test_SubUsecOflow(void) {
c = sub_tval_us(a, MICROSECONDS - 100);
TEST_ASSERT_EQUAL_timeval(E, c);
}
+
+ return;
}
//----------------------------------------------------------------------
@@ -433,8 +512,10 @@ test_SubUsecOflow(void) {
//----------------------------------------------------------------------
void
-test_Neg(void) {
+test_Neg(void)
+{
int i = -4;
+
for (i = -4; i <= 4; ++i) {
struct timeval a = timeval_init(i, 100);
struct timeval b;
@@ -444,6 +525,8 @@ test_Neg(void) {
c = add_tval(a, b);
TEST_ASSERT_EQUAL(0, test_tval(c));
}
+
+ return;
}
//----------------------------------------------------------------------
@@ -451,8 +534,10 @@ test_Neg(void) {
//----------------------------------------------------------------------
void
-test_AbsNoFrac(void) {
+test_AbsNoFrac(void)
+{
int i = -4;
+
for (i = -4; i <= 4; ++i) {
struct timeval a = timeval_init(i, 0);
struct timeval b;
@@ -460,12 +545,16 @@ test_AbsNoFrac(void) {
b = abs_tval(a);
TEST_ASSERT_EQUAL((i != 0), test_tval(b));
}
+
+ return;
}
void
-test_AbsWithFrac(void) {
+test_AbsWithFrac(void)
+{
int i = -4;
+
for (i = -4; i <= 4; ++i) {
struct timeval a = timeval_init(i, 100);
struct timeval b;
@@ -473,6 +562,8 @@ test_AbsWithFrac(void) {
b = abs_tval(a);
TEST_ASSERT_EQUAL(1, test_tval(b));
}
+
+ return;
}
// ---------------------------------------------------------------------
@@ -481,20 +572,20 @@ test_AbsWithFrac(void) {
void
-test_Helpers2(void) {
-
+test_Helpers2(void)
+{
struct timeval limit = timeval_init(0, 2);
struct timeval x, y;
- long i;
+ long i;
- for (x.tv_sec = -2; x.tv_sec < 3; x.tv_sec++){
+ for (x.tv_sec = -2; x.tv_sec < 3; x.tv_sec++) {
for (x.tv_usec = 1;
x.tv_usec < 1000000;
x.tv_usec += 499999) {
for (i = -4; i < 5; ++i) {
y = x;
y.tv_usec += i;
- if (i >= -2 && i <= 2){
+ if (i >= -2 && i <= 2) {
TEST_ASSERT_TRUE(AssertTimevalClose(x, y, limit));//ASSERT_PRED_FORMAT2(isClose, x, y);
}
else {
@@ -503,6 +594,8 @@ test_Helpers2(void) {
}
}
}
+
+ return;
}
// and the global predicate instances we're using here
@@ -515,8 +608,9 @@ test_Helpers2(void) {
//----------------------------------------------------------------------
void
-test_ToLFPbittest(void) {
- l_fp lfpClose = l_fp_init(0, 1);
+test_ToLFPbittest(void)
+{
+ l_fp lfpClose = l_fp_init(0, 1);
u_int32 i = 0;
for (i = 0; i < 1000000; ++i) {
@@ -527,14 +621,17 @@ test_ToLFPbittest(void) {
r = tval_intv_to_lfp(a);
TEST_ASSERT_TRUE(AssertFpClose(E, r, lfpClose)); //ASSERT_PRED_FORMAT2(FpClose, E, r);
}
+
+ return;
}
void
-test_ToLFPrelPos(void) {
+test_ToLFPrelPos(void)
+{
l_fp lfpClose = l_fp_init(0, 1);
-
int i = 0;
+
for (i = 0; i < COUNTOF(fdata); ++i) {
struct timeval a = timeval_init(1, fdata[i].usec);
l_fp E = l_fp_init(1, fdata[i].frac);
@@ -543,13 +640,17 @@ test_ToLFPrelPos(void) {
r = tval_intv_to_lfp(a);
TEST_ASSERT_TRUE(AssertFpClose(E, r, lfpClose));
}
+
+ return;
}
void
-test_ToLFPrelNeg(void) {
+test_ToLFPrelNeg(void)
+{
l_fp lfpClose = l_fp_init(0, 1);
int i = 0;
+
for (i = 0; i < COUNTOF(fdata); ++i) {
struct timeval a = timeval_init(-1, fdata[i].usec);
l_fp E = l_fp_init(~0, fdata[i].frac);
@@ -558,14 +659,17 @@ test_ToLFPrelNeg(void) {
r = tval_intv_to_lfp(a);
TEST_ASSERT_TRUE(AssertFpClose(E, r, lfpClose));
}
+
+ return;
}
void
-test_ToLFPabs(void) {
+test_ToLFPabs(void)
+{
l_fp lfpClose = l_fp_init(0, 1);
-
int i = 0;
+
for (i = 0; i < COUNTOF(fdata); ++i) {
struct timeval a = timeval_init(1, fdata[i].usec);
l_fp E = l_fp_init(1 + JAN_1970, fdata[i].frac);
@@ -574,6 +678,8 @@ test_ToLFPabs(void) {
r = tval_stamp_to_lfp(a);
TEST_ASSERT_TRUE(AssertFpClose(E, r, lfpClose));
}
+
+ return;
}
//----------------------------------------------------------------------
@@ -581,12 +687,14 @@ test_ToLFPabs(void) {
//----------------------------------------------------------------------
void
-test_FromLFPbittest(void) {
+test_FromLFPbittest(void)
+{
struct timeval timevalClose = timeval_init(0, 1);
// Not *exactly* a bittest, because 2**32 tests would take a
// really long time even on very fast machines! So we do test
// every 1000 fractional units.
u_int32 tsf = 0;
+
for (tsf = 0; tsf < ~((u_int32)(1000)); tsf += 1000) {
struct timeval E = timeval_init(1, my_tsf_to_tick(tsf));
l_fp a = l_fp_init(1, tsf);
@@ -597,13 +705,17 @@ test_FromLFPbittest(void) {
// comparing to calculated value.
TEST_ASSERT_TRUE(AssertTimevalClose(E, r, timevalClose));
}
+
+ return;
}
void
-test_FromLFPrelPos(void) {
+test_FromLFPrelPos(void)
+{
struct timeval timevalClose = timeval_init(0, 1);
- int i = 0;
+ int i = 0;
+
for (i = 0; i < COUNTOF(fdata); ++i) {
l_fp a = l_fp_init(1, fdata[i].frac);
struct timeval E = timeval_init(1, fdata[i].usec);
@@ -612,13 +724,17 @@ test_FromLFPrelPos(void) {
r = lfp_intv_to_tval(a);
TEST_ASSERT_TRUE(AssertTimevalClose(E, r, timevalClose));
}
+
+ return;
}
void
-test_FromLFPrelNeg(void) {
+test_FromLFPrelNeg(void)
+{
struct timeval timevalClose = timeval_init(0, 1);
int i = 0;
+
for (i = 0; i < COUNTOF(fdata); ++i) {
l_fp a = l_fp_init(~0, fdata[i].frac);
struct timeval E = timeval_init(-1, fdata[i].usec);
@@ -627,14 +743,18 @@ test_FromLFPrelNeg(void) {
r = lfp_intv_to_tval(a);
TEST_ASSERT_TRUE(AssertTimevalClose(E, r, timevalClose));
}
+
+ return;
}
// usec -> frac -> usec roundtrip, using a prime start and increment
void
-test_LFProundtrip(void) {
+test_LFProundtrip(void)
+{
int32_t t = -1;
u_int32 i = 5;
+
for (t = -1; t < 2; ++t)
for (i = 5; i < 1000000; i += 11) {
struct timeval E = timeval_init(t, i);
@@ -645,6 +765,8 @@ test_LFProundtrip(void) {
r = lfp_intv_to_tval(a);
TEST_ASSERT_EQUAL_timeval(E, r);
}
+
+ return;
}
//----------------------------------------------------------------------
@@ -652,7 +774,8 @@ test_LFProundtrip(void) {
//----------------------------------------------------------------------
void
-test_ToString(void) {
+test_ToString(void)
+{
static const struct {
time_t sec;
long usec;
@@ -668,6 +791,7 @@ test_ToString(void) {
{-1,-1, "-1.000001" },
};
int i;
+
for (i = 0; i < COUNTOF(data); ++i) {
struct timeval a = timeval_init(data[i].sec, data[i].usec);
const char * E = data[i].repr;
@@ -675,6 +799,8 @@ test_ToString(void) {
TEST_ASSERT_EQUAL_STRING(E, r);
}
+
+ return;
}
// -*- EOF -*-
diff --git a/contrib/ntp/tests/libntp/uglydate.c b/contrib/ntp/tests/libntp/uglydate.c
index f47f3e4..3a5aa8a 100644
--- a/contrib/ntp/tests/libntp/uglydate.c
+++ b/contrib/ntp/tests/libntp/uglydate.c
@@ -5,14 +5,26 @@
#include "unity.h"
+void setUp(void);
void test_ConstantDateTime(void);
+
+void
+setUp(void)
+{
+ init_lib();
+
+ return;
+}
+
void
-test_ConstantDateTime(void) {
+test_ConstantDateTime(void)
+{
const u_int32 HALF = 2147483648UL;
- l_fp time = {{3485080800UL}, HALF}; /* 2010-06-09 14:00:00.5 */
+ l_fp e_time = {{3485080800UL}, HALF}; /* 2010-06-09 14:00:00.5 */
TEST_ASSERT_EQUAL_STRING("3485080800.500000 10:159:14:00:00.500",
- uglydate(&time));
+ uglydate(&e_time));
+ return;
}
diff --git a/contrib/ntp/tests/ntpd/leapsec.c b/contrib/ntp/tests/ntpd/leapsec.c
index 37e4398..36ecd39 100644
--- a/contrib/ntp/tests/ntpd/leapsec.c
+++ b/contrib/ntp/tests/ntpd/leapsec.c
@@ -234,6 +234,7 @@ static const uint32_t lsec2015 = 3644697600u; // +36, 1 Jul 2015, 00:00:00 utc
int stringreader(void* farg)
{
const char ** cpp = (const char**)farg;
+
if (**cpp)
return *(*cpp)++;
else
@@ -247,6 +248,7 @@ setup_load_table(
{
int rc;
leap_table_t * pt = leapsec_get_table(0);
+
rc = (pt != NULL) && leapsec_load(pt, stringreader, &cp, blim);
rc = rc && leapsec_set_table(pt);
return rc;
@@ -257,6 +259,7 @@ setup_clear_table(void)
{
int rc;
leap_table_t * pt = leapsec_get_table(0);
+
if (pt)
leapsec_clear(pt);
rc = leapsec_set_table(pt);
@@ -264,10 +267,13 @@ setup_clear_table(void)
}
-char * CalendarToString(const struct calendar cal) {
+char *
+CalendarToString(const struct calendar cal)
+{
char * ss = malloc (sizeof (char) * 100);
-
char buffer[100] ="";
+
+ *ss = '\0';
sprintf(buffer, "%u", cal.year);
strcat(ss,buffer);
strcat(ss,"-");
@@ -293,34 +299,47 @@ char * CalendarToString(const struct calendar cal) {
}
-int IsEqual(const struct calendar expected, const struct calendar actual) {
- if (expected.year == actual.year &&
- (expected.yearday == actual.yearday ||
- (expected.month == actual.month &&
- expected.monthday == actual.monthday)) &&
- expected.hour == actual.hour &&
- expected.minute == actual.minute &&
- expected.second == actual.second) {
+int
+IsEqual(const struct calendar expected, const struct calendar actual)
+{
+
+ if ( expected.year == actual.year
+ && ( expected.yearday == actual.yearday
+ || ( expected.month == actual.month
+ && expected.monthday == actual.monthday))
+ && expected.hour == actual.hour
+ && expected.minute == actual.minute
+ && expected.second == actual.second) {
return TRUE;
} else {
- printf("expected: %s but was %s", CalendarToString(expected) ,CalendarToString(actual));
+ char *p_exp = CalendarToString(expected);
+ char *p_act = CalendarToString(actual);
+
+ printf("expected: %s but was %s", p_exp, p_act);
+
+ free(p_exp);
+ free(p_act);
return FALSE;
-
}
}
//-------------------------
-void setUp(void)
+void
+setUp(void)
{
ntpcal_set_timefunc(timefunc);
settime(1970, 1, 1, 0, 0, 0);
leapsec_ut_pristine();
+
+ return;
}
-void tearDown(void)
+void
+tearDown(void)
{
ntpcal_set_timefunc(NULL);
+ return;
}
// =====================================================================
@@ -328,45 +347,73 @@ void tearDown(void)
// =====================================================================
// ----------------------------------------------------------------------
-void test_ValidateGood(void) {
+void
+test_ValidateGood(void)
+{
const char *cp = leap_ghash;
int rc = leapsec_validate(stringreader, &cp);
+
TEST_ASSERT_EQUAL(LSVALID_GOODHASH, rc);
+ return;
}
// ----------------------------------------------------------------------
-void test_ValidateNoHash(void) {
+void
+test_ValidateNoHash(void)
+{
const char *cp = leap2;
int rc = leapsec_validate(stringreader, &cp);
+
TEST_ASSERT_EQUAL(LSVALID_NOHASH, rc);
+ return;
}
// ----------------------------------------------------------------------
-void test_ValidateBad(void) {
+void
+test_ValidateBad(void)
+{
const char *cp = leap_bhash;
int rc = leapsec_validate(stringreader, &cp);
+
TEST_ASSERT_EQUAL(LSVALID_BADHASH, rc);
+
+ return;
}
// ----------------------------------------------------------------------
-void test_ValidateMalformed(void) {
+void
+test_ValidateMalformed(void)
+{
const char *cp = leap_mhash;
int rc = leapsec_validate(stringreader, &cp);
+
TEST_ASSERT_EQUAL(LSVALID_BADFORMAT, rc);
+
+ return;
}
// ----------------------------------------------------------------------
-void test_ValidateMalformedShort(void) {
+void
+test_ValidateMalformedShort(void)
+{
const char *cp = leap_shash;
int rc = leapsec_validate(stringreader, &cp);
+
TEST_ASSERT_EQUAL(LSVALID_BADFORMAT, rc);
+
+ return;
}
// ----------------------------------------------------------------------
-void test_ValidateNoLeadZero(void) {
+void
+test_ValidateNoLeadZero(void)
+{
const char *cp = leap_gthash;
int rc = leapsec_validate(stringreader, &cp);
+
TEST_ASSERT_EQUAL(LSVALID_GOODHASH, rc);
+
+ return;
}
// =====================================================================
@@ -375,7 +422,9 @@ void test_ValidateNoLeadZero(void) {
// ----------------------------------------------------------------------
// test table selection
-void test_tableSelect(void) {
+void
+test_tableSelect(void)
+{
leap_table_t *pt1, *pt2, *pt3, *pt4;
pt1 = leapsec_get_table(0);
@@ -406,12 +455,16 @@ void test_tableSelect(void) {
pt3 = leapsec_get_table(1);
TEST_ASSERT_EQUAL(pt1, pt2);
TEST_ASSERT_NOT_EQUAL(pt2, pt3);
+
+ return;
}
// ----------------------------------------------------------------------
// load file & check expiration
-void test_loadFileExpire(void) {
+void
+test_loadFileExpire(void)
+{
const char *cp = leap1;
int rc;
leap_table_t * pt = leapsec_get_table(0);
@@ -423,18 +476,21 @@ void test_loadFileExpire(void) {
TEST_ASSERT_EQUAL(0, rc);
rc = leapsec_expired(3610569601u, NULL);
TEST_ASSERT_EQUAL(1, rc);
+
+ return;
}
// ----------------------------------------------------------------------
// load file & check time-to-live
-void test_loadFileTTL(void) {
- const char *cp = leap1;
- int rc;
- leap_table_t * pt = leapsec_get_table(0);
- time_t pivot = 0x70000000u;
-
- const uint32_t limit = 3610569600u;
+void
+test_loadFileTTL(void)
+{
+ const char *cp = leap1;
+ int rc;
+ leap_table_t * pt = leapsec_get_table(0);
+ time_t pivot = 0x70000000u;
+ const uint32_t limit = 3610569600u;
rc = leapsec_load(pt, stringreader, &cp, FALSE)
&& leapsec_set_table(pt);
@@ -442,16 +498,18 @@ void test_loadFileTTL(void) {
// exactly 1 day to live
rc = leapsec_daystolive(limit - 86400, &pivot);
- TEST_ASSERT_EQUAL( 1, rc);
+ TEST_ASSERT_EQUAL( 1, rc);
// less than 1 day to live
rc = leapsec_daystolive(limit - 86399, &pivot);
- TEST_ASSERT_EQUAL( 0, rc);
+ TEST_ASSERT_EQUAL( 0, rc);
// hit expiration exactly
rc = leapsec_daystolive(limit, &pivot);
- TEST_ASSERT_EQUAL( 0, rc);
+ TEST_ASSERT_EQUAL( 0, rc);
// expired since 1 sec
rc = leapsec_daystolive(limit + 1, &pivot);
- TEST_ASSERT_EQUAL(-1, rc);
+ TEST_ASSERT_EQUAL(-1, rc);
+
+ return;
}
// =====================================================================
@@ -460,19 +518,25 @@ void test_loadFileTTL(void) {
// ----------------------------------------------------------------------
// test query in pristine state (bug#2745 misbehaviour)
-void test_lsQueryPristineState(void) {
+void
+test_lsQueryPristineState(void)
+{
int rc;
leap_result_t qr;
-
+
rc = leapsec_query(&qr, lsec2012, NULL);
TEST_ASSERT_EQUAL(FALSE, rc);
TEST_ASSERT_EQUAL(0, qr.warped );
TEST_ASSERT_EQUAL(LSPROX_NOWARN, qr.proximity);
+
+ return;
}
// ----------------------------------------------------------------------
// ad-hoc jump: leap second at 2009.01.01 -60days
-void test_ls2009faraway(void) {
+void
+test_ls2009faraway(void)
+{
int rc;
leap_result_t qr;
@@ -485,11 +549,15 @@ void test_ls2009faraway(void) {
TEST_ASSERT_EQUAL(33, qr.tai_offs);
TEST_ASSERT_EQUAL(0, qr.tai_diff);
TEST_ASSERT_EQUAL(LSPROX_NOWARN, qr.proximity);
+
+ return;
}
// ----------------------------------------------------------------------
// ad-hoc jump: leap second at 2009.01.01 -1week
-void test_ls2009weekaway(void) {
+void
+test_ls2009weekaway(void)
+{
int rc;
leap_result_t qr;
@@ -502,11 +570,15 @@ void test_ls2009weekaway(void) {
TEST_ASSERT_EQUAL(33, qr.tai_offs);
TEST_ASSERT_EQUAL(1, qr.tai_diff);
TEST_ASSERT_EQUAL(LSPROX_SCHEDULE, qr.proximity);
+
+ return;
}
// ----------------------------------------------------------------------
// ad-hoc jump: leap second at 2009.01.01 -1hr
-void test_ls2009houraway(void) {
+void
+test_ls2009houraway(void)
+{
int rc;
leap_result_t qr;
@@ -519,11 +591,15 @@ void test_ls2009houraway(void) {
TEST_ASSERT_EQUAL(33, qr.tai_offs);
TEST_ASSERT_EQUAL(1, qr.tai_diff);
TEST_ASSERT_EQUAL(LSPROX_ANNOUNCE, qr.proximity);
+
+ return;
}
// ----------------------------------------------------------------------
// ad-hoc jump: leap second at 2009.01.01 -1sec
-void test_ls2009secaway(void) {
+void
+test_ls2009secaway(void)
+{
int rc;
leap_result_t qr;
@@ -536,11 +612,15 @@ void test_ls2009secaway(void) {
TEST_ASSERT_EQUAL(33, qr.tai_offs);
TEST_ASSERT_EQUAL(1, qr.tai_diff);
TEST_ASSERT_EQUAL(LSPROX_ALERT, qr.proximity);
+
+ return;
}
// ----------------------------------------------------------------------
// ad-hoc jump to leap second at 2009.01.01
-void test_ls2009onspot(void) {
+void
+test_ls2009onspot(void)
+{
int rc;
leap_result_t qr;
@@ -553,11 +633,15 @@ void test_ls2009onspot(void) {
TEST_ASSERT_EQUAL(34, qr.tai_offs);
TEST_ASSERT_EQUAL(0, qr.tai_diff);
TEST_ASSERT_EQUAL(LSPROX_NOWARN, qr.proximity);
+
+ return;
}
// ----------------------------------------------------------------------
// test handling of the leap second at 2009.01.01 without table
-void test_ls2009nodata(void) {
+void
+test_ls2009nodata(void)
+{
int rc;
leap_result_t qr;
@@ -570,11 +654,15 @@ void test_ls2009nodata(void) {
TEST_ASSERT_EQUAL(0, qr.tai_offs);
TEST_ASSERT_EQUAL(0, qr.tai_diff);
TEST_ASSERT_EQUAL(LSPROX_NOWARN, qr.proximity);
+
+ return;
}
// ----------------------------------------------------------------------
// test handling of the leap second at 2009.01.01 with culled data
-void test_ls2009limdata(void) {
+void
+test_ls2009limdata(void)
+{
int rc;
leap_result_t qr;
@@ -591,15 +679,19 @@ void test_ls2009limdata(void) {
TEST_ASSERT_TRUE(35 >= qr.tai_offs);
TEST_ASSERT_EQUAL(0, qr.tai_diff);
TEST_ASSERT_EQUAL(LSPROX_NOWARN, qr.proximity);
+
+ return;
}
// ----------------------------------------------------------------------
// Far-distance forward jump into a transiton window.
-void test_qryJumpFarAhead(void) {
+void
+test_qryJumpFarAhead(void)
+{
int rc;
leap_result_t qr;
int last, idx;
- int mode;
+ int mode;
for (mode=0; mode < 2; ++mode) {
leapsec_ut_pristine();
@@ -618,10 +710,10 @@ void test_qryJumpFarAhead(void) {
// ----------------------------------------------------------------------
// Forward jump into the next transition window
void test_qryJumpAheadToTransition(void) {
- int rc;
- leap_result_t qr;
- int last, idx;
- int mode;
+ int rc;
+ leap_result_t qr;
+ int last, idx;
+ int mode;
for (mode=0; mode < 2; ++mode) {
leapsec_ut_pristine();
@@ -635,15 +727,19 @@ void test_qryJumpAheadToTransition(void) {
rc = leapsec_query(&qr, lsec2009+1, NULL);
TEST_ASSERT_EQUAL(TRUE, rc);
}
+
+ return;
}
// ----------------------------------------------------------------------
// Forward jump over the next transition window
-void test_qryJumpAheadOverTransition(void) {
- int rc;
- leap_result_t qr;
- int last, idx;
- int mode;
+void
+test_qryJumpAheadOverTransition(void)
+{
+ int rc;
+ leap_result_t qr;
+ int last, idx;
+ int mode;
for (mode=0; mode < 2; ++mode) {
leapsec_ut_pristine();
@@ -657,6 +753,8 @@ void test_qryJumpAheadOverTransition(void) {
rc = leapsec_query(&qr, lsec2009+5, NULL);
TEST_ASSERT_EQUAL(FALSE, rc);
}
+
+ return;
}
// =====================================================================
@@ -665,7 +763,9 @@ void test_qryJumpAheadOverTransition(void) {
// ----------------------------------------------------------------------
// add dynamic leap second (like from peer/clock)
-void test_addDynamic(void) {
+void
+test_addDynamic(void)
+{
int rc;
leap_result_t qr;
@@ -683,8 +783,7 @@ void test_addDynamic(void) {
rc = setup_load_table(leap2, FALSE);
TEST_ASSERT_EQUAL(1, rc);
- leap_table_t * pt = leapsec_get_table(0);
- int idx;
+ int idx;
for (idx=1; insns[idx]; ++idx) {
rc = leapsec_add_dyn(TRUE, insns[idx] - 20*SECSPERDAY - 100, NULL);
@@ -693,13 +792,18 @@ void test_addDynamic(void) {
// try to slip in a previous entry
rc = leapsec_add_dyn(TRUE, insns[0] - 20*SECSPERDAY - 100, NULL);
TEST_ASSERT_EQUAL(FALSE, rc);
+ //leap_table_t * pt = leapsec_get_table(0);
//leapsec_dump(pt, (leapsec_dumper)fprintf, stdout);
+
+ return;
}
// ----------------------------------------------------------------------
// add fixed leap seconds (like from network packet)
#if 0 /* currently unused -- possibly revived later */
-void FAILtest_addFixed(void) {
+void
+FAILtest_addFixed(void)
+{
int rc;
leap_result_t qr;
@@ -716,8 +820,8 @@ void FAILtest_addFixed(void) {
rc = setup_load_table(leap2, FALSE);
TEST_ASSERT_EQUAL(1, rc);
+
int idx;
- leap_table_t * pt = leapsec_get_table(0);
// try to get in BAD time stamps...
for (idx=0; insns[idx].tt; ++idx) {
rc = leapsec_add_fix(
@@ -743,14 +847,19 @@ void FAILtest_addFixed(void) {
insns[0].tt + SECSPERDAY,
NULL);
TEST_ASSERT_EQUAL(FALSE, rc);
+ //leap_table_t * pt = leapsec_get_table(0);
//leapsec_dump(pt, (leapsec_dumper)fprintf, stdout);
+
+ return;
}
#endif
// ----------------------------------------------------------------------
// add fixed leap seconds (like from network packet)
#if 0 /* currently unused -- possibly revived later */
-void FAILtest_addFixedExtend(void) {
+void
+FAILtest_addFixedExtend(void)
+{
int rc;
leap_result_t qr;
int last, idx;
@@ -764,7 +873,6 @@ void FAILtest_addFixedExtend(void) {
rc = setup_load_table(leap2, FALSE);
TEST_ASSERT_EQUAL(1, rc);
- leap_table_t * pt = leapsec_get_table(FALSE);
for (last=idx=0; insns[idx].tt; ++idx) {
last = idx;
rc = leapsec_add_fix(
@@ -774,7 +882,7 @@ void FAILtest_addFixedExtend(void) {
NULL);
TEST_ASSERT_EQUAL(TRUE, rc);
}
-
+
// try to extend the expiration of the last entry
rc = leapsec_add_fix(
insns[last].of,
@@ -782,7 +890,7 @@ void FAILtest_addFixedExtend(void) {
insns[last].tt + 128*SECSPERDAY,
NULL);
TEST_ASSERT_EQUAL(TRUE, rc);
-
+
// try to extend the expiration of the last entry with wrong offset
rc = leapsec_add_fix(
insns[last].of+1,
@@ -790,7 +898,10 @@ void FAILtest_addFixedExtend(void) {
insns[last].tt + 129*SECSPERDAY,
NULL);
TEST_ASSERT_EQUAL(FALSE, rc);
+ //leap_table_t * pt = leapsec_get_table(FALSE);
//leapsec_dump(pt, (leapsec_dumper)fprintf, stdout);
+
+ return;
}
#endif
@@ -799,7 +910,9 @@ void FAILtest_addFixedExtend(void) {
// empty table and test queries before / between /after the tabulated
// values.
#if 0 /* currently unused -- possibly revived later */
-void FAILtest_setFixedExtend(void) {
+void
+FAILtest_setFixedExtend(void)
+{
int rc;
leap_result_t qr;
int last, idx;
@@ -810,7 +923,6 @@ void FAILtest_setFixedExtend(void) {
{0,0} // sentinel
};
- leap_table_t * pt = leapsec_get_table(0);
for (last=idx=0; insns[idx].tt; ++idx) {
last = idx;
rc = leapsec_add_fix(
@@ -820,7 +932,7 @@ void FAILtest_setFixedExtend(void) {
NULL);
TEST_ASSERT_EQUAL(TRUE, rc);
}
-
+
rc = leapsec_query(&qr, insns[0].tt - 86400, NULL);
TEST_ASSERT_EQUAL(28, qr.tai_offs);
@@ -833,7 +945,10 @@ void FAILtest_setFixedExtend(void) {
rc = leapsec_query(&qr, insns[1].tt + 86400, NULL);
TEST_ASSERT_EQUAL(30, qr.tai_offs);
+ //leap_table_t * pt = leapsec_get_table(0);
//leapsec_dump(pt, (leapsec_dumper)fprintf, stdout);
+
+ return;
}
#endif
@@ -846,7 +961,7 @@ void FAILtest_setFixedExtend(void) {
void test_taiEmptyTable(void) {
int rc;
- rc = leapsec_autokey_tai(35, lsec2015-30*86400, NULL);
+ rc = leapsec_autokey_tai(35, lsec2015-30*86400, NULL);
TEST_ASSERT_EQUAL(TRUE, rc);
rc = leapsec_autokey_tai(35, lsec2015-29*86400, NULL);
@@ -855,7 +970,9 @@ void test_taiEmptyTable(void) {
// ----------------------------------------------------------------------
// Check that with fixed entries the operation fails
-void test_taiTableFixed(void) {
+void
+test_taiTableFixed(void)
+{
int rc;
rc = setup_load_table(leap1, FALSE);
@@ -863,11 +980,15 @@ void test_taiTableFixed(void) {
rc = leapsec_autokey_tai(35, lsec2015-30*86400, NULL);
TEST_ASSERT_EQUAL(FALSE, rc);
+
+ return;
}
// ----------------------------------------------------------------------
// test adjustment with a dynamic entry already there
-void test_taiTableDynamic(void) {
+void
+test_taiTableDynamic(void)
+{
int rc;
leap_era_t era;
@@ -879,7 +1000,7 @@ void test_taiTableDynamic(void) {
leapsec_query_era(&era, lsec2015+10, NULL);
TEST_ASSERT_EQUAL(1, era.taiof);
- rc = leapsec_autokey_tai(35, lsec2015-19*86400, NULL);
+ rc = leapsec_autokey_tai(35, lsec2015-19*86400, NULL);
TEST_ASSERT_EQUAL(TRUE, rc);
rc = leapsec_autokey_tai(35, lsec2015-19*86400, NULL);
@@ -889,21 +1010,27 @@ void test_taiTableDynamic(void) {
TEST_ASSERT_EQUAL(35, era.taiof);
leapsec_query_era(&era, lsec2015+10, NULL);
TEST_ASSERT_EQUAL(36, era.taiof);
+
+ return;
}
// ----------------------------------------------------------------------
// test adjustment with a dynamic entry already there in dead zone
-void test_taiTableDynamicDeadZone(void) {
+void
+test_taiTableDynamicDeadZone(void)
+{
int rc;
rc = leapsec_add_dyn(TRUE, lsec2015-20*SECSPERDAY, NULL);
TEST_ASSERT_EQUAL(TRUE, rc);
- rc = leapsec_autokey_tai(35, lsec2015-5, NULL);
+ rc = leapsec_autokey_tai(35, lsec2015-5, NULL);
TEST_ASSERT_EQUAL(FALSE, rc);
rc = leapsec_autokey_tai(35, lsec2015+5, NULL);
TEST_ASSERT_EQUAL(FALSE, rc);
+
+ return;
}
@@ -913,7 +1040,9 @@ void test_taiTableDynamicDeadZone(void) {
// ----------------------------------------------------------------------
// leap second insert at 2009.01.01, electric mode
-void test_ls2009seqInsElectric(void) {
+void
+test_ls2009seqInsElectric(void)
+{
int rc;
leap_result_t qr;
@@ -952,11 +1081,15 @@ void test_ls2009seqInsElectric(void) {
TEST_ASSERT_EQUAL(FALSE, rc);
TEST_ASSERT_EQUAL(0, qr.warped );
TEST_ASSERT_EQUAL(LSPROX_NOWARN, qr.proximity);
+
+ return;
}
// ----------------------------------------------------------------------
// leap second insert at 2009.01.01, dumb mode
-void test_ls2009seqInsDumb(void) {
+void
+test_ls2009seqInsDumb(void)
+{
int rc;
leap_result_t qr;
@@ -999,12 +1132,16 @@ void test_ls2009seqInsDumb(void) {
TEST_ASSERT_EQUAL(FALSE, rc);
TEST_ASSERT_EQUAL(0, qr.warped );
TEST_ASSERT_EQUAL(LSPROX_NOWARN, qr.proximity);
+
+ return;
}
// ----------------------------------------------------------------------
// fake leap second remove at 2009.01.01, electric mode
-void test_ls2009seqDelElectric(void) {
+void
+test_ls2009seqDelElectric(void)
+{
int rc;
leap_result_t qr;
@@ -1043,11 +1180,15 @@ void test_ls2009seqDelElectric(void) {
TEST_ASSERT_EQUAL(FALSE, rc);
TEST_ASSERT_EQUAL(0, qr.warped );
TEST_ASSERT_EQUAL(LSPROX_NOWARN, qr.proximity);
+
+ return;
}
// ----------------------------------------------------------------------
// fake leap second remove at 2009.01.01. dumb mode
-void test_ls2009seqDelDumb(void) {
+void
+test_ls2009seqDelDumb(void)
+{
int rc;
leap_result_t qr;
@@ -1085,11 +1226,15 @@ void test_ls2009seqDelDumb(void) {
TEST_ASSERT_EQUAL(FALSE, rc);
TEST_ASSERT_EQUAL(0, qr.warped );
TEST_ASSERT_EQUAL(LSPROX_NOWARN, qr.proximity);
+
+ return;
}
// ----------------------------------------------------------------------
// leap second insert at 2012.07.01, electric mode
-void test_ls2012seqInsElectric(void) {
+void
+test_ls2012seqInsElectric(void)
+{
int rc;
leap_result_t qr;
@@ -1128,11 +1273,15 @@ void test_ls2012seqInsElectric(void) {
TEST_ASSERT_EQUAL(FALSE, rc);
TEST_ASSERT_EQUAL(0, qr.warped );
TEST_ASSERT_EQUAL(LSPROX_NOWARN, qr.proximity);
+
+ return;
}
// ----------------------------------------------------------------------
// leap second insert at 2012.07.01, dumb mode
-void test_ls2012seqInsDumb(void) {
+void
+test_ls2012seqInsDumb(void)
+{
int rc;
leap_result_t qr;
@@ -1177,11 +1326,15 @@ void test_ls2012seqInsDumb(void) {
TEST_ASSERT_EQUAL(FALSE, rc);
TEST_ASSERT_EQUAL(0, qr.warped );
TEST_ASSERT_EQUAL(LSPROX_NOWARN, qr.proximity);
+
+ return;
}
// ----------------------------------------------------------------------
// test repeated query on empty table in dumb mode
-void test_lsEmptyTableDumb(void) {
+void
+test_lsEmptyTableDumb(void)
+{
int rc;
leap_result_t qr;
@@ -1189,7 +1342,7 @@ void test_lsEmptyTableDumb(void) {
time_t pivot;
pivot = lsec2012;
// const
- //time_t pivot(lsec2012);
+ //time_t pivot(lsec2012);
const uint32_t t0 = lsec2012 - 10;
const uint32_t tE = lsec2012 + 10;
@@ -1202,20 +1355,24 @@ void test_lsEmptyTableDumb(void) {
TEST_ASSERT_EQUAL(0, qr.warped );
TEST_ASSERT_EQUAL(LSPROX_NOWARN, qr.proximity);
}
+
+ return;
}
// ----------------------------------------------------------------------
// test repeated query on empty table in electric mode
-void test_lsEmptyTableElectric(void) {
+void
+test_lsEmptyTableElectric(void)
+{
int rc;
leap_result_t qr;
-
+
leapsec_electric(1);
TEST_ASSERT_EQUAL(1, leapsec_electric(-1));
//const
time_t pivot;//(lsec2012);
- pivot = lsec2012;
+ pivot = lsec2012;
const uint32_t t0 = lsec2012 - 10;
const uint32_t tE = lsec2012 + 10;
@@ -1226,4 +1383,6 @@ void test_lsEmptyTableElectric(void) {
TEST_ASSERT_EQUAL(0, qr.warped );
TEST_ASSERT_EQUAL(LSPROX_NOWARN, qr.proximity);
}
+
+ return;
}
diff --git a/contrib/ntp/tests/ntpd/ntp_prio_q.c b/contrib/ntp/tests/ntpd/ntp_prio_q.c
index c2d4f76..4b27157 100644
--- a/contrib/ntp/tests/ntpd/ntp_prio_q.c
+++ b/contrib/ntp/tests/ntpd/ntp_prio_q.c
@@ -251,6 +251,7 @@ test_AppendQueues(void) {
free_node(e3_ptr);
free_node(e4_ptr);
free_node(e5_ptr);
+ free_node(e6_ptr);
TEST_ASSERT_EQUAL(0, get_no_of_elements(q4));
diff --git a/contrib/ntp/tests/ntpd/ntp_restrict.c b/contrib/ntp/tests/ntpd/ntp_restrict.c
index 98d6e83..08d236e 100644
--- a/contrib/ntp/tests/ntpd/ntp_restrict.c
+++ b/contrib/ntp/tests/ntpd/ntp_restrict.c
@@ -26,6 +26,7 @@ setUp(void) {
}
+void
tearDown(void) {
restrict_u *empty_restrict = malloc(sizeof(restrict_u));
memset(empty_restrict, 0, sizeof(restrict_u));
diff --git a/contrib/ntp/tests/ntpd/rc_cmdlength.c b/contrib/ntp/tests/ntpd/rc_cmdlength.c
index e3d599f..dfe5316 100644
--- a/contrib/ntp/tests/ntpd/rc_cmdlength.c
+++ b/contrib/ntp/tests/ntpd/rc_cmdlength.c
@@ -3,6 +3,7 @@
#include "ntp.h"
#include "ntp_calendar.h"
#include "ntp_stdlib.h"
+#include "rc_cmdlength.h"
#include "unity.h"
diff --git a/contrib/ntp/tests/ntpd/run-leapsec.c b/contrib/ntp/tests/ntpd/run-leapsec.c
index c02cfa8..03b633e 100644
--- a/contrib/ntp/tests/ntpd/run-leapsec.c
+++ b/contrib/ntp/tests/ntpd/run-leapsec.c
@@ -84,39 +84,39 @@ int main(int argc, char *argv[])
{
progname = argv[0];
UnityBegin("leapsec.c");
- RUN_TEST(test_ValidateGood, 331);
- RUN_TEST(test_ValidateNoHash, 338);
- RUN_TEST(test_ValidateBad, 345);
- RUN_TEST(test_ValidateMalformed, 352);
- RUN_TEST(test_ValidateMalformedShort, 359);
- RUN_TEST(test_ValidateNoLeadZero, 366);
- RUN_TEST(test_tableSelect, 378);
- RUN_TEST(test_loadFileExpire, 414);
- RUN_TEST(test_loadFileTTL, 431);
- RUN_TEST(test_lsQueryPristineState, 463);
- RUN_TEST(test_ls2009faraway, 475);
- RUN_TEST(test_ls2009weekaway, 492);
- RUN_TEST(test_ls2009houraway, 509);
- RUN_TEST(test_ls2009secaway, 526);
- RUN_TEST(test_ls2009onspot, 543);
- RUN_TEST(test_ls2009nodata, 560);
- RUN_TEST(test_ls2009limdata, 577);
- RUN_TEST(test_qryJumpFarAhead, 598);
- RUN_TEST(test_qryJumpAheadToTransition, 620);
- RUN_TEST(test_qryJumpAheadOverTransition, 642);
- RUN_TEST(test_addDynamic, 668);
- RUN_TEST(test_taiEmptyTable, 846);
- RUN_TEST(test_taiTableFixed, 858);
- RUN_TEST(test_taiTableDynamic, 870);
- RUN_TEST(test_taiTableDynamicDeadZone, 896);
- RUN_TEST(test_ls2009seqInsElectric, 916);
- RUN_TEST(test_ls2009seqInsDumb, 959);
- RUN_TEST(test_ls2009seqDelElectric, 1007);
- RUN_TEST(test_ls2009seqDelDumb, 1050);
- RUN_TEST(test_ls2012seqInsElectric, 1092);
- RUN_TEST(test_ls2012seqInsDumb, 1135);
- RUN_TEST(test_lsEmptyTableDumb, 1184);
- RUN_TEST(test_lsEmptyTableElectric, 1209);
+ RUN_TEST(test_ValidateGood, 351);
+ RUN_TEST(test_ValidateNoHash, 362);
+ RUN_TEST(test_ValidateBad, 373);
+ RUN_TEST(test_ValidateMalformed, 385);
+ RUN_TEST(test_ValidateMalformedShort, 397);
+ RUN_TEST(test_ValidateNoLeadZero, 409);
+ RUN_TEST(test_tableSelect, 426);
+ RUN_TEST(test_loadFileExpire, 466);
+ RUN_TEST(test_loadFileTTL, 487);
+ RUN_TEST(test_lsQueryPristineState, 522);
+ RUN_TEST(test_ls2009faraway, 538);
+ RUN_TEST(test_ls2009weekaway, 559);
+ RUN_TEST(test_ls2009houraway, 580);
+ RUN_TEST(test_ls2009secaway, 601);
+ RUN_TEST(test_ls2009onspot, 622);
+ RUN_TEST(test_ls2009nodata, 643);
+ RUN_TEST(test_ls2009limdata, 664);
+ RUN_TEST(test_qryJumpFarAhead, 689);
+ RUN_TEST(test_qryJumpAheadToTransition, 712);
+ RUN_TEST(test_qryJumpAheadOverTransition, 737);
+ RUN_TEST(test_addDynamic, 767);
+ RUN_TEST(test_taiEmptyTable, 961);
+ RUN_TEST(test_taiTableFixed, 974);
+ RUN_TEST(test_taiTableDynamic, 990);
+ RUN_TEST(test_taiTableDynamicDeadZone, 1020);
+ RUN_TEST(test_ls2009seqInsElectric, 1044);
+ RUN_TEST(test_ls2009seqInsDumb, 1091);
+ RUN_TEST(test_ls2009seqDelElectric, 1143);
+ RUN_TEST(test_ls2009seqDelDumb, 1190);
+ RUN_TEST(test_ls2012seqInsElectric, 1236);
+ RUN_TEST(test_ls2012seqInsDumb, 1283);
+ RUN_TEST(test_lsEmptyTableDumb, 1336);
+ RUN_TEST(test_lsEmptyTableElectric, 1365);
return (UnityEnd());
}
diff --git a/contrib/ntp/tests/ntpd/run-ntp_restrict.c b/contrib/ntp/tests/ntpd/run-ntp_restrict.c
index 0d945eb..d884462 100644
--- a/contrib/ntp/tests/ntpd/run-ntp_restrict.c
+++ b/contrib/ntp/tests/ntpd/run-ntp_restrict.c
@@ -55,14 +55,14 @@ int main(int argc, char *argv[])
{
progname = argv[0];
UnityBegin("ntp_restrict.c");
- RUN_TEST(test_RestrictionsAreEmptyAfterInit, 59);
- RUN_TEST(test_ReturnsCorrectDefaultRestrictions, 85);
- RUN_TEST(test_HackingDefaultRestriction, 96);
- RUN_TEST(test_CantRemoveDefaultEntry, 119);
- RUN_TEST(test_AddingNewRestriction, 130);
- RUN_TEST(test_TheMostFittingRestrictionIsMatched, 143);
- RUN_TEST(test_DeletedRestrictionIsNotMatched, 165);
- RUN_TEST(test_RestrictUnflagWorks, 189);
+ RUN_TEST(test_RestrictionsAreEmptyAfterInit, 60);
+ RUN_TEST(test_ReturnsCorrectDefaultRestrictions, 86);
+ RUN_TEST(test_HackingDefaultRestriction, 97);
+ RUN_TEST(test_CantRemoveDefaultEntry, 120);
+ RUN_TEST(test_AddingNewRestriction, 131);
+ RUN_TEST(test_TheMostFittingRestrictionIsMatched, 144);
+ RUN_TEST(test_DeletedRestrictionIsNotMatched, 166);
+ RUN_TEST(test_RestrictUnflagWorks, 190);
return (UnityEnd());
}
diff --git a/contrib/ntp/tests/ntpd/run-rc_cmdlength.c b/contrib/ntp/tests/ntpd/run-rc_cmdlength.c
index c6fb7cc..927a45e 100644
--- a/contrib/ntp/tests/ntpd/run-rc_cmdlength.c
+++ b/contrib/ntp/tests/ntpd/run-rc_cmdlength.c
@@ -26,6 +26,7 @@
#include "ntp.h"
#include "ntp_calendar.h"
#include "ntp_stdlib.h"
+#include "rc_cmdlength.h"
#include "test-libntp.h"
#include <string.h>
@@ -51,7 +52,7 @@ int main(int argc, char *argv[])
{
progname = argv[0];
UnityBegin("rc_cmdlength.c");
- RUN_TEST(test_EvaluateCommandLength, 15);
+ RUN_TEST(test_EvaluateCommandLength, 16);
return (UnityEnd());
}
diff --git a/contrib/ntp/tests/ntpd/run-t-ntp_signd.c b/contrib/ntp/tests/ntpd/run-t-ntp_signd.c
index 662cada..5226f7f 100644
--- a/contrib/ntp/tests/ntpd/run-t-ntp_signd.c
+++ b/contrib/ntp/tests/ntpd/run-t-ntp_signd.c
@@ -36,7 +36,7 @@ extern void test_connect_correct_socket(void);
extern void test_write_all(void);
extern void test_send_packet(void);
extern void test_recv_packet(void);
-extern void test_send_via_ntp_signd();
+extern void test_send_via_ntp_signd(void);
//=======Test Reset Option=====
@@ -55,12 +55,12 @@ int main(int argc, char *argv[])
{
progname = argv[0];
UnityBegin("t-ntp_signd.c");
- RUN_TEST(test_connect_incorrect_socket, 49);
- RUN_TEST(test_connect_correct_socket, 54);
- RUN_TEST(test_write_all, 74);
- RUN_TEST(test_send_packet, 84);
- RUN_TEST(test_recv_packet, 93);
- RUN_TEST(test_send_via_ntp_signd, 104);
+ RUN_TEST(test_connect_incorrect_socket, 67);
+ RUN_TEST(test_connect_correct_socket, 68);
+ RUN_TEST(test_write_all, 69);
+ RUN_TEST(test_send_packet, 70);
+ RUN_TEST(test_recv_packet, 71);
+ RUN_TEST(test_send_via_ntp_signd, 72);
return (UnityEnd());
}
diff --git a/contrib/ntp/tests/ntpd/t-ntp_scanner.c b/contrib/ntp/tests/ntpd/t-ntp_scanner.c
index 9bc77c4..862a2ee 100644
--- a/contrib/ntp/tests/ntpd/t-ntp_scanner.c
+++ b/contrib/ntp/tests/ntpd/t-ntp_scanner.c
@@ -26,13 +26,13 @@ void test_InitializeLexStack(void);
void test_keywordIncorrectToken(void){
- char * temp = keyword(999);
+ const char * temp = keyword(999);
//printf("%s\n",temp);
TEST_ASSERT_EQUAL_STRING("(keyword not found)",temp);
}
void test_keywordServerToken(void){
- char * temp = keyword(401);
+ const char * temp = keyword(T_Server);
//printf("%s",temp); //143 or 401 ?
TEST_ASSERT_EQUAL_STRING("server",temp);
}
@@ -127,7 +127,7 @@ void test_EOC(void){
temp = is_EOC(';');
TEST_ASSERT_TRUE(temp);
}
- temp = is_EOC("A");
+ temp = is_EOC('A');
TEST_ASSERT_FALSE(temp);
temp = is_EOC('1');
TEST_ASSERT_FALSE(temp);
diff --git a/contrib/ntp/tests/ntpd/t-ntp_signd.c b/contrib/ntp/tests/ntpd/t-ntp_signd.c
index 45972fb..534c940 100644
--- a/contrib/ntp/tests/ntpd/t-ntp_signd.c
+++ b/contrib/ntp/tests/ntpd/t-ntp_signd.c
@@ -9,7 +9,6 @@
#include "test-libntp.h"
-
#define HAVE_NTP_SIGND
#include "ntp_signd.c"
@@ -20,41 +19,70 @@ extern int ux_socket_connect(const char *name);
//MOCKED FUNCTIONS
//this connect function overrides/mocks connect() from <sys/socket.h>
-int connect(int socket, const struct sockaddr *address,
-socklen_t address_len){
+int
+connect(int socket, const struct sockaddr *address, socklen_t address_len)
+{
return 1;
}
-//mocked write will only send 4 bytes at a time. This is so write_all can be properly tested
-ssize_t write(int fd, void const * buf, size_t len){
- if(len >= 4){return 4;}
- else return len;
+/*
+** Mocked read() and write() calls.
+**
+** These will only operate 4 bytes at a time.
+**
+** This is so write_all can be properly tested.
+*/
+
+static char rw_buf[4];
+
+ssize_t
+write(int fd, void const * buf, size_t len)
+{
+ REQUIRE(0 <= len);
+ if (len >= 4) len = 4; /* 4 bytes, max */
+ (void)memcpy(rw_buf, buf, len);
+
+ return len;
}
-ssize_t read(int fd, void * buf, size_t len){
- if(len >= 4){return 4;}
- else return len;
+ssize_t
+read(int fd, void * buf, size_t len)
+{
+ REQUIRE(0 <= len);
+ if (len >= 4) len = 4;
+ (void)memcpy(buf, rw_buf, len);
+ return len;
}
//END OF MOCKED FUNCTIONS
-int isGE(int a,int b){
- if(a >= b) {return 1;}
+static int
+isGE(int a,int b)
+{
+ if (a >= b) {return 1;}
else {return 0;}
}
+extern void test_connect_incorrect_socket(void);
+extern void test_connect_correct_socket(void);
+extern void test_write_all(void);
+extern void test_send_packet(void);
+extern void test_recv_packet(void);
+extern void test_send_via_ntp_signd(void);
+
void
-test_connect_incorrect_socket(void){
+test_connect_incorrect_socket(void)
+{
TEST_ASSERT_EQUAL(-1, ux_socket_connect(NULL));
+
+ return;
}
void
-test_connect_correct_socket(void){
-
-
-
+test_connect_correct_socket(void)
+{
int temp = ux_socket_connect("/socket");
//risky, what if something is listening on :123, or localhost isnt 127.0.0.1?
@@ -67,50 +95,87 @@ test_connect_correct_socket(void){
//char *socketName = "Random_Socket_Name";
//int length = strlen(socketName);
+ return;
}
void
-test_write_all(void){
+test_write_all(void)
+{
int fd = ux_socket_connect("/socket");
- TEST_ASSERT_TRUE(isGE(fd,0));
+
+ TEST_ASSERT_TRUE(isGE(fd, 0));
+
char * str = "TEST123";
int temp = write_all(fd, str,strlen(str));
- TEST_ASSERT_EQUAL(strlen(str),temp);
+ TEST_ASSERT_EQUAL(strlen(str), temp);
+
+ (void)close(fd);
+ return;
}
void
-test_send_packet(void){
+test_send_packet(void)
+{
int fd = ux_socket_connect("/socket");
+
+ TEST_ASSERT_TRUE(isGE(fd, 0));
+
char * str2 = "PACKET12345";
int temp = send_packet(fd, str2, strlen(str2));
+
TEST_ASSERT_EQUAL(0,temp);
+
+ (void)close(fd);
+ return;
}
+/*
+** HMS: What's going on here?
+** Looks like this needs more work.
+*/
void
-test_recv_packet(void){
+test_recv_packet(void)
+{
int fd = ux_socket_connect("/socket");
- int size = 256;
- char str[size];
+ TEST_ASSERT_TRUE(isGE(fd, 0));
+
+ uint32_t size = 256;
+ char *str = NULL;
int temp = recv_packet(fd, &str, &size);
+
send_packet(fd, str, strlen(str));
+ free(str);
TEST_ASSERT_EQUAL(0,temp); //0 because nobody sent us anything (yet!)
+
+ (void)close(fd);
+ return;
}
void
-test_send_via_ntp_signd(){
-
+test_send_via_ntp_signd(void)
+{
struct recvbuf *rbufp = (struct recvbuf *) malloc(sizeof(struct recvbuf));
int xmode = 1;
keyid_t xkeyid = 12345;
- int flags =0;
+ int flags = 0;
struct pkt *xpkt = (struct pkt *) malloc(sizeof(struct pkt)); //defined in ntp.h
+ TEST_ASSERT_NOT_NULL(rbufp);
+ TEST_ASSERT_NOT_NULL(xpkt);
+ memset(xpkt, 0, sizeof(struct pkt));
+
//send_via_ntp_signd(NULL,NULL,NULL,NULL,NULL); //doesn't work
+ /*
+ ** Send the xpkt to Samba, read the response back in rbufp
+ */
send_via_ntp_signd(rbufp,xmode,xkeyid,flags,xpkt);
+ free(rbufp);
+ free(xpkt);
+ return;
}
diff --git a/contrib/ntp/tests/sandbox/run-uglydate.c b/contrib/ntp/tests/sandbox/run-uglydate.c
index e65cd01..5a5a716 100644
--- a/contrib/ntp/tests/sandbox/run-uglydate.c
+++ b/contrib/ntp/tests/sandbox/run-uglydate.c
@@ -24,6 +24,7 @@
#include <stdio.h>
#include "config.h"
#include "ntp_fp.h"
+#include "ntp_stdlib.h"
//=======External Functions This Runner Calls=====
extern void setUp(void);
@@ -47,7 +48,7 @@ int main(int argc, char *argv[])
{
progname = argv[0];
UnityBegin("uglydate.c");
- RUN_TEST(test_ConstantDateTime, 9);
+ RUN_TEST(test_ConstantDateTime, 10);
return (UnityEnd());
}
diff --git a/contrib/ntp/tests/sandbox/smeartest.c b/contrib/ntp/tests/sandbox/smeartest.c
index a8ee210..cc4e503 100644
--- a/contrib/ntp/tests/sandbox/smeartest.c
+++ b/contrib/ntp/tests/sandbox/smeartest.c
@@ -2,6 +2,7 @@
#include <ntp.h>
#include <ntp_fp.h>
+#include <ntp_assert.h>
/*
* we want to test a refid format of:
@@ -125,11 +126,14 @@ ltor(l_fp l)
}
+int
main()
{
l_fp l;
int rc;
+ init_lib();
+
rtol(0xfe800000);
rtol(0xfe800001);
rtol(0xfe8ffffe);
@@ -167,6 +171,8 @@ main()
rtoltor(0xfe7fffff);
rc = atolfp("-.932087", &l);
+ INSIST(1 == rc);
+
ltor(l);
rtol(0xfec458b0);
printf("%x -> %d.%d.%d.%d\n",
diff --git a/contrib/ntp/tests/sandbox/uglydate.c b/contrib/ntp/tests/sandbox/uglydate.c
index a7879c1..ba8377e 100644
--- a/contrib/ntp/tests/sandbox/uglydate.c
+++ b/contrib/ntp/tests/sandbox/uglydate.c
@@ -2,15 +2,30 @@
#include "ntp_fp.h"
#include "unity.h"
-//#include "ntp_stdlib.h"
+#include "ntp_stdlib.h"
+
//#include "libntptest.h"
+void setUp(void);
+void test_ConstantDateTime(void);
+
+
+void
+setUp(void)
+{
+ init_lib();
+
+ return;
+}
+
+
void
-test_ConstantDateTime(void) {
+test_ConstantDateTime(void)
+{
const u_int32 HALF = 2147483648UL;
- l_fp time = {3485080800UL, HALF}; // 2010-06-09 14:00:00.5
+ l_fp e_time = {{3485080800UL}, HALF}; // 2010-06-09 14:00:00.5
TEST_ASSERT_EQUAL_STRING("3485080800.500000 10:159:14:00:00.500",
- uglydate(&time));
+ uglydate(&e_time));
}
diff --git a/contrib/ntp/tests/sec-2853/sec-2853.c b/contrib/ntp/tests/sec-2853/sec-2853.c
index 49589d2..f9255b0 100644
--- a/contrib/ntp/tests/sec-2853/sec-2853.c
+++ b/contrib/ntp/tests/sec-2853/sec-2853.c
@@ -13,7 +13,7 @@ int embedded_nul( void );
int trailing_space( void );
static int verbose = 1; // if not 0, also print results if test passed
-static int exit_on_err = 0; // if not 0, exit if test failed
+// static int exit_on_err = 0; // if not 0, exit if test failed
void setUp(void)
@@ -49,7 +49,6 @@ int basic_good( void )
{
const char string[] = "good";
const char *EOstring;
- char *cp;
size_t len;
int failed;
@@ -60,9 +59,9 @@ int basic_good( void )
failed = ( 4 != len );
if ( failed || verbose )
- printf( "remoteconfig_cmdlength(\"%s\") returned %d, expected %d: %s\n",
+ printf( "remoteconfig_cmdlength(\"%s\") returned %llu, expected %u: %s\n",
string,
- len,
+ (unsigned long long)len,
4,
failed ? "NO <<" : "yes" );
@@ -74,7 +73,6 @@ int embedded_nul( void )
{
const char string[] = "nul\0 there";
const char *EOstring;
- char *cp;
size_t len;
int failed;
@@ -85,9 +83,9 @@ int embedded_nul( void )
failed = ( 3 != len );
if ( failed || verbose )
- printf( "remoteconfig_cmdlength(\"%s\") returned %d, expected %d: %s\n",
+ printf( "remoteconfig_cmdlength(\"%s\") returned %llu, expected %u: %s\n",
string,
- len,
+ (unsigned long long)len,
3,
failed ? "NO <<" : "yes" );
@@ -99,7 +97,6 @@ int trailing_space( void )
{
const char string[] = "trailing space ";
const char *EOstring;
- char *cp;
size_t len;
int failed;
@@ -110,9 +107,9 @@ int trailing_space( void )
failed = ( 14 != len );
if ( failed || verbose )
- printf( "remoteconfig_cmdlength(\"%s\") returned %d, expected %d: %s\n",
+ printf( "remoteconfig_cmdlength(\"%s\") returned %llu, expected %u: %s\n",
string,
- len,
+ (unsigned long long)len,
14,
failed ? "NO <<" : "yes" );
diff --git a/contrib/ntp/util/invoke-ntp-keygen.texi b/contrib/ntp/util/invoke-ntp-keygen.texi
index eafcb43..36a1a42 100644
--- a/contrib/ntp/util/invoke-ntp-keygen.texi
+++ b/contrib/ntp/util/invoke-ntp-keygen.texi
@@ -6,7 +6,7 @@
#
# EDIT THIS FILE WITH CAUTION (invoke-ntp-keygen.texi)
#
-# It has been AutoGen-ed October 21, 2015 at 12:40:07 PM by AutoGen 5.18.5
+# It has been AutoGen-ed January 7, 2016 at 11:32:40 PM by AutoGen 5.18.5
# From the definitions ntp-keygen-opts.def
# and the template file agtexi-cmd.tpl
@end ignore
@@ -886,7 +886,7 @@ with a status code of 0.
@exampleindent 0
@example
-ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.8p4
+ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.8p5
Usage: ntp-keygen [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]...
Flg Arg Option-Name Description
-b Num imbits identity modulus bits
diff --git a/contrib/ntp/util/ntp-keygen-opts.c b/contrib/ntp/util/ntp-keygen-opts.c
index 1f256f9..f41bff4 100644
--- a/contrib/ntp/util/ntp-keygen-opts.c
+++ b/contrib/ntp/util/ntp-keygen-opts.c
@@ -1,7 +1,7 @@
/*
* EDIT THIS FILE WITH CAUTION (ntp-keygen-opts.c)
*
- * It has been AutoGen-ed October 21, 2015 at 12:39:50 PM by AutoGen 5.18.5
+ * It has been AutoGen-ed January 7, 2016 at 11:32:25 PM by AutoGen 5.18.5
* From the definitions ntp-keygen-opts.def
* and the template file options
*
@@ -72,7 +72,7 @@ extern FILE * option_usage_fp;
* static const strings for ntp-keygen options
*/
static char const ntp_keygen_opt_strs[2419] =
-/* 0 */ "ntp-keygen (ntp) 4.2.8p4\n"
+/* 0 */ "ntp-keygen (ntp) 4.2.8p5\n"
"Copyright (C) 1992-2015 The University of Delaware and Network Time Foundation, all rights reserved.\n"
"This is free software. It is licensed for use, modification and\n"
"redistribution under the terms of the NTP License, copies of which\n"
@@ -164,14 +164,14 @@ static char const ntp_keygen_opt_strs[2419] =
/* 2202 */ "no-load-opts\0"
/* 2215 */ "no\0"
/* 2218 */ "NTP_KEYGEN\0"
-/* 2229 */ "ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.8p4\n"
+/* 2229 */ "ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.8p5\n"
"Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]...\n\0"
/* 2343 */ "$HOME\0"
/* 2349 */ ".\0"
/* 2351 */ ".ntprc\0"
/* 2358 */ "http://bugs.ntp.org, bugs@ntp.org\0"
/* 2392 */ "\n\0"
-/* 2394 */ "ntp-keygen (ntp) 4.2.8p4";
+/* 2394 */ "ntp-keygen (ntp) 4.2.8p5";
/**
* imbits option description:
@@ -1309,7 +1309,7 @@ static void bogus_function(void) {
translate option names.
*/
/* referenced via ntp_keygenOptions.pzCopyright */
- puts(_("ntp-keygen (ntp) 4.2.8p4\n\
+ puts(_("ntp-keygen (ntp) 4.2.8p5\n\
Copyright (C) 1992-2015 The University of Delaware and Network Time Foundation, all rights reserved.\n\
This is free software. It is licensed for use, modification and\n\
redistribution under the terms of the NTP License, copies of which\n\
@@ -1408,14 +1408,14 @@ implied warranty.\n"));
puts(_("load options from a config file"));
/* referenced via ntp_keygenOptions.pzUsageTitle */
- puts(_("ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.8p4\n\
+ puts(_("ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.8p5\n\
Usage: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]...\n"));
/* referenced via ntp_keygenOptions.pzExplain */
puts(_("\n"));
/* referenced via ntp_keygenOptions.pzFullVersion */
- puts(_("ntp-keygen (ntp) 4.2.8p4"));
+ puts(_("ntp-keygen (ntp) 4.2.8p5"));
/* referenced via ntp_keygenOptions.pzFullUsage */
puts(_("<<<NOT-FOUND>>>"));
diff --git a/contrib/ntp/util/ntp-keygen-opts.h b/contrib/ntp/util/ntp-keygen-opts.h
index c88bef8..1205494 100644
--- a/contrib/ntp/util/ntp-keygen-opts.h
+++ b/contrib/ntp/util/ntp-keygen-opts.h
@@ -1,7 +1,7 @@
/*
* EDIT THIS FILE WITH CAUTION (ntp-keygen-opts.h)
*
- * It has been AutoGen-ed October 21, 2015 at 12:39:50 PM by AutoGen 5.18.5
+ * It has been AutoGen-ed January 7, 2016 at 11:32:24 PM by AutoGen 5.18.5
* From the definitions ntp-keygen-opts.def
* and the template file options
*
@@ -94,9 +94,9 @@ typedef enum {
/** count of all options for ntp-keygen */
#define OPTION_CT 26
/** ntp-keygen version */
-#define NTP_KEYGEN_VERSION "4.2.8p4"
+#define NTP_KEYGEN_VERSION "4.2.8p5"
/** Full ntp-keygen version text */
-#define NTP_KEYGEN_FULL_VERSION "ntp-keygen (ntp) 4.2.8p4"
+#define NTP_KEYGEN_FULL_VERSION "ntp-keygen (ntp) 4.2.8p5"
/**
* Interface defines for all options. Replace "n" with the UPPER_CASED
diff --git a/contrib/ntp/util/ntp-keygen.1ntp-keygenman b/contrib/ntp/util/ntp-keygen.1ntp-keygenman
index 99d9925..195e3d2 100644
--- a/contrib/ntp/util/ntp-keygen.1ntp-keygenman
+++ b/contrib/ntp/util/ntp-keygen.1ntp-keygenman
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntp-keygen 1ntp-keygenman "21 Oct 2015" "ntp (4.2.8p4)" "User Commands"
+.TH ntp-keygen 1ntp-keygenman "07 Jan 2016" "ntp (4.2.8p5)" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-r5aiQP/ag-E5aaPP)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-LNaiiw/ag-XNaahw)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:40:02 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:32:36 PM by AutoGen 5.18.5
.\" From the definitions ntp-keygen-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/util/ntp-keygen.1ntp-keygenmdoc b/contrib/ntp/util/ntp-keygen.1ntp-keygenmdoc
index 7b749fd..18c38fb 100644
--- a/contrib/ntp/util/ntp-keygen.1ntp-keygenmdoc
+++ b/contrib/ntp/util/ntp-keygen.1ntp-keygenmdoc
@@ -1,9 +1,9 @@
-.Dd October 21 2015
+.Dd January 7 2016
.Dt NTP_KEYGEN 1ntp-keygenmdoc User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntp-keygen-opts.mdoc)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:40:10 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:32:43 PM by AutoGen 5.18.5
.\" From the definitions ntp-keygen-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/contrib/ntp/util/ntp-keygen.c b/contrib/ntp/util/ntp-keygen.c
index 9568adc..ab34927 100644
--- a/contrib/ntp/util/ntp-keygen.c
+++ b/contrib/ntp/util/ntp-keygen.c
@@ -187,7 +187,7 @@ readlink(
int len
)
{
- return strlen(file);
+ return (int)strlen(file); /* assume no overflow possible */
}
/*
@@ -1957,10 +1957,10 @@ x509 (
X509_time_adj(X509_get_notAfter(cert), lifetime * SECSPERDAY, &epoch);
subj = X509_get_subject_name(cert);
X509_NAME_add_entry_by_txt(subj, "commonName", MBSTRING_ASC,
- (u_char *)name, strlen(name), -1, 0);
+ (u_char *)name, -1, -1, 0);
subj = X509_get_issuer_name(cert);
X509_NAME_add_entry_by_txt(subj, "commonName", MBSTRING_ASC,
- (u_char *)name, strlen(name), -1, 0);
+ (u_char *)name, -1, -1, 0);
if (!X509_set_pubkey(cert, pkey)) {
fprintf(stderr, "Assign certificate signing key fails\n%s\n",
ERR_error_string(ERR_get_error(), NULL));
diff --git a/contrib/ntp/util/ntp-keygen.html b/contrib/ntp/util/ntp-keygen.html
index 39d911e..f7a6073 100644
--- a/contrib/ntp/util/ntp-keygen.html
+++ b/contrib/ntp/util/ntp-keygen.html
@@ -70,7 +70,7 @@ All other files are in PEM-encoded
printable ASCII format so they can be embedded as MIME attachments in
mail to other sites.
- <p>This document applies to version 4.2.8p4 of <code>ntp-keygen</code>.
+ <p>This document applies to version 4.2.8p5 of <code>ntp-keygen</code>.
<div class="node">
<p><hr>
@@ -1085,7 +1085,7 @@ the usage text by passing it through a pager program.
used to select the program, defaulting to <span class="file">more</span>. Both will exit
with a status code of 0.
-<pre class="example">ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.8p4-sec-RC2
+<pre class="example">ntp-keygen (ntp) - Create a NTP host key - Ver. 4.2.8p4
Usage: ntp-keygen [ -&lt;flag&gt; [&lt;val&gt;] | --&lt;name&gt;[{=| }&lt;val&gt;] ]...
Flg Arg Option-Name Description
-b Num imbits identity modulus bits
diff --git a/contrib/ntp/util/ntp-keygen.man.in b/contrib/ntp/util/ntp-keygen.man.in
index a928768..c76c4df 100644
--- a/contrib/ntp/util/ntp-keygen.man.in
+++ b/contrib/ntp/util/ntp-keygen.man.in
@@ -10,11 +10,11 @@
.ds B-Font B
.ds I-Font I
.ds R-Font R
-.TH ntp-keygen @NTP_KEYGEN_MS@ "21 Oct 2015" "ntp (4.2.8p4)" "User Commands"
+.TH ntp-keygen @NTP_KEYGEN_MS@ "07 Jan 2016" "ntp (4.2.8p5)" "User Commands"
.\"
-.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-r5aiQP/ag-E5aaPP)
+.\" EDIT THIS FILE WITH CAUTION (/tmp/.ag-LNaiiw/ag-XNaahw)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:40:02 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:32:36 PM by AutoGen 5.18.5
.\" From the definitions ntp-keygen-opts.def
.\" and the template file agman-cmd.tpl
.SH NAME
diff --git a/contrib/ntp/util/ntp-keygen.mdoc.in b/contrib/ntp/util/ntp-keygen.mdoc.in
index 4d035cb..9e6675b 100644
--- a/contrib/ntp/util/ntp-keygen.mdoc.in
+++ b/contrib/ntp/util/ntp-keygen.mdoc.in
@@ -1,9 +1,9 @@
-.Dd October 21 2015
+.Dd January 7 2016
.Dt NTP_KEYGEN @NTP_KEYGEN_MS@ User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntp-keygen-opts.mdoc)
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:40:10 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:32:43 PM by AutoGen 5.18.5
.\" From the definitions ntp-keygen-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/gnu/usr.bin/binutils/ld/Makefile b/gnu/usr.bin/binutils/ld/Makefile
index 5058c0a..5bc3846 100644
--- a/gnu/usr.bin/binutils/ld/Makefile
+++ b/gnu/usr.bin/binutils/ld/Makefile
@@ -6,7 +6,8 @@ ELF_SCR_EXT= x xbn xc xd xdc xdw xn xr xs xsc xsw xu xw
.PATH: ${SRCDIR}/ld
-PROG= ld
+PROG= ld.bfd
+MAN= ld.1
SCRIPTDIR= /usr/libdata/ldscripts
SRCS+= ldcref.c \
ldctor.c \
@@ -48,7 +49,7 @@ CLEANFILES+= ldemul-list.h stringify.sed
FILES= ${LDSCRIPTS:S|^|ldscripts/|}
FILESDIR= ${SCRIPTDIR}
-LINKS= ${BINDIR}/ld ${BINDIR}/ld.bfd
+LINKS= ${BINDIR}/ld.bfd ${BINDIR}/ld
HOST= ${TARGET_TUPLE}
LIBSEARCHPATH= \"=/lib\":\"=/usr/lib\"
diff --git a/lib/libdpv/util.h b/lib/libdpv/util.h
index 7bb3b18..d746cb6 100644
--- a/lib/libdpv/util.h
+++ b/lib/libdpv/util.h
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2013-2014 Devin Teske <dteske@FreeBSD.org>
+ * Copyright (c) 2013-2016 Devin Teske <dteske@FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -41,7 +41,7 @@
#define PATH_SHELL "/bin/sh"
#endif
-#define CMDBUFMAX 4096
+#define CMDBUFMAX 65536
__BEGIN_DECLS
int shell_spawn_pipecmd(const char *_cmd, const char *_label, pid_t *_pid);
diff --git a/lib/libmd/Makefile.depend b/lib/libmd/Makefile.depend
index 00038a0..e3acaaf 100644
--- a/lib/libmd/Makefile.depend
+++ b/lib/libmd/Makefile.depend
@@ -33,6 +33,9 @@ sha1hl.po: sha1hl.c
sha256hl.So: sha256hl.c
sha256hl.o: sha256hl.c
sha256hl.po: sha256hl.c
+sha384hl.So: sha384hl.c
+sha384hl.o: sha384hl.c
+sha384hl.po: sha384hl.c
sha512hl.So: sha512hl.c
sha512hl.o: sha512hl.c
sha512hl.po: sha512hl.c
diff --git a/lib/libstand/Makefile b/lib/libstand/Makefile
index 9740d29..bce0b07 100644
--- a/lib/libstand/Makefile
+++ b/lib/libstand/Makefile
@@ -17,7 +17,7 @@ LIBC_SRC= ${LIBSTAND_SRC}/../libc
LIB= stand
NO_PIC=
-INCS= stand.h
+INCS?= stand.h
MAN?= libstand.3
WARNS?= 0
diff --git a/lib/libsysdecode/Makefile.depend b/lib/libsysdecode/Makefile.depend
new file mode 100644
index 0000000..653f526
--- /dev/null
+++ b/lib/libsysdecode/Makefile.depend
@@ -0,0 +1,22 @@
+# $FreeBSD$
+# Autogenerated - do NOT edit!
+
+DIRDEPS = \
+ gnu/lib/csu \
+ gnu/lib/libgcc \
+ include \
+ include/rpc \
+ include/xlocale \
+ lib/${CSU_DIR} \
+ lib/libc \
+ lib/libcompiler_rt \
+
+
+.include <dirdeps.mk>
+
+.if ${DEP_RELDIR} == ${_DEP_RELDIR}
+# local dependencies - needed for -jN in clean tree
+ioctl.So: ioctl.c
+ioctl.o: ioctl.c
+ioctl.po: ioctl.c
+.endif
diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c
index 424f2ea..ad5d359 100644
--- a/libexec/rtld-elf/rtld.c
+++ b/libexec/rtld-elf/rtld.c
@@ -1144,13 +1144,13 @@ digest_dynamic1(Obj_Entry *obj, int early, const Elf_Dyn **dyn_rpath,
* is mapped read-only. DT_MIPS_RLD_MAP is used instead.
*/
+#ifndef __mips__
case DT_DEBUG:
- if (!obj->writable_dynamic)
- break;
if (!early)
dbg("Filling in DT_DEBUG entry");
((Elf_Dyn*)dynp)->d_un.d_ptr = (Elf_Addr) &r_debug;
break;
+#endif
case DT_FLAGS:
if (dynp->d_un.d_val & DF_ORIGIN)
@@ -1331,8 +1331,6 @@ digest_phdr(const Elf_Phdr *phdr, int phnum, caddr_t entry, const char *path)
break;
case PT_DYNAMIC:
- if (ph->p_flags & PROT_WRITE)
- obj->writable_dynamic = true;
obj->dynamic = (const Elf_Dyn *)(ph->p_vaddr + obj->relocbase);
break;
diff --git a/libexec/rtld-elf/rtld.h b/libexec/rtld-elf/rtld.h
index f151db0..72a632e 100644
--- a/libexec/rtld-elf/rtld.h
+++ b/libexec/rtld-elf/rtld.h
@@ -264,7 +264,6 @@ typedef struct Struct_Obj_Entry {
bool valid_hash_sysv : 1; /* A valid System V hash hash tag is available */
bool valid_hash_gnu : 1; /* A valid GNU hash tag is available */
bool dlopened : 1; /* dlopen()-ed (vs. load statically) */
- bool writable_dynamic : 1; /* PT_DYNAMIC is writable */
struct link_map linkmap; /* For GDB and dlinfo() */
Objlist dldags; /* Object belongs to these dlopened DAGs (%) */
diff --git a/sbin/geom/class/eli/Makefile b/sbin/geom/class/eli/Makefile
index 50de651..5eff32c 100644
--- a/sbin/geom/class/eli/Makefile
+++ b/sbin/geom/class/eli/Makefile
@@ -4,6 +4,7 @@
GEOM_CLASS= eli
SRCS= g_eli_crypto.c
+SRCS+= g_eli_hmac.c
SRCS+= g_eli_key.c
SRCS+= pkcs5v2.c
SRCS+= sha256c.c
diff --git a/share/man/man4/ioat.4 b/share/man/man4/ioat.4
index 59e17e6..10f2663 100644
--- a/share/man/man4/ioat.4
+++ b/share/man/man4/ioat.4
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd January 5, 2016
+.Dd January 7, 2016
.Dt IOAT 4
.Os
.Sh NAME
@@ -73,6 +73,8 @@ In
.Fn ioat_get_max_coalesce_period "bus_dmaengine_t dmaengine"
.Ft void
.Fn ioat_acquire "bus_dmaengine_t dmaengine"
+.Ft int
+.Fn ioat_acquire_reserve "bus_dmaengine_t dmaengine" "uint32_t n" "int mflags"
.Ft void
.Fn ioat_release "bus_dmaengine_t dmaengine"
.Ft struct bus_dmadesc *
@@ -178,6 +180,14 @@ When the user wants to offload a copy, they will first
the
.Ar bus_dmaengine_t
object for exclusive access to enqueue operations on that channel.
+Optionally, the user can reserve space by using
+.Fn ioat_acquire_reserve
+instead.
+If
+.Fn ioat_acquire_reserve
+succeeds, there is guaranteed to be room for
+.Fa N
+new operations in the internal ring buffer.
Then, they will submit one or more operations using
.Fn ioat_blockfill ,
.Fn ioat_copy ,
diff --git a/share/man/man4/nvme.4 b/share/man/man4/nvme.4
index 068b006..83ca8ae 100644
--- a/share/man/man4/nvme.4
+++ b/share/man/man4/nvme.4
@@ -1,5 +1,5 @@
.\"
-.\" Copyright (c) 2012-2014 Intel Corporation
+.\" Copyright (c) 2012-2016 Intel Corporation
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
@@ -33,7 +33,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd March 18, 2014
+.Dd January 7, 2016
.Dt NVME 4
.Os
.Sh NAME
@@ -89,7 +89,10 @@ not 0, and this driver follows that convention.
By default,
.Nm
will create an I/O queue pair for each CPU, provided enough MSI-X vectors
-can be allocated.
+and NVMe queue pairs can be allocated. If not enough vectors or queue
+pairs are available, nvme(4) will use a smaller number of queue pairs and
+assign multiple CPUs per queue pair.
+.Pp
To force a single I/O queue pair shared by all CPUs, set the following
tunable value in
.Xr loader.conf 5 :
@@ -97,6 +100,13 @@ tunable value in
hw.nvme.per_cpu_io_queues=0
.Ed
.Pp
+To assign more than one CPU per I/O queue pair, thereby reducing the number
+of MSI-X vectors consumed by the device, set the following tunable value in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+hw.nvme.min_cpus_per_ioq=X
+.Ed
+.Pp
To force legacy interrupts for all
.Nm
driver instances, set the following tunable value in
@@ -109,6 +119,8 @@ Note that use of INTx implies disabling of per-CPU I/O queue pairs.
.Sh SYSCTL VARIABLES
The following controller-level sysctls are currently implemented:
.Bl -tag -width indent
+.It Va dev.nvme.0.num_cpus_per_ioq
+(R) Number of CPUs associated with each I/O queue pair.
.It Va dev.nvme.0.int_coal_time
(R/W) Interrupt coalescing timer period in microseconds.
Set to 0 to disable.
diff --git a/share/man/man7/ascii.7 b/share/man/man7/ascii.7
index a9c75ad..aa02af9 100644
--- a/share/man/man7/ascii.7
+++ b/share/man/man7/ascii.7
@@ -28,7 +28,7 @@
.\" @(#)ascii.7 8.1 (Berkeley) 6/5/93
.\" $FreeBSD$
.\"
-.Dd June 5, 1993
+.Dd January 6, 2016
.Dt ASCII 7
.Os
.Sh NAME
@@ -42,7 +42,7 @@ The
set:
.Bd -literal -offset left
000 NUL 001 SOH 002 STX 003 ETX 004 EOT 005 ENQ 006 ACK 007 BEL
-010 BS 011 HT 012 NL 013 VT 014 NP 015 CR 016 SO 017 SI
+010 BS 011 HT 012 LF 013 VT 014 FF 015 CR 016 SO 017 SI
020 DLE 021 DC1 022 DC2 023 DC3 024 DC4 025 NAK 026 SYN 027 ETB
030 CAN 031 EM 032 SUB 033 ESC 034 FS 035 GS 036 RS 037 US
040 SP 041 ! 042 " 043 # 044 $ 045 % 046 & 047 '
@@ -64,7 +64,7 @@ The
set:
.Bd -literal -offset left
00 NUL 01 SOH 02 STX 03 ETX 04 EOT 05 ENQ 06 ACK 07 BEL
-08 BS 09 HT 0A NL 0B VT 0C NP 0D CR 0E SO 0F SI
+08 BS 09 HT 0A LF 0B VT 0C FF 0D CR 0E SO 0F SI
10 DLE 11 DC1 12 DC2 13 DC3 14 DC4 15 NAK 16 SYN 17 ETB
18 CAN 19 EM 1A SUB 1B ESC 1C FS 1D GS 1E RS 1F US
20 SP 21 ! 22 " 23 # 24 $ 25 % 26 & 27 '
@@ -86,7 +86,7 @@ The
set:
.Bd -literal -offset left
0 NUL 1 SOH 2 STX 3 ETX 4 EOT 5 ENQ 6 ACK 7 BEL
- 8 BS 9 HT 10 NL 11 VT 12 NP 13 CR 14 SO 15 SI
+ 8 BS 9 HT 10 LF 11 VT 12 FF 13 CR 14 SO 15 SI
16 DLE 17 DC1 18 DC2 19 DC3 20 DC4 21 NAK 22 SYN 23 ETB
24 CAN 25 EM 26 SUB 27 ESC 28 FS 29 GS 30 RS 31 US
32 SP 33 ! 34 " 35 # 36 $ 37 % 38 & 39 '
diff --git a/share/man/man9/DEVICE_PROBE.9 b/share/man/man9/DEVICE_PROBE.9
index 86b8339..5fef21f 100644
--- a/share/man/man9/DEVICE_PROBE.9
+++ b/share/man/man9/DEVICE_PROBE.9
@@ -100,7 +100,8 @@ This is for source or binary drivers that are not yet integrated into the
tree.
Its use in the base OS is prohibited.
.It BUS_PROBE_DEFAULT
-The device is a normal device matching some plug and play ID. This is
+The device is a normal device matching some plug and play ID.
+This is
the normal return value for drivers to use.
It is intended that nearly all of the drivers in the tree should return
this value.
diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile
index 3cd6f7f..def2936 100644
--- a/share/man/man9/Makefile
+++ b/share/man/man9/Makefile
@@ -1013,7 +1013,8 @@ MLINKS+=make_dev.9 destroy_dev.9 \
make_dev.9 make_dev_alias_p.9 \
make_dev.9 make_dev_cred.9 \
make_dev.9 make_dev_credf.9 \
- make_dev.9 make_dev_p.9
+ make_dev.9 make_dev_p.9 \
+ make_dev.9 make_dev_s.9
MLINKS+=malloc.9 free.9 \
malloc.9 MALLOC_DECLARE.9 \
malloc.9 MALLOC_DEFINE.9 \
diff --git a/share/man/man9/kern_testfrwk.9 b/share/man/man9/kern_testfrwk.9
index 0838c72..653cb5e 100644
--- a/share/man/man9/kern_testfrwk.9
+++ b/share/man/man9/kern_testfrwk.9
@@ -65,7 +65,6 @@ When your test loads, you register your tests with the kernel test framework.
You do that through a call to
.Fn kern_testframework_register .
Usually this is done at the module load event as shown below:
-.Pp
.Bd -literal -offset indent
switch (type) {
case MOD_LOAD:
@@ -122,7 +121,6 @@ field is a test-specific set of information that is an opaque blob.
It is passed in from user space and has a maximum size of 256 bytes.
You can pass arbitrary test input in the space.
In the case of callout_test we reshape that to:
-.Pp
.Bd -literal -offset indent
struct callout_test {
int number_of_callouts;
@@ -133,7 +131,6 @@ struct callout_test {
So the first lines of
.Fn run_callout_test
does the following to get at the user specific data:
-.Pp
.\" This is a bad example and violates strict aliasing. It should be replaced.
.Bd -literal -offset indent
struct callout_test *u;
diff --git a/share/man/man9/make_dev.9 b/share/man/man9/make_dev.9
index 78345fa..0c53e8d 100644
--- a/share/man/man9/make_dev.9
+++ b/share/man/man9/make_dev.9
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd Dec 22, 2012
+.Dd Jan 3, 2016
.Dt MAKE_DEV 9
.Os
.Sh NAME
@@ -32,6 +32,7 @@
.Nm make_dev_cred ,
.Nm make_dev_credf ,
.Nm make_dev_p ,
+.Nm make_dev_s ,
.Nm make_dev_alias ,
.Nm make_dev_alias_p ,
.Nm destroy_dev ,
@@ -45,16 +46,10 @@ and DEVFS registration for devices
.Sh SYNOPSIS
.In sys/param.h
.In sys/conf.h
-.Ft struct cdev *
-.Fn make_dev "struct cdevsw *cdevsw" "int unit" "uid_t uid" "gid_t gid" "int perms" "const char *fmt" ...
-.Ft struct cdev *
-.Fn make_dev_cred "struct cdevsw *cdevsw" "int unit" "struct ucred *cr" "uid_t uid" "gid_t gid" "int perms" "const char *fmt" ...
-.Ft struct cdev *
-.Fn make_dev_credf "int flags" "struct cdevsw *cdevsw" "int unit" "struct ucred *cr" "uid_t uid" "gid_t gid" "int perms" "const char *fmt" ...
+.Ft void
+.Fn make_dev_args_init "struct make_dev_args *args"
.Ft int
-.Fn make_dev_p "int flags" "struct cdev **cdev" "struct cdevsw *devsw" "struct ucred *cr" "uid_t uid" "gid_t gid" "int mode" "const char *fmt" ...
-.Ft struct cdev *
-.Fn make_dev_alias "struct cdev *pdev" "const char *fmt" ...
+.Fn make_dev_s "struct make_dev_args *args" "struct cdev **cdev" "const char *fmt" ...
.Ft int
.Fn make_dev_alias_p "int flags" "struct cdev **cdev" "struct cdev *pdev" "const char *fmt" ...
.Ft void
@@ -67,12 +62,26 @@ and DEVFS registration for devices
.Fn destroy_dev_drain "struct cdevsw *csw"
.Ft void
.Fn dev_depends "struct cdev *pdev" "struct cdev *cdev"
+.Pp
+LEGACY INTERFACES
+.Ft struct cdev *
+.Fn make_dev "struct cdevsw *cdevsw" "int unit" "uid_t uid" "gid_t gid" "int perms" "const char *fmt" ...
+.Ft struct cdev *
+.Fn make_dev_cred "struct cdevsw *cdevsw" "int unit" "struct ucred *cr" "uid_t uid" "gid_t gid" "int perms" "const char *fmt" ...
+.Ft struct cdev *
+.Fn make_dev_credf "int flags" "struct cdevsw *cdevsw" "int unit" "struct ucred *cr" "uid_t uid" "gid_t gid" "int perms" "const char *fmt" ...
+.Ft int
+.Fn make_dev_p "int flags" "struct cdev **cdev" "struct cdevsw *devsw" "struct ucred *cr" "uid_t uid" "gid_t gid" "int mode" "const char *fmt" ...
+.Ft struct cdev *
+.Fn make_dev_alias "struct cdev *pdev" "const char *fmt" ...
.Sh DESCRIPTION
The
-.Fn make_dev_credf
+.Fn make_dev_s
function creates a
.Fa cdev
-structure for a new device.
+structure for a new device, which is returned into the
+.Fa cdev
+argument.
It also notifies
.Xr devfs 5
of the presence of the new device, that causes corresponding nodes
@@ -80,10 +89,34 @@ to be created.
Besides this, a
.Xr devctl 4
notification is sent.
-The device will be owned by
-.Va uid ,
+The function takes the structure
+.Va struct make_dev_args args ,
+which specifies the parameters for the device creation:
+.Pp
+.Bd -literal -offset indent -compact
+struct make_dev_args {
+ size_t mda_size;
+ int mda_flags;
+ struct cdevsw *mda_devsw;
+ struct ucred *mda_cr;
+ uid_t mda_uid;
+ gid_t mda_gid;
+ int mda_mode;
+ int mda_unit;
+ void *mda_si_drv1;
+ void *mda_si_drv2;
+};
+.Ed
+Before use and filling with the desired values, the structure must be
+initialized by the
+.Fn make_dev_args_init
+function, which ensures that future kernel interface expansion does
+not affect driver source code or binary interface.
+.Pp
+The created device will be owned by
+.Va args.mda_uid ,
with the group ownership as
-.Va gid .
+.Va args.mda_gid .
The name is the expansion of
.Va fmt
and following arguments as
@@ -97,7 +130,7 @@ mount point and may contain slash
.Ql /
characters to denote subdirectories.
The permissions of the file specified in
-.Va perms
+.Va args.mda_mode
are defined in
.In sys/stat.h :
.Pp
@@ -126,29 +159,28 @@ are defined in
.Ed
.Pp
The
-.Va cr
+.Va args.mda_cr
argument specifies credentials that will be stored in the
.Fa si_cred
member of the initialized
.Fa struct cdev .
+.Pp
The
-.Va flags
+.Va args.mda_flags
argument alters the operation of
-.Fn make_dev_credf
-or
-.Fn make_dev_p .
+.Fn make_dev_s.
The following values are currently accepted:
.Pp
-.Bl -tag -width "MAKEDEV_CHECKNAME" -compact -offset indent
-.It MAKEDEV_REF
+.Bl -tag -width "It Dv MAKEDEV_CHECKNAME" -compact -offset indent
+.It Dv MAKEDEV_REF
reference the created device
-.It MAKEDEV_NOWAIT
+.It Dv MAKEDEV_NOWAIT
do not sleep, the call may fail
-.It MAKEDEV_WAITOK
+.It Dv MAKEDEV_WAITOK
allow the function to sleep to satisfy malloc
-.It MAKEDEV_ETERNAL
+.It Dv MAKEDEV_ETERNAL
created device will be never destroyed
-.It MAKEDEV_CHECKNAME
+.It Dv MAKEDEV_CHECKNAME
return an error if the device name is invalid or already exists
.El
.Pp
@@ -189,10 +221,49 @@ For the convenience, use the
flag for the code that can be compiled into kernel or loaded
(and unloaded) as loadable module.
.Pp
-A panic will occur if the MAKEDEV_CHECKNAME flag is not specified
+A panic will occur if the
+.Dv MAKEDEV_CHECKNAME
+flag is not specified
and the device name is invalid or already exists.
.Pp
The
+.Fn make_dev_p
+use of the form
+.Bd -literal -offset indent
+struct cdev *dev;
+int res;
+res = make_dev_p(flags, &dev, cdevsw, cred, uid, gid, perms, name);
+.Ed
+is equivalent to the code
+.Bd -literal -offset indent
+struct cdev *dev;
+struct make_dev_args args;
+int res;
+
+make_dev_args_init(&args);
+args.mda_flags = flags;
+args.mda_devsw = cdevsw;
+args.mda_cred = cred;
+args.mda_uid = uid;
+args.mda_gid = gid;
+args.mda_mode = perms;
+res = make_dev_s(&args, &dev, name);
+.Ed
+.Pp
+Similarly, the
+.Fn make_dev_credf
+function call is equivalent to
+.Bd -literal -offset indent
+ (void) make_dev_s(&args, &dev, name);
+.Ed
+In other words,
+.Fn make_dev_credf
+does not allow the caller to obtain the return value, and in
+kernels compiled with the
+.Va INVARIANTS
+options, the function asserts that the device creation succeeded.
+.Pp
+The
.Fn make_dev_cred
function is equivalent to the call
.Bd -literal -offset indent
@@ -207,45 +278,55 @@ make_dev_credf(0, cdevsw, unit, NULL, uid, gid, perms, fmt, ...);
.Ed
.Pp
The
-.Fn make_dev_p
-function is similar to
-.Fn make_dev_credf
-but it may return an error number and takes a pointer to the resulting
-.Ft *cdev
-as an argument.
-.Pp
-The
-.Fn make_dev_alias
+.Fn make_dev_alias_p
function takes the returned
.Ft cdev
from
.Fn make_dev
and makes another (aliased) name for this device.
It is an error to call
-.Fn make_dev_alias
+.Fn make_dev_alias_p
prior to calling
.Fn make_dev .
.Pp
-.Fn make_dev_alias_p
+The
+.Fn make_dev_alias
function is similar to
.Fn make_dev_alias
-but it takes a pointer to the resulting
+but it returns the resulting aliasing
.Ft *cdev
-as an argument and may return an error.
+and may not return an error.
.Pp
The
.Fa cdev
returned by
-.Fn make_dev
+.Fn make_dev_s
and
-.Fn make_dev_alias
+.Fn make_dev_alias_p
has two fields,
.Fa si_drv1
and
.Fa si_drv2 ,
that are available to store state.
Both fields are of type
-.Ft void * .
+.Ft void * ,
+and can be initialized simultaneously with the
+.Va cdev
+allocation by filling
+.Va args.mda_si_drv1
+and
+.Va args.mda_si_drv2
+members of the
+.Fn make_dev_s
+argument structure, or filled after the
+.Va cdev
+is allocated, if using legacy interfaces.
+In the latter case, the driver should handle the race of
+accessing uninitialized
+.Va si_drv1
+and
+.Va si_drv2
+itself.
These are designed to replace the
.Fa unit
argument to
@@ -331,8 +412,10 @@ unload until
is actually finished for all of them.
.Sh RETURN VALUES
If successful,
+.Fn make_dev_s
+and
.Fn make_dev_p
-will return 0, otherwise it will return an error.
+will return 0, otherwise they will return an error.
If successful,
.Fn make_dev_credf
will return a valid
@@ -341,10 +424,11 @@ pointer, otherwise it will return
.Dv NULL .
.Sh ERRORS
The
+.Fn make_dev_s ,
.Fn make_dev_p
and
.Fn make_dev_alias_p
-call will fail and the device will be not registered if:
+calls will fail and the device will be not registered if:
.Bl -tag -width Er
.It Bq Er ENOMEM
The
@@ -403,3 +487,7 @@ The function
.Fn make_dev_p
first appeared in
.Fx 8.2 .
+The function
+.Fn make_dev_s
+first appeared in
+.Fx 11.0 .
diff --git a/share/man/man9/malloc.9 b/share/man/man9/malloc.9
index eec2c86..81d40dc 100644
--- a/share/man/man9/malloc.9
+++ b/share/man/man9/malloc.9
@@ -229,7 +229,7 @@ may sleep when called with
never sleeps.
However,
.Fn malloc ,
-.Fn realloc,
+.Fn realloc ,
.Fn reallocf
and
.Fn free
diff --git a/share/man/man9/timeout.9 b/share/man/man9/timeout.9
index 58905bc..3f5b4dc 100644
--- a/share/man/man9/timeout.9
+++ b/share/man/man9/timeout.9
@@ -261,7 +261,7 @@ returns zero it will arrange for the function
.Fa drain
to be called using the same argument given to the
.Fn callout_reset
-function.
+function.
.Fn callout_async_drain
If the callout has an associated lock,
then that lock must be held when this function is called.
diff --git a/share/misc/ascii b/share/misc/ascii
index b7bcef5..2a71a43 100644
--- a/share/misc/ascii
+++ b/share/misc/ascii
@@ -1,5 +1,5 @@
|000 nul|001 soh|002 stx|003 etx|004 eot|005 enq|006 ack|007 bel|
-|010 bs |011 ht |012 nl |013 vt |014 np |015 cr |016 so |017 si |
+|010 bs |011 ht |012 lf |013 vt |014 ff |015 cr |016 so |017 si |
|020 dle|021 dc1|022 dc2|023 dc3|024 dc4|025 nak|026 syn|027 etb|
|030 can|031 em |032 sub|033 esc|034 fs |035 gs |036 rs |037 us |
|040 sp |041 ! |042 " |043 # |044 $ |045 % |046 & |047 ' |
@@ -16,7 +16,7 @@
|170 x |171 y |172 z |173 { |174 | |175 } |176 ~ |177 del|
| 00 nul| 01 soh| 02 stx| 03 etx| 04 eot| 05 enq| 06 ack| 07 bel|
-| 08 bs | 09 ht | 0a nl | 0b vt | 0c np | 0d cr | 0e so | 0f si |
+| 08 bs | 09 ht | 0a lf | 0b vt | 0c ff | 0d cr | 0e so | 0f si |
| 10 dle| 11 dc1| 12 dc2| 13 dc3| 14 dc4| 15 nak| 16 syn| 17 etb|
| 18 can| 19 em | 1a sub| 1b esc| 1c fs | 1d gs | 1e rs | 1f us |
| 20 sp | 21 ! | 22 " | 23 # | 24 $ | 25 % | 26 & | 27 ' |
@@ -33,7 +33,7 @@
| 78 x | 79 y | 7a z | 7b { | 7c | | 7d } | 7e ~ | 7f del|
| 0 nul| 1 soh| 2 stx| 3 etx| 4 eot| 5 enq| 6 ack| 7 bel|
-| 8 bs | 9 ht | 10 nl | 11 vt | 12 np | 13 cr | 14 so | 15 si |
+| 8 bs | 9 ht | 10 lf | 11 vt | 12 ff | 13 cr | 14 so | 15 si |
| 16 dle| 17 dc1| 18 dc2| 19 dc3| 20 dc4| 21 nak| 22 syn| 23 etb|
| 24 can| 25 em | 26 sub| 27 esc| 28 fs | 29 gs | 30 rs | 31 us |
| 32 sp | 33 ! | 34 " | 35 # | 36 $ | 37 % | 38 & | 39 ' |
diff --git a/sys/amd64/include/metadata.h b/sys/amd64/include/metadata.h
index e13eba0..98d0272 100644
--- a/sys/amd64/include/metadata.h
+++ b/sys/amd64/include/metadata.h
@@ -1,57 +1,6 @@
/*-
- * Copyright (c) 2003 Peter Wemm <peter@FreeBSD.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
+ * This file is in the public domain.
*/
+/* $FreeBSD$ */
-#ifndef _MACHINE_METADATA_H_
-#define _MACHINE_METADATA_H_
-
-#define MODINFOMD_SMAP 0x1001
-#define MODINFOMD_SMAP_XATTR 0x1002
-#define MODINFOMD_DTBP 0x1003
-#define MODINFOMD_EFI_MAP 0x1004
-#define MODINFOMD_EFI_FB 0x1005
-#define MODINFOMD_MODULEP 0x1006
-
-struct efi_map_header {
- uint64_t memory_size;
- uint64_t descriptor_size;
- uint32_t descriptor_version;
-};
-
-struct efi_fb {
- uint64_t fb_addr;
- uint64_t fb_size;
- uint32_t fb_height;
- uint32_t fb_width;
- uint32_t fb_stride;
- uint32_t fb_mask_red;
- uint32_t fb_mask_green;
- uint32_t fb_mask_blue;
- uint32_t fb_mask_reserved;
-};
-
-#endif /* !_MACHINE_METADATA_H_ */
+#include <x86/metadata.h>
diff --git a/sys/arm/arm/db_interface.c b/sys/arm/arm/db_interface.c
index 25d1706..4383146 100644
--- a/sys/arm/arm/db_interface.c
+++ b/sys/arm/arm/db_interface.c
@@ -152,6 +152,10 @@ int db_frame(struct db_variable *vp, db_expr_t *valp, int rw)
void
db_show_mdpcpu(struct pcpu *pc)
{
+
+#if __ARM_ARCH >= 6
+ db_printf("curpmap = %p\n", pc->pc_curpmap);
+#endif
}
int
db_validate_address(vm_offset_t addr)
diff --git a/sys/boot/efi/boot1/Makefile b/sys/boot/efi/boot1/Makefile
index c1b3714..3642314 100644
--- a/sys/boot/efi/boot1/Makefile
+++ b/sys/boot/efi/boot1/Makefile
@@ -79,8 +79,15 @@ boot1.o: ${.CURDIR}/../../common/ufsread.c
# created by generate-fat.sh
.include "${.CURDIR}/Makefile.fat"
+BOOT1_MAXSIZE?= 131072
boot1.efifat: boot1.efi
+ @set -- `ls -l boot1.efi`; \
+ x=$$(($$5-${BOOT1_MAXSIZE})); \
+ if [ $$x -ge 0 ]; then \
+ echo "boot1 $$x bytes too large; regenerate FAT templates?" >&2 ;\
+ exit 1; \
+ fi
echo ${.OBJDIR}
uudecode ${.CURDIR}/fat-${MACHINE}.tmpl.bz2.uu
mv fat-${MACHINE}.tmpl.bz2 ${.TARGET}.bz2
diff --git a/sys/boot/efi/boot1/fat-amd64.tmpl.bz2.uu b/sys/boot/efi/boot1/fat-amd64.tmpl.bz2.uu
index d8a44b7..85a4b0f 100644
--- a/sys/boot/efi/boot1/fat-amd64.tmpl.bz2.uu
+++ b/sys/boot/efi/boot1/fat-amd64.tmpl.bz2.uu
@@ -2,19 +2,25 @@ FAT template boot filesystem created by generate-fat.sh
DO NOT EDIT
$FreeBSD$
begin 644 fat-amd64.tmpl.bz2
-M0EIH.3%!629362AK*D(`&I+____[ZZKJZ_^N_ZO^Z_Z_OJ[L`4`!7I0$#&$"
-M0$!$3&(<P`(;J*C:0E0E#30&AH`T````9#0```9````#)ZF0:,-3U/409,`)
-M@`"8`C3",````$R:8F@P`C`````"24U,D>I-DTU,)ZAZ0VA-!M0T'J`>H#"9
-M'I#0-H&HQI&0&3&FH>H>*`JHHU3V]1%/4/2``T#0`!H``#0`````#1H,@``6
-M'1&G'&@?$6[T#A)?X8$A160"20BO#")0J4TB1*4GXF$B4I,&>43+=_?K=#3*
-M6]<E0HE`UBF?(J%8BRF#?8OQ2'D)`)(EL2;F4.'R>R"ZNKJZI,9*68E8*E2Q
-M4J5*E3'(1830A"$(12A-"<(0A#]VD)H0A"$,>I0FA"$(0I\>P^=F5:M6K5JU
-M:DI3:64UN;[7%5B]Y-^\]@_K@B:N\/,5F%&H<\G#IXQXAEFC&D?![6%0'6MR
-MX1@@%FC"FD`M7,/SXFNG:2`'-0<-C$8^+$N.7M1B,^6)9,DV9,0A\OL<:C"L
-ML1V&,<\9YRB>XV#BG")'6NKRK^("UF2XO?_L!#29">MGDF$R3).!PX&%E,4C
-M''=(FL1.`_3?CN@-IB2PI3!FF\<8X.X@D,>CA90I)#M$XRPNDFJELL<3=1?8
-M2B7\5Z64,!7Z;EEBW-MXN-4IJ@W$462]-*\YCR,-B,5[W?=3&L/U>SX,WV#\
-M\B`:I"'0Z)5"$1B.E)(K[5I4RS`%R$>Y\D0NR*,;<9CZ:^V3P(I?D<D#!UC)
-D^M-HEE3SAN-8O0FQ$(`$(DF`?ZQ]'U2F_XNY(IPH2!0UE2$`
+M0EIH.3%!62936;D*A>0`&T#_____ZZKJ[_^N_^O^Z_Z[OJ_NJ^JK^KZNKNNJ
+MZ^KNZOJ^P`+\&$`!D#0T:`80&@T#`@`-`:9`:`P"`R::```:8)II@@,FC(-&
+M$`!D,(:9`E5%&3_]*J?ZHC(--&@::#3)HQ#0`&C330,"9,F$::9!D#`F30#3
+M3)H9-&1DTR`R:,3"`&0-#1H!A`:#0,"``T!ID!H#`(#)IH``!I@FFF"`R:,@
+MT80`&0PAID!5)$)Y0@R&HQ#3U-I--,@-&0R-&@T-`&FF@9-!IIIH-&1ILHTT
+M&ADQ#-$\B;1-/2-H93$\4\34Q9ZDM*M:U49"2K6F0C'21$(GD$1$085)7RB(
+M00A7Q'^3"!"&CM$T+&UM5A49]7/"3^:EK7GMDVS9MRWK=+E>.(OG-?ZZMDA:
+MR74C/HR\T0"$,Y+,YBA.JO&6C*K-DV26*@S24I%*E-2I4J5*JH43)*%"A0H4
+M*5-"E)2E2I4J5+!RPP]&&&&&&,P(9X]&&&&&&.IMKISQPX<.'#AP@0A"$(0A
+M"$(0A"(MX]&&&&&&&$(0A"$(0(0A"$(?ME2N'#APX<.'"+EZ,,,,,,,($(0A
+M"$0>NEGIM!8-(Y6FM$:.>9*3D219:RJKD^H2><E'K)-B^-<-VW[]G'7J_835
+MV`;*SC5&G@`GJ:N1`"ME+C<;GOI5H@!F'<0==<-#$2A&BJ%];5)UFHN9,G4?
+M]G6ARV-EJBOU_NY'021>1%9\LD8<E236-:]ILVV?0M6\<%=N2Y;G.DQ&<9G;
+MYJUNKRLLL]6X.TJQ;DFP1"P)D;"2W:]/XKP9*EC5W57(SUF^DRDD9N1\+:MN
+MLGV-ZX"Y<5R'+7S`832.Y=383)I.'I9>O.X4EIVM=.HDTT1'B:J=8;[A9NLU
+M"OX%C.X>0U/WZ^E74T&IHJ3EG))(^U[S\6_?HX;B.,Y*]7SGN@PV*_(O+^9#
+M+^Q,N_S1'42+=METV+CK9;+US'.8#H,%B,9Y*RD-/)TYXB8XQHI(RLF')')<
+MI>OZ<QW[FL!T6"X+#8C:LZZ5O?(VDD<W&Y\YA<5&NDFDA@-2Z#HNDWC!83#;
+MMB/W8SIL=EC%D8\FXDOI':7&/BN`UTRVDB;11`(0E`!CSIY+M)?HOW^+N2*<
+'*$A<A4+R````
`
end
diff --git a/sys/boot/efi/boot1/fat-arm.tmpl.bz2.uu b/sys/boot/efi/boot1/fat-arm.tmpl.bz2.uu
index 15b59d8..7356bde 100644
--- a/sys/boot/efi/boot1/fat-arm.tmpl.bz2.uu
+++ b/sys/boot/efi/boot1/fat-arm.tmpl.bz2.uu
@@ -2,25 +2,24 @@ FAT template boot filesystem created by generate-fat.sh
DO NOT EDIT
$FreeBSD$
begin 644 fat-arm.tmpl.bz2
-M0EIH.3%!629365NH-?4`&T!_____ZZ[J[_ZN_ZO^J_Z[OJ_^J^J[^KZNKNNJ
-MZNKNZOJ^P`+\#$``0`&AD:,@TTTT-&C30#$R&FF1H:!B&)D&F@```-&AB::#
-M1HP0-,AD`T8F(TTP2JII&?^I5/]4`@TTT-&(T8FAB:&@T:8F(Q!@!`9,1DR9
-M`-,$:,FC)B&FC"8"#3"#(-,0`&AD:,@TTTT-&C30#$R&FF1H:!B&)D&F@```
-M-&AB::#1HP0-,AD`T8F(TTP*HI)D\DFDVC0AIIH]3(:-``80>HTTR!IH::#$
-M-`Q`:`/2:::&)IDP"/0$T:>IFD]$R8---3HUK2<PNK%<6\J]BA",-*(A%:0B
-M(B#G5%F8B$$(68C_:!`A#OL<HAB+JZ6UHRRU>*K9].C:!IWS-2UK9M<WC]W[
-M+]QW,9%V2,?<"ZEO9B("$,I.0ZFE66K/,<N6+8ITS$J3))F2I4HJ5*E2I74J
-M:$J5*E2I4JE5*I*I-2I4J5.;84I4J5*E2I6ZU4Q*E2I4J5+X<SOK,65E965D
-MT:($(0A"$(0A"$(0C>.3@8,&#!@P8(0A"$(0@0A"$(0[;_L-&C1HT:-&B+YP
-M,&#!@P8,$"$(0A"-?NW$*YY:V9IQ,:B93+AX^A7B),5HN_4JV=2\Y,:-+W'Q
-MKQKVU7KA+YR'.:*V#48N-"7<`%:TT4D`/;N;SZM9X,V(@!D'=P==+O)9*\H8
-MI8W<L9:.AU[N;G"QEHLZBWB/2B.SKCGRM):%ZK3-2U3ZV1;%MUZX:^?X_Y@N
-MM=0SN1R7Z\&PN,I8VVWKMS$1-X41%"V)-;+V9:MI5;.+M*TMZ]K7HQ-ALY1\
-M4LG)\#5/I7#7-D_1<KUPE\OW)<YEW=.GMJ%$MUF)TE9N)8[M[6LIEXF@H6?S
-MW%U89M5M+:LW6(\?7Z6I:U4F>IM*Q<2E)KFG;%M&U;INV]<)Q%^P'*<]T6R;
-M^7`P.+I+N(HA%=#(^Q0WVV0]=$2=5)>-XWKW7!95E7$<5QW)<IS6"PF@7&+H
-M&<ETI.`9F48V7/E&??ROG%<9FU^Y#E.8W+GL%]#L7+U=^CY91Q\+`K'-WPF4
-M.2S[EM@S38.8YKG.@P6_83I,-<G1DPY84N-)VMWK,/!;AIJ&3E%&7B`0A,`&
-3'65I7J6`B^?^+N2*<*$@MU!KZ@``
+M0EIH.3%!629368U&4)@`&T#_____^ZKJ[_ZN_^O^J_[[OJ_NJ^JK^KZNKN^J
+MZNKNZOJ^P`+\```"!H:-`,(#0:!@0`&@-,@-`8!`9--```-,$TTP0&31D&C"
+M``R&$-,A`T-&@&$!H-`P(`#0&F0&@,`@,FF@``&F"::8(#)HR#1A``9#"&F0
+M@:&C0#"`T&@8$`!H#3(#0&`0&330``#3!--,$!DT9!HP@`,AA#3("J**'Y%(
+M1D]&IH`]3(#0``T-`-``&@&F@#0``9``-`:-&"--!H;4T]1HPF:GJ;VW`G0L
+M;"P1EY8.%8A&4E$0BV0B(B#=7%\Q$((0OB/ZL$"$.9SBR&6QL9AX#0*.D6]>
+MGO'8M.]!X[V'QO:?6V;6L=^[<.#;YP\P:^3CD9VR(!"&?G@>`JM8+J&<8C--
+M];XRRIPJ9DN7++ERY<N8*JMB5555555RZJY*Y-RY<N7-SA*I5555559=16)5
+M55555>7SNPOB]>O7KUZ]0HHHHHHHHHHHHHHHHY&)5555555444444444****
+M***,/F?'O7KUZ]>O7J-;*JJJJJJJA1111111B\A/&6:##:%^>;:*3FK;$R_"
+M49GMN<56Z-+L4QW:7AO-:E[[YFN;)^C(;II,,-/FH[0Z.`"W`TDD`/"Q-3ZO
+ML:*<*(`<"YB#/:ER\1,(YK`,_;8S*FLEB8#_>+<MF\G$P%_BV#=RS$NU=T[Y
+MIWFO5<$^%JVN;-M&V?XWCAF*]'?M#*-K$<'PNNV5S$XG"^G58,:@EX*(9@L/
+M9EX4M2TRW1NB2P,O@TP;,QA/DD8DGDO.>FWU[;5/F:QL'WOT8[^6Z<VXABX=
+MBR7U\Y.EM9&LL8O*5M72X*(CI.RM9;Y=9C83I5_SY:U]F7ZCX=-<I=4ZFN!:
+M9J4I/=>,U3YVK?8UK[7X-H_=D-NW;>OD/OR+$,[IK&Q^A$8LFH>@V#PVR9YG
+MFT;5MG].4;EO&2ZIF9'12_Z38G,2C$ENY1LWXMH_5^S1,=D-NW#Z6[;QY[BG
+M]^GM3.Q$O,EW$F/D[:TW.P$RAD.J;=[[^WP-PW+=/];QL62_YE,0WLF5+)EC
+ER<EJ,K>OH:6QGY19C1`(0F`#*M6RUZ60C(?^+N2*<*$A&HRA,```
`
end
diff --git a/sys/boot/efi/boot1/fat-arm64.tmpl.bz2.uu b/sys/boot/efi/boot1/fat-arm64.tmpl.bz2.uu
index 031815c..e555837 100644
--- a/sys/boot/efi/boot1/fat-arm64.tmpl.bz2.uu
+++ b/sys/boot/efi/boot1/fat-arm64.tmpl.bz2.uu
@@ -2,25 +2,25 @@ FAT template boot filesystem created by generate-fat.sh
DO NOT EDIT
$FreeBSD$
begin 644 fat-arm64.tmpl.bz2
-M0EIH.3%!62936:2BH:(`&T#_____ZZKJ[_^N_ZO_J_Z[OJ_NJ^JK^KZNKNNJ
-MZNKNZOJ^P`+\```"``:`9,@T&F3$,@!B`,AIHP$#0-`T``,09--&31IH9#)D
-M,(#$T&)B!A``-`,F0:#3)B&0`Q`&0TT8"!H&@:``&(,FFC)HTT,ADR&$!B:#
-M$Q`P@`&@&3(-!IDQ#(`8@#(::,!`T#0-``#$&331DT::&0R9#"`Q-!B8@8"J
-M*0GY$I&GH"-&AZ@T```T`:`!HT```&@&@-,C0`-`#U,(-`&)ZF(PGIJ>IO;U
-M^=&QL3`-\E@Q+$(RTHB$7I"(B(-W:73$0@A#;S##$3$`A#FL\LAF,;&8;[CE
-M&D=@ON\:9IWHO):QK7LL=LFN;1M6Y:%F>-1G^&O-A*(@0AQ,\#H*KRCJF>9Q
-MFF_,RWU4X-,R6K5EJU:M6L"JMB5555555JVJU*U-JU:M6MUB*I555555;XHJ
-ME555555YM='L;(N7+ERY<N4****************.2B55555555%%%%%%%%"B
-MBBBBBC#S/DW+ERY<N7+E&NE55555550HHHHHHHS_(SQEG'X7.OTSKFY=#*]*
-M9?C*,7MM&JO=0EIDQW:7C-0U;WGRM>_!^S^F[=KA#3YJ.S-)`!>O]K)`#-ZO
-MU=9T,X(@!H',-+,1Q'-6'#ZNQORGURS=]_O%.6SF5G,PC`G#X_@7W$RC>2Q)
-M9MW3P&G:AJFA?`^AKWXOV?R_QDL9F^`=5H>$UWWT9K&Q/HS.!KXB)U)9$6,)
-M*/!EJ7>+W2L65_C\&LP69G$?'M$18.(LL.G:AZ;%>TUKYF.V+9/W9AMF[<VT
-MS/X;%DL?1SW5Y]4L]R=+RLNCTMB[6_5C8C2+?DPWF/F.G]WN[5+:G4UOWC%E
-M*3V7BO??&^=COL?:V3]&T9#<-XWKX3\,BQ#[KW01%D(X'O<#8?*B.`D]1J&O
-M>&^]HFB?J_AM6V;ANF2RG7,61I)?])L35<Y8C.RWDHV3\GZOW;-TC:MLW#<O
-MG;QDO2<6_S5;,T$1["/3W^^]&4;3*_F\:?7"90R&E;=N']O@;ENF[?ZR6Q93
-M_F6SAO9,N65+9R:#69>2^EX5C12BSAX@$(3`!EWEZ6P2R$9#_Q=R13A0D*2B
-"H:(`
+M0EIH.3%!629360E-\T``&T#_____ZZKJ[__N_^O^J_Z[OJ_NJ^JK^KZNKNNJ
+MZNKNZOJ^P`+<#$``@`-#(T9!IIIH:-&F@&)D--,C0T#$,3(--````:-#$TT&
+MC1@@:9#(!HQ,1II@E532,_]2J?ZH!!IIH:,1HQ-#$T-!HTQ,1B#`"`R8C)DR
+M`:8(T9-&3$--&$P$&F$&0:8@`-#(T9!IIIH:-&F@&)D--,C0T#$,3(--````
+M:-#$TT&C1@@:9#(!HQ,1II@511(>21,:&D:`])Z0-`T&FC30:&1D`R:!IDT:
+M#30&FC1ZFC1H::8FF3$VB,(TTT])@38C)J85-B<VNK6T&+E:6M"$8B41"*9"
+M(B(,"LLS$0@A"S$<J@0(0S-RHABKJZ6]AEEL\13YB=*T+W'R/=:]M'V-VX+>
+M+YQG-=.Q@NI[!'1T;V8B`A#*STN3J4K5GURR"X8UC&+5'4IF2M6HK5JU:M:*
+ME5"52I4J5*E:NI6E6FM6K5JU_:JDJE2I4J5,6ME42J5*E2I4^'O-]9BRLK*R
+MLFC1`A"$(0A"$(0A"$;QR<#!@P8,&#!"$(0A"$"$(0A"';?U+1HT:-&C1HB^
+M<#!@P8,&#!`A"$(0C7[MQ"N?8V[-.'W]RCNJ:$RX4HQWHVBV4YY+0IC2I>VU
+M;7-BVR]<!Q'(8#1VX:JXC1&<@`IL:.2`&/UUYK^^FTB`&3=Q!E-<[>(F$9BP
+M=730QJVW4L?8<[K';9##R%A9U.GI9677RQN6E'U1%+!E3+1M(]9JFL:Y=-DW
+M"]<)Q'^O^<]E5STS6]5E-YO[9<7=KN-9:1>$M0B%N4(U$KQIE.=8Z5C+VGUV
+ME&,M6TD7<GO-6UK&M@V;\FY;UP'$7SDL!WKN62MZ%$MUFYTM+(Q&YH49>VI5
+M2V,1&=T5*WVNYREJSRSML52\#%Y_8Z:M;5U&@JL4EQ*4FP:ELFU?FW3=M\X+
+MAKYQW+8+";,W_'H0Z33T+W;(C)2?.^->O:?NNUVX;BN,Y+EK]SV&\=CI&<ET
+M)-\9B49"6#*."_AFG$<5WZ^<ARW-;=@N>UCK7,O.*CXI1_F'QM)8+^]$RAQV
+M@<IRW,;)S5^P'.<]^##=!B,B84F)+#E?2=I]&)A-NTU"[E%&9B`0A,`&)2IE
+0O4N0CD/_%W)%.%"0"4WS0```
`
end
diff --git a/sys/boot/efi/boot1/fat-i386.tmpl.bz2.uu b/sys/boot/efi/boot1/fat-i386.tmpl.bz2.uu
index 2bdebf0..0e38ebb 100644
--- a/sys/boot/efi/boot1/fat-i386.tmpl.bz2.uu
+++ b/sys/boot/efi/boot1/fat-i386.tmpl.bz2.uu
@@ -2,25 +2,24 @@ FAT template boot filesystem created by generate-fat.sh
DO NOT EDIT
$FreeBSD$
begin 644 fat-i386.tmpl.bz2
-M0EIH.3%!629368LPC"P`&T#_____[ZKJ[_ZN_ZO^J_Z[OJ_OJ^JK_KZNKNNJ
-MZNKNZOJ^P`+\``4`15/%`]3U!H:-`:,C0```&@:9!H`T`!D````&@&@:9HF1
-MA``R:``:"``T,C1D&FFFAHT::`8F0TTR-#0,0Q,@TT```!HT,330:-&"!ID,
-M@&C$Q&FF(`#0R-&0::::&C1IH!B9#33(T-`Q#$R#30```&C0Q--!HT8(&F0R
-M`:,3$::8%4DDT_(HDQDFC$TR8F31H#0R,@T-!IH`#0R-`:9`TT--&C0-,C(R
-M--/0C"---/28$P:::G.M7$NU9*YMC#26[FI",))$0BU((B(@Y=99)$((0LB)
-M<:0@0AFL6JA=Y+)+JX9A-W:UXB7H/&:9\#3OG;)]#;MZOE^X3DL>PXZ:3<R.
-MJ1C*H@$(=/+'8VBTMO`8MBEXQ##KM0R"4I%:M56K5JU:VHI4DHHHHHHK5T5I
-M*TJU:M6K<JY4244444489-2)******/<SFZLBQ8L6+%BQ,FFFFFFFFFFFFFF
-MFFZV)*******)IIIIIIIIDTTTTTTUUFM/8L6+%BQ8L37TE%%%%%%$R::::::
-M;HNLR]568NF=;_H3.25=S.TN8C:-Q*3(SMM])&*T6=89:T"3R4HTB33/?:UL
-M&T;EO'`<1RVBN@U%Y'F&?@`M7&BD0`O=;\FNSTK<0`QK-P9;M*C)ZVIAUSMY
-M+RX<WJ797N#>Z7)W*[T]0YDF(D\UI%&H:I\KI&Q?FW+,N`_U_S`9%EL9H,?D
-M+[=S7F7N=K>6VVB(EK"J(J71=U(].36-&M9]E)+CJ[>NMXBU<ME(921[;4OB
-M8E]+[GX-LW+>.`OW%#X"4"I`L0*`H@*982S&"L)%`M'-HP#B!/4PH$;I)EK"
-M?`??(&!3=]_K])6G70T%+BT8F221>O8;!LVT?HV[=-ZWZ_<-QW,<YL3*[OAV
-MEUANWB*H1:7J(DC':.IN-FB,9(U;4KYX3]V595OW!<)Q7'<I@,%H6)DE$D=U
-M)SY&X7$29N2,5)S+BI&\;YOW`<%GE^XCCN2VCF,!JF6<C5_VCU)(X.#PK1RK
-MX2DAPVA<9QW(:]R7*<MS6`W#!<]A,4<Z3`DPI,&2_D==K<+`;5I:F4DBK,Q`
-8(0E`!A6EJ2^2<1'$?^+N2*<*$A%F$86`
+M0EIH.3%!629363V[U-``&T#_____^ZKJ[_ZN_^O^J_Z[OJ_NK^JO^KZNKNNJ
+MZNKNZOJ^P`+\&$`!(&AHT`P@-!H&!``:`TR`T!@$!DTT```TP333!`9-&0:,
+M(`#(80TR!*J:B:?_I5/]51H9!D:`80&C"8(&@--,$`!H#30R,@P$R:`T`9`:
+M-`T`T``:`:(&AHT`P@-!H&!``:`TR`T!@$!DTT```TP333!`9-&0:,(`#(80
+MTR`JBIJ9-JF28Q31Z1ZFFTU&0T!H:#0::`TT#0:!B`&@#)H8C330TTTTTR:>
+MAHF"/4]33TFT:38F)J8U%A.A7-:J,G*K6J(1D)1$(HD(B(@PZ3)3$0@A#)1'
+M+J"!"&@RZI"SN;E96#/+%WZCR4ZAIFK:Y[S9MPVC>N*WZ_<AS5PRF:F#@2ZQ
+M%O4A`0AU$])F*ZA5>(RZV6C*LHLU<S*9DI4JE*E2I4JJNKU$JZNKJZNKJ5-=
+M2E2FE2I4J6%6,0######$4(:%`,,,,,,<//>!X3CCCCCCB!"$(0A"$(0A"$(
+MS<*`88888880A"$(0A`A"$(0C!3?!<<<<<<<<1=P#######"!"$(0A$;FH,M
+M4SUDT*]Z%WLG;45$RXTHRWG]PKJ/#2TR8U"7MOD;%M7Z+QQ%\P&&T]D'NVD>
+M::.`"BPT\D`+78Z_9=Y-6(`9AVD&;V+LXB81H+`NJ*C*K&[E:V#G9QG[;'MM
+M5=5EG[E08DLK+SGIJ[5M8V"X?@W:\<9?/]?\Q6:9VWUUQF=]P[%:=76W7"JQ
+MKR7KHA<:*4;Z(Z`RE9'L2V#5*/!9R5AV-79U;6BLW$C)R?`UCYUJVC;MR_9P
+M'$7R_<IANY7#HK*HJ2N]#.IM;!O)9?/UZ%,M'$1X'E4+/<;RYK/"9+<V="[R
+M>DVNJI6--<TM>PH+24I-HU;;/S;I=MZX+BKU?N2P6(QFW.'R:@M8B5OZE1>;
+MDBWE6DU[6M^\APETNEZX[D.4P6$Q6.TK+2-'+GR<`[646TL24<1QEZOG':)?
+ML!@N:W;$8KYF=<S8<=&ME'^8_(H,*\$RAR6D<M@N8VSFL)AN<Q7!8[GLA;&-
+J)D2QY7\G7;+(QGZM349N45-!$`A"8`,BA1*\2P$8!_Q=R13A0D#V[U-`
`
end
diff --git a/sys/boot/efi/boot1/generate-fat.sh b/sys/boot/efi/boot1/generate-fat.sh
index 7992b55..8b3fae8 100755
--- a/sys/boot/efi/boot1/generate-fat.sh
+++ b/sys/boot/efi/boot1/generate-fat.sh
@@ -55,14 +55,25 @@ BOOT1_OFFSET=$(hd $OUTPUT_FILE | grep 'Boot1 START' | cut -f 1 -d ' ')
# Convert to number of blocks
BOOT1_OFFSET=$(echo 0x$BOOT1_OFFSET | awk '{printf("%x\n",$1/512);}')
+# Record maximum boot1 size in bytes
+case $BOOT1_SIZE in
+*k)
+ BOOT1_MAXSIZE=$(expr ${BOOT1_SIZE%k} '*' 1024)
+ ;;
+*)
+ BOOT1_MAXSIZE=$BOOT1_SIZE
+ ;;
+esac
+
echo '# This file autogenerated by generate-fat.sh - DO NOT EDIT' > Makefile.fat
-echo '# $FreeBSD$' >> Makefile.fat
+echo "# \$FreeBSD\$" >> Makefile.fat
echo "BOOT1_OFFSET=0x$BOOT1_OFFSET" >> Makefile.fat
+echo "BOOT1_MAXSIZE=$BOOT1_MAXSIZE" >> Makefile.fat
bzip2 $OUTPUT_FILE
echo 'FAT template boot filesystem created by generate-fat.sh' > $OUTPUT_FILE.bz2.uu
echo 'DO NOT EDIT' >> $OUTPUT_FILE.bz2.uu
-echo '$FreeBSD$' >> $OUTPUT_FILE.bz2.uu
+echo "\$FreeBSD\$" >> $OUTPUT_FILE.bz2.uu
uuencode $OUTPUT_FILE.bz2 $OUTPUT_FILE.bz2 >> $OUTPUT_FILE.bz2.uu
rm $OUTPUT_FILE.bz2
diff --git a/sys/boot/i386/loader/main.c b/sys/boot/i386/loader/main.c
index d4073e7..73f3507 100644
--- a/sys/boot/i386/loader/main.c
+++ b/sys/boot/i386/loader/main.c
@@ -321,7 +321,8 @@ init_zfs_bootenv(char *currdev)
currdev++;
/* Remove the last element (current bootenv) */
beroot = strrchr(currdev, '/');
- beroot[0] = '\0';
+ if (beroot != NULL)
+ beroot[0] = '\0';
beroot = currdev;
diff --git a/sys/boot/libstand32/Makefile b/sys/boot/libstand32/Makefile
index d1c9ba2..66798d7 100644
--- a/sys/boot/libstand32/Makefile
+++ b/sys/boot/libstand32/Makefile
@@ -10,6 +10,7 @@ LIBSTAND_CPUARCH=${MACHINE_CPUARCH}
.endif
LIBC_SRC= ${LIBSTAND_SRC}/../libc
INTERNALLIB=
+INCS=
MAN=
.PATH: ${LIBSTAND_SRC}
diff --git a/sys/boot/libstand32/Makefile.depend b/sys/boot/libstand32/Makefile.depend
index dae5bcd..57cd80c 100644
--- a/sys/boot/libstand32/Makefile.depend
+++ b/sys/boot/libstand32/Makefile.depend
@@ -6,7 +6,6 @@ DIRDEPS = \
include/arpa \
include/xlocale \
lib/libbz2 \
- lib/libstand \
.include <dirdeps.mk>
diff --git a/sys/boot/userboot/test/Makefile.depend b/sys/boot/userboot/test/Makefile.depend
index a5da8fd..3646e2e 100644
--- a/sys/boot/userboot/test/Makefile.depend
+++ b/sys/boot/userboot/test/Makefile.depend
@@ -8,7 +8,6 @@ DIRDEPS = \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
- lib/libc_nonshared \
lib/libcompiler_rt \
diff --git a/sys/boot/userboot/userboot/main.c b/sys/boot/userboot/userboot/main.c
index d4cefff..335c8fd 100644
--- a/sys/boot/userboot/userboot/main.c
+++ b/sys/boot/userboot/userboot/main.c
@@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
static void userboot_zfs_probe(void);
static int userboot_zfs_found;
+static void init_zfs_bootenv(char *currdev);
#endif
#define USERBOOT_VERSION USERBOOT_VERSION_3
@@ -190,6 +191,10 @@ extract_currdev(void)
dev.d_unit = 0;
}
+#if defined(USERBOOT_ZFS_SUPPORT)
+ init_zfs_bootenv(zfs_fmtdev(&dev));
+#endif
+
env_setenv("currdev", EV_VOLATILE, userboot_fmtdev(&dev),
userboot_setcurrdev, env_nounset);
env_setenv("loaddev", EV_VOLATILE, userboot_fmtdev(&dev),
@@ -198,6 +203,29 @@ extract_currdev(void)
#if defined(USERBOOT_ZFS_SUPPORT)
static void
+init_zfs_bootenv(char *currdev)
+{
+ char *beroot;
+
+ /* Remove the trailing : */
+ currdev[strlen(currdev) - 1] = '\0';
+ setenv("zfs_be_active", currdev, 1);
+ /* Do not overwrite if already set */
+ setenv("vfs.root.mountfrom", currdev, 0);
+ /* Forward past zfs: */
+ currdev = strchr(currdev, ':');
+ currdev++;
+ /* Remove the last element (current bootenv) */
+ beroot = strrchr(currdev, '/');
+ if (beroot != NULL)
+ beroot[0] = '\0';
+
+ beroot = currdev;
+
+ setenv("zfs_be_root", beroot, 1);
+}
+
+static void
userboot_zfs_probe(void)
{
char devname[32];
@@ -237,6 +265,33 @@ command_lszfs(int argc, char *argv[])
}
return (CMD_OK);
}
+
+COMMAND_SET(reloadbe, "reloadbe", "refresh the list of ZFS Boot Environments",
+ command_reloadbe);
+
+static int
+command_reloadbe(int argc, char *argv[])
+{
+ int err;
+
+ if (argc > 2) {
+ command_errmsg = "wrong number of arguments";
+ return (CMD_ERROR);
+ }
+
+ if (argc == 2) {
+ err = zfs_bootenv(argv[1]);
+ } else {
+ err = zfs_bootenv(getenv("zfs_be_root"));
+ }
+
+ if (err != 0) {
+ command_errmsg = strerror(err);
+ return (CMD_ERROR);
+ }
+
+ return (CMD_OK);
+}
#endif /* USERBOOT_ZFS_SUPPORT */
COMMAND_SET(quit, "quit", "exit the loader", command_quit);
diff --git a/sys/cam/ctl/ctl.c b/sys/cam/ctl/ctl.c
index ac886ca..4fdaa05 100644
--- a/sys/cam/ctl/ctl.c
+++ b/sys/cam/ctl/ctl.c
@@ -1778,6 +1778,7 @@ ctl_ha_role_sysctl(SYSCTL_HANDLER_ARGS)
static int
ctl_init(void)
{
+ struct make_dev_args args;
struct ctl_softc *softc;
void *other_pool;
int i, error;
@@ -1785,9 +1786,17 @@ ctl_init(void)
softc = control_softc = malloc(sizeof(*control_softc), M_DEVBUF,
M_WAITOK | M_ZERO);
- softc->dev = make_dev(&ctl_cdevsw, 0, UID_ROOT, GID_OPERATOR, 0600,
- "cam/ctl");
- softc->dev->si_drv1 = softc;
+ make_dev_args_init(&args);
+ args.mda_devsw = &ctl_cdevsw;
+ args.mda_uid = UID_ROOT;
+ args.mda_gid = GID_OPERATOR;
+ args.mda_mode = 0600;
+ args.mda_si_drv1 = softc;
+ error = make_dev_s(&args, &softc->dev, "cam/ctl");
+ if (error != 0) {
+ free(control_softc, M_DEVBUF);
+ return (error);
+ }
sysctl_ctx_init(&softc->sysctl_ctx);
softc->sysctl_tree = SYSCTL_ADD_NODE(&softc->sysctl_ctx,
diff --git a/sys/cam/scsi/scsi_ch.c b/sys/cam/scsi/scsi_ch.c
index bc398e7..137128d 100644
--- a/sys/cam/scsi/scsi_ch.c
+++ b/sys/cam/scsi/scsi_ch.c
@@ -372,6 +372,8 @@ chregister(struct cam_periph *periph, void *arg)
struct ch_softc *softc;
struct ccb_getdev *cgd;
struct ccb_pathinq cpi;
+ struct make_dev_args args;
+ int error;
cgd = (struct ccb_getdev *)arg;
if (cgd == NULL) {
@@ -431,11 +433,20 @@ chregister(struct cam_periph *periph, void *arg)
/* Register the device */
- softc->dev = make_dev(&ch_cdevsw, periph->unit_number, UID_ROOT,
- GID_OPERATOR, 0600, "%s%d", periph->periph_name,
- periph->unit_number);
+ make_dev_args_init(&args);
+ args.mda_devsw = &ch_cdevsw;
+ args.mda_unit = periph->unit_number;
+ args.mda_uid = UID_ROOT;
+ args.mda_gid = GID_OPERATOR;
+ args.mda_mode = 0600;
+ args.mda_si_drv1 = periph;
+ error = make_dev_s(&args, &softc->dev, "%s%d", periph->periph_name,
+ periph->unit_number);
cam_periph_lock(periph);
- softc->dev->si_drv1 = periph;
+ if (error != 0) {
+ cam_periph_release_locked(periph);
+ return (CAM_REQ_CMP_ERR);
+ }
/*
* Add an async callback so that we get
@@ -507,8 +518,6 @@ chclose(struct cdev *dev, int flag, int fmt, struct thread *td)
struct mtx *mtx;
periph = (struct cam_periph *)dev->si_drv1;
- if (periph == NULL)
- return(ENXIO);
mtx = cam_periph_mtx(periph);
mtx_lock(mtx);
@@ -754,9 +763,6 @@ chioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td)
int error;
periph = (struct cam_periph *)dev->si_drv1;
- if (periph == NULL)
- return(ENXIO);
-
cam_periph_lock(periph);
CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("entering chioctl\n"));
diff --git a/sys/cam/scsi/scsi_enc.c b/sys/cam/scsi/scsi_enc.c
index 844f25a..a450cd0 100644
--- a/sys/cam/scsi/scsi_enc.c
+++ b/sys/cam/scsi/scsi_enc.c
@@ -264,10 +264,6 @@ enc_open(struct cdev *dev, int flags, int fmt, struct thread *td)
int error = 0;
periph = (struct cam_periph *)dev->si_drv1;
- if (periph == NULL) {
- return (ENXIO);
- }
-
if (cam_periph_acquire(periph) != CAM_REQ_CMP)
return (ENXIO);
@@ -302,8 +298,6 @@ enc_close(struct cdev *dev, int flag, int fmt, struct thread *td)
struct mtx *mtx;
periph = (struct cam_periph *)dev->si_drv1;
- if (periph == NULL)
- return (ENXIO);
mtx = cam_periph_mtx(periph);
mtx_lock(mtx);
@@ -364,9 +358,6 @@ enc_ioctl(struct cdev *dev, u_long cmd, caddr_t arg_addr, int flag,
addr = NULL;
periph = (struct cam_periph *)dev->si_drv1;
- if (periph == NULL)
- return (ENXIO);
-
CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("entering encioctl\n"));
cam_periph_lock(periph);
@@ -905,6 +896,7 @@ enc_ctor(struct cam_periph *periph, void *arg)
enc_softc_t *enc;
struct ccb_getdev *cgd;
char *tname;
+ struct make_dev_args args;
cgd = (struct ccb_getdev *)arg;
if (cgd == NULL) {
@@ -987,12 +979,20 @@ enc_ctor(struct cam_periph *periph, void *arg)
return (CAM_REQ_CMP_ERR);
}
- enc->enc_dev = make_dev(&enc_cdevsw, periph->unit_number,
- UID_ROOT, GID_OPERATOR, 0600, "%s%d",
- periph->periph_name, periph->unit_number);
-
+ make_dev_args_init(&args);
+ args.mda_devsw = &enc_cdevsw;
+ args.mda_unit = periph->unit_number;
+ args.mda_uid = UID_ROOT;
+ args.mda_gid = GID_OPERATOR;
+ args.mda_mode = 0600;
+ args.mda_si_drv1 = periph;
+ err = make_dev_s(&args, &enc->enc_dev, "%s%d", periph->periph_name,
+ periph->unit_number);
cam_periph_lock(periph);
- enc->enc_dev->si_drv1 = periph;
+ if (err != 0) {
+ cam_periph_release_locked(periph);
+ return (CAM_REQ_CMP_ERR);
+ }
enc->enc_flags |= ENC_FLAG_INITIALIZED;
diff --git a/sys/cam/scsi/scsi_pass.c b/sys/cam/scsi/scsi_pass.c
index 09cda5b..c0c313e 100644
--- a/sys/cam/scsi/scsi_pass.c
+++ b/sys/cam/scsi/scsi_pass.c
@@ -548,7 +548,8 @@ passregister(struct cam_periph *periph, void *arg)
struct pass_softc *softc;
struct ccb_getdev *cgd;
struct ccb_pathinq cpi;
- int no_tags;
+ struct make_dev_args args;
+ int error, no_tags;
cgd = (struct ccb_getdev *)arg;
if (cgd == NULL) {
@@ -648,9 +649,20 @@ passregister(struct cam_periph *periph, void *arg)
}
/* Register the device */
- softc->dev = make_dev(&pass_cdevsw, periph->unit_number,
- UID_ROOT, GID_OPERATOR, 0600, "%s%d",
- periph->periph_name, periph->unit_number);
+ make_dev_args_init(&args);
+ args.mda_devsw = &pass_cdevsw;
+ args.mda_unit = periph->unit_number;
+ args.mda_uid = UID_ROOT;
+ args.mda_gid = GID_OPERATOR;
+ args.mda_mode = 0600;
+ args.mda_si_drv1 = periph;
+ error = make_dev_s(&args, &softc->dev, "%s%d", periph->periph_name,
+ periph->unit_number);
+ if (error != 0) {
+ cam_periph_lock(periph);
+ cam_periph_release_locked(periph);
+ return (CAM_REQ_CMP_ERR);
+ }
/*
* Hold a reference to the periph before we create the physical
@@ -664,7 +676,6 @@ passregister(struct cam_periph *periph, void *arg)
}
cam_periph_lock(periph);
- softc->dev->si_drv1 = periph;
TASK_INIT(&softc->add_physpath_task, /*priority*/0,
pass_add_physpath, periph);
@@ -754,8 +765,6 @@ passclose(struct cdev *dev, int flag, int fmt, struct thread *td)
struct mtx *mtx;
periph = (struct cam_periph *)dev->si_drv1;
- if (periph == NULL)
- return (ENXIO);
mtx = cam_periph_mtx(periph);
mtx_lock(mtx);
@@ -1759,9 +1768,6 @@ passdoioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread
uint32_t priority;
periph = (struct cam_periph *)dev->si_drv1;
- if (periph == NULL)
- return(ENXIO);
-
cam_periph_lock(periph);
softc = (struct pass_softc *)periph->softc;
@@ -2068,9 +2074,6 @@ passpoll(struct cdev *dev, int poll_events, struct thread *td)
int revents;
periph = (struct cam_periph *)dev->si_drv1;
- if (periph == NULL)
- return (ENXIO);
-
softc = (struct pass_softc *)periph->softc;
revents = poll_events & (POLLOUT | POLLWRNORM);
@@ -2095,9 +2098,6 @@ passkqfilter(struct cdev *dev, struct knote *kn)
struct pass_softc *softc;
periph = (struct cam_periph *)dev->si_drv1;
- if (periph == NULL)
- return (ENXIO);
-
softc = (struct pass_softc *)periph->softc;
kn->kn_hook = (caddr_t)periph;
diff --git a/sys/cam/scsi/scsi_pt.c b/sys/cam/scsi/scsi_pt.c
index 15240da..e9d2437 100644
--- a/sys/cam/scsi/scsi_pt.c
+++ b/sys/cam/scsi/scsi_pt.c
@@ -173,9 +173,6 @@ ptclose(struct cdev *dev, int flag, int fmt, struct thread *td)
struct pt_softc *softc;
periph = (struct cam_periph *)dev->si_drv1;
- if (periph == NULL)
- return (ENXIO);
-
softc = (struct pt_softc *)periph->softc;
cam_periph_lock(periph);
@@ -252,6 +249,8 @@ ptctor(struct cam_periph *periph, void *arg)
struct pt_softc *softc;
struct ccb_getdev *cgd;
struct ccb_pathinq cpi;
+ struct make_dev_args args;
+ int error;
cgd = (struct ccb_getdev *)arg;
if (cgd == NULL) {
@@ -282,6 +281,21 @@ ptctor(struct cam_periph *periph, void *arg)
xpt_action((union ccb *)&cpi);
cam_periph_unlock(periph);
+
+ make_dev_args_init(&args);
+ args.mda_devsw = &pt_cdevsw;
+ args.mda_unit = periph->unit_number;
+ args.mda_uid = UID_ROOT;
+ args.mda_gid = GID_OPERATOR;
+ args.mda_mode = 0600;
+ args.mda_si_drv1 = periph;
+ error = make_dev_s(&args, &softc->dev, "%s%d", periph->periph_name,
+ periph->unit_number);
+ if (error != 0) {
+ cam_periph_lock(periph);
+ return (CAM_REQ_CMP_ERR);
+ }
+
softc->device_stats = devstat_new_entry("pt",
periph->unit_number, 0,
DEVSTAT_NO_BLOCKSIZE,
@@ -289,11 +303,7 @@ ptctor(struct cam_periph *periph, void *arg)
XPORT_DEVSTAT_TYPE(cpi.transport),
DEVSTAT_PRIORITY_OTHER);
- softc->dev = make_dev(&pt_cdevsw, periph->unit_number, UID_ROOT,
- GID_OPERATOR, 0600, "%s%d", periph->periph_name,
- periph->unit_number);
cam_periph_lock(periph);
- softc->dev->si_drv1 = periph;
/*
* Add async callbacks for bus reset and
@@ -571,9 +581,6 @@ ptioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td)
int error = 0;
periph = (struct cam_periph *)dev->si_drv1;
- if (periph == NULL)
- return(ENXIO);
-
softc = (struct pt_softc *)periph->softc;
cam_periph_lock(periph);
diff --git a/sys/cam/scsi/scsi_sa.c b/sys/cam/scsi/scsi_sa.c
index 6110b3d..149d062 100644
--- a/sys/cam/scsi/scsi_sa.c
+++ b/sys/cam/scsi/scsi_sa.c
@@ -731,9 +731,6 @@ saclose(struct cdev *dev, int flag, int fmt, struct thread *td)
mode = SAMODE(dev);
periph = (struct cam_periph *)dev->si_drv1;
- if (periph == NULL)
- return (ENXIO);
-
cam_periph_lock(periph);
softc = (struct sa_softc *)periph->softc;
@@ -906,10 +903,6 @@ sastrategy(struct bio *bp)
return;
}
periph = (struct cam_periph *)bp->bio_dev->si_drv1;
- if (periph == NULL) {
- biofinish(bp, NULL, ENXIO);
- return;
- }
cam_periph_lock(periph);
softc = (struct sa_softc *)periph->softc;
@@ -1517,9 +1510,6 @@ saioctl(struct cdev *dev, u_long cmd, caddr_t arg, int flag, struct thread *td)
spaceop = 0; /* shut up gcc */
periph = (struct cam_periph *)dev->si_drv1;
- if (periph == NULL)
- return (ENXIO);
-
cam_periph_lock(periph);
softc = (struct sa_softc *)periph->softc;
@@ -2285,7 +2275,7 @@ saasync(void *callback_arg, u_int32_t code,
static void
sasetupdev(struct sa_softc *softc, struct cdev *dev)
{
- dev->si_drv1 = softc->periph;
+
dev->si_iosize_max = softc->maxio;
dev->si_flags |= softc->si_flags;
/*
@@ -2347,8 +2337,10 @@ saregister(struct cam_periph *periph, void *arg)
struct sa_softc *softc;
struct ccb_getdev *cgd;
struct ccb_pathinq cpi;
+ struct make_dev_args args;
caddr_t match;
char tmpstr[80];
+ int error;
cgd = (struct ccb_getdev *)arg;
if (cgd == NULL) {
@@ -2506,25 +2498,48 @@ saregister(struct cam_periph *periph, void *arg)
return (CAM_REQ_CMP_ERR);
}
- softc->devs.ctl_dev = make_dev(&sa_cdevsw, SAMINOR(SA_CTLDEV,
- SA_ATYPE_R), UID_ROOT, GID_OPERATOR,
- 0660, "%s%d.ctl", periph->periph_name, periph->unit_number);
+ make_dev_args_init(&args);
+ args.mda_devsw = &sa_cdevsw;
+ args.mda_si_drv1 = softc->periph;
+ args.mda_uid = UID_ROOT;
+ args.mda_gid = GID_OPERATOR;
+ args.mda_mode = 0660;
+
+ args.mda_unit = SAMINOR(SA_CTLDEV, SA_ATYPE_R);
+ error = make_dev_s(&args, &softc->devs.ctl_dev, "%s%d.ctl",
+ periph->periph_name, periph->unit_number);
+ if (error != 0) {
+ cam_periph_lock(periph);
+ return (CAM_REQ_CMP_ERR);
+ }
sasetupdev(softc, softc->devs.ctl_dev);
- softc->devs.r_dev = make_dev(&sa_cdevsw, SAMINOR(SA_NOT_CTLDEV,
- SA_ATYPE_R), UID_ROOT, GID_OPERATOR,
- 0660, "%s%d", periph->periph_name, periph->unit_number);
+ args.mda_unit = SAMINOR(SA_NOT_CTLDEV, SA_ATYPE_R);
+ error = make_dev_s(&args, &softc->devs.r_dev, "%s%d",
+ periph->periph_name, periph->unit_number);
+ if (error != 0) {
+ cam_periph_lock(periph);
+ return (CAM_REQ_CMP_ERR);
+ }
sasetupdev(softc, softc->devs.r_dev);
- softc->devs.nr_dev = make_dev(&sa_cdevsw, SAMINOR(SA_NOT_CTLDEV,
- SA_ATYPE_NR), UID_ROOT, GID_OPERATOR,
- 0660, "n%s%d", periph->periph_name, periph->unit_number);
+ args.mda_unit = SAMINOR(SA_NOT_CTLDEV, SA_ATYPE_NR);
+ error = make_dev_s(&args, &softc->devs.nr_dev, "n%s%d",
+ periph->periph_name, periph->unit_number);
+ if (error != 0) {
+ cam_periph_lock(periph);
+ return (CAM_REQ_CMP_ERR);
+ }
sasetupdev(softc, softc->devs.nr_dev);
- softc->devs.er_dev = make_dev(&sa_cdevsw, SAMINOR(SA_NOT_CTLDEV,
- SA_ATYPE_ER), UID_ROOT, GID_OPERATOR,
- 0660, "e%s%d", periph->periph_name, periph->unit_number);
- sasetupdev(softc, softc->devs.er_dev);
+ args.mda_unit = SAMINOR(SA_NOT_CTLDEV, SA_ATYPE_ER);
+ error = make_dev_s(&args, &softc->devs.er_dev, "e%s%d",
+ periph->periph_name, periph->unit_number);
+ if (error != 0) {
+ cam_periph_lock(periph);
+ return (CAM_REQ_CMP_ERR);
+ }
+ sasetupdev(softc, softc->devs.er_dev);
cam_periph_lock(periph);
diff --git a/sys/cam/scsi/scsi_sg.c b/sys/cam/scsi/scsi_sg.c
index 3e13003..ef83fc7 100644
--- a/sys/cam/scsi/scsi_sg.c
+++ b/sys/cam/scsi/scsi_sg.c
@@ -300,7 +300,8 @@ sgregister(struct cam_periph *periph, void *arg)
struct sg_softc *softc;
struct ccb_getdev *cgd;
struct ccb_pathinq cpi;
- int no_tags;
+ struct make_dev_args args;
+ int no_tags, error;
cgd = (struct ccb_getdev *)arg;
if (cgd == NULL) {
@@ -361,9 +362,20 @@ sgregister(struct cam_periph *periph, void *arg)
}
/* Register the device */
- softc->dev = make_dev(&sg_cdevsw, periph->unit_number,
- UID_ROOT, GID_OPERATOR, 0600, "%s%d",
- periph->periph_name, periph->unit_number);
+ make_dev_args_init(&args);
+ args.mda_devsw = &sg_cdevsw;
+ args.mda_unit = periph->unit_number;
+ args.mda_uid = UID_ROOT;
+ args.mda_gid = GID_OPERATOR;
+ args.mda_mode = 0600;
+ args.mda_si_drv1 = periph;
+ error = make_dev_s(&args, &softc->dev, "%s%d",
+ periph->periph_name, periph->unit_number);
+ if (error != 0) {
+ cam_periph_lock(periph);
+ cam_periph_release_locked(periph);
+ return (CAM_REQ_CMP_ERR);
+ }
if (periph->unit_number < 26) {
(void)make_dev_alias(softc->dev, "sg%c",
periph->unit_number + 'a');
@@ -373,7 +385,6 @@ sgregister(struct cam_periph *periph, void *arg)
(periph->unit_number % 26) + 'a');
}
cam_periph_lock(periph);
- softc->dev->si_drv1 = periph;
/*
* Add as async callback so that we get
@@ -429,9 +440,6 @@ sgopen(struct cdev *dev, int flags, int fmt, struct thread *td)
int error = 0;
periph = (struct cam_periph *)dev->si_drv1;
- if (periph == NULL)
- return (ENXIO);
-
if (cam_periph_acquire(periph) != CAM_REQ_CMP)
return (ENXIO);
@@ -468,8 +476,6 @@ sgclose(struct cdev *dev, int flag, int fmt, struct thread *td)
struct mtx *mtx;
periph = (struct cam_periph *)dev->si_drv1;
- if (periph == NULL)
- return (ENXIO);
mtx = cam_periph_mtx(periph);
mtx_lock(mtx);
@@ -506,9 +512,6 @@ sgioctl(struct cdev *dev, u_long cmd, caddr_t arg, int flag, struct thread *td)
int dir, error;
periph = (struct cam_periph *)dev->si_drv1;
- if (periph == NULL)
- return (ENXIO);
-
cam_periph_lock(periph);
softc = (struct sg_softc *)periph->softc;
diff --git a/sys/compat/linuxkpi/common/include/linux/gfp.h b/sys/compat/linuxkpi/common/include/linux/gfp.h
index a82f30d..38a0222 100644
--- a/sys/compat/linuxkpi/common/include/linux/gfp.h
+++ b/sys/compat/linuxkpi/common/include/linux/gfp.h
@@ -66,15 +66,15 @@ page_address(struct page *page)
}
static inline unsigned long
-_get_page(gfp_t mask)
+linux_get_page(gfp_t mask)
{
return kmem_malloc(kmem_arena, PAGE_SIZE, mask);
}
-#define get_zeroed_page(mask) _get_page((mask) | M_ZERO)
-#define alloc_page(mask) virt_to_page(_get_page((mask)))
-#define __get_free_page(mask) _get_page((mask))
+#define get_zeroed_page(mask) linux_get_page((mask) | M_ZERO)
+#define alloc_page(mask) virt_to_page(linux_get_page((mask)))
+#define __get_free_page(mask) linux_get_page((mask))
static inline void
free_page(unsigned long page)
diff --git a/sys/compat/linuxkpi/common/include/linux/interrupt.h b/sys/compat/linuxkpi/common/include/linux/interrupt.h
index d33a3b0..dd943e3 100644
--- a/sys/compat/linuxkpi/common/include/linux/interrupt.h
+++ b/sys/compat/linuxkpi/common/include/linux/interrupt.h
@@ -54,24 +54,17 @@ struct irq_ent {
};
static inline int
-_irq_rid(struct device *dev, int irq)
+linux_irq_rid(struct device *dev, int irq)
{
if (irq == dev->irq)
return (0);
return irq - dev->msix + 1;
}
-static inline void
-_irq_handler(void *ent)
-{
- struct irq_ent *irqe;
-
- irqe = ent;
- irqe->handler(irqe->irq, irqe->arg);
-}
+extern void linux_irq_handler(void *);
static inline struct irq_ent *
-_irq_ent(struct device *dev, int irq)
+linux_irq_ent(struct device *dev, int irq)
{
struct irq_ent *irqe;
@@ -95,7 +88,7 @@ request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags,
dev = _pci_find_irq_dev(irq);
if (dev == NULL)
return -ENXIO;
- rid = _irq_rid(dev, irq);
+ rid = linux_irq_rid(dev, irq);
res = bus_alloc_resource_any(dev->bsddev, SYS_RES_IRQ, &rid,
flags | RF_ACTIVE);
if (res == NULL)
@@ -107,7 +100,7 @@ request_irq(unsigned int irq, irq_handler_t handler, unsigned long flags,
irqe->handler = handler;
irqe->irq = irq;
error = bus_setup_intr(dev->bsddev, res, INTR_TYPE_NET | INTR_MPSAFE,
- NULL, _irq_handler, irqe, &irqe->tag);
+ NULL, linux_irq_handler, irqe, &irqe->tag);
if (error) {
bus_release_resource(dev->bsddev, SYS_RES_IRQ, rid, irqe->res);
kfree(irqe);
@@ -128,7 +121,7 @@ bind_irq_to_cpu(unsigned int irq, int cpu_id)
if (dev == NULL)
return (-ENOENT);
- irqe = _irq_ent(dev, irq);
+ irqe = linux_irq_ent(dev, irq);
if (irqe == NULL)
return (-ENOENT);
@@ -145,8 +138,8 @@ free_irq(unsigned int irq, void *device)
dev = _pci_find_irq_dev(irq);
if (dev == NULL)
return;
- rid = _irq_rid(dev, irq);
- irqe = _irq_ent(dev, irq);
+ rid = linux_irq_rid(dev, irq);
+ irqe = linux_irq_ent(dev, irq);
if (irqe == NULL)
return;
bus_teardown_intr(dev->bsddev, irqe->res, irqe->tag);
diff --git a/sys/compat/linuxkpi/common/include/linux/kthread.h b/sys/compat/linuxkpi/common/include/linux/kthread.h
index fa8e9ba..f85a3f4 100644
--- a/sys/compat/linuxkpi/common/include/linux/kthread.h
+++ b/sys/compat/linuxkpi/common/include/linux/kthread.h
@@ -42,7 +42,7 @@
#include <linux/sched.h>
static inline void
-_kthread_fn(void *arg)
+linux_kthread_fn(void *arg)
{
struct task_struct *task;
@@ -58,7 +58,7 @@ _kthread_fn(void *arg)
}
static inline struct task_struct *
-_kthread_create(int (*threadfn)(void *data), void *data)
+linux_kthread_create(int (*threadfn)(void *data), void *data)
{
struct task_struct *task;
@@ -69,17 +69,12 @@ _kthread_create(int (*threadfn)(void *data), void *data)
return (task);
}
-struct task_struct *kthread_create(int (*threadfn)(void *data),
- void *data,
- const char namefmt[], ...)
- __attribute__((format(printf, 3, 4)));
-
#define kthread_run(fn, data, fmt, ...) \
({ \
struct task_struct *_task; \
\
- _task = _kthread_create((fn), (data)); \
- if (kthread_add(_kthread_fn, _task, NULL, &_task->task_thread, \
+ _task = linux_kthread_create((fn), (data)); \
+ if (kthread_add(linux_kthread_fn, _task, NULL, &_task->task_thread, \
0, 0, fmt, ## __VA_ARGS__)) { \
kfree(_task); \
_task = NULL; \
diff --git a/sys/compat/linuxkpi/common/include/linux/netdevice.h b/sys/compat/linuxkpi/common/include/linux/netdevice.h
index 1b1f8bf..1d50ac1 100644
--- a/sys/compat/linuxkpi/common/include/linux/netdevice.h
+++ b/sys/compat/linuxkpi/common/include/linux/netdevice.h
@@ -2,7 +2,7 @@
* Copyright (c) 2010 Isilon Systems, Inc.
* Copyright (c) 2010 iX Systems, Inc.
* Copyright (c) 2010 Panasas, Inc.
- * Copyright (c) 2013, 2014 Mellanox Technologies, Ltd.
+ * Copyright (c) 2013-2016 Mellanox Technologies, Ltd.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -69,103 +69,10 @@ netdev_priv(const struct net_device *dev)
return (dev->if_softc);
}
-static inline void
-_handle_ifnet_link_event(void *arg, struct ifnet *ifp, int linkstate)
-{
- struct notifier_block *nb;
-
- nb = arg;
- if (linkstate == LINK_STATE_UP)
- nb->notifier_call(nb, NETDEV_UP, ifp);
- else
- nb->notifier_call(nb, NETDEV_DOWN, ifp);
-}
-
-static inline void
-_handle_ifnet_arrival_event(void *arg, struct ifnet *ifp)
-{
- struct notifier_block *nb;
-
- nb = arg;
- nb->notifier_call(nb, NETDEV_REGISTER, ifp);
-}
-
-static inline void
-_handle_ifnet_departure_event(void *arg, struct ifnet *ifp)
-{
- struct notifier_block *nb;
-
- nb = arg;
- nb->notifier_call(nb, NETDEV_UNREGISTER, ifp);
-}
-
-static inline void
-_handle_iflladdr_event(void *arg, struct ifnet *ifp)
-{
- struct notifier_block *nb;
-
- nb = arg;
- nb->notifier_call(nb, NETDEV_CHANGEADDR, ifp);
-}
-
-static inline void
-_handle_ifaddr_event(void *arg, struct ifnet *ifp)
-{
- struct notifier_block *nb;
-
- nb = arg;
- nb->notifier_call(nb, NETDEV_CHANGEIFADDR, ifp);
-}
-
-static inline int
-register_netdevice_notifier(struct notifier_block *nb)
-{
-
- nb->tags[NETDEV_UP] = EVENTHANDLER_REGISTER(
- ifnet_link_event, _handle_ifnet_link_event, nb, 0);
- nb->tags[NETDEV_REGISTER] = EVENTHANDLER_REGISTER(
- ifnet_arrival_event, _handle_ifnet_arrival_event, nb, 0);
- nb->tags[NETDEV_UNREGISTER] = EVENTHANDLER_REGISTER(
- ifnet_departure_event, _handle_ifnet_departure_event, nb, 0);
- nb->tags[NETDEV_CHANGEADDR] = EVENTHANDLER_REGISTER(
- iflladdr_event, _handle_iflladdr_event, nb, 0);
-
- return (0);
-}
-
-static inline int
-register_inetaddr_notifier(struct notifier_block *nb)
-{
-
- nb->tags[NETDEV_CHANGEIFADDR] = EVENTHANDLER_REGISTER(
- ifaddr_event, _handle_ifaddr_event, nb, 0);
- return (0);
-}
-
-static inline int
-unregister_netdevice_notifier(struct notifier_block *nb)
-{
-
- EVENTHANDLER_DEREGISTER(ifnet_link_event, nb->tags[NETDEV_UP]);
- EVENTHANDLER_DEREGISTER(ifnet_arrival_event, nb->tags[NETDEV_REGISTER]);
- EVENTHANDLER_DEREGISTER(ifnet_departure_event,
- nb->tags[NETDEV_UNREGISTER]);
- EVENTHANDLER_DEREGISTER(iflladdr_event,
- nb->tags[NETDEV_CHANGEADDR]);
-
- return (0);
-}
-
-static inline int
-unregister_inetaddr_notifier(struct notifier_block *nb)
-{
-
- EVENTHANDLER_DEREGISTER(ifaddr_event,
- nb->tags[NETDEV_CHANGEIFADDR]);
-
- return (0);
-}
-
+int register_netdevice_notifier(struct notifier_block *);
+int register_inetaddr_notifier(struct notifier_block *);
+int unregister_netdevice_notifier(struct notifier_block *);
+int unregister_inetaddr_notifier(struct notifier_block *);
#define rtnl_lock()
#define rtnl_unlock()
diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c
index efda788..56080a4 100644
--- a/sys/compat/linuxkpi/common/src/linux_compat.c
+++ b/sys/compat/linuxkpi/common/src/linux_compat.c
@@ -66,6 +66,7 @@ __FBSDID("$FreeBSD$");
#include <linux/timer.h>
#include <linux/workqueue.h>
#include <linux/rcupdate.h>
+#include <linux/interrupt.h>
#include <vm/vm_pager.h>
@@ -1139,6 +1140,114 @@ const struct kobj_type linux_cdev_static_ktype = {
};
static void
+linux_handle_ifnet_link_event(void *arg, struct ifnet *ifp, int linkstate)
+{
+ struct notifier_block *nb;
+
+ nb = arg;
+ if (linkstate == LINK_STATE_UP)
+ nb->notifier_call(nb, NETDEV_UP, ifp);
+ else
+ nb->notifier_call(nb, NETDEV_DOWN, ifp);
+}
+
+static void
+linux_handle_ifnet_arrival_event(void *arg, struct ifnet *ifp)
+{
+ struct notifier_block *nb;
+
+ nb = arg;
+ nb->notifier_call(nb, NETDEV_REGISTER, ifp);
+}
+
+static void
+linux_handle_ifnet_departure_event(void *arg, struct ifnet *ifp)
+{
+ struct notifier_block *nb;
+
+ nb = arg;
+ nb->notifier_call(nb, NETDEV_UNREGISTER, ifp);
+}
+
+static void
+linux_handle_iflladdr_event(void *arg, struct ifnet *ifp)
+{
+ struct notifier_block *nb;
+
+ nb = arg;
+ nb->notifier_call(nb, NETDEV_CHANGEADDR, ifp);
+}
+
+static void
+linux_handle_ifaddr_event(void *arg, struct ifnet *ifp)
+{
+ struct notifier_block *nb;
+
+ nb = arg;
+ nb->notifier_call(nb, NETDEV_CHANGEIFADDR, ifp);
+}
+
+int
+register_netdevice_notifier(struct notifier_block *nb)
+{
+
+ nb->tags[NETDEV_UP] = EVENTHANDLER_REGISTER(
+ ifnet_link_event, linux_handle_ifnet_link_event, nb, 0);
+ nb->tags[NETDEV_REGISTER] = EVENTHANDLER_REGISTER(
+ ifnet_arrival_event, linux_handle_ifnet_arrival_event, nb, 0);
+ nb->tags[NETDEV_UNREGISTER] = EVENTHANDLER_REGISTER(
+ ifnet_departure_event, linux_handle_ifnet_departure_event, nb, 0);
+ nb->tags[NETDEV_CHANGEADDR] = EVENTHANDLER_REGISTER(
+ iflladdr_event, linux_handle_iflladdr_event, nb, 0);
+
+ return (0);
+}
+
+int
+register_inetaddr_notifier(struct notifier_block *nb)
+{
+
+ nb->tags[NETDEV_CHANGEIFADDR] = EVENTHANDLER_REGISTER(
+ ifaddr_event, linux_handle_ifaddr_event, nb, 0);
+ return (0);
+}
+
+int
+unregister_netdevice_notifier(struct notifier_block *nb)
+{
+
+ EVENTHANDLER_DEREGISTER(ifnet_link_event,
+ nb->tags[NETDEV_UP]);
+ EVENTHANDLER_DEREGISTER(ifnet_arrival_event,
+ nb->tags[NETDEV_REGISTER]);
+ EVENTHANDLER_DEREGISTER(ifnet_departure_event,
+ nb->tags[NETDEV_UNREGISTER]);
+ EVENTHANDLER_DEREGISTER(iflladdr_event,
+ nb->tags[NETDEV_CHANGEADDR]);
+
+ return (0);
+}
+
+int
+unregister_inetaddr_notifier(struct notifier_block *nb)
+{
+
+ EVENTHANDLER_DEREGISTER(ifaddr_event,
+ nb->tags[NETDEV_CHANGEIFADDR]);
+
+ return (0);
+}
+
+void
+linux_irq_handler(void *ent)
+{
+ struct irq_ent *irqe;
+
+ irqe = ent;
+ irqe->handler(irqe->irq, irqe->arg);
+}
+
+static void
linux_compat_init(void *arg)
{
struct sysctl_oid *rootoid;
diff --git a/sys/conf/files b/sys/conf/files
index feac6c0..3652b3b 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -2994,6 +2994,7 @@ geom/concat/g_concat.c optional geom_concat
geom/eli/g_eli.c optional geom_eli
geom/eli/g_eli_crypto.c optional geom_eli
geom/eli/g_eli_ctl.c optional geom_eli
+geom/eli/g_eli_hmac.c optional geom_eli
geom/eli/g_eli_integrity.c optional geom_eli
geom/eli/g_eli_key.c optional geom_eli
geom/eli/g_eli_key_cache.c optional geom_eli
diff --git a/sys/dev/bwi/if_bwi.c b/sys/dev/bwi/if_bwi.c
index ebed09c..00e89f3 100644
--- a/sys/dev/bwi/if_bwi.c
+++ b/sys/dev/bwi/if_bwi.c
@@ -356,8 +356,8 @@ bwi_attach(struct bwi_softc *sc)
device_t dev = sc->sc_dev;
struct bwi_mac *mac;
struct bwi_phy *phy;
+ uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)];
int i, error;
- uint8_t bands;
BWI_LOCK_INIT(sc);
@@ -453,15 +453,15 @@ bwi_attach(struct bwi_softc *sc)
/*
* Setup ratesets, phytype, channels and get MAC address
*/
- bands = 0;
+ memset(bands, 0, sizeof(bands));
if (phy->phy_mode == IEEE80211_MODE_11B ||
phy->phy_mode == IEEE80211_MODE_11G) {
- setbit(&bands, IEEE80211_MODE_11B);
+ setbit(bands, IEEE80211_MODE_11B);
if (phy->phy_mode == IEEE80211_MODE_11B) {
ic->ic_phytype = IEEE80211_T_DS;
} else {
ic->ic_phytype = IEEE80211_T_OFDM;
- setbit(&bands, IEEE80211_MODE_11G);
+ setbit(bands, IEEE80211_MODE_11G);
}
bwi_get_eaddr(sc, BWI_SPROM_11BG_EADDR, ic->ic_macaddr);
@@ -475,7 +475,7 @@ bwi_attach(struct bwi_softc *sc)
}
} else if (phy->phy_mode == IEEE80211_MODE_11A) {
/* TODO:11A */
- setbit(&bands, IEEE80211_MODE_11A);
+ setbit(bands, IEEE80211_MODE_11A);
error = ENXIO;
goto fail;
} else {
@@ -487,7 +487,7 @@ bwi_attach(struct bwi_softc *sc)
BWI_SPROM_CARD_INFO_LOCALE);
DPRINTF(sc, BWI_DBG_ATTACH, "locale: %d\n", sc->sc_locale);
/* XXX use locale */
- ieee80211_init_channels(ic, NULL, &bands);
+ ieee80211_init_channels(ic, NULL, bands);
ic->ic_softc = sc;
ic->ic_name = device_get_nameunit(dev);
diff --git a/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_cm.c b/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_cm.c
index 7b43560..b98caae 100644
--- a/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_cm.c
+++ b/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_cm.c
@@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$");
#include <net/route.h>
#include <netinet/in_systm.h>
#include <netinet/in.h>
+#include <netinet/in_fib.h>
#include <netinet/in_pcb.h>
#include <netinet/ip.h>
#include <netinet/ip_var.h>
@@ -264,20 +265,14 @@ void __free_ep(struct iwch_ep_common *epc)
free(epc, M_DEVBUF);
}
-static struct rtentry *
+static int
find_route(__be32 local_ip, __be32 peer_ip, __be16 local_port,
- __be16 peer_port, u8 tos)
+ __be16 peer_port, u8 tos, struct nhop4_extended *pnh4)
{
- struct route iproute;
- struct sockaddr_in *dst = (struct sockaddr_in *)&iproute.ro_dst;
-
- bzero(&iproute, sizeof iproute);
- dst->sin_family = AF_INET;
- dst->sin_len = sizeof *dst;
- dst->sin_addr.s_addr = peer_ip;
-
- rtalloc(&iproute);
- return iproute.ro_rt;
+ struct in_addr addr;
+
+ addr.s_addr = peer_ip;
+ return (fib4_lookup_nh_ext(RT_DEFAULT_FIB, addr, NHR_REF, 0, pnh4));
}
static void
@@ -1293,7 +1288,7 @@ iwch_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
int err = 0;
struct iwch_dev *h = to_iwch_dev(cm_id->device);
struct iwch_ep *ep;
- struct rtentry *rt;
+ struct nhop4_extended nh4;
struct toedev *tdev;
if (is_loopback_dst(cm_id)) {
@@ -1329,28 +1324,28 @@ iwch_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
goto fail2;
/* find a route */
- rt = find_route(cm_id->local_addr.sin_addr.s_addr,
+ err = find_route(cm_id->local_addr.sin_addr.s_addr,
cm_id->remote_addr.sin_addr.s_addr,
cm_id->local_addr.sin_port,
- cm_id->remote_addr.sin_port, IPTOS_LOWDELAY);
- if (!rt) {
+ cm_id->remote_addr.sin_port, IPTOS_LOWDELAY, &nh4);
+ if (err) {
printf("%s - cannot find route.\n", __FUNCTION__);
err = EHOSTUNREACH;
goto fail2;
}
- if (!(rt->rt_ifp->if_flags & IFCAP_TOE)) {
+ if (!(nh4.nh_ifp->if_flags & IFCAP_TOE)) {
printf("%s - interface not TOE capable.\n", __FUNCTION__);
- RTFREE(rt);
+ fib4_free_nh_ext(RT_DEFAULT_FIB, &nh4);
goto fail2;
}
- tdev = TOEDEV(rt->rt_ifp);
+ tdev = TOEDEV(nh4.nh_ifp);
if (tdev == NULL) {
printf("%s - No toedev for interface.\n", __FUNCTION__);
- RTFREE(rt);
+ fib4_free_nh_ext(RT_DEFAULT_FIB, &nh4);
goto fail2;
}
- RTFREE(rt);
+ fib4_free_nh_ext(RT_DEFAULT_FIB, &nh4);
state_set(&ep->com, CONNECTING);
ep->com.local_addr = cm_id->local_addr;
diff --git a/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c b/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c
index 985306c..d896020 100644
--- a/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c
+++ b/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c
@@ -1536,14 +1536,13 @@ assign_rxopt(struct tcpcb *tp, uint16_t tcpopt)
struct toepcb *toep = tp->t_toe;
struct adapter *sc = toep->tp_tod->tod_softc;
- tp->t_maxseg = tp->t_maxopd = sc->params.mtus[G_TCPOPT_MSS(tcpopt)] - 40;
+ tp->t_maxseg = sc->params.mtus[G_TCPOPT_MSS(tcpopt)] - 40;
if (G_TCPOPT_TSTAMP(tcpopt)) {
tp->t_flags |= TF_RCVD_TSTMP;
tp->t_flags |= TF_REQ_TSTMP; /* forcibly set */
tp->ts_recent = 0; /* XXX */
tp->ts_recent_age = tcp_ts_getticks();
- tp->t_maxseg -= TCPOLEN_TSTAMP_APPA;
}
if (G_TCPOPT_SACK(tcpopt))
diff --git a/sys/dev/cxgb/ulp/tom/cxgb_listen.c b/sys/dev/cxgb/ulp/tom/cxgb_listen.c
index 933a83c..b7d69df 100644
--- a/sys/dev/cxgb/ulp/tom/cxgb_listen.c
+++ b/sys/dev/cxgb/ulp/tom/cxgb_listen.c
@@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
#include <net/route.h>
#include <netinet/in.h>
#include <netinet/ip.h>
+#include <netinet/in_fib.h>
#include <netinet/in_pcb.h>
#include <netinet/in_var.h>
#include <netinet/tcp_timer.h>
@@ -480,8 +481,8 @@ do_pass_accept_req(struct sge_qset *qs, struct rsp_desc *r, struct mbuf *m)
unsigned int tid = GET_TID(req);
struct listen_ctx *lctx = lookup_stid(&td->tid_maps, stid);
struct l2t_entry *e = NULL;
+ struct nhop4_basic nh4;
struct sockaddr_in nam;
- struct rtentry *rt;
struct inpcb *inp;
struct socket *so;
struct port_info *pi;
@@ -525,18 +526,12 @@ do_pass_accept_req(struct sge_qset *qs, struct rsp_desc *r, struct mbuf *m)
nam.sin_len = sizeof(nam);
nam.sin_family = AF_INET;
nam.sin_addr = inc.inc_faddr;
- rt = rtalloc1((struct sockaddr *)&nam, 0, 0);
- if (rt == NULL)
+ if (fib4_lookup_nh_basic(RT_DEFAULT_FIB, nam.sin_addr, 0, 0, &nh4) != 0)
REJECT_PASS_ACCEPT();
else {
- struct sockaddr *nexthop;
-
- RT_UNLOCK(rt);
- nexthop = rt->rt_flags & RTF_GATEWAY ? rt->rt_gateway :
- (struct sockaddr *)&nam;
- if (rt->rt_ifp == ifp)
- e = t3_l2t_get(pi, rt->rt_ifp, nexthop);
- RTFREE(rt);
+ nam.sin_addr = nh4.nh_addr;
+ if (nh4.nh_ifp == ifp)
+ e = t3_l2t_get(pi, ifp, (struct sockaddr *)&nam);
if (e == NULL)
REJECT_PASS_ACCEPT(); /* no l2te, or ifp mismatch */
}
diff --git a/sys/dev/cxgbe/iw_cxgbe/cm.c b/sys/dev/cxgbe/iw_cxgbe/cm.c
index cb4be71..8af7df5 100644
--- a/sys/dev/cxgbe/iw_cxgbe/cm.c
+++ b/sys/dev/cxgbe/iw_cxgbe/cm.c
@@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$");
#include <netinet/in_systm.h>
#include <netinet/in_pcb.h>
#include <netinet/ip.h>
+#include <netinet/in_fib.h>
#include <netinet/ip_var.h>
#include <netinet/tcp_var.h>
#include <netinet/tcp.h>
@@ -86,8 +87,8 @@ static void __state_set(struct c4iw_ep_common *epc, enum c4iw_ep_state tostate);
static void state_set(struct c4iw_ep_common *epc, enum c4iw_ep_state tostate);
static void *alloc_ep(int size, gfp_t flags);
void __free_ep(struct c4iw_ep_common *epc);
-static struct rtentry * find_route(__be32 local_ip, __be32 peer_ip, __be16 local_port,
- __be16 peer_port, u8 tos);
+static int find_route(__be32 local_ip, __be32 peer_ip, __be16 local_port,
+ __be16 peer_port, u8 tos, struct nhop4_extended *pnh4);
static int close_socket(struct c4iw_ep_common *epc, int close);
static int shutdown_socket(struct c4iw_ep_common *epc);
static void abort_socket(struct c4iw_ep *ep);
@@ -201,23 +202,21 @@ done:
}
-static struct rtentry *
+static int
find_route(__be32 local_ip, __be32 peer_ip, __be16 local_port,
- __be16 peer_port, u8 tos)
+ __be16 peer_port, u8 tos, struct nhop4_extended *pnh4)
{
- struct route iproute;
- struct sockaddr_in *dst = (struct sockaddr_in *)&iproute.ro_dst;
+ struct in_addr addr;
+ int err;
CTR5(KTR_IW_CXGBE, "%s:frtB %x, %x, %d, %d", __func__, local_ip,
peer_ip, ntohs(local_port), ntohs(peer_port));
- bzero(&iproute, sizeof iproute);
- dst->sin_family = AF_INET;
- dst->sin_len = sizeof *dst;
- dst->sin_addr.s_addr = peer_ip;
-
- rtalloc(&iproute);
- CTR2(KTR_IW_CXGBE, "%s:frtE %p", __func__, (uint64_t)iproute.ro_rt);
- return iproute.ro_rt;
+
+ addr.s_addr = peer_ip;
+ err = fib4_lookup_nh_ext(RT_DEFAULT_FIB, addr, NHR_REF, 0, pnh4);
+
+ CTR2(KTR_IW_CXGBE, "%s:frtE %d", __func__, err);
+ return err;
}
static int
@@ -2012,7 +2011,7 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
int err = 0;
struct c4iw_dev *dev = to_c4iw_dev(cm_id->device);
struct c4iw_ep *ep = NULL;
- struct rtentry *rt;
+ struct nhop4_extended nh4;
struct toedev *tdev;
CTR2(KTR_IW_CXGBE, "%s:ccB %p", __func__, cm_id);
@@ -2068,13 +2067,13 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
init_sock(&ep->com);
/* find a route */
- rt = find_route(
+ err = find_route(
cm_id->local_addr.sin_addr.s_addr,
cm_id->remote_addr.sin_addr.s_addr,
cm_id->local_addr.sin_port,
- cm_id->remote_addr.sin_port, 0);
+ cm_id->remote_addr.sin_port, 0, &nh4);
- if (!rt) {
+ if (err) {
CTR2(KTR_IW_CXGBE, "%s:cc7 %p", __func__, ep);
printk(KERN_ERR MOD "%s - cannot find route.\n", __func__);
@@ -2082,7 +2081,7 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
goto fail2;
}
- if (!(rt->rt_ifp->if_capenable & IFCAP_TOE)) {
+ if (!(nh4.nh_ifp->if_capenable & IFCAP_TOE)) {
CTR2(KTR_IW_CXGBE, "%s:cc8 %p", __func__, ep);
printf("%s - interface not TOE capable.\n", __func__);
@@ -2090,7 +2089,7 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
err = -ENOPROTOOPT;
goto fail3;
}
- tdev = TOEDEV(rt->rt_ifp);
+ tdev = TOEDEV(nh4.nh_ifp);
if (tdev == NULL) {
@@ -2098,7 +2097,7 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
printf("%s - No toedev for interface.\n", __func__);
goto fail3;
}
- RTFREE(rt);
+ fib4_free_nh_ext(RT_DEFAULT_FIB, &nh4);
state_set(&ep->com, CONNECTING);
ep->tos = 0;
@@ -2117,7 +2116,7 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
fail3:
CTR2(KTR_IW_CXGBE, "%s:ccb %p", __func__, ep);
- RTFREE(rt);
+ fib4_free_nh_ext(RT_DEFAULT_FIB, &nh4);
fail2:
cm_id->rem_ref(cm_id);
c4iw_put_ep(&ep->com);
diff --git a/sys/dev/cxgbe/tom/t4_cpl_io.c b/sys/dev/cxgbe/tom/t4_cpl_io.c
index d58592e..f18f115 100644
--- a/sys/dev/cxgbe/tom/t4_cpl_io.c
+++ b/sys/dev/cxgbe/tom/t4_cpl_io.c
@@ -221,7 +221,7 @@ assign_rxopt(struct tcpcb *tp, unsigned int opt)
n = sizeof(struct ip6_hdr) + sizeof(struct tcphdr);
else
n = sizeof(struct ip) + sizeof(struct tcphdr);
- tp->t_maxseg = tp->t_maxopd = sc->params.mtus[G_TCPOPT_MSS(opt)] - n;
+ tp->t_maxseg = sc->params.mtus[G_TCPOPT_MSS(opt)] - n;
CTR4(KTR_CXGBE, "%s: tid %d, mtu_idx %u (%u)", __func__, toep->tid,
G_TCPOPT_MSS(opt), sc->params.mtus[G_TCPOPT_MSS(opt)]);
@@ -230,7 +230,6 @@ assign_rxopt(struct tcpcb *tp, unsigned int opt)
tp->t_flags |= TF_RCVD_TSTMP; /* timestamps ok */
tp->ts_recent = 0; /* hmmm */
tp->ts_recent_age = tcp_ts_getticks();
- tp->t_maxseg -= TCPOLEN_TSTAMP_APPA;
}
if (G_TCPOPT_SACK(opt))
diff --git a/sys/dev/cxgbe/tom/t4_listen.c b/sys/dev/cxgbe/tom/t4_listen.c
index 187a9f8..5af9260 100644
--- a/sys/dev/cxgbe/tom/t4_listen.c
+++ b/sys/dev/cxgbe/tom/t4_listen.c
@@ -49,9 +49,11 @@ __FBSDID("$FreeBSD$");
#include <net/if_vlan_var.h>
#include <net/route.h>
#include <netinet/in.h>
+#include <netinet/in_fib.h>
#include <netinet/in_pcb.h>
#include <netinet/ip.h>
#include <netinet/ip6.h>
+#include <netinet6/in6_fib.h>
#include <netinet6/scope6_var.h>
#include <netinet/tcp_timer.h>
#include <netinet/tcp_var.h>
@@ -1095,46 +1097,44 @@ static struct l2t_entry *
get_l2te_for_nexthop(struct port_info *pi, struct ifnet *ifp,
struct in_conninfo *inc)
{
- struct rtentry *rt;
struct l2t_entry *e;
struct sockaddr_in6 sin6;
struct sockaddr *dst = (void *)&sin6;
if (inc->inc_flags & INC_ISIPV6) {
+ struct nhop6_basic nh6;
+
+ bzero(dst, sizeof(struct sockaddr_in6));
dst->sa_len = sizeof(struct sockaddr_in6);
dst->sa_family = AF_INET6;
- ((struct sockaddr_in6 *)dst)->sin6_addr = inc->inc6_faddr;
if (IN6_IS_ADDR_LINKLOCAL(&inc->inc6_laddr)) {
/* no need for route lookup */
e = t4_l2t_get(pi, ifp, dst);
return (e);
}
+
+ if (fib6_lookup_nh_basic(RT_DEFAULT_FIB, &inc->inc6_faddr,
+ 0, 0, 0, &nh6) != 0)
+ return (NULL);
+ if (nh6.nh_ifp != ifp)
+ return (NULL);
+ ((struct sockaddr_in6 *)dst)->sin6_addr = nh6.nh_addr;
} else {
+ struct nhop4_basic nh4;
+
dst->sa_len = sizeof(struct sockaddr_in);
dst->sa_family = AF_INET;
- ((struct sockaddr_in *)dst)->sin_addr = inc->inc_faddr;
- }
- rt = rtalloc1(dst, 0, 0);
- if (rt == NULL)
- return (NULL);
- else {
- struct sockaddr *nexthop;
-
- RT_UNLOCK(rt);
- if (rt->rt_ifp != ifp)
- e = NULL;
- else {
- if (rt->rt_flags & RTF_GATEWAY)
- nexthop = rt->rt_gateway;
- else
- nexthop = dst;
- e = t4_l2t_get(pi, ifp, nexthop);
- }
- RTFREE(rt);
+ if (fib4_lookup_nh_basic(RT_DEFAULT_FIB, inc->inc_faddr, 0, 0,
+ &nh4) != 0)
+ return (NULL);
+ if (nh4.nh_ifp != ifp)
+ return (NULL);
+ ((struct sockaddr_in *)dst)->sin_addr = nh4.nh_addr;
}
+ e = t4_l2t_get(pi, ifp, dst);
return (e);
}
diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c
index d9b3ca5..f586d39 100644
--- a/sys/dev/e1000/if_em.c
+++ b/sys/dev/e1000/if_em.c
@@ -260,7 +260,9 @@ static bool em_rxeof(struct rx_ring *, int, int *);
#ifndef __NO_STRICT_ALIGNMENT
static int em_fixup_rx(struct rx_ring *);
#endif
-static void em_receive_checksum(struct e1000_rx_desc *, struct mbuf *);
+static void em_setup_rxdesc(union e1000_rx_desc_extended *,
+ const struct em_rxbuffer *rxbuf);
+static void em_receive_checksum(uint32_t status, struct mbuf *);
static void em_transmit_checksum_setup(struct tx_ring *, struct mbuf *, int,
struct ip *, u32 *, u32 *);
static void em_tso_setup(struct tx_ring *, struct mbuf *, int, struct ip *,
@@ -631,7 +633,7 @@ em_attach(device_t dev)
} else
adapter->num_tx_desc = em_txd;
- if (((em_rxd * sizeof(struct e1000_rx_desc)) % EM_DBA_ALIGN) != 0 ||
+ if (((em_rxd * sizeof(union e1000_rx_desc_extended)) % EM_DBA_ALIGN) != 0 ||
(em_rxd > EM_MAX_RXD) || (em_rxd < EM_MIN_RXD)) {
device_printf(dev, "Using %d RX descriptors instead of %d!\n",
EM_DEFAULT_RXD, em_rxd);
@@ -1872,7 +1874,7 @@ em_xmit(struct tx_ring *txr, struct mbuf **m_headp)
struct adapter *adapter = txr->adapter;
bus_dma_segment_t segs[EM_MAX_SCATTER];
bus_dmamap_t map;
- struct em_buffer *tx_buffer, *tx_buffer_mapped;
+ struct em_txbuffer *tx_buffer, *tx_buffer_mapped;
struct e1000_tx_desc *ctxd = NULL;
struct mbuf *m_head;
struct ether_header *eh;
@@ -3296,7 +3298,7 @@ em_allocate_queues(struct adapter *adapter)
* Next the RX queues...
*/
rsize = roundup2(adapter->num_rx_desc *
- sizeof(struct e1000_rx_desc), EM_DBA_ALIGN);
+ sizeof(union e1000_rx_desc_extended), EM_DBA_ALIGN);
for (int i = 0; i < adapter->num_queues; i++, rxconf++) {
rxr = &adapter->rx_rings[i];
rxr->adapter = adapter;
@@ -3314,7 +3316,7 @@ em_allocate_queues(struct adapter *adapter)
error = ENOMEM;
goto err_rx_desc;
}
- rxr->rx_base = (struct e1000_rx_desc *)rxr->rxdma.dma_vaddr;
+ rxr->rx_base = (union e1000_rx_desc_extended *)rxr->rxdma.dma_vaddr;
bzero((void *)rxr->rx_base, rsize);
/* Allocate receive buffers for the ring*/
@@ -3357,7 +3359,7 @@ em_allocate_transmit_buffers(struct tx_ring *txr)
{
struct adapter *adapter = txr->adapter;
device_t dev = adapter->dev;
- struct em_buffer *txbuf;
+ struct em_txbuffer *txbuf;
int error, i;
/*
@@ -3380,7 +3382,7 @@ em_allocate_transmit_buffers(struct tx_ring *txr)
}
if (!(txr->tx_buffers =
- (struct em_buffer *) malloc(sizeof(struct em_buffer) *
+ (struct em_txbuffer *) malloc(sizeof(struct em_txbuffer) *
adapter->num_tx_desc, M_DEVBUF, M_NOWAIT | M_ZERO))) {
device_printf(dev, "Unable to allocate tx_buffer memory\n");
error = ENOMEM;
@@ -3413,7 +3415,7 @@ static void
em_setup_transmit_ring(struct tx_ring *txr)
{
struct adapter *adapter = txr->adapter;
- struct em_buffer *txbuf;
+ struct em_txbuffer *txbuf;
int i;
#ifdef DEV_NETMAP
struct netmap_slot *slot;
@@ -3632,7 +3634,7 @@ static void
em_free_transmit_buffers(struct tx_ring *txr)
{
struct adapter *adapter = txr->adapter;
- struct em_buffer *txbuf;
+ struct em_txbuffer *txbuf;
INIT_DEBUGOUT("free_transmit_ring: begin");
@@ -3699,7 +3701,7 @@ em_transmit_checksum_setup(struct tx_ring *txr, struct mbuf *mp, int ip_off,
{
struct adapter *adapter = txr->adapter;
struct e1000_context_desc *TXD = NULL;
- struct em_buffer *tx_buffer;
+ struct em_txbuffer *tx_buffer;
int cur, hdr_len;
u32 cmd = 0;
u16 offload = 0;
@@ -3733,29 +3735,38 @@ em_transmit_checksum_setup(struct tx_ring *txr, struct mbuf *mp, int ip_off,
offload |= CSUM_TCP;
tucss = hdr_len;
tucso = hdr_len + offsetof(struct tcphdr, th_sum);
- /*
- * Setting up new checksum offload context for every frames
- * takes a lot of processing time for hardware. This also
- * reduces performance a lot for small sized frames so avoid
- * it if driver can use previously configured checksum
- * offload context.
- */
- if (txr->last_hw_offload == offload) {
- if (offload & CSUM_IP) {
- if (txr->last_hw_ipcss == ipcss &&
- txr->last_hw_ipcso == ipcso &&
- txr->last_hw_tucss == tucss &&
- txr->last_hw_tucso == tucso)
- return;
- } else {
- if (txr->last_hw_tucss == tucss &&
- txr->last_hw_tucso == tucso)
- return;
- }
- }
- txr->last_hw_offload = offload;
- txr->last_hw_tucss = tucss;
- txr->last_hw_tucso = tucso;
+ /*
+ * The 82574L can only remember the *last* context used
+ * regardless of queue that it was use for. We cannot reuse
+ * contexts on this hardware platform and must generate a new
+ * context every time. 82574L hardware spec, section 7.2.6,
+ * second note.
+ */
+ if (adapter->num_queues < 2) {
+ /*
+ * Setting up new checksum offload context for every
+ * frames takes a lot of processing time for hardware.
+ * This also reduces performance a lot for small sized
+ * frames so avoid it if driver can use previously
+ * configured checksum offload context.
+ */
+ if (txr->last_hw_offload == offload) {
+ if (offload & CSUM_IP) {
+ if (txr->last_hw_ipcss == ipcss &&
+ txr->last_hw_ipcso == ipcso &&
+ txr->last_hw_tucss == tucss &&
+ txr->last_hw_tucso == tucso)
+ return;
+ } else {
+ if (txr->last_hw_tucss == tucss &&
+ txr->last_hw_tucso == tucso)
+ return;
+ }
+ }
+ txr->last_hw_offload = offload;
+ txr->last_hw_tucss = tucss;
+ txr->last_hw_tucso = tucso;
+ }
/*
* Start offset for payload checksum calculation.
* End offset for payload checksum calculation.
@@ -3771,29 +3782,38 @@ em_transmit_checksum_setup(struct tx_ring *txr, struct mbuf *mp, int ip_off,
*txd_upper |= E1000_TXD_POPTS_TXSM << 8;
tucss = hdr_len;
tucso = hdr_len + offsetof(struct udphdr, uh_sum);
- /*
- * Setting up new checksum offload context for every frames
- * takes a lot of processing time for hardware. This also
- * reduces performance a lot for small sized frames so avoid
- * it if driver can use previously configured checksum
- * offload context.
- */
- if (txr->last_hw_offload == offload) {
- if (offload & CSUM_IP) {
- if (txr->last_hw_ipcss == ipcss &&
- txr->last_hw_ipcso == ipcso &&
- txr->last_hw_tucss == tucss &&
- txr->last_hw_tucso == tucso)
- return;
- } else {
- if (txr->last_hw_tucss == tucss &&
- txr->last_hw_tucso == tucso)
- return;
+ /*
+ * The 82574L can only remember the *last* context used
+ * regardless of queue that it was use for. We cannot reuse
+ * contexts on this hardware platform and must generate a new
+ * context every time. 82574L hardware spec, section 7.2.6,
+ * second note.
+ */
+ if (adapter->num_queues < 2) {
+ /*
+ * Setting up new checksum offload context for every
+ * frames takes a lot of processing time for hardware.
+ * This also reduces performance a lot for small sized
+ * frames so avoid it if driver can use previously
+ * configured checksum offload context.
+ */
+ if (txr->last_hw_offload == offload) {
+ if (offload & CSUM_IP) {
+ if (txr->last_hw_ipcss == ipcss &&
+ txr->last_hw_ipcso == ipcso &&
+ txr->last_hw_tucss == tucss &&
+ txr->last_hw_tucso == tucso)
+ return;
+ } else {
+ if (txr->last_hw_tucss == tucss &&
+ txr->last_hw_tucso == tucso)
+ return;
+ }
}
- }
- txr->last_hw_offload = offload;
- txr->last_hw_tucss = tucss;
- txr->last_hw_tucso = tucso;
+ txr->last_hw_offload = offload;
+ txr->last_hw_tucss = tucss;
+ txr->last_hw_tucso = tucso;
+ }
/*
* Start offset for header checksum calculation.
* End offset for header checksum calculation.
@@ -3836,7 +3856,7 @@ em_tso_setup(struct tx_ring *txr, struct mbuf *mp, int ip_off,
{
struct adapter *adapter = txr->adapter;
struct e1000_context_desc *TXD;
- struct em_buffer *tx_buffer;
+ struct em_txbuffer *tx_buffer;
int cur, hdr_len;
/*
@@ -3914,7 +3934,7 @@ em_txeof(struct tx_ring *txr)
{
struct adapter *adapter = txr->adapter;
int first, last, done, processed;
- struct em_buffer *tx_buffer;
+ struct em_txbuffer *tx_buffer;
struct e1000_tx_desc *tx_desc, *eop_desc;
if_t ifp = adapter->ifp;
@@ -4020,7 +4040,6 @@ em_txeof(struct tx_ring *txr)
txr->busy = EM_TX_IDLE;
}
-
/*********************************************************************
*
* Refresh RX descriptor mbufs from system mbuf buffer pool.
@@ -4031,8 +4050,8 @@ em_refresh_mbufs(struct rx_ring *rxr, int limit)
{
struct adapter *adapter = rxr->adapter;
struct mbuf *m;
- bus_dma_segment_t segs[1];
- struct em_buffer *rxbuf;
+ bus_dma_segment_t segs;
+ struct em_rxbuffer *rxbuf;
int i, j, error, nsegs;
bool cleaned = FALSE;
@@ -4067,7 +4086,7 @@ em_refresh_mbufs(struct rx_ring *rxr, int limit)
/* Use bus_dma machinery to setup the memory mapping */
error = bus_dmamap_load_mbuf_sg(rxr->rxtag, rxbuf->map,
- m, segs, &nsegs, BUS_DMA_NOWAIT);
+ m, &segs, &nsegs, BUS_DMA_NOWAIT);
if (error != 0) {
printf("Refresh mbufs: hdr dmamap load"
" failure - %d\n", error);
@@ -4076,9 +4095,10 @@ em_refresh_mbufs(struct rx_ring *rxr, int limit)
goto update;
}
rxbuf->m_head = m;
+ rxbuf->paddr = segs.ds_addr;
bus_dmamap_sync(rxr->rxtag,
rxbuf->map, BUS_DMASYNC_PREREAD);
- rxr->rx_base[i].buffer_addr = htole64(segs[0].ds_addr);
+ em_setup_rxdesc(&rxr->rx_base[i], rxbuf);
cleaned = TRUE;
i = j; /* Next is precalulated for us */
@@ -4113,10 +4133,10 @@ em_allocate_receive_buffers(struct rx_ring *rxr)
{
struct adapter *adapter = rxr->adapter;
device_t dev = adapter->dev;
- struct em_buffer *rxbuf;
+ struct em_rxbuffer *rxbuf;
int error;
- rxr->rx_buffers = malloc(sizeof(struct em_buffer) *
+ rxr->rx_buffers = malloc(sizeof(struct em_rxbuffer) *
adapter->num_rx_desc, M_DEVBUF, M_NOWAIT | M_ZERO);
if (rxr->rx_buffers == NULL) {
device_printf(dev, "Unable to allocate rx_buffer memory\n");
@@ -4169,7 +4189,7 @@ static int
em_setup_receive_ring(struct rx_ring *rxr)
{
struct adapter *adapter = rxr->adapter;
- struct em_buffer *rxbuf;
+ struct em_rxbuffer *rxbuf;
bus_dma_segment_t seg[1];
int rsize, nsegs, error = 0;
#ifdef DEV_NETMAP
@@ -4181,7 +4201,7 @@ em_setup_receive_ring(struct rx_ring *rxr)
/* Clear the ring contents */
EM_RX_LOCK(rxr);
rsize = roundup2(adapter->num_rx_desc *
- sizeof(struct e1000_rx_desc), EM_DBA_ALIGN);
+ sizeof(union e1000_rx_desc_extended), EM_DBA_ALIGN);
bzero((void *)rxr->rx_base, rsize);
#ifdef DEV_NETMAP
slot = netmap_reset(na, NR_RX, rxr->me, 0);
@@ -4212,8 +4232,7 @@ em_setup_receive_ring(struct rx_ring *rxr)
addr = PNMB(na, slot + si, &paddr);
netmap_load_map(na, rxr->rxtag, rxbuf->map, addr);
- /* Update descriptor */
- rxr->rx_base[j].buffer_addr = htole64(paddr);
+ em_setup_rxdesc(&rxr->rx_base[j], rxbuf);
continue;
}
#endif /* DEV_NETMAP */
@@ -4239,8 +4258,8 @@ em_setup_receive_ring(struct rx_ring *rxr)
bus_dmamap_sync(rxr->rxtag,
rxbuf->map, BUS_DMASYNC_PREREAD);
- /* Update descriptor */
- rxr->rx_base[j].buffer_addr = htole64(seg[0].ds_addr);
+ rxbuf->paddr = seg[0].ds_addr;
+ em_setup_rxdesc(&rxr->rx_base[j], rxbuf);
}
rxr->next_to_check = 0;
rxr->next_to_refresh = 0;
@@ -4277,7 +4296,7 @@ fail:
for (int i = 0; i < q; ++i) {
rxr = &adapter->rx_rings[i];
for (int n = 0; n < adapter->num_rx_desc; n++) {
- struct em_buffer *rxbuf;
+ struct em_rxbuffer *rxbuf;
rxbuf = &rxr->rx_buffers[n];
if (rxbuf->m_head != NULL) {
bus_dmamap_sync(rxr->rxtag, rxbuf->map,
@@ -4324,7 +4343,7 @@ static void
em_free_receive_buffers(struct rx_ring *rxr)
{
struct adapter *adapter = rxr->adapter;
- struct em_buffer *rxbuf = NULL;
+ struct em_rxbuffer *rxbuf = NULL;
INIT_DEBUGOUT("free_receive_buffers: begin");
@@ -4366,11 +4385,10 @@ em_free_receive_buffers(struct rx_ring *rxr)
static void
em_initialize_receive_unit(struct adapter *adapter)
{
- struct rx_ring *rxr = adapter->rx_rings;
+ struct rx_ring *rxr = adapter->rx_rings;
if_t ifp = adapter->ifp;
struct e1000_hw *hw = &adapter->hw;
- u64 bus_addr;
- u32 rctl, rxcsum;
+ u32 rctl, rxcsum, rfctl;
INIT_DEBUGOUT("em_initialize_receive_units: begin");
@@ -4383,6 +4401,25 @@ em_initialize_receive_unit(struct adapter *adapter)
if ((hw->mac.type != e1000_82574) && (hw->mac.type != e1000_82583))
E1000_WRITE_REG(hw, E1000_RCTL, rctl & ~E1000_RCTL_EN);
+ /* Setup the Receive Control Register */
+ rctl &= ~(3 << E1000_RCTL_MO_SHIFT);
+ rctl |= E1000_RCTL_EN | E1000_RCTL_BAM |
+ E1000_RCTL_LBM_NO | E1000_RCTL_RDMTS_HALF |
+ (hw->mac.mc_filter_type << E1000_RCTL_MO_SHIFT);
+
+ /* Do not store bad packets */
+ rctl &= ~E1000_RCTL_SBP;
+
+ /* Enable Long Packet receive */
+ if (if_getmtu(ifp) > ETHERMTU)
+ rctl |= E1000_RCTL_LPE;
+ else
+ rctl &= ~E1000_RCTL_LPE;
+
+ /* Strip the CRC */
+ if (!em_disable_crc_stripping)
+ rctl |= E1000_RCTL_SECRC;
+
E1000_WRITE_REG(&adapter->hw, E1000_RADV,
adapter->rx_abs_int_delay.value);
@@ -4394,20 +4431,21 @@ em_initialize_receive_unit(struct adapter *adapter)
*/
E1000_WRITE_REG(hw, E1000_ITR, DEFAULT_ITR);
+ /* Use extended rx descriptor formats */
+ rfctl = E1000_READ_REG(hw, E1000_RFCTL);
+ rfctl |= E1000_RFCTL_EXTEN;
/*
** When using MSIX interrupts we need to throttle
** using the EITR register (82574 only)
*/
if (hw->mac.type == e1000_82574) {
- u32 rfctl;
for (int i = 0; i < 4; i++)
E1000_WRITE_REG(hw, E1000_EITR_82574(i),
DEFAULT_ITR);
/* Disable accelerated acknowledge */
- rfctl = E1000_READ_REG(hw, E1000_RFCTL);
rfctl |= E1000_RFCTL_ACK_DIS;
- E1000_WRITE_REG(hw, E1000_RFCTL, rfctl);
}
+ E1000_WRITE_REG(hw, E1000_RFCTL, rfctl);
rxcsum = E1000_READ_REG(hw, E1000_RXCSUM);
if (if_getcapenable(ifp) & IFCAP_RXCSUM) {
@@ -4424,38 +4462,44 @@ em_initialize_receive_unit(struct adapter *adapter)
E1000_WRITE_REG(hw, E1000_RXCSUM, rxcsum);
#ifdef EM_MULTIQUEUE
+#define RSSKEYLEN 10
if (adapter->num_queues > 1) {
- uint32_t rss_key[10];
- uint32_t reta;
+ uint8_t rss_key[4 * RSSKEYLEN];
+ uint32_t reta = 0;
int i;
/*
* Configure RSS key
*/
arc4rand(rss_key, sizeof(rss_key), 0);
- for (i = 0; i < 10; ++i)
- E1000_WRITE_REG_ARRAY(hw,E1000_RSSRK(0), i, rss_key[i]);
+ for (i = 0; i < RSSKEYLEN; ++i) {
+ uint32_t rssrk = 0;
+
+ rssrk = EM_RSSRK_VAL(rss_key, i);
+ E1000_WRITE_REG(hw,E1000_RSSRK(i), rssrk);
+ }
/*
* Configure RSS redirect table in following fashion:
* (hash & ring_cnt_mask) == rdr_table[(hash & rdr_table_mask)]
*/
- reta = 0;
- for (i = 0; i < 4; ++i) {
+ for (i = 0; i < sizeof(reta); ++i) {
uint32_t q;
+
q = (i % adapter->num_queues) << 7;
reta |= q << (8 * i);
}
- for (i = 0; i < 32; ++i)
+
+ for (i = 0; i < 32; ++i) {
E1000_WRITE_REG(hw, E1000_RETA(i), reta);
+ }
E1000_WRITE_REG(hw, E1000_MRQC, E1000_MRQC_RSS_ENABLE_2Q |
E1000_MRQC_RSS_FIELD_IPV4_TCP |
E1000_MRQC_RSS_FIELD_IPV4 |
E1000_MRQC_RSS_FIELD_IPV6_TCP_EX |
E1000_MRQC_RSS_FIELD_IPV6_EX |
- E1000_MRQC_RSS_FIELD_IPV6 |
- E1000_MRQC_RSS_FIELD_IPV6_TCP);
+ E1000_MRQC_RSS_FIELD_IPV6);
}
#endif
/*
@@ -4470,11 +4514,11 @@ em_initialize_receive_unit(struct adapter *adapter)
for (int i = 0; i < adapter->num_queues; i++, rxr++) {
/* Setup the Base and Length of the Rx Descriptor Ring */
+ u64 bus_addr = rxr->rxdma.dma_paddr;
u32 rdt = adapter->num_rx_desc - 1; /* default */
- bus_addr = rxr->rxdma.dma_paddr;
E1000_WRITE_REG(hw, E1000_RDLEN(i),
- adapter->num_rx_desc * sizeof(struct e1000_rx_desc));
+ adapter->num_rx_desc * sizeof(union e1000_rx_desc_extended));
E1000_WRITE_REG(hw, E1000_RDBAH(i), (u32)(bus_addr >> 32));
E1000_WRITE_REG(hw, E1000_RDBAL(i), (u32)bus_addr);
/* Setup the Head and Tail Descriptor Pointers */
@@ -4505,14 +4549,13 @@ em_initialize_receive_unit(struct adapter *adapter)
(if_getmtu(ifp) > ETHERMTU)) {
u32 rxdctl = E1000_READ_REG(hw, E1000_RXDCTL(0));
E1000_WRITE_REG(hw, E1000_RXDCTL(0), rxdctl | 3);
- } else if ((adapter->hw.mac.type == e1000_82574) &&
- (if_getmtu(ifp) > ETHERMTU)) {
+ } else if (adapter->hw.mac.type == e1000_82574) {
for (int i = 0; i < adapter->num_queues; i++) {
u32 rxdctl = E1000_READ_REG(hw, E1000_RXDCTL(i));
- rxdctl |= 0x20; /* PTHRESH */
- rxdctl |= 4 << 8; /* HTHRESH */
- rxdctl |= 4 << 16;/* WTHRESH */
+ rxdctl |= 0x20; /* PTHRESH */
+ rxdctl |= 4 << 8; /* HTHRESH */
+ rxdctl |= 4 << 16;/* WTHRESH */
rxdctl |= 1 << 24; /* Switch to granularity */
E1000_WRITE_REG(hw, E1000_RXDCTL(i), rxdctl);
}
@@ -4525,19 +4568,8 @@ em_initialize_receive_unit(struct adapter *adapter)
e1000_lv_jumbo_workaround_ich8lan(hw, FALSE);
}
- /* Setup the Receive Control Register */
- rctl &= ~(3 << E1000_RCTL_MO_SHIFT);
- rctl |= E1000_RCTL_EN | E1000_RCTL_BAM |
- E1000_RCTL_LBM_NO | E1000_RCTL_RDMTS_HALF |
- (hw->mac.mc_filter_type << E1000_RCTL_MO_SHIFT);
-
- /* Strip the CRC */
- if (!em_disable_crc_stripping)
- rctl |= E1000_RCTL_SECRC;
-
/* Make sure VLAN Filters are off */
rctl &= ~E1000_RCTL_VFE;
- rctl &= ~E1000_RCTL_SBP;
if (adapter->rx_mbuf_sz == MCLBYTES)
rctl |= E1000_RCTL_SZ_2048;
@@ -4546,11 +4578,8 @@ em_initialize_receive_unit(struct adapter *adapter)
else if (adapter->rx_mbuf_sz > MJUMPAGESIZE)
rctl |= E1000_RCTL_SZ_8192 | E1000_RCTL_BSEX;
- if (if_getmtu(ifp) > ETHERMTU)
- rctl |= E1000_RCTL_LPE;
- else
- rctl &= ~E1000_RCTL_LPE;
-
+ /* ensure we clear use DTYPE of 00 here */
+ rctl &= ~0x00000C00;
/* Write out the settings */
E1000_WRITE_REG(hw, E1000_RCTL, rctl);
@@ -4575,11 +4604,11 @@ em_rxeof(struct rx_ring *rxr, int count, int *done)
struct adapter *adapter = rxr->adapter;
if_t ifp = adapter->ifp;
struct mbuf *mp, *sendmp;
- u8 status = 0;
+ u32 status = 0;
u16 len;
int i, processed, rxdone = 0;
bool eop;
- struct e1000_rx_desc *cur;
+ union e1000_rx_desc_extended *cur;
EM_RX_LOCK(rxr);
@@ -4596,21 +4625,20 @@ em_rxeof(struct rx_ring *rxr, int count, int *done)
#endif /* DEV_NETMAP */
for (i = rxr->next_to_check, processed = 0; count != 0;) {
-
if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0)
break;
cur = &rxr->rx_base[i];
- status = cur->status;
+ status = le32toh(cur->wb.upper.status_error);
mp = sendmp = NULL;
if ((status & E1000_RXD_STAT_DD) == 0)
break;
- len = le16toh(cur->length);
+ len = le16toh(cur->wb.upper.length);
eop = (status & E1000_RXD_STAT_EOP) != 0;
- if ((cur->errors & E1000_RXD_ERR_FRAME_ERR_MASK) ||
+ if ((status & E1000_RXDEXT_ERR_FRAME_ERR_MASK) ||
(rxr->discard == TRUE)) {
adapter->dropped_pkts++;
++rxr->rx_discarded;
@@ -4647,7 +4675,7 @@ em_rxeof(struct rx_ring *rxr, int count, int *done)
sendmp = rxr->fmp;
if_setrcvif(sendmp, ifp);
if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1);
- em_receive_checksum(cur, sendmp);
+ em_receive_checksum(status, sendmp);
#ifndef __NO_STRICT_ALIGNMENT
if (adapter->hw.mac.max_frame_size >
(MCLBYTES - ETHER_ALIGN) &&
@@ -4656,7 +4684,7 @@ em_rxeof(struct rx_ring *rxr, int count, int *done)
#endif
if (status & E1000_RXD_STAT_VP) {
if_setvtag(sendmp,
- le16toh(cur->special));
+ le16toh(cur->wb.upper.vlan));
sendmp->m_flags |= M_VLANTAG;
}
#ifndef __NO_STRICT_ALIGNMENT
@@ -4670,7 +4698,7 @@ next_desc:
BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
/* Zero out the receive descriptors status. */
- cur->status = 0;
+ cur->wb.upper.status_error &= htole32(~0xFF);
++rxdone; /* cumulative for POLL */
++processed;
@@ -4709,7 +4737,7 @@ next_desc:
static __inline void
em_rx_discard(struct rx_ring *rxr, int i)
{
- struct em_buffer *rbuf;
+ struct em_rxbuffer *rbuf;
rbuf = &rxr->rx_buffers[i];
bus_dmamap_unload(rxr->rxtag, rbuf->map);
@@ -4781,6 +4809,14 @@ em_fixup_rx(struct rx_ring *rxr)
}
#endif
+static void
+em_setup_rxdesc(union e1000_rx_desc_extended *rxd, const struct em_rxbuffer *rxbuf)
+{
+ rxd->read.buffer_addr = htole64(rxbuf->paddr);
+ /* DD bits must be cleared */
+ rxd->wb.upper.status_error= 0;
+}
+
/*********************************************************************
*
* Verify that the hardware indicated that the checksum is valid.
@@ -4789,23 +4825,27 @@ em_fixup_rx(struct rx_ring *rxr)
*
*********************************************************************/
static void
-em_receive_checksum(struct e1000_rx_desc *rx_desc, struct mbuf *mp)
+em_receive_checksum(uint32_t status, struct mbuf *mp)
{
mp->m_pkthdr.csum_flags = 0;
/* Ignore Checksum bit is set */
- if (rx_desc->status & E1000_RXD_STAT_IXSM)
- return;
-
- if (rx_desc->errors & (E1000_RXD_ERR_TCPE | E1000_RXD_ERR_IPE))
+ if (status & E1000_RXD_STAT_IXSM)
return;
- /* IP Checksum Good? */
- if (rx_desc->status & E1000_RXD_STAT_IPCS)
+ /* If the IP checksum exists and there is no IP Checksum error */
+ if ((status & (E1000_RXD_STAT_IPCS | E1000_RXDEXT_STATERR_IPE)) ==
+ E1000_RXD_STAT_IPCS) {
mp->m_pkthdr.csum_flags = (CSUM_IP_CHECKED | CSUM_IP_VALID);
+ }
/* TCP or UDP checksum */
- if (rx_desc->status & (E1000_RXD_STAT_TCPCS | E1000_RXD_STAT_UDPCS)) {
+ if ((status & (E1000_RXD_STAT_TCPCS | E1000_RXDEXT_STATERR_TCPE)) ==
+ E1000_RXD_STAT_TCPCS) {
+ mp->m_pkthdr.csum_flags |= (CSUM_DATA_VALID | CSUM_PSEUDO_HDR);
+ mp->m_pkthdr.csum_data = htons(0xffff);
+ }
+ if (status & E1000_RXD_STAT_UDPCS) {
mp->m_pkthdr.csum_flags |= (CSUM_DATA_VALID | CSUM_PSEUDO_HDR);
mp->m_pkthdr.csum_data = htons(0xffff);
}
diff --git a/sys/dev/e1000/if_em.h b/sys/dev/e1000/if_em.h
index 8725de3..be9fdc9 100644
--- a/sys/dev/e1000/if_em.h
+++ b/sys/dev/e1000/if_em.h
@@ -330,7 +330,7 @@ struct tx_ring {
struct taskqueue *tq;
u32 next_avail_desc;
u32 next_to_clean;
- struct em_buffer *tx_buffers;
+ struct em_txbuffer *tx_buffers;
volatile u16 tx_avail;
u32 tx_tso; /* last tx was tso */
u16 last_hw_offload;
@@ -362,11 +362,11 @@ struct rx_ring {
u32 payload;
struct task rx_task;
struct taskqueue *tq;
- struct e1000_rx_desc *rx_base;
+ union e1000_rx_desc_extended *rx_base;
struct em_dma_alloc rxdma;
u32 next_to_refresh;
u32 next_to_check;
- struct em_buffer *rx_buffers;
+ struct em_rxbuffer *rx_buffers;
struct mbuf *fmp;
struct mbuf *lmp;
@@ -499,12 +499,19 @@ typedef struct _em_vendor_info_t {
unsigned int index;
} em_vendor_info_t;
-struct em_buffer {
+struct em_txbuffer {
int next_eop; /* Index of the desc to watch */
struct mbuf *m_head;
bus_dmamap_t map; /* bus_dma map for packet */
};
+struct em_rxbuffer {
+ int next_eop; /* Index of the desc to watch */
+ struct mbuf *m_head;
+ bus_dmamap_t map; /* bus_dma map for packet */
+ bus_addr_t paddr;
+};
+
/*
** Find the number of unrefreshed RX descriptors
@@ -541,4 +548,9 @@ e1000_rx_unrefreshed(struct rx_ring *rxr)
#define EM_TX_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->tx_mtx, MA_OWNED)
#define EM_RX_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->rx_mtx, MA_OWNED)
+#define EM_RSSRK_SIZE 4
+#define EM_RSSRK_VAL(key, i) (key[(i) * EM_RSSRK_SIZE] | \
+ key[(i) * EM_RSSRK_SIZE + 1] << 8 | \
+ key[(i) * EM_RSSRK_SIZE + 2] << 16 | \
+ key[(i) * EM_RSSRK_SIZE + 3] << 24)
#endif /* _EM_H_DEFINED_ */
diff --git a/sys/dev/if_ndis/if_ndis.c b/sys/dev/if_ndis/if_ndis.c
index bb1f19e..47594fc 100644
--- a/sys/dev/if_ndis/if_ndis.c
+++ b/sys/dev/if_ndis/if_ndis.c
@@ -724,8 +724,8 @@ ndis_80211attach(struct ndis_softc *sc)
ndis_80211_rates_ex rates;
struct ndis_80211_nettype_list *ntl;
uint32_t arg;
- int mode, i, r, len;
- uint8_t bands = 0;
+ int mode, i, r, len, nonettypes = 1;
+ uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)] = { 0 };
callout_init(&sc->ndis_scan_callout, 1);
@@ -751,8 +751,9 @@ ndis_80211attach(struct ndis_softc *sc)
for (i = 0; i < ntl->ntl_items; i++) {
mode = ndis_nettype_mode(ntl->ntl_type[i]);
if (mode) {
+ nonettypes = 0;
setbit(ic->ic_modecaps, mode);
- setbit(&bands, mode);
+ setbit(bands, mode);
} else
device_printf(sc->ndis_dev, "Unknown nettype %d\n",
ntl->ntl_type[i]);
@@ -760,9 +761,9 @@ ndis_80211attach(struct ndis_softc *sc)
free(ntl, M_DEVBUF);
nonettypes:
/* Default to 11b channels if the card did not supply any */
- if (bands == 0) {
+ if (nonettypes) {
setbit(ic->ic_modecaps, IEEE80211_MODE_11B);
- setbit(&bands, IEEE80211_MODE_11B);
+ setbit(bands, IEEE80211_MODE_11B);
}
len = sizeof(rates);
bzero((char *)&rates, len);
@@ -859,7 +860,7 @@ nonettypes:
#undef INCRATE
#undef TESTSETRATE
- ieee80211_init_channels(ic, NULL, &bands);
+ ieee80211_init_channels(ic, NULL, bands);
/*
* To test for WPA support, we need to see if we can
diff --git a/sys/dev/ioat/ioat.c b/sys/dev/ioat/ioat.c
index c93d1b5..7f14c3f 100644
--- a/sys/dev/ioat/ioat.c
+++ b/sys/dev/ioat/ioat.c
@@ -789,6 +789,21 @@ ioat_acquire(bus_dmaengine_t dmaengine)
CTR0(KTR_IOAT, __func__);
}
+int
+ioat_acquire_reserve(bus_dmaengine_t dmaengine, unsigned n, int mflags)
+{
+ struct ioat_softc *ioat;
+ int error;
+
+ ioat = to_ioat_softc(dmaengine);
+ ioat_acquire(dmaengine);
+
+ error = ioat_reserve_space(ioat, n, mflags);
+ if (error != 0)
+ ioat_release(dmaengine);
+ return (error);
+}
+
void
ioat_release(bus_dmaengine_t dmaengine)
{
diff --git a/sys/dev/ioat/ioat.h b/sys/dev/ioat/ioat.h
index f5d5fad..64f9783 100644
--- a/sys/dev/ioat/ioat.h
+++ b/sys/dev/ioat/ioat.h
@@ -96,13 +96,26 @@ uint16_t ioat_get_max_coalesce_period(bus_dmaengine_t dmaengine);
/*
* Acquire must be called before issuing an operation to perform. Release is
- * called after. Multiple operations can be issued within the context of one
+ * called after. Multiple operations can be issued within the context of one
* acquire and release
*/
void ioat_acquire(bus_dmaengine_t dmaengine);
void ioat_release(bus_dmaengine_t dmaengine);
/*
+ * Acquire_reserve can be called to ensure there is room for N descriptors. If
+ * it succeeds, the next N valid operations will successfully enqueue.
+ *
+ * It may fail with:
+ * - ENXIO if the channel is in an errored state, or the driver is being
+ * unloaded
+ * - EAGAIN if mflags included M_NOWAIT
+ *
+ * On failure, the caller does not hold the dmaengine.
+ */
+int ioat_acquire_reserve(bus_dmaengine_t dmaengine, unsigned n, int mflags);
+
+/*
* Issue a blockfill operation. The 64-bit pattern 'fillpattern' is written to
* 'len' physically contiguous bytes at 'dst'.
*
diff --git a/sys/dev/ismt/ismt.c b/sys/dev/ismt/ismt.c
index dc90e3f..3fbcfed 100644
--- a/sys/dev/ismt/ismt.c
+++ b/sys/dev/ismt/ismt.c
@@ -72,7 +72,7 @@ __FBSDID("$FreeBSD$");
#define ISMT_DESC_LPR 0x80 /* Large Packet Received */
/* Macros */
-#define ISMT_DESC_ADDR_RW(addr, is_read) ((addr) | (is_read))
+#define ISMT_DESC_ADDR_RW(addr, is_read) ((addr << 1) | (is_read))
/* iSMT General Register address offsets (SMBBAR + <addr>) */
#define ISMT_GR_GCTRL 0x000 /* General Control */
diff --git a/sys/dev/iwi/if_iwi.c b/sys/dev/iwi/if_iwi.c
index 53141e1..55004f6 100644
--- a/sys/dev/iwi/if_iwi.c
+++ b/sys/dev/iwi/if_iwi.c
@@ -271,8 +271,8 @@ iwi_attach(device_t dev)
struct iwi_softc *sc = device_get_softc(dev);
struct ieee80211com *ic = &sc->sc_ic;
uint16_t val;
+ uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)];
int i, error;
- uint8_t bands;
sc->sc_dev = dev;
@@ -373,13 +373,13 @@ iwi_attach(device_t dev)
val = iwi_read_prom_word(sc, IWI_EEPROM_MAC + 2);
ic->ic_macaddr[4] = val & 0xff;
ic->ic_macaddr[5] = val >> 8;
-
- bands = 0;
- setbit(&bands, IEEE80211_MODE_11B);
- setbit(&bands, IEEE80211_MODE_11G);
+
+ memset(bands, 0, sizeof(bands));
+ setbit(bands, IEEE80211_MODE_11B);
+ setbit(bands, IEEE80211_MODE_11G);
if (pci_get_device(dev) >= 0x4223)
- setbit(&bands, IEEE80211_MODE_11A);
- ieee80211_init_channels(ic, NULL, &bands);
+ setbit(bands, IEEE80211_MODE_11A);
+ ieee80211_init_channels(ic, NULL, bands);
ieee80211_ifattach(ic);
/* override default methods */
diff --git a/sys/dev/ixgbe/if_ix.c b/sys/dev/ixgbe/if_ix.c
index c7ac593..90d70d9 100644
--- a/sys/dev/ixgbe/if_ix.c
+++ b/sys/dev/ixgbe/if_ix.c
@@ -2947,12 +2947,7 @@ ixgbe_config_link(struct adapter *adapter)
sfp = ixgbe_is_sfp(hw);
if (sfp) {
- if (hw->phy.multispeed_fiber) {
- hw->mac.ops.setup_sfp(hw);
- ixgbe_enable_tx_laser(hw);
- taskqueue_enqueue(adapter->tq, &adapter->msf_task);
- } else
- taskqueue_enqueue(adapter->tq, &adapter->mod_task);
+ taskqueue_enqueue(adapter->tq, &adapter->mod_task);
} else {
if (hw->mac.ops.check_link)
err = ixgbe_check_link(hw, &adapter->link_speed,
@@ -3758,23 +3753,66 @@ ixgbe_handle_mod(void *context, int pending)
{
struct adapter *adapter = context;
struct ixgbe_hw *hw = &adapter->hw;
+ enum ixgbe_phy_type orig_type = hw->phy.type;
device_t dev = adapter->dev;
u32 err;
+ IXGBE_CORE_LOCK(adapter);
+
+ /* Check to see if the PHY type changed */
+ if (hw->phy.ops.identify) {
+ hw->phy.type = ixgbe_phy_unknown;
+ hw->phy.ops.identify(hw);
+ }
+
+ if (hw->phy.type != orig_type) {
+ device_printf(dev, "Detected phy_type %d\n", hw->phy.type);
+
+ if (hw->phy.type == ixgbe_phy_none) {
+ hw->phy.sfp_type = ixgbe_sfp_type_unknown;
+ goto out;
+ }
+
+ /* Try to do the initialization that was skipped before */
+ if (hw->phy.ops.init)
+ hw->phy.ops.init(hw);
+ if (hw->phy.ops.reset)
+ hw->phy.ops.reset(hw);
+ }
+
err = hw->phy.ops.identify_sfp(hw);
if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) {
device_printf(dev,
"Unsupported SFP+ module type was detected.\n");
- return;
+ goto out;
}
err = hw->mac.ops.setup_sfp(hw);
if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) {
device_printf(dev,
"Setup failure - unsupported SFP+ module type.\n");
- return;
+ goto out;
}
- taskqueue_enqueue(adapter->tq, &adapter->msf_task);
+ if (hw->phy.multispeed_fiber)
+ taskqueue_enqueue(adapter->tq, &adapter->msf_task);
+out:
+ /* Update media type */
+ switch (hw->mac.ops.get_media_type(hw)) {
+ case ixgbe_media_type_fiber:
+ adapter->optics = IFM_10G_SR;
+ break;
+ case ixgbe_media_type_copper:
+ adapter->optics = IFM_10G_TWINAX;
+ break;
+ case ixgbe_media_type_cx4:
+ adapter->optics = IFM_10G_CX4;
+ break;
+ default:
+ adapter->optics = 0;
+ break;
+ }
+
+ IXGBE_CORE_UNLOCK(adapter);
return;
}
@@ -3790,6 +3828,7 @@ ixgbe_handle_msf(void *context, int pending)
u32 autoneg;
bool negotiate;
+ IXGBE_CORE_LOCK(adapter);
/* get_supported_phy_layer will call hw->phy.ops.identify_sfp() */
adapter->phy_layer = ixgbe_get_supported_physical_layer(hw);
@@ -3802,6 +3841,7 @@ ixgbe_handle_msf(void *context, int pending)
/* Adjust media types shown in ifconfig */
ifmedia_removeall(&adapter->media);
ixgbe_add_media_types(adapter);
+ IXGBE_CORE_UNLOCK(adapter);
return;
}
diff --git a/sys/dev/ixgbe/if_ixv.c b/sys/dev/ixgbe/if_ixv.c
index 0b147d4..20358ad 100644
--- a/sys/dev/ixgbe/if_ixv.c
+++ b/sys/dev/ixgbe/if_ixv.c
@@ -1664,7 +1664,7 @@ ixv_initialize_receive_units(struct adapter *adapter)
/* Disable the queue */
rxdctl = IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(i));
- rxdctl &= ~(IXGBE_RXDCTL_ENABLE | IXGBE_RXDCTL_VME);
+ rxdctl &= ~IXGBE_RXDCTL_ENABLE;
IXGBE_WRITE_REG(hw, IXGBE_VFRXDCTL(i), rxdctl);
for (int j = 0; j < 10; j++) {
if (IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(i)) &
@@ -1698,8 +1698,7 @@ ixv_initialize_receive_units(struct adapter *adapter)
rxr->tail = IXGBE_VFRDT(rxr->me);
/* Do the queue enabling last */
- rxdctl = IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(i));
- rxdctl |= IXGBE_RXDCTL_ENABLE;
+ rxdctl |= IXGBE_RXDCTL_ENABLE | IXGBE_RXDCTL_VME;
IXGBE_WRITE_REG(hw, IXGBE_VFRXDCTL(i), rxdctl);
for (int k = 0; k < 10; k++) {
if (IXGBE_READ_REG(hw, IXGBE_VFRXDCTL(i)) &
diff --git a/sys/dev/malo/if_malo.c b/sys/dev/malo/if_malo.c
index d02b6d5..ff48708 100644
--- a/sys/dev/malo/if_malo.c
+++ b/sys/dev/malo/if_malo.c
@@ -173,7 +173,7 @@ malo_attach(uint16_t devid, struct malo_softc *sc)
struct ieee80211com *ic = &sc->malo_ic;
struct malo_hal *mh;
int error;
- uint8_t bands;
+ uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)];
MALO_LOCK_INIT(sc);
callout_init_mtx(&sc->malo_watchdog_timer, &sc->malo_mtx, 0);
@@ -222,10 +222,10 @@ malo_attach(uint16_t devid, struct malo_softc *sc)
sc->malo_hwspecs.wcbbase[2], sc->malo_hwspecs.wcbbase[3]);
/* NB: firmware looks that it does not export regdomain info API. */
- bands = 0;
- setbit(&bands, IEEE80211_MODE_11B);
- setbit(&bands, IEEE80211_MODE_11G);
- ieee80211_init_channels(ic, NULL, &bands);
+ memset(bands, 0, sizeof(bands));
+ setbit(bands, IEEE80211_MODE_11B);
+ setbit(bands, IEEE80211_MODE_11G);
+ ieee80211_init_channels(ic, NULL, bands);
sc->malo_txantenna = 0x2; /* h/w default */
sc->malo_rxantenna = 0xffff; /* h/w default */
diff --git a/sys/dev/netmap/if_em_netmap.h b/sys/dev/netmap/if_em_netmap.h
index eae4f8c..28f2dd4 100644
--- a/sys/dev/netmap/if_em_netmap.h
+++ b/sys/dev/netmap/if_em_netmap.h
@@ -148,7 +148,7 @@ em_netmap_txsync(struct netmap_kring *kring, int flags)
/* device-specific */
struct e1000_tx_desc *curr = &txr->tx_base[nic_i];
- struct em_buffer *txbuf = &txr->tx_buffers[nic_i];
+ struct em_txbuffer *txbuf = &txr->tx_buffers[nic_i];
int flags = (slot->flags & NS_REPORT ||
nic_i == 0 || nic_i == report_frequency) ?
E1000_TXD_CMD_RS : 0;
@@ -239,12 +239,12 @@ em_netmap_rxsync(struct netmap_kring *kring, int flags)
nm_i = netmap_idx_n2k(kring, nic_i);
for (n = 0; ; n++) { // XXX no need to count
- struct e1000_rx_desc *curr = &rxr->rx_base[nic_i];
- uint32_t staterr = le32toh(curr->status);
+ union e1000_rx_desc_extended *curr = &rxr->rx_base[nic_i];
+ uint32_t staterr = le32toh(curr->wb.upper.status_error);
if ((staterr & E1000_RXD_STAT_DD) == 0)
break;
- ring->slot[nm_i].len = le16toh(curr->length);
+ ring->slot[nm_i].len = le16toh(curr->wb.upper.length);
ring->slot[nm_i].flags = slot_flags;
bus_dmamap_sync(rxr->rxtag, rxr->rx_buffers[nic_i].map,
BUS_DMASYNC_POSTREAD);
@@ -271,19 +271,19 @@ em_netmap_rxsync(struct netmap_kring *kring, int flags)
uint64_t paddr;
void *addr = PNMB(na, slot, &paddr);
- struct e1000_rx_desc *curr = &rxr->rx_base[nic_i];
- struct em_buffer *rxbuf = &rxr->rx_buffers[nic_i];
+ union e1000_rx_desc_extended *curr = &rxr->rx_base[nic_i];
+ struct em_rxbuffer *rxbuf = &rxr->rx_buffers[nic_i];
if (addr == NETMAP_BUF_BASE(na)) /* bad buf */
goto ring_reset;
if (slot->flags & NS_BUF_CHANGED) {
/* buffer has changed, reload map */
- curr->buffer_addr = htole64(paddr);
+ curr->read.buffer_addr = htole64(paddr);
netmap_reload_map(na, rxr->rxtag, rxbuf->map, addr);
slot->flags &= ~NS_BUF_CHANGED;
}
- curr->status = 0;
+ curr->wb.upper.status_error = 0;
bus_dmamap_sync(rxr->rxtag, rxbuf->map,
BUS_DMASYNC_PREREAD);
nm_i = nm_next(nm_i, lim);
diff --git a/sys/dev/nvd/nvd.c b/sys/dev/nvd/nvd.c
index f459e06..24ee075 100644
--- a/sys/dev/nvd/nvd.c
+++ b/sys/dev/nvd/nvd.c
@@ -47,6 +47,8 @@ struct nvd_disk;
static disk_ioctl_t nvd_ioctl;
static disk_strategy_t nvd_strategy;
+static void nvd_done(void *arg, const struct nvme_completion *cpl);
+
static void *nvd_new_disk(struct nvme_namespace *ns, void *ctrlr);
static void destroy_geom_disk(struct nvd_disk *ndisk);
@@ -71,6 +73,7 @@ struct nvd_disk {
struct nvme_namespace *ns;
uint32_t cur_depth;
+ uint32_t ordered_in_flight;
TAILQ_ENTRY(nvd_disk) global_tailq;
TAILQ_ENTRY(nvd_disk) ctrlr_tailq;
@@ -148,6 +151,28 @@ nvd_unload()
nvme_unregister_consumer(consumer_handle);
}
+static int
+nvd_bio_submit(struct nvd_disk *ndisk, struct bio *bp)
+{
+ int err;
+
+ bp->bio_driver1 = NULL;
+ atomic_add_int(&ndisk->cur_depth, 1);
+ err = nvme_ns_bio_process(ndisk->ns, bp, nvd_done);
+ if (err) {
+ atomic_add_int(&ndisk->cur_depth, -1);
+ if (__predict_false(bp->bio_flags & BIO_ORDERED))
+ atomic_add_int(&ndisk->ordered_in_flight, -1);
+ bp->bio_error = err;
+ bp->bio_flags |= BIO_ERROR;
+ bp->bio_resid = bp->bio_bcount;
+ biodone(bp);
+ return (-1);
+ }
+
+ return (0);
+}
+
static void
nvd_strategy(struct bio *bp)
{
@@ -155,6 +180,18 @@ nvd_strategy(struct bio *bp)
ndisk = (struct nvd_disk *)bp->bio_disk->d_drv1;
+ if (__predict_false(bp->bio_flags & BIO_ORDERED))
+ atomic_add_int(&ndisk->ordered_in_flight, 1);
+
+ if (__predict_true(ndisk->ordered_in_flight == 0)) {
+ nvd_bio_submit(ndisk, bp);
+ return;
+ }
+
+ /*
+ * There are ordered bios in flight, so we need to submit
+ * bios through the task queue to enforce ordering.
+ */
mtx_lock(&ndisk->bioqlock);
bioq_insert_tail(&ndisk->bioq, bp);
mtx_unlock(&ndisk->bioqlock);
@@ -186,6 +223,8 @@ nvd_done(void *arg, const struct nvme_completion *cpl)
ndisk = bp->bio_disk->d_drv1;
atomic_add_int(&ndisk->cur_depth, -1);
+ if (__predict_false(bp->bio_flags & BIO_ORDERED))
+ atomic_add_int(&ndisk->ordered_in_flight, -1);
biodone(bp);
}
@@ -195,7 +234,6 @@ nvd_bioq_process(void *arg, int pending)
{
struct nvd_disk *ndisk = arg;
struct bio *bp;
- int err;
for (;;) {
mtx_lock(&ndisk->bioqlock);
@@ -204,30 +242,8 @@ nvd_bioq_process(void *arg, int pending)
if (bp == NULL)
break;
-#ifdef BIO_ORDERED
- /*
- * BIO_ORDERED flag dictates that all outstanding bios
- * must be completed before processing the bio with
- * BIO_ORDERED flag set.
- */
- if (bp->bio_flags & BIO_ORDERED) {
- while (ndisk->cur_depth > 0) {
- pause("nvd flush", 1);
- }
- }
-#endif
-
- bp->bio_driver1 = NULL;
- atomic_add_int(&ndisk->cur_depth, 1);
-
- err = nvme_ns_bio_process(ndisk->ns, bp, nvd_done);
-
- if (err) {
- atomic_add_int(&ndisk->cur_depth, -1);
- bp->bio_error = err;
- bp->bio_flags |= BIO_ERROR;
- bp->bio_resid = bp->bio_bcount;
- biodone(bp);
+ if (nvd_bio_submit(ndisk, bp) != 0) {
+ continue;
}
#ifdef BIO_ORDERED
@@ -287,7 +303,7 @@ nvd_new_disk(struct nvme_namespace *ns, void *ctrlr_arg)
disk->d_unit =
TAILQ_LAST(&disk_head, disk_list)->disk->d_unit + 1;
- disk->d_flags = 0;
+ disk->d_flags = DISKFLAG_DIRECT_COMPLETION;
if (nvme_ns_get_flags(ns) & NVME_NS_DEALLOCATE_SUPPORTED)
disk->d_flags |= DISKFLAG_CANDELETE;
@@ -317,6 +333,7 @@ nvd_new_disk(struct nvme_namespace *ns, void *ctrlr_arg)
ndisk->ns = ns;
ndisk->disk = disk;
ndisk->cur_depth = 0;
+ ndisk->ordered_in_flight = 0;
mtx_init(&ndisk->bioqlock, "NVD bioq lock", NULL, MTX_DEF);
bioq_init(&ndisk->bioq);
diff --git a/sys/dev/nvme/nvme.c b/sys/dev/nvme/nvme.c
index cc14d34..9db2b14 100644
--- a/sys/dev/nvme/nvme.c
+++ b/sys/dev/nvme/nvme.c
@@ -270,8 +270,6 @@ nvme_attach(device_t dev)
return (status);
}
- nvme_sysctl_initialize_ctrlr(ctrlr);
-
pci_enable_busmaster(dev);
ctrlr->config_hook.ich_func = nvme_ctrlr_start_config_hook;
diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c
index ee4b901..e400f52 100644
--- a/sys/dev/nvme/nvme_ctrlr.c
+++ b/sys/dev/nvme/nvme_ctrlr.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (C) 2012-2015 Intel Corporation
+ * Copyright (C) 2012-2016 Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$");
static void nvme_ctrlr_construct_and_submit_aer(struct nvme_controller *ctrlr,
struct nvme_async_event_request *aer);
+static void nvme_ctrlr_setup_interrupts(struct nvme_controller *ctrlr);
static int
nvme_ctrlr_allocate_bar(struct nvme_controller *ctrlr)
@@ -140,6 +141,13 @@ nvme_ctrlr_construct_io_qpairs(struct nvme_controller *ctrlr)
*/
num_trackers = min(num_trackers, (num_entries-1));
+ /*
+ * This was calculated previously when setting up interrupts, but
+ * a controller could theoretically support fewer I/O queues than
+ * MSI-X vectors. So calculate again here just to be safe.
+ */
+ ctrlr->num_cpus_per_ioq = howmany(mp_ncpus, ctrlr->num_io_queues);
+
ctrlr->ioq = malloc(ctrlr->num_io_queues * sizeof(struct nvme_qpair),
M_NVME, M_ZERO | M_WAITOK);
@@ -160,8 +168,13 @@ nvme_ctrlr_construct_io_qpairs(struct nvme_controller *ctrlr)
num_trackers,
ctrlr);
- if (ctrlr->per_cpu_io_queues)
- bus_bind_intr(ctrlr->dev, qpair->res, i);
+ /*
+ * Do not bother binding interrupts if we only have one I/O
+ * interrupt thread for this controller.
+ */
+ if (ctrlr->num_io_queues > 1)
+ bus_bind_intr(ctrlr->dev, qpair->res,
+ i * ctrlr->num_cpus_per_ioq);
}
return (0);
@@ -306,8 +319,15 @@ nvme_ctrlr_hw_reset(struct nvme_controller *ctrlr)
int i;
nvme_admin_qpair_disable(&ctrlr->adminq);
- for (i = 0; i < ctrlr->num_io_queues; i++)
- nvme_io_qpair_disable(&ctrlr->ioq[i]);
+ /*
+ * I/O queues are not allocated before the initial HW
+ * reset, so do not try to disable them. Use is_initialized
+ * to determine if this is the initial HW reset.
+ */
+ if (ctrlr->is_initialized) {
+ for (i = 0; i < ctrlr->num_io_queues; i++)
+ nvme_io_qpair_disable(&ctrlr->ioq[i]);
+ }
DELAY(100*1000);
@@ -363,7 +383,7 @@ static int
nvme_ctrlr_set_num_qpairs(struct nvme_controller *ctrlr)
{
struct nvme_completion_poll_status status;
- int cq_allocated, i, sq_allocated;
+ int cq_allocated, sq_allocated;
status.done = FALSE;
nvme_ctrlr_cmd_set_num_queues(ctrlr, ctrlr->num_io_queues,
@@ -384,26 +404,12 @@ nvme_ctrlr_set_num_qpairs(struct nvme_controller *ctrlr)
cq_allocated = (status.cpl.cdw0 >> 16) + 1;
/*
- * Check that the controller was able to allocate the number of
- * queues we requested. If not, revert to one IO queue pair.
+ * Controller may allocate more queues than we requested,
+ * so use the minimum of the number requested and what was
+ * actually allocated.
*/
- if (sq_allocated < ctrlr->num_io_queues ||
- cq_allocated < ctrlr->num_io_queues) {
-
- /*
- * Destroy extra IO queue pairs that were created at
- * controller construction time but are no longer
- * needed. This will only happen when a controller
- * supports fewer queues than MSI-X vectors. This
- * is not the normal case, but does occur with the
- * Chatham prototype board.
- */
- for (i = 1; i < ctrlr->num_io_queues; i++)
- nvme_io_qpair_destroy(&ctrlr->ioq[i]);
-
- ctrlr->num_io_queues = 1;
- ctrlr->per_cpu_io_queues = 0;
- }
+ ctrlr->num_io_queues = min(ctrlr->num_io_queues, sq_allocated);
+ ctrlr->num_io_queues = min(ctrlr->num_io_queues, cq_allocated);
return (0);
}
@@ -687,9 +693,20 @@ static void
nvme_ctrlr_start(void *ctrlr_arg)
{
struct nvme_controller *ctrlr = ctrlr_arg;
+ uint32_t old_num_io_queues;
int i;
- nvme_qpair_reset(&ctrlr->adminq);
+ /*
+ * Only reset adminq here when we are restarting the
+ * controller after a reset. During initialization,
+ * we have already submitted admin commands to get
+ * the number of I/O queues supported, so cannot reset
+ * the adminq again here.
+ */
+ if (ctrlr->is_resetting) {
+ nvme_qpair_reset(&ctrlr->adminq);
+ }
+
for (i = 0; i < ctrlr->num_io_queues; i++)
nvme_qpair_reset(&ctrlr->ioq[i]);
@@ -700,11 +717,25 @@ nvme_ctrlr_start(void *ctrlr_arg)
return;
}
+ /*
+ * The number of qpairs are determined during controller initialization,
+ * including using NVMe SET_FEATURES/NUMBER_OF_QUEUES to determine the
+ * HW limit. We call SET_FEATURES again here so that it gets called
+ * after any reset for controllers that depend on the driver to
+ * explicit specify how many queues it will use. This value should
+ * never change between resets, so panic if somehow that does happen.
+ */
+ old_num_io_queues = ctrlr->num_io_queues;
if (nvme_ctrlr_set_num_qpairs(ctrlr) != 0) {
nvme_ctrlr_fail(ctrlr);
return;
}
+ if (old_num_io_queues != ctrlr->num_io_queues) {
+ panic("num_io_queues changed from %u to %u", old_num_io_queues,
+ ctrlr->num_io_queues);
+ }
+
if (nvme_ctrlr_create_qpairs(ctrlr) != 0) {
nvme_ctrlr_fail(ctrlr);
return;
@@ -727,7 +758,16 @@ nvme_ctrlr_start_config_hook(void *arg)
{
struct nvme_controller *ctrlr = arg;
- nvme_ctrlr_start(ctrlr);
+ nvme_qpair_reset(&ctrlr->adminq);
+ nvme_admin_qpair_enable(&ctrlr->adminq);
+
+ if (nvme_ctrlr_set_num_qpairs(ctrlr) == 0 &&
+ nvme_ctrlr_construct_io_qpairs(ctrlr) == 0)
+ nvme_ctrlr_start(ctrlr);
+ else
+ nvme_ctrlr_fail(ctrlr);
+
+ nvme_sysctl_initialize_ctrlr(ctrlr);
config_intrhook_disestablish(&ctrlr->config_hook);
ctrlr->is_initialized = 1;
@@ -778,8 +818,9 @@ static int
nvme_ctrlr_configure_intx(struct nvme_controller *ctrlr)
{
+ ctrlr->msix_enabled = 0;
ctrlr->num_io_queues = 1;
- ctrlr->per_cpu_io_queues = 0;
+ ctrlr->num_cpus_per_ioq = mp_ncpus;
ctrlr->rid = 0;
ctrlr->res = bus_alloc_resource_any(ctrlr->dev, SYS_RES_IRQ,
&ctrlr->rid, RF_SHAREABLE | RF_ACTIVE);
@@ -926,13 +967,93 @@ static struct cdevsw nvme_ctrlr_cdevsw = {
.d_ioctl = nvme_ctrlr_ioctl
};
+static void
+nvme_ctrlr_setup_interrupts(struct nvme_controller *ctrlr)
+{
+ device_t dev;
+ int per_cpu_io_queues;
+ int min_cpus_per_ioq;
+ int num_vectors_requested, num_vectors_allocated;
+ int num_vectors_available;
+
+ dev = ctrlr->dev;
+ min_cpus_per_ioq = 1;
+ TUNABLE_INT_FETCH("hw.nvme.min_cpus_per_ioq", &min_cpus_per_ioq);
+
+ if (min_cpus_per_ioq < 1) {
+ min_cpus_per_ioq = 1;
+ } else if (min_cpus_per_ioq > mp_ncpus) {
+ min_cpus_per_ioq = mp_ncpus;
+ }
+
+ per_cpu_io_queues = 1;
+ TUNABLE_INT_FETCH("hw.nvme.per_cpu_io_queues", &per_cpu_io_queues);
+
+ if (per_cpu_io_queues == 0) {
+ min_cpus_per_ioq = mp_ncpus;
+ }
+
+ ctrlr->force_intx = 0;
+ TUNABLE_INT_FETCH("hw.nvme.force_intx", &ctrlr->force_intx);
+
+ /*
+ * FreeBSD currently cannot allocate more than about 190 vectors at
+ * boot, meaning that systems with high core count and many devices
+ * requesting per-CPU interrupt vectors will not get their full
+ * allotment. So first, try to allocate as many as we may need to
+ * understand what is available, then immediately release them.
+ * Then figure out how many of those we will actually use, based on
+ * assigning an equal number of cores to each I/O queue.
+ */
+
+ /* One vector for per core I/O queue, plus one vector for admin queue. */
+ num_vectors_available = min(pci_msix_count(dev), mp_ncpus + 1);
+ if (pci_alloc_msix(dev, &num_vectors_available) != 0) {
+ num_vectors_available = 0;
+ }
+ pci_release_msi(dev);
+
+ if (ctrlr->force_intx || num_vectors_available < 2) {
+ nvme_ctrlr_configure_intx(ctrlr);
+ return;
+ }
+
+ /*
+ * Do not use all vectors for I/O queues - one must be saved for the
+ * admin queue.
+ */
+ ctrlr->num_cpus_per_ioq = max(min_cpus_per_ioq,
+ howmany(mp_ncpus, num_vectors_available - 1));
+
+ ctrlr->num_io_queues = howmany(mp_ncpus, ctrlr->num_cpus_per_ioq);
+ num_vectors_requested = ctrlr->num_io_queues + 1;
+ num_vectors_allocated = num_vectors_requested;
+
+ /*
+ * Now just allocate the number of vectors we need. This should
+ * succeed, since we previously called pci_alloc_msix()
+ * successfully returning at least this many vectors, but just to
+ * be safe, if something goes wrong just revert to INTx.
+ */
+ if (pci_alloc_msix(dev, &num_vectors_allocated) != 0) {
+ nvme_ctrlr_configure_intx(ctrlr);
+ return;
+ }
+
+ if (num_vectors_allocated < num_vectors_requested) {
+ pci_release_msi(dev);
+ nvme_ctrlr_configure_intx(ctrlr);
+ return;
+ }
+
+ ctrlr->msix_enabled = 1;
+}
+
int
nvme_ctrlr_construct(struct nvme_controller *ctrlr, device_t dev)
{
union cap_lo_register cap_lo;
union cap_hi_register cap_hi;
- int i, per_cpu_io_queues, rid;
- int num_vectors_requested, num_vectors_allocated;
int status, timeout_period;
ctrlr->dev = dev;
@@ -967,116 +1088,13 @@ nvme_ctrlr_construct(struct nvme_controller *ctrlr, device_t dev)
nvme_retry_count = NVME_DEFAULT_RETRY_COUNT;
TUNABLE_INT_FETCH("hw.nvme.retry_count", &nvme_retry_count);
- per_cpu_io_queues = 1;
- TUNABLE_INT_FETCH("hw.nvme.per_cpu_io_queues", &per_cpu_io_queues);
- ctrlr->per_cpu_io_queues = per_cpu_io_queues ? TRUE : FALSE;
-
- if (ctrlr->per_cpu_io_queues)
- ctrlr->num_io_queues = mp_ncpus;
- else
- ctrlr->num_io_queues = 1;
-
- ctrlr->force_intx = 0;
- TUNABLE_INT_FETCH("hw.nvme.force_intx", &ctrlr->force_intx);
-
ctrlr->enable_aborts = 0;
TUNABLE_INT_FETCH("hw.nvme.enable_aborts", &ctrlr->enable_aborts);
- ctrlr->msix_enabled = 1;
-
- if (ctrlr->force_intx) {
- ctrlr->msix_enabled = 0;
- goto intx;
- }
-
- /* One vector per IO queue, plus one vector for admin queue. */
- num_vectors_requested = ctrlr->num_io_queues + 1;
-
- /*
- * If we cannot even allocate 2 vectors (one for admin, one for
- * I/O), then revert to INTx.
- */
- if (pci_msix_count(dev) < 2) {
- ctrlr->msix_enabled = 0;
- goto intx;
- } else if (pci_msix_count(dev) < num_vectors_requested) {
- ctrlr->per_cpu_io_queues = FALSE;
- ctrlr->num_io_queues = 1;
- num_vectors_requested = 2; /* one for admin, one for I/O */
- }
-
- num_vectors_allocated = num_vectors_requested;
- if (pci_alloc_msix(dev, &num_vectors_allocated) != 0) {
- ctrlr->msix_enabled = 0;
- goto intx;
- } else if (num_vectors_allocated < num_vectors_requested) {
- if (num_vectors_allocated < 2) {
- pci_release_msi(dev);
- ctrlr->msix_enabled = 0;
- goto intx;
- } else {
- ctrlr->per_cpu_io_queues = FALSE;
- ctrlr->num_io_queues = 1;
- /*
- * Release whatever vectors were allocated, and just
- * reallocate the two needed for the admin and single
- * I/O qpair.
- */
- num_vectors_allocated = 2;
- pci_release_msi(dev);
- if (pci_alloc_msix(dev, &num_vectors_allocated) != 0)
- panic("could not reallocate any vectors\n");
- if (num_vectors_allocated != 2)
- panic("could not reallocate 2 vectors\n");
- }
- }
-
- /*
- * On earlier FreeBSD releases, there are reports that
- * pci_alloc_msix() can return successfully with all vectors
- * requested, but a subsequent bus_alloc_resource_any()
- * for one of those vectors fails. This issue occurs more
- * readily with multiple devices using per-CPU vectors.
- * To workaround this issue, try to allocate the resources now,
- * and fall back to INTx if we cannot allocate all of them.
- * This issue cannot be reproduced on more recent versions of
- * FreeBSD which have increased the maximum number of MSI-X
- * vectors, but adding the workaround makes it easier for
- * vendors wishing to import this driver into kernels based on
- * older versions of FreeBSD.
- */
- for (i = 0; i < num_vectors_allocated; i++) {
- rid = i + 1;
- ctrlr->msi_res[i] = bus_alloc_resource_any(ctrlr->dev,
- SYS_RES_IRQ, &rid, RF_ACTIVE);
-
- if (ctrlr->msi_res[i] == NULL) {
- ctrlr->msix_enabled = 0;
- while (i > 0) {
- i--;
- bus_release_resource(ctrlr->dev,
- SYS_RES_IRQ,
- rman_get_rid(ctrlr->msi_res[i]),
- ctrlr->msi_res[i]);
- }
- pci_release_msi(dev);
- nvme_printf(ctrlr, "could not obtain all MSI-X "
- "resources, reverting to intx\n");
- break;
- }
- }
-
-intx:
-
- if (!ctrlr->msix_enabled)
- nvme_ctrlr_configure_intx(ctrlr);
+ nvme_ctrlr_setup_interrupts(ctrlr);
ctrlr->max_xfer_size = NVME_MAX_XFER_SIZE;
nvme_ctrlr_construct_admin_qpair(ctrlr);
- status = nvme_ctrlr_construct_io_qpairs(ctrlr);
-
- if (status != 0)
- return (status);
ctrlr->cdev = make_dev(&nvme_ctrlr_cdevsw, device_get_unit(dev),
UID_ROOT, GID_WHEEL, 0600, "nvme%d", device_get_unit(dev));
@@ -1188,11 +1206,7 @@ nvme_ctrlr_submit_io_request(struct nvme_controller *ctrlr,
{
struct nvme_qpair *qpair;
- if (ctrlr->per_cpu_io_queues)
- qpair = &ctrlr->ioq[curcpu];
- else
- qpair = &ctrlr->ioq[0];
-
+ qpair = &ctrlr->ioq[curcpu / ctrlr->num_cpus_per_ioq];
nvme_qpair_submit_request(qpair, req);
}
diff --git a/sys/dev/nvme/nvme_private.h b/sys/dev/nvme/nvme_private.h
index 6137b41..3330711 100644
--- a/sys/dev/nvme/nvme_private.h
+++ b/sys/dev/nvme/nvme_private.h
@@ -265,7 +265,7 @@ struct nvme_controller {
uint32_t enable_aborts;
uint32_t num_io_queues;
- boolean_t per_cpu_io_queues;
+ uint32_t num_cpus_per_ioq;
/* Fields for tracking progress during controller initialization. */
struct intr_config_hook config_hook;
@@ -276,8 +276,6 @@ struct nvme_controller {
struct task fail_req_task;
struct taskqueue *taskqueue;
- struct resource *msi_res[MAXCPU + 1];
-
/* For shared legacy interrupt. */
int rid;
struct resource *res;
diff --git a/sys/dev/nvme/nvme_qpair.c b/sys/dev/nvme/nvme_qpair.c
index d0cb8c6..92fe672 100644
--- a/sys/dev/nvme/nvme_qpair.c
+++ b/sys/dev/nvme/nvme_qpair.c
@@ -479,8 +479,9 @@ nvme_qpair_construct(struct nvme_qpair *qpair, uint32_t id,
* the queue's vector to get the corresponding rid to use.
*/
qpair->rid = vector + 1;
- qpair->res = ctrlr->msi_res[vector];
+ qpair->res = bus_alloc_resource_any(ctrlr->dev, SYS_RES_IRQ,
+ &qpair->rid, RF_ACTIVE);
bus_setup_intr(ctrlr->dev, qpair->res,
INTR_TYPE_MISC | INTR_MPSAFE, NULL,
nvme_qpair_msix_handler, qpair, &qpair->tag);
diff --git a/sys/dev/nvme/nvme_sysctl.c b/sys/dev/nvme/nvme_sysctl.c
index 8b99111..08cd15e 100644
--- a/sys/dev/nvme/nvme_sysctl.c
+++ b/sys/dev/nvme/nvme_sysctl.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (C) 2012-2013 Intel Corporation
+ * Copyright (C) 2012-2016 Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -267,6 +267,10 @@ nvme_sysctl_initialize_ctrlr(struct nvme_controller *ctrlr)
ctrlr_tree = device_get_sysctl_tree(ctrlr->dev);
ctrlr_list = SYSCTL_CHILDREN(ctrlr_tree);
+ SYSCTL_ADD_UINT(ctrlr_ctx, ctrlr_list, OID_AUTO, "num_cpus_per_ioq",
+ CTLFLAG_RD, &ctrlr->num_cpus_per_ioq, 0,
+ "Number of CPUs assigned per I/O queue pair");
+
SYSCTL_ADD_PROC(ctrlr_ctx, ctrlr_list, OID_AUTO,
"int_coal_time", CTLTYPE_UINT | CTLFLAG_RW, ctrlr, 0,
nvme_sysctl_int_coal_time, "IU",
diff --git a/sys/dev/otus/if_otus.c b/sys/dev/otus/if_otus.c
index 160b05e..daa9626 100644
--- a/sys/dev/otus/if_otus.c
+++ b/sys/dev/otus/if_otus.c
@@ -624,8 +624,8 @@ otus_attachhook(struct otus_softc *sc)
struct ieee80211com *ic = &sc->sc_ic;
usb_device_request_t req;
uint32_t in, out;
+ uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)];
int error;
- uint8_t bands;
/* Not locked */
error = otus_load_firmware(sc, "otusfw_init", AR_FW_INIT_ADDR);
@@ -743,19 +743,19 @@ otus_attachhook(struct otus_softc *sc)
otus_get_chanlist(sc);
#else
/* Set supported .11b and .11g rates. */
- bands = 0;
+ memset(bands, 0, sizeof(bands));
if (sc->eeprom.baseEepHeader.opCapFlags & AR5416_OPFLAGS_11G) {
- setbit(&bands, IEEE80211_MODE_11B);
- setbit(&bands, IEEE80211_MODE_11G);
+ setbit(bands, IEEE80211_MODE_11B);
+ setbit(bands, IEEE80211_MODE_11G);
}
if (sc->eeprom.baseEepHeader.opCapFlags & AR5416_OPFLAGS_11A) {
- setbit(&bands, IEEE80211_MODE_11A);
+ setbit(bands, IEEE80211_MODE_11A);
}
#if 0
if (sc->sc_ht)
- setbit(&bands, IEEE80211_MODE_11NG);
+ setbit(bands, IEEE80211_MODE_11NG);
#endif
- ieee80211_init_channels(ic, NULL, &bands);
+ ieee80211_init_channels(ic, NULL, bands);
#endif
ieee80211_ifattach(ic);
diff --git a/sys/dev/ral/rt2560.c b/sys/dev/ral/rt2560.c
index d62c470..1ba2791 100644
--- a/sys/dev/ral/rt2560.c
+++ b/sys/dev/ral/rt2560.c
@@ -199,7 +199,7 @@ rt2560_attach(device_t dev, int id)
{
struct rt2560_softc *sc = device_get_softc(dev);
struct ieee80211com *ic = &sc->sc_ic;
- uint8_t bands;
+ uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)];
int error;
sc->sc_dev = dev;
@@ -278,12 +278,12 @@ rt2560_attach(device_t dev, int id)
#endif
;
- bands = 0;
- setbit(&bands, IEEE80211_MODE_11B);
- setbit(&bands, IEEE80211_MODE_11G);
+ memset(bands, 0, sizeof(bands));
+ setbit(bands, IEEE80211_MODE_11B);
+ setbit(bands, IEEE80211_MODE_11G);
if (sc->rf_rev == RT2560_RF_5222)
- setbit(&bands, IEEE80211_MODE_11A);
- ieee80211_init_channels(ic, NULL, &bands);
+ setbit(bands, IEEE80211_MODE_11A);
+ ieee80211_init_channels(ic, NULL, bands);
ieee80211_ifattach(ic);
ic->ic_raw_xmit = rt2560_raw_xmit;
diff --git a/sys/dev/ral/rt2661.c b/sys/dev/ral/rt2661.c
index a2e955c..a53d509 100644
--- a/sys/dev/ral/rt2661.c
+++ b/sys/dev/ral/rt2661.c
@@ -199,8 +199,8 @@ rt2661_attach(device_t dev, int id)
struct rt2661_softc *sc = device_get_softc(dev);
struct ieee80211com *ic = &sc->sc_ic;
uint32_t val;
+ uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)];
int error, ac, ntries;
- uint8_t bands;
sc->sc_id = id;
sc->sc_dev = dev;
@@ -279,12 +279,12 @@ rt2661_attach(device_t dev, int id)
#endif
;
- bands = 0;
- setbit(&bands, IEEE80211_MODE_11B);
- setbit(&bands, IEEE80211_MODE_11G);
+ memset(bands, 0, sizeof(bands));
+ setbit(bands, IEEE80211_MODE_11B);
+ setbit(bands, IEEE80211_MODE_11G);
if (sc->rf_rev == RT2661_RF_5225 || sc->rf_rev == RT2661_RF_5325)
- setbit(&bands, IEEE80211_MODE_11A);
- ieee80211_init_channels(ic, NULL, &bands);
+ setbit(bands, IEEE80211_MODE_11A);
+ ieee80211_init_channels(ic, NULL, bands);
ieee80211_ifattach(ic);
#if 0
diff --git a/sys/dev/ral/rt2860.c b/sys/dev/ral/rt2860.c
index 9447976..8bfb00d 100644
--- a/sys/dev/ral/rt2860.c
+++ b/sys/dev/ral/rt2860.c
@@ -232,8 +232,8 @@ rt2860_attach(device_t dev, int id)
struct rt2860_softc *sc = device_get_softc(dev);
struct ieee80211com *ic = &sc->sc_ic;
uint32_t tmp;
+ uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)];
int error, ntries, qid;
- uint8_t bands;
sc->sc_dev = dev;
sc->sc_debug = 0;
@@ -319,12 +319,12 @@ rt2860_attach(device_t dev, int id)
| IEEE80211_C_WME /* 802.11e */
;
- bands = 0;
- setbit(&bands, IEEE80211_MODE_11B);
- setbit(&bands, IEEE80211_MODE_11G);
+ memset(bands, 0, sizeof(bands));
+ setbit(bands, IEEE80211_MODE_11B);
+ setbit(bands, IEEE80211_MODE_11G);
if (sc->rf_rev == RT2860_RF_2750 || sc->rf_rev == RT2860_RF_2850)
- setbit(&bands, IEEE80211_MODE_11A);
- ieee80211_init_channels(ic, NULL, &bands);
+ setbit(bands, IEEE80211_MODE_11A);
+ ieee80211_init_channels(ic, NULL, bands);
ieee80211_ifattach(ic);
diff --git a/sys/dev/rtwn/if_rtwn.c b/sys/dev/rtwn/if_rtwn.c
index 6fedf7d..ec17cdc 100644
--- a/sys/dev/rtwn/if_rtwn.c
+++ b/sys/dev/rtwn/if_rtwn.c
@@ -251,7 +251,7 @@ rtwn_attach(device_t dev)
struct rtwn_softc *sc = device_get_softc(dev);
struct ieee80211com *ic = &sc->sc_ic;
uint32_t lcsr;
- uint8_t bands;
+ uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)];
int i, count, error, rid;
sc->sc_dev = dev;
@@ -353,10 +353,10 @@ rtwn_attach(device_t dev)
| IEEE80211_C_WME /* 802.11e */
;
- bands = 0;
- setbit(&bands, IEEE80211_MODE_11B);
- setbit(&bands, IEEE80211_MODE_11G);
- ieee80211_init_channels(ic, NULL, &bands);
+ memset(bands, 0, sizeof(bands));
+ setbit(bands, IEEE80211_MODE_11B);
+ setbit(bands, IEEE80211_MODE_11G);
+ ieee80211_init_channels(ic, NULL, bands);
ieee80211_ifattach(ic);
diff --git a/sys/dev/usb/wlan/if_rsu.c b/sys/dev/usb/wlan/if_rsu.c
index ea89bff..0dcde19 100644
--- a/sys/dev/usb/wlan/if_rsu.c
+++ b/sys/dev/usb/wlan/if_rsu.c
@@ -403,7 +403,8 @@ rsu_attach(device_t self)
struct rsu_softc *sc = device_get_softc(self);
struct ieee80211com *ic = &sc->sc_ic;
int error;
- uint8_t iface_index, bands;
+ uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)];
+ uint8_t iface_index;
struct usb_interface *iface;
const char *rft;
@@ -531,12 +532,12 @@ rsu_attach(device_t self)
}
/* Set supported .11b and .11g rates. */
- bands = 0;
- setbit(&bands, IEEE80211_MODE_11B);
- setbit(&bands, IEEE80211_MODE_11G);
+ memset(bands, 0, sizeof(bands));
+ setbit(bands, IEEE80211_MODE_11B);
+ setbit(bands, IEEE80211_MODE_11G);
if (sc->sc_ht)
- setbit(&bands, IEEE80211_MODE_11NG);
- ieee80211_init_channels(ic, NULL, &bands);
+ setbit(bands, IEEE80211_MODE_11NG);
+ ieee80211_init_channels(ic, NULL, bands);
ieee80211_ifattach(ic);
ic->ic_raw_xmit = rsu_raw_xmit;
diff --git a/sys/dev/usb/wlan/if_rum.c b/sys/dev/usb/wlan/if_rum.c
index 02b82ef..3fada69 100644
--- a/sys/dev/usb/wlan/if_rum.c
+++ b/sys/dev/usb/wlan/if_rum.c
@@ -468,8 +468,9 @@ rum_attach(device_t self)
struct usb_attach_arg *uaa = device_get_ivars(self);
struct rum_softc *sc = device_get_softc(self);
struct ieee80211com *ic = &sc->sc_ic;
- uint8_t iface_index, bands;
uint32_t tmp;
+ uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)];
+ uint8_t iface_index;
int error, ntries;
device_set_usb_desc(self);
@@ -537,12 +538,12 @@ rum_attach(device_t self)
IEEE80211_CRYPTO_TKIPMIC |
IEEE80211_CRYPTO_TKIP;
- bands = 0;
- setbit(&bands, IEEE80211_MODE_11B);
- setbit(&bands, IEEE80211_MODE_11G);
+ memset(bands, 0, sizeof(bands));
+ setbit(bands, IEEE80211_MODE_11B);
+ setbit(bands, IEEE80211_MODE_11G);
if (sc->rf_rev == RT2573_RF_5225 || sc->rf_rev == RT2573_RF_5226)
- setbit(&bands, IEEE80211_MODE_11A);
- ieee80211_init_channels(ic, NULL, &bands);
+ setbit(bands, IEEE80211_MODE_11A);
+ ieee80211_init_channels(ic, NULL, bands);
ieee80211_ifattach(ic);
ic->ic_update_promisc = rum_update_promisc;
diff --git a/sys/dev/usb/wlan/if_run.c b/sys/dev/usb/wlan/if_run.c
index 1ad9f60..7a10d2c 100644
--- a/sys/dev/usb/wlan/if_run.c
+++ b/sys/dev/usb/wlan/if_run.c
@@ -704,8 +704,9 @@ run_attach(device_t self)
struct usb_attach_arg *uaa = device_get_ivars(self);
struct ieee80211com *ic = &sc->sc_ic;
uint32_t ver;
+ uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)];
+ uint8_t iface_index;
int ntries, error;
- uint8_t iface_index, bands;
device_set_usb_desc(self);
sc->sc_udev = uaa->device;
@@ -785,14 +786,14 @@ run_attach(device_t self)
ic->ic_flags |= IEEE80211_F_DATAPAD;
ic->ic_flags_ext |= IEEE80211_FEXT_SWBMISS;
- bands = 0;
- setbit(&bands, IEEE80211_MODE_11B);
- setbit(&bands, IEEE80211_MODE_11G);
+ memset(bands, 0, sizeof(bands));
+ setbit(bands, IEEE80211_MODE_11B);
+ setbit(bands, IEEE80211_MODE_11G);
if (sc->rf_rev == RT2860_RF_2750 || sc->rf_rev == RT2860_RF_2850 ||
sc->rf_rev == RT3070_RF_3052 || sc->rf_rev == RT3593_RF_3053 ||
sc->rf_rev == RT5592_RF_5592)
- setbit(&bands, IEEE80211_MODE_11A);
- ieee80211_init_channels(ic, NULL, &bands);
+ setbit(bands, IEEE80211_MODE_11A);
+ ieee80211_init_channels(ic, NULL, bands);
ieee80211_ifattach(ic);
diff --git a/sys/dev/usb/wlan/if_uath.c b/sys/dev/usb/wlan/if_uath.c
index 747d49d..404fdd8 100644
--- a/sys/dev/usb/wlan/if_uath.c
+++ b/sys/dev/usb/wlan/if_uath.c
@@ -328,7 +328,8 @@ uath_attach(device_t dev)
struct uath_softc *sc = device_get_softc(dev);
struct usb_attach_arg *uaa = device_get_ivars(dev);
struct ieee80211com *ic = &sc->sc_ic;
- uint8_t bands, iface_index = UATH_IFACE_INDEX; /* XXX */
+ uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)];
+ uint8_t iface_index = UATH_IFACE_INDEX; /* XXX */
usb_error_t error;
sc->sc_dev = dev;
@@ -431,13 +432,13 @@ uath_attach(device_t dev)
/* put a regulatory domain to reveal informations. */
uath_regdomain = sc->sc_devcap.regDomain;
- bands = 0;
- setbit(&bands, IEEE80211_MODE_11B);
- setbit(&bands, IEEE80211_MODE_11G);
+ memset(bands, 0, sizeof(bands));
+ setbit(bands, IEEE80211_MODE_11B);
+ setbit(bands, IEEE80211_MODE_11G);
if ((sc->sc_devcap.analog5GhzRevision & 0xf0) == 0x30)
- setbit(&bands, IEEE80211_MODE_11A);
+ setbit(bands, IEEE80211_MODE_11A);
/* XXX turbo */
- ieee80211_init_channels(ic, NULL, &bands);
+ ieee80211_init_channels(ic, NULL, bands);
ieee80211_ifattach(ic);
ic->ic_raw_xmit = uath_raw_xmit;
diff --git a/sys/dev/usb/wlan/if_upgt.c b/sys/dev/usb/wlan/if_upgt.c
index 8030c6f..7f1e8ad 100644
--- a/sys/dev/usb/wlan/if_upgt.c
+++ b/sys/dev/usb/wlan/if_upgt.c
@@ -243,7 +243,8 @@ upgt_attach(device_t dev)
struct upgt_softc *sc = device_get_softc(dev);
struct ieee80211com *ic = &sc->sc_ic;
struct usb_attach_arg *uaa = device_get_ivars(dev);
- uint8_t bands, iface_index = UPGT_IFACE_INDEX;
+ uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)];
+ uint8_t iface_index = UPGT_IFACE_INDEX;
int error;
sc->sc_dev = dev;
@@ -337,10 +338,10 @@ upgt_attach(device_t dev)
| IEEE80211_C_WPA /* 802.11i */
;
- bands = 0;
- setbit(&bands, IEEE80211_MODE_11B);
- setbit(&bands, IEEE80211_MODE_11G);
- ieee80211_init_channels(ic, NULL, &bands);
+ memset(bands, 0, sizeof(bands));
+ setbit(bands, IEEE80211_MODE_11B);
+ setbit(bands, IEEE80211_MODE_11G);
+ ieee80211_init_channels(ic, NULL, bands);
ieee80211_ifattach(ic);
ic->ic_raw_xmit = upgt_raw_xmit;
diff --git a/sys/dev/usb/wlan/if_ural.c b/sys/dev/usb/wlan/if_ural.c
index 4d84e5a..328b0a2 100644
--- a/sys/dev/usb/wlan/if_ural.c
+++ b/sys/dev/usb/wlan/if_ural.c
@@ -424,7 +424,8 @@ ural_attach(device_t self)
struct usb_attach_arg *uaa = device_get_ivars(self);
struct ural_softc *sc = device_get_softc(self);
struct ieee80211com *ic = &sc->sc_ic;
- uint8_t iface_index, bands;
+ uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)];
+ uint8_t iface_index;
int error;
device_set_usb_desc(self);
@@ -473,12 +474,12 @@ ural_attach(device_t self)
| IEEE80211_C_WPA /* 802.11i */
;
- bands = 0;
- setbit(&bands, IEEE80211_MODE_11B);
- setbit(&bands, IEEE80211_MODE_11G);
+ memset(bands, 0, sizeof(bands));
+ setbit(bands, IEEE80211_MODE_11B);
+ setbit(bands, IEEE80211_MODE_11G);
if (sc->rf_rev == RAL_RF_5222)
- setbit(&bands, IEEE80211_MODE_11A);
- ieee80211_init_channels(ic, NULL, &bands);
+ setbit(bands, IEEE80211_MODE_11A);
+ ieee80211_init_channels(ic, NULL, bands);
ieee80211_ifattach(ic);
ic->ic_update_promisc = ural_update_promisc;
diff --git a/sys/dev/usb/wlan/if_urtw.c b/sys/dev/usb/wlan/if_urtw.c
index 105fd9d..0f7b4d9 100644
--- a/sys/dev/usb/wlan/if_urtw.c
+++ b/sys/dev/usb/wlan/if_urtw.c
@@ -785,7 +785,8 @@ urtw_attach(device_t dev)
struct urtw_softc *sc = device_get_softc(dev);
struct usb_attach_arg *uaa = device_get_ivars(dev);
struct ieee80211com *ic = &sc->sc_ic;
- uint8_t bands, iface_index = URTW_IFACE_INDEX; /* XXX */
+ uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)];
+ uint8_t iface_index = URTW_IFACE_INDEX; /* XXX */
uint16_t n_setup;
uint32_t data;
usb_error_t error;
@@ -876,10 +877,10 @@ urtw_attach(device_t dev)
IEEE80211_C_BGSCAN | /* capable of bg scanning */
IEEE80211_C_WPA; /* 802.11i */
- bands = 0;
- setbit(&bands, IEEE80211_MODE_11B);
- setbit(&bands, IEEE80211_MODE_11G);
- ieee80211_init_channels(ic, NULL, &bands);
+ memset(bands, 0, sizeof(bands));
+ setbit(bands, IEEE80211_MODE_11B);
+ setbit(bands, IEEE80211_MODE_11G);
+ ieee80211_init_channels(ic, NULL, bands);
ieee80211_ifattach(ic);
ic->ic_raw_xmit = urtw_raw_xmit;
diff --git a/sys/dev/usb/wlan/if_urtwn.c b/sys/dev/usb/wlan/if_urtwn.c
index 73eda59..13f3926 100644
--- a/sys/dev/usb/wlan/if_urtwn.c
+++ b/sys/dev/usb/wlan/if_urtwn.c
@@ -439,7 +439,7 @@ urtwn_attach(device_t self)
struct usb_attach_arg *uaa = device_get_ivars(self);
struct urtwn_softc *sc = device_get_softc(self);
struct ieee80211com *ic = &sc->sc_ic;
- uint8_t bands;
+ uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)];
int error;
device_set_usb_desc(self);
@@ -525,10 +525,10 @@ urtwn_attach(device_t self)
IEEE80211_CRYPTO_TKIP |
IEEE80211_CRYPTO_AES_CCM;
- bands = 0;
- setbit(&bands, IEEE80211_MODE_11B);
- setbit(&bands, IEEE80211_MODE_11G);
- ieee80211_init_channels(ic, NULL, &bands);
+ memset(bands, 0, sizeof(bands));
+ setbit(bands, IEEE80211_MODE_11B);
+ setbit(bands, IEEE80211_MODE_11G);
+ ieee80211_init_channels(ic, NULL, bands);
ieee80211_ifattach(ic);
ic->ic_raw_xmit = urtwn_raw_xmit;
diff --git a/sys/dev/usb/wlan/if_zyd.c b/sys/dev/usb/wlan/if_zyd.c
index d23f306..4463fc6 100644
--- a/sys/dev/usb/wlan/if_zyd.c
+++ b/sys/dev/usb/wlan/if_zyd.c
@@ -334,7 +334,8 @@ zyd_attach(device_t dev)
struct usb_attach_arg *uaa = device_get_ivars(dev);
struct zyd_softc *sc = device_get_softc(dev);
struct ieee80211com *ic = &sc->sc_ic;
- uint8_t iface_index, bands;
+ uint8_t bands[howmany(IEEE80211_MODE_MAX, 8)];
+ uint8_t iface_index;
int error;
if (uaa->info.bcdDevice < 0x4330) {
@@ -387,10 +388,10 @@ zyd_attach(device_t dev)
| IEEE80211_C_WPA /* 802.11i */
;
- bands = 0;
- setbit(&bands, IEEE80211_MODE_11B);
- setbit(&bands, IEEE80211_MODE_11G);
- ieee80211_init_channels(ic, NULL, &bands);
+ memset(bands, 0, sizeof(bands));
+ setbit(bands, IEEE80211_MODE_11B);
+ setbit(bands, IEEE80211_MODE_11G);
+ ieee80211_init_channels(ic, NULL, bands);
ieee80211_ifattach(ic);
ic->ic_raw_xmit = zyd_raw_xmit;
diff --git a/sys/fs/ext2fs/ext2_bmap.c b/sys/fs/ext2fs/ext2_bmap.c
index d144e92..7d4a880 100644
--- a/sys/fs/ext2fs/ext2_bmap.c
+++ b/sys/fs/ext2fs/ext2_bmap.c
@@ -96,6 +96,7 @@ ext4_bmapext(struct vnode *vp, int32_t bn, int64_t *bnp, int *runp, int *runb)
struct ext4_extent *ep;
struct ext4_extent_path path = { .ep_bp = NULL };
daddr_t lbn;
+ int ret = 0;
ip = VTOI(vp);
fs = ip->i_e2fs;
@@ -113,15 +114,21 @@ ext4_bmapext(struct vnode *vp, int32_t bn, int64_t *bnp, int *runp, int *runb)
ext4_ext_find_extent(fs, ip, lbn, &path);
ep = path.ep_ext;
if (ep == NULL)
- return (EIO);
+ ret = EIO;
+ else {
+ *bnp = fsbtodb(fs, lbn - ep->e_blk +
+ (ep->e_start_lo | (daddr_t)ep->e_start_hi << 32));
- *bnp = fsbtodb(fs, lbn - ep->e_blk +
- (ep->e_start_lo | (daddr_t)ep->e_start_hi << 32));
+ if (*bnp == 0)
+ *bnp = -1;
+ }
- if (*bnp == 0)
- *bnp = -1;
+ if (path.ep_bp != NULL) {
+ brelse(path.ep_bp);
+ path.ep_bp = NULL;
+ }
- return (0);
+ return (ret);
}
/*
diff --git a/sys/geom/eli/g_eli.c b/sys/geom/eli/g_eli.c
index 57adc40..a2b4e65 100644
--- a/sys/geom/eli/g_eli.c
+++ b/sys/geom/eli/g_eli.c
@@ -571,40 +571,6 @@ again:
}
}
-/*
- * Here we generate IV. It is unique for every sector.
- */
-void
-g_eli_crypto_ivgen(struct g_eli_softc *sc, off_t offset, u_char *iv,
- size_t size)
-{
- uint8_t off[8];
-
- if ((sc->sc_flags & G_ELI_FLAG_NATIVE_BYTE_ORDER) != 0)
- bcopy(&offset, off, sizeof(off));
- else
- le64enc(off, (uint64_t)offset);
-
- switch (sc->sc_ealgo) {
- case CRYPTO_AES_XTS:
- bcopy(off, iv, sizeof(off));
- bzero(iv + sizeof(off), size - sizeof(off));
- break;
- default:
- {
- u_char hash[SHA256_DIGEST_LENGTH];
- SHA256_CTX ctx;
-
- /* Copy precalculated SHA256 context for IV-Key. */
- bcopy(&sc->sc_ivctx, &ctx, sizeof(ctx));
- SHA256_Update(&ctx, off, sizeof(off));
- SHA256_Final(hash, &ctx);
- bcopy(hash, iv, MIN(sizeof(hash), size));
- break;
- }
- }
-}
-
int
g_eli_read_metadata(struct g_class *mp, struct g_provider *pp,
struct g_eli_metadata *md)
@@ -751,44 +717,9 @@ g_eli_create(struct gctl_req *req, struct g_class *mp, struct g_provider *bpp,
else
gp->access = g_std_access;
- sc->sc_version = md->md_version;
- sc->sc_inflight = 0;
- sc->sc_crypto = G_ELI_CRYPTO_UNKNOWN;
- sc->sc_flags = md->md_flags;
- /* Backward compatibility. */
- if (md->md_version < G_ELI_VERSION_04)
- sc->sc_flags |= G_ELI_FLAG_NATIVE_BYTE_ORDER;
- if (md->md_version < G_ELI_VERSION_05)
- sc->sc_flags |= G_ELI_FLAG_SINGLE_KEY;
- if (md->md_version < G_ELI_VERSION_06 &&
- (sc->sc_flags & G_ELI_FLAG_AUTH) != 0) {
- sc->sc_flags |= G_ELI_FLAG_FIRST_KEY;
- }
- if (md->md_version < G_ELI_VERSION_07)
- sc->sc_flags |= G_ELI_FLAG_ENC_IVKEY;
- sc->sc_ealgo = md->md_ealgo;
+ eli_metadata_softc(sc, md, bpp->sectorsize, bpp->mediasize);
sc->sc_nkey = nkey;
- if (sc->sc_flags & G_ELI_FLAG_AUTH) {
- sc->sc_akeylen = sizeof(sc->sc_akey) * 8;
- sc->sc_aalgo = md->md_aalgo;
- sc->sc_alen = g_eli_hashlen(sc->sc_aalgo);
-
- sc->sc_data_per_sector = bpp->sectorsize - sc->sc_alen;
- /*
- * Some hash functions (like SHA1 and RIPEMD160) generates hash
- * which length is not multiple of 128 bits, but we want data
- * length to be multiple of 128, so we can encrypt without
- * padding. The line below rounds down data length to multiple
- * of 128 bits.
- */
- sc->sc_data_per_sector -= sc->sc_data_per_sector % 16;
-
- sc->sc_bytes_per_sector =
- (md->md_sectorsize - 1) / sc->sc_data_per_sector + 1;
- sc->sc_bytes_per_sector *= bpp->sectorsize;
- }
-
gp->softc = sc;
sc->sc_geom = gp;
@@ -831,22 +762,10 @@ g_eli_create(struct gctl_req *req, struct g_class *mp, struct g_provider *bpp,
goto failed;
}
- sc->sc_sectorsize = md->md_sectorsize;
- sc->sc_mediasize = bpp->mediasize;
- if (!(sc->sc_flags & G_ELI_FLAG_ONETIME))
- sc->sc_mediasize -= bpp->sectorsize;
- if (!(sc->sc_flags & G_ELI_FLAG_AUTH))
- sc->sc_mediasize -= (sc->sc_mediasize % sc->sc_sectorsize);
- else {
- sc->sc_mediasize /= sc->sc_bytes_per_sector;
- sc->sc_mediasize *= sc->sc_sectorsize;
- }
-
/*
* Remember the keys in our softc structure.
*/
g_eli_mkey_propagate(sc, mkey);
- sc->sc_ekeylen = md->md_keylen;
LIST_INIT(&sc->sc_workers);
diff --git a/sys/geom/eli/g_eli.h b/sys/geom/eli/g_eli.h
index e4dbee6..3deb865 100644
--- a/sys/geom/eli/g_eli.h
+++ b/sys/geom/eli/g_eli.h
@@ -40,8 +40,6 @@
#include <sys/libkern.h>
#include <sys/lock.h>
#include <sys/mutex.h>
-#include <sys/queue.h>
-#include <sys/tree.h>
#include <geom/geom.h>
#else
#include <assert.h>
@@ -49,6 +47,8 @@
#include <string.h>
#include <strings.h>
#endif
+#include <sys/queue.h>
+#include <sys/tree.h>
#ifndef _OpenSSL_
#include <sys/md5.h>
#endif
@@ -132,15 +132,15 @@
/* Switch data encryption key every 2^20 blocks. */
#define G_ELI_KEY_SHIFT 20
+#define G_ELI_CRYPTO_UNKNOWN 0
+#define G_ELI_CRYPTO_HW 1
+#define G_ELI_CRYPTO_SW 2
+
#ifdef _KERNEL
extern int g_eli_debug;
extern u_int g_eli_overwrites;
extern u_int g_eli_batch;
-#define G_ELI_CRYPTO_UNKNOWN 0
-#define G_ELI_CRYPTO_HW 1
-#define G_ELI_CRYPTO_SW 2
-
#define G_ELI_DEBUG(lvl, ...) do { \
if (g_eli_debug >= (lvl)) { \
printf("GEOM_ELI"); \
@@ -173,6 +173,8 @@ struct g_eli_worker {
LIST_ENTRY(g_eli_worker) w_next;
};
+#endif /* _KERNEL */
+
struct g_eli_softc {
struct g_geom *sc_geom;
u_int sc_version;
@@ -200,15 +202,35 @@ struct g_eli_softc {
size_t sc_sectorsize;
u_int sc_bytes_per_sector;
u_int sc_data_per_sector;
+#ifndef _KERNEL
+ int sc_cpubind;
+#else /* _KERNEL */
boolean_t sc_cpubind;
/* Only for software cryptography. */
struct bio_queue_head sc_queue;
struct mtx sc_queue_mtx;
LIST_HEAD(, g_eli_worker) sc_workers;
+#endif /* _KERNEL */
};
#define sc_name sc_geom->name
-#endif /* _KERNEL */
+
+#define G_ELI_KEY_MAGIC 0xe11341c
+
+struct g_eli_key {
+ /* Key value, must be first in the structure. */
+ uint8_t gek_key[G_ELI_DATAKEYLEN];
+ /* Magic. */
+ int gek_magic;
+ /* Key number. */
+ uint64_t gek_keyno;
+ /* Reference counter. */
+ int gek_count;
+ /* Keeps keys sorted by most recent use. */
+ TAILQ_ENTRY(g_eli_key) gek_next;
+ /* Keeps keys sorted by number. */
+ RB_ENTRY(g_eli_key) gek_link;
+};
struct g_eli_metadata {
char md_magic[16]; /* Magic value. */
@@ -569,6 +591,60 @@ g_eli_hashlen(u_int algo)
return (0);
}
+static __inline void
+eli_metadata_softc(struct g_eli_softc *sc, const struct g_eli_metadata *md,
+ u_int sectorsize, off_t mediasize)
+{
+
+ sc->sc_version = md->md_version;
+ sc->sc_inflight = 0;
+ sc->sc_crypto = G_ELI_CRYPTO_UNKNOWN;
+ sc->sc_flags = md->md_flags;
+ /* Backward compatibility. */
+ if (md->md_version < G_ELI_VERSION_04)
+ sc->sc_flags |= G_ELI_FLAG_NATIVE_BYTE_ORDER;
+ if (md->md_version < G_ELI_VERSION_05)
+ sc->sc_flags |= G_ELI_FLAG_SINGLE_KEY;
+ if (md->md_version < G_ELI_VERSION_06 &&
+ (sc->sc_flags & G_ELI_FLAG_AUTH) != 0) {
+ sc->sc_flags |= G_ELI_FLAG_FIRST_KEY;
+ }
+ if (md->md_version < G_ELI_VERSION_07)
+ sc->sc_flags |= G_ELI_FLAG_ENC_IVKEY;
+ sc->sc_ealgo = md->md_ealgo;
+
+ if (sc->sc_flags & G_ELI_FLAG_AUTH) {
+ sc->sc_akeylen = sizeof(sc->sc_akey) * 8;
+ sc->sc_aalgo = md->md_aalgo;
+ sc->sc_alen = g_eli_hashlen(sc->sc_aalgo);
+
+ sc->sc_data_per_sector = sectorsize - sc->sc_alen;
+ /*
+ * Some hash functions (like SHA1 and RIPEMD160) generates hash
+ * which length is not multiple of 128 bits, but we want data
+ * length to be multiple of 128, so we can encrypt without
+ * padding. The line below rounds down data length to multiple
+ * of 128 bits.
+ */
+ sc->sc_data_per_sector -= sc->sc_data_per_sector % 16;
+
+ sc->sc_bytes_per_sector =
+ (md->md_sectorsize - 1) / sc->sc_data_per_sector + 1;
+ sc->sc_bytes_per_sector *= sectorsize;
+ }
+ sc->sc_sectorsize = md->md_sectorsize;
+ sc->sc_mediasize = mediasize;
+ if (!(sc->sc_flags & G_ELI_FLAG_ONETIME))
+ sc->sc_mediasize -= sectorsize;
+ if (!(sc->sc_flags & G_ELI_FLAG_AUTH))
+ sc->sc_mediasize -= (sc->sc_mediasize % sc->sc_sectorsize);
+ else {
+ sc->sc_mediasize /= sc->sc_bytes_per_sector;
+ sc->sc_mediasize *= sc->sc_sectorsize;
+ }
+ sc->sc_ekeylen = md->md_keylen;
+}
+
#ifdef _KERNEL
int g_eli_read_metadata(struct g_class *mp, struct g_provider *pp,
struct g_eli_metadata *md);
@@ -583,8 +659,6 @@ void g_eli_config(struct gctl_req *req, struct g_class *mp, const char *verb);
void g_eli_read_done(struct bio *bp);
void g_eli_write_done(struct bio *bp);
int g_eli_crypto_rerun(struct cryptop *crp);
-void g_eli_crypto_ivgen(struct g_eli_softc *sc, off_t offset, u_char *iv,
- size_t size);
void g_eli_crypto_read(struct g_eli_softc *sc, struct bio *bp, boolean_t fromworker);
void g_eli_crypto_run(struct g_eli_worker *wr, struct bio *bp);
@@ -592,6 +666,8 @@ void g_eli_crypto_run(struct g_eli_worker *wr, struct bio *bp);
void g_eli_auth_read(struct g_eli_softc *sc, struct bio *bp);
void g_eli_auth_run(struct g_eli_worker *wr, struct bio *bp);
#endif
+void g_eli_crypto_ivgen(struct g_eli_softc *sc, off_t offset, u_char *iv,
+ size_t size);
void g_eli_mkey_hmac(unsigned char *mkey, const unsigned char *key);
int g_eli_mkey_decrypt(const struct g_eli_metadata *md,
@@ -620,6 +696,8 @@ void g_eli_crypto_hmac_final(struct hmac_ctx *ctx, uint8_t *md, size_t mdsize);
void g_eli_crypto_hmac(const uint8_t *hkey, size_t hkeysize,
const uint8_t *data, size_t datasize, uint8_t *md, size_t mdsize);
+void g_eli_key_fill(struct g_eli_softc *sc, struct g_eli_key *key,
+ uint64_t keyno);
#ifdef _KERNEL
void g_eli_key_init(struct g_eli_softc *sc);
void g_eli_key_destroy(struct g_eli_softc *sc);
diff --git a/sys/geom/eli/g_eli_crypto.c b/sys/geom/eli/g_eli_crypto.c
index 43eabf4..2d145fd 100644
--- a/sys/geom/eli/g_eli_crypto.c
+++ b/sys/geom/eli/g_eli_crypto.c
@@ -221,75 +221,3 @@ g_eli_crypto_decrypt(u_int algo, u_char *data, size_t datasize,
return (g_eli_crypto_cipher(algo, 0, data, datasize, key, keysize));
}
-
-void
-g_eli_crypto_hmac_init(struct hmac_ctx *ctx, const uint8_t *hkey,
- size_t hkeylen)
-{
- u_char k_ipad[128], key[128];
- SHA512_CTX lctx;
- u_int i;
-
- bzero(key, sizeof(key));
- if (hkeylen == 0)
- ; /* do nothing */
- else if (hkeylen <= 128)
- bcopy(hkey, key, hkeylen);
- else {
- /* If key is longer than 128 bytes reset it to key = SHA512(key). */
- SHA512_Init(&lctx);
- SHA512_Update(&lctx, hkey, hkeylen);
- SHA512_Final(key, &lctx);
- }
-
- /* XOR key with ipad and opad values. */
- for (i = 0; i < sizeof(key); i++) {
- k_ipad[i] = key[i] ^ 0x36;
- ctx->k_opad[i] = key[i] ^ 0x5c;
- }
- bzero(key, sizeof(key));
- /* Perform inner SHA512. */
- SHA512_Init(&ctx->shactx);
- SHA512_Update(&ctx->shactx, k_ipad, sizeof(k_ipad));
- bzero(k_ipad, sizeof(k_ipad));
-}
-
-void
-g_eli_crypto_hmac_update(struct hmac_ctx *ctx, const uint8_t *data,
- size_t datasize)
-{
-
- SHA512_Update(&ctx->shactx, data, datasize);
-}
-
-void
-g_eli_crypto_hmac_final(struct hmac_ctx *ctx, uint8_t *md, size_t mdsize)
-{
- u_char digest[SHA512_MDLEN];
- SHA512_CTX lctx;
-
- SHA512_Final(digest, &ctx->shactx);
- /* Perform outer SHA512. */
- SHA512_Init(&lctx);
- SHA512_Update(&lctx, ctx->k_opad, sizeof(ctx->k_opad));
- bzero(ctx, sizeof(*ctx));
- SHA512_Update(&lctx, digest, sizeof(digest));
- SHA512_Final(digest, &lctx);
- bzero(&lctx, sizeof(lctx));
- /* mdsize == 0 means "Give me the whole hash!" */
- if (mdsize == 0)
- mdsize = SHA512_MDLEN;
- bcopy(digest, md, mdsize);
- bzero(digest, sizeof(digest));
-}
-
-void
-g_eli_crypto_hmac(const uint8_t *hkey, size_t hkeysize, const uint8_t *data,
- size_t datasize, uint8_t *md, size_t mdsize)
-{
- struct hmac_ctx ctx;
-
- g_eli_crypto_hmac_init(&ctx, hkey, hkeysize);
- g_eli_crypto_hmac_update(&ctx, data, datasize);
- g_eli_crypto_hmac_final(&ctx, md, mdsize);
-}
diff --git a/sys/geom/eli/g_eli_hmac.c b/sys/geom/eli/g_eli_hmac.c
new file mode 100644
index 0000000..36b76de
--- /dev/null
+++ b/sys/geom/eli/g_eli_hmac.c
@@ -0,0 +1,150 @@
+/*-
+ * Copyright (c) 2005-2010 Pawel Jakub Dawidek <pjd@FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#ifdef _KERNEL
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/malloc.h>
+#else
+#include <stdint.h>
+#include <string.h>
+#include <strings.h>
+#include <errno.h>
+#include <assert.h>
+#include <openssl/evp.h>
+#define _OpenSSL_
+#endif
+#include <geom/eli/g_eli.h>
+
+void
+g_eli_crypto_hmac_init(struct hmac_ctx *ctx, const uint8_t *hkey,
+ size_t hkeylen)
+{
+ u_char k_ipad[128], key[128];
+ SHA512_CTX lctx;
+ u_int i;
+
+ bzero(key, sizeof(key));
+ if (hkeylen == 0)
+ ; /* do nothing */
+ else if (hkeylen <= 128)
+ bcopy(hkey, key, hkeylen);
+ else {
+ /* If key is longer than 128 bytes reset it to key = SHA512(key). */
+ SHA512_Init(&lctx);
+ SHA512_Update(&lctx, hkey, hkeylen);
+ SHA512_Final(key, &lctx);
+ }
+
+ /* XOR key with ipad and opad values. */
+ for (i = 0; i < sizeof(key); i++) {
+ k_ipad[i] = key[i] ^ 0x36;
+ ctx->k_opad[i] = key[i] ^ 0x5c;
+ }
+ bzero(key, sizeof(key));
+ /* Perform inner SHA512. */
+ SHA512_Init(&ctx->shactx);
+ SHA512_Update(&ctx->shactx, k_ipad, sizeof(k_ipad));
+ bzero(k_ipad, sizeof(k_ipad));
+}
+
+void
+g_eli_crypto_hmac_update(struct hmac_ctx *ctx, const uint8_t *data,
+ size_t datasize)
+{
+
+ SHA512_Update(&ctx->shactx, data, datasize);
+}
+
+void
+g_eli_crypto_hmac_final(struct hmac_ctx *ctx, uint8_t *md, size_t mdsize)
+{
+ u_char digest[SHA512_MDLEN];
+ SHA512_CTX lctx;
+
+ SHA512_Final(digest, &ctx->shactx);
+ /* Perform outer SHA512. */
+ SHA512_Init(&lctx);
+ SHA512_Update(&lctx, ctx->k_opad, sizeof(ctx->k_opad));
+ bzero(ctx, sizeof(*ctx));
+ SHA512_Update(&lctx, digest, sizeof(digest));
+ SHA512_Final(digest, &lctx);
+ bzero(&lctx, sizeof(lctx));
+ /* mdsize == 0 means "Give me the whole hash!" */
+ if (mdsize == 0)
+ mdsize = SHA512_MDLEN;
+ bcopy(digest, md, mdsize);
+ bzero(digest, sizeof(digest));
+}
+
+void
+g_eli_crypto_hmac(const uint8_t *hkey, size_t hkeysize, const uint8_t *data,
+ size_t datasize, uint8_t *md, size_t mdsize)
+{
+ struct hmac_ctx ctx;
+
+ g_eli_crypto_hmac_init(&ctx, hkey, hkeysize);
+ g_eli_crypto_hmac_update(&ctx, data, datasize);
+ g_eli_crypto_hmac_final(&ctx, md, mdsize);
+}
+
+/*
+ * Here we generate IV. It is unique for every sector.
+ */
+void
+g_eli_crypto_ivgen(struct g_eli_softc *sc, off_t offset, u_char *iv,
+ size_t size)
+{
+ uint8_t off[8];
+
+ if ((sc->sc_flags & G_ELI_FLAG_NATIVE_BYTE_ORDER) != 0)
+ bcopy(&offset, off, sizeof(off));
+ else
+ le64enc(off, (uint64_t)offset);
+
+ switch (sc->sc_ealgo) {
+ case CRYPTO_AES_XTS:
+ bcopy(off, iv, sizeof(off));
+ bzero(iv + sizeof(off), size - sizeof(off));
+ break;
+ default:
+ {
+ u_char hash[SHA256_DIGEST_LENGTH];
+ SHA256_CTX ctx;
+
+ /* Copy precalculated SHA256 context for IV-Key. */
+ bcopy(&sc->sc_ivctx, &ctx, sizeof(ctx));
+ SHA256_Update(&ctx, off, sizeof(off));
+ SHA256_Final(hash, &ctx);
+ bcopy(hash, iv, MIN(sizeof(hash), size));
+ break;
+ }
+ }
+}
diff --git a/sys/geom/eli/g_eli_key_cache.c b/sys/geom/eli/g_eli_key_cache.c
index cb86716..0b909be 100644
--- a/sys/geom/eli/g_eli_key_cache.c
+++ b/sys/geom/eli/g_eli_key_cache.c
@@ -28,17 +28,20 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
+#ifdef _KERNEL
#include <sys/kernel.h>
#include <sys/malloc.h>
-#include <sys/queue.h>
#include <sys/sysctl.h>
#include <sys/systm.h>
+#endif /* _KERNEL */
+#include <sys/queue.h>
#include <sys/tree.h>
#include <geom/geom.h>
#include <geom/eli/g_eli.h>
+#ifdef _KERNEL
MALLOC_DECLARE(M_ELI);
SYSCTL_DECL(_kern_geom_eli);
@@ -56,22 +59,7 @@ static uint64_t g_eli_key_cache_misses;
SYSCTL_UQUAD(_kern_geom_eli, OID_AUTO, key_cache_misses, CTLFLAG_RW,
&g_eli_key_cache_misses, 0, "Key cache misses");
-#define G_ELI_KEY_MAGIC 0xe11341c
-
-struct g_eli_key {
- /* Key value, must be first in the structure. */
- uint8_t gek_key[G_ELI_DATAKEYLEN];
- /* Magic. */
- int gek_magic;
- /* Key number. */
- uint64_t gek_keyno;
- /* Reference counter. */
- int gek_count;
- /* Keeps keys sorted by most recent use. */
- TAILQ_ENTRY(g_eli_key) gek_next;
- /* Keeps keys sorted by number. */
- RB_ENTRY(g_eli_key) gek_link;
-};
+#endif /* _KERNEL */
static int
g_eli_key_cmp(const struct g_eli_key *a, const struct g_eli_key *b)
@@ -84,10 +72,7 @@ g_eli_key_cmp(const struct g_eli_key *a, const struct g_eli_key *b)
return (0);
}
-RB_PROTOTYPE(g_eli_key_tree, g_eli_key, gek_link, g_eli_key_cmp);
-RB_GENERATE(g_eli_key_tree, g_eli_key, gek_link, g_eli_key_cmp);
-
-static void
+void
g_eli_key_fill(struct g_eli_softc *sc, struct g_eli_key *key, uint64_t keyno)
{
const uint8_t *ekey;
@@ -110,6 +95,10 @@ g_eli_key_fill(struct g_eli_softc *sc, struct g_eli_key *key, uint64_t keyno)
key->gek_magic = G_ELI_KEY_MAGIC;
}
+#ifdef _KERNEL
+RB_PROTOTYPE(g_eli_key_tree, g_eli_key, gek_link, g_eli_key_cmp);
+RB_GENERATE(g_eli_key_tree, g_eli_key, gek_link, g_eli_key_cmp);
+
static struct g_eli_key *
g_eli_key_allocate(struct g_eli_softc *sc, uint64_t keyno)
{
@@ -350,3 +339,4 @@ g_eli_key_drop(struct g_eli_softc *sc, uint8_t *rawkey)
}
mtx_unlock(&sc->sc_ekeys_lock);
}
+#endif /* _KERNEL */
diff --git a/sys/geom/eli/pkcs5v2.c b/sys/geom/eli/pkcs5v2.c
index 05677c1..6992801 100644
--- a/sys/geom/eli/pkcs5v2.c
+++ b/sys/geom/eli/pkcs5v2.c
@@ -83,6 +83,7 @@ pkcs5v2_genkey(uint8_t *key, unsigned keylen, const uint8_t *salt,
}
#ifndef _KERNEL
+#ifndef _STAND
/*
* Return the number of microseconds needed for 'interations' iterations.
*/
@@ -120,4 +121,5 @@ pkcs5v2_calculate(int usecs)
}
return (((intmax_t)iterations * (intmax_t)usecs) / v);
}
+#endif /* !_STAND */
#endif /* !_KERNEL */
diff --git a/sys/i386/include/metadata.h b/sys/i386/include/metadata.h
index 9003c15..98d0272 100644
--- a/sys/i386/include/metadata.h
+++ b/sys/i386/include/metadata.h
@@ -1,37 +1,6 @@
/*-
- * Copyright (c) 2003 Peter Wemm <peter@FreeBSD.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
+ * This file is in the public domain.
*/
+/* $FreeBSD$ */
-#ifndef _MACHINE_METADATA_H_
-#define _MACHINE_METADATA_H_
-
-#define MODINFOMD_SMAP 0x1001
-#define MODINFOMD_SMAP_XATTR 0x1002
-#define MODINFOMD_DTBP 0x1003
-#define MODINFOMD_MODULEP 0x1006
-
-#endif /* !_MACHINE_METADATA_H_ */
+#include <x86/metadata.h>
diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c
index 2056542..ea68a6d 100644
--- a/sys/kern/kern_conf.c
+++ b/sys/kern/kern_conf.c
@@ -566,22 +566,26 @@ notify_destroy(struct cdev *dev)
}
static struct cdev *
-newdev(struct cdevsw *csw, int unit, struct cdev *si)
+newdev(struct make_dev_args *args, struct cdev *si)
{
struct cdev *si2;
+ struct cdevsw *csw;
mtx_assert(&devmtx, MA_OWNED);
+ csw = args->mda_devsw;
if (csw->d_flags & D_NEEDMINOR) {
/* We may want to return an existing device */
LIST_FOREACH(si2, &csw->d_devs, si_list) {
- if (dev2unit(si2) == unit) {
+ if (dev2unit(si2) == args->mda_unit) {
dev_free_devlocked(si);
return (si2);
}
}
}
- si->si_drv0 = unit;
+ si->si_drv0 = args->mda_unit;
si->si_devsw = csw;
+ si->si_drv1 = args->mda_si_drv1;
+ si->si_drv2 = args->mda_si_drv2;
LIST_INSERT_HEAD(&csw->d_devs, si, si_list);
return (si);
}
@@ -737,33 +741,46 @@ prep_devname(struct cdev *dev, const char *fmt, va_list ap)
return (0);
}
+void
+make_dev_args_init_impl(struct make_dev_args *args, size_t sz)
+{
+
+ bzero(args, sz);
+ args->mda_size = sz;
+}
+
static int
-make_dev_credv(int flags, struct cdev **dres, struct cdevsw *devsw, int unit,
- struct ucred *cr, uid_t uid, gid_t gid, int mode, const char *fmt,
- va_list ap)
+make_dev_sv(struct make_dev_args *args1, struct cdev **dres,
+ const char *fmt, va_list ap)
{
struct cdev *dev, *dev_new;
+ struct make_dev_args args;
int res;
- KASSERT((flags & MAKEDEV_WAITOK) == 0 || (flags & MAKEDEV_NOWAIT) == 0,
- ("make_dev_credv: both WAITOK and NOWAIT specified"));
- dev_new = devfs_alloc(flags);
+ bzero(&args, sizeof(args));
+ if (sizeof(args) < args1->mda_size)
+ return (EINVAL);
+ bcopy(args1, &args, args1->mda_size);
+ KASSERT((args.mda_flags & MAKEDEV_WAITOK) == 0 ||
+ (args.mda_flags & MAKEDEV_NOWAIT) == 0,
+ ("make_dev_sv: both WAITOK and NOWAIT specified"));
+ dev_new = devfs_alloc(args.mda_flags);
if (dev_new == NULL)
return (ENOMEM);
dev_lock();
- res = prep_cdevsw(devsw, flags);
+ res = prep_cdevsw(args.mda_devsw, args.mda_flags);
if (res != 0) {
dev_unlock();
devfs_free(dev_new);
return (res);
}
- dev = newdev(devsw, unit, dev_new);
+ dev = newdev(&args, dev_new);
if ((dev->si_flags & SI_NAMED) == 0) {
res = prep_devname(dev, fmt, ap);
if (res != 0) {
- if ((flags & MAKEDEV_CHECKNAME) == 0) {
+ if ((args.mda_flags & MAKEDEV_CHECKNAME) == 0) {
panic(
- "make_dev_credv: bad si_name (error=%d, si_name=%s)",
+ "make_dev_sv: bad si_name (error=%d, si_name=%s)",
res, dev->si_name);
}
if (dev == dev_new) {
@@ -775,9 +792,9 @@ make_dev_credv(int flags, struct cdev **dres, struct cdevsw *devsw, int unit,
return (res);
}
}
- if (flags & MAKEDEV_REF)
+ if ((args.mda_flags & MAKEDEV_REF) != 0)
dev_refl(dev);
- if (flags & MAKEDEV_ETERNAL)
+ if ((args.mda_flags & MAKEDEV_ETERNAL) != 0)
dev->si_flags |= SI_ETERNAL;
if (dev->si_flags & SI_CHEAPCLONE &&
dev->si_flags & SI_NAMED) {
@@ -792,24 +809,55 @@ make_dev_credv(int flags, struct cdev **dres, struct cdevsw *devsw, int unit,
}
KASSERT(!(dev->si_flags & SI_NAMED),
("make_dev() by driver %s on pre-existing device (min=%x, name=%s)",
- devsw->d_name, dev2unit(dev), devtoname(dev)));
+ args.mda_devsw->d_name, dev2unit(dev), devtoname(dev)));
dev->si_flags |= SI_NAMED;
- if (cr != NULL)
- dev->si_cred = crhold(cr);
- dev->si_uid = uid;
- dev->si_gid = gid;
- dev->si_mode = mode;
+ if (args.mda_cr != NULL)
+ dev->si_cred = crhold(args.mda_cr);
+ dev->si_uid = args.mda_uid;
+ dev->si_gid = args.mda_gid;
+ dev->si_mode = args.mda_mode;
devfs_create(dev);
clean_unrhdrl(devfs_inos);
dev_unlock_and_free();
- notify_create(dev, flags);
+ notify_create(dev, args.mda_flags);
*dres = dev;
return (0);
}
+int
+make_dev_s(struct make_dev_args *args, struct cdev **dres,
+ const char *fmt, ...)
+{
+ va_list ap;
+ int res;
+
+ va_start(ap, fmt);
+ res = make_dev_sv(args, dres, fmt, ap);
+ va_end(ap);
+ return (res);
+}
+
+static int
+make_dev_credv(int flags, struct cdev **dres, struct cdevsw *devsw, int unit,
+ struct ucred *cr, uid_t uid, gid_t gid, int mode, const char *fmt,
+ va_list ap)
+{
+ struct make_dev_args args;
+
+ make_dev_args_init(&args);
+ args.mda_flags = flags;
+ args.mda_devsw = devsw;
+ args.mda_cr = cr;
+ args.mda_uid = uid;
+ args.mda_gid = gid;
+ args.mda_mode = mode;
+ args.mda_unit = unit;
+ return (make_dev_sv(&args, dres, fmt, ap));
+}
+
struct cdev *
make_dev(struct cdevsw *devsw, int unit, uid_t uid, gid_t gid, int mode,
const char *fmt, ...)
@@ -1247,6 +1295,7 @@ clone_create(struct clonedevs **cdp, struct cdevsw *csw, int *up,
{
struct clonedevs *cd;
struct cdev *dev, *ndev, *dl, *de;
+ struct make_dev_args args;
int unit, low, u;
KASSERT(*cdp != NULL,
@@ -1298,7 +1347,10 @@ clone_create(struct clonedevs **cdp, struct cdevsw *csw, int *up,
}
if (unit == -1)
unit = low & CLONE_UNITMASK;
- dev = newdev(csw, unit | extra, ndev);
+ make_dev_args_init(&args);
+ args.mda_unit = unit | extra;
+ args.mda_devsw = csw;
+ dev = newdev(&args, ndev);
if (dev->si_flags & SI_CLONELIST) {
printf("dev %p (%s) is on clonelist\n", dev, dev->si_name);
printf("unit=%d, low=%d, extra=0x%x\n", unit, low, extra);
diff --git a/sys/kern/tty.c b/sys/kern/tty.c
index d9d0cce..9695312 100644
--- a/sys/kern/tty.c
+++ b/sys/kern/tty.c
@@ -237,14 +237,10 @@ static int
ttydev_open(struct cdev *dev, int oflags, int devtype, struct thread *td)
{
struct tty *tp;
- int error = 0;
-
- while ((tp = dev->si_drv1) == NULL) {
- error = tsleep(&dev->si_drv1, PCATCH, "ttdrv1", 1);
- if (error != EWOULDBLOCK)
- return (error);
- }
+ int error;
+ tp = dev->si_drv1;
+ error = 0;
tty_lock(tp);
if (tty_gone(tp)) {
/* Device is already gone. */
@@ -755,13 +751,10 @@ static int
ttyil_open(struct cdev *dev, int oflags, int devtype, struct thread *td)
{
struct tty *tp;
- int error = 0;
+ int error;
- while ((tp = dev->si_drv1) == NULL) {
- error = tsleep(&dev->si_drv1, PCATCH, "ttdrv1", 1);
- if (error != EWOULDBLOCK)
- return (error);
- }
+ tp = dev->si_drv1;
+ error = 0;
tty_lock(tp);
if (tty_gone(tp))
error = ENODEV;
@@ -1189,6 +1182,7 @@ tty_makedevf(struct tty *tp, struct ucred *cred, int flags,
const char *fmt, ...)
{
va_list ap;
+ struct make_dev_args args;
struct cdev *dev, *init, *lock, *cua, *cinit, *clock;
const char *prefix = "tty";
char name[SPECNAMELEN - 3]; /* for "tty" and "cua". */
@@ -1221,71 +1215,72 @@ tty_makedevf(struct tty *tp, struct ucred *cred, int flags,
flags |= MAKEDEV_CHECKNAME;
/* Master call-in device. */
- error = make_dev_p(flags, &dev, &ttydev_cdevsw, cred, uid, gid, mode,
- "%s%s", prefix, name);
- if (error)
+ make_dev_args_init(&args);
+ args.mda_flags = flags;
+ args.mda_devsw = &ttydev_cdevsw;
+ args.mda_cr = cred;
+ args.mda_uid = uid;
+ args.mda_gid = gid;
+ args.mda_mode = mode;
+ args.mda_si_drv1 = tp;
+ error = make_dev_s(&args, &dev, "%s%s", prefix, name);
+ if (error != 0)
return (error);
- dev->si_drv1 = tp;
- wakeup(&dev->si_drv1);
tp->t_dev = dev;
init = lock = cua = cinit = clock = NULL;
/* Slave call-in devices. */
if (tp->t_flags & TF_INITLOCK) {
- error = make_dev_p(flags, &init, &ttyil_cdevsw, cred, uid,
- gid, mode, "%s%s.init", prefix, name);
- if (error)
+ args.mda_devsw = &ttyil_cdevsw;
+ args.mda_unit = TTYUNIT_INIT;
+ args.mda_si_drv1 = tp;
+ args.mda_si_drv2 = &tp->t_termios_init_in;
+ error = make_dev_s(&args, &init, "%s%s.init", prefix, name);
+ if (error != 0)
goto fail;
dev_depends(dev, init);
- dev2unit(init) = TTYUNIT_INIT;
- init->si_drv1 = tp;
- wakeup(&init->si_drv1);
- init->si_drv2 = &tp->t_termios_init_in;
- error = make_dev_p(flags, &lock, &ttyil_cdevsw, cred, uid,
- gid, mode, "%s%s.lock", prefix, name);
- if (error)
+ args.mda_unit = TTYUNIT_LOCK;
+ args.mda_si_drv2 = &tp->t_termios_lock_in;
+ error = make_dev_s(&args, &lock, "%s%s.lock", prefix, name);
+ if (error != 0)
goto fail;
dev_depends(dev, lock);
- dev2unit(lock) = TTYUNIT_LOCK;
- lock->si_drv1 = tp;
- wakeup(&lock->si_drv1);
- lock->si_drv2 = &tp->t_termios_lock_in;
}
/* Call-out devices. */
if (tp->t_flags & TF_CALLOUT) {
- error = make_dev_p(flags, &cua, &ttydev_cdevsw, cred,
- UID_UUCP, GID_DIALER, 0660, "cua%s", name);
- if (error)
+ make_dev_args_init(&args);
+ args.mda_flags = flags;
+ args.mda_devsw = &ttydev_cdevsw;
+ args.mda_cr = cred;
+ args.mda_uid = UID_UUCP;
+ args.mda_gid = GID_DIALER;
+ args.mda_mode = 0660;
+ args.mda_unit = TTYUNIT_CALLOUT;
+ args.mda_si_drv1 = tp;
+ error = make_dev_s(&args, &cua, "cua%s", name);
+ if (error != 0)
goto fail;
dev_depends(dev, cua);
- dev2unit(cua) = TTYUNIT_CALLOUT;
- cua->si_drv1 = tp;
- wakeup(&cua->si_drv1);
/* Slave call-out devices. */
if (tp->t_flags & TF_INITLOCK) {
- error = make_dev_p(flags, &cinit, &ttyil_cdevsw, cred,
- UID_UUCP, GID_DIALER, 0660, "cua%s.init", name);
- if (error)
+ args.mda_devsw = &ttyil_cdevsw;
+ args.mda_unit = TTYUNIT_CALLOUT | TTYUNIT_INIT;
+ args.mda_si_drv2 = &tp->t_termios_init_out;
+ error = make_dev_s(&args, &cinit, "cua%s.init", name);
+ if (error != 0)
goto fail;
dev_depends(dev, cinit);
- dev2unit(cinit) = TTYUNIT_CALLOUT | TTYUNIT_INIT;
- cinit->si_drv1 = tp;
- wakeup(&cinit->si_drv1);
- cinit->si_drv2 = &tp->t_termios_init_out;
- error = make_dev_p(flags, &clock, &ttyil_cdevsw, cred,
- UID_UUCP, GID_DIALER, 0660, "cua%s.lock", name);
- if (error)
+ args.mda_unit = TTYUNIT_CALLOUT | TTYUNIT_LOCK;
+ args.mda_si_drv2 = &tp->t_termios_lock_out;
+ error = make_dev_s(&args, &clock, "cua%s.lock", name);
+ if (error != 0)
goto fail;
dev_depends(dev, clock);
- dev2unit(clock) = TTYUNIT_CALLOUT | TTYUNIT_LOCK;
- clock->si_drv1 = tp;
- wakeup(&clock->si_drv1);
- clock->si_drv2 = &tp->t_termios_lock_out;
}
}
diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c
index ff3736d..f1bd821 100644
--- a/sys/kern/vfs_cache.c
+++ b/sys/kern/vfs_cache.c
@@ -288,7 +288,7 @@ static u_long nummiss; STATNODE(CTLFLAG_RD, nummiss, &nummiss,
"Number of cache misses");
static u_long nummisszap; STATNODE(CTLFLAG_RD, nummisszap, &nummisszap,
"Number of cache misses we do not want to cache");
-static u_long numposzaps; STATNODE(CTLFLAG_RD, numposzaps, &numposzaps,
+static u_long numposzaps; STATNODE(CTLFLAG_RD, numposzaps, &numposzaps,
"Number of cache hits (positive) we do not want to cache");
static u_long numposhits; STATNODE(CTLFLAG_RD, numposhits, &numposhits,
"Number of cache hits (positive)");
@@ -303,8 +303,6 @@ SYSCTL_OPAQUE(_vfs_cache, OID_AUTO, nchstats, CTLFLAG_RD | CTLFLAG_MPSAFE,
&nchstats, sizeof(nchstats), "LU",
"VFS cache effectiveness statistics");
-
-
static void cache_zap(struct namecache *ncp);
static int vn_vptocnp_locked(struct vnode **vp, struct ucred *cred, char *buf,
u_int *buflen);
@@ -410,8 +408,7 @@ SYSCTL_PROC(_debug_hashstat, OID_AUTO, nchash, CTLTYPE_INT|CTLFLAG_RD|
* pointer to a vnode or if it is just a negative cache entry.
*/
static void
-cache_zap(ncp)
- struct namecache *ncp;
+cache_zap(struct namecache *ncp)
{
struct vnode *vp;
@@ -446,7 +443,7 @@ cache_zap(ncp)
}
numcache--;
cache_free(ncp);
- if (vp)
+ if (vp != NULL)
vdrop(vp);
}
@@ -468,12 +465,8 @@ cache_zap(ncp)
*/
int
-cache_lookup(dvp, vpp, cnp, tsp, ticksp)
- struct vnode *dvp;
- struct vnode **vpp;
- struct componentname *cnp;
- struct timespec *tsp;
- int *ticksp;
+cache_lookup(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp,
+ struct timespec *tsp, int *ticksp)
{
struct namecache *ncp;
uint32_t hash;
@@ -701,12 +694,8 @@ unlock:
* Add an entry to the cache.
*/
void
-cache_enter_time(dvp, vp, cnp, tsp, dtsp)
- struct vnode *dvp;
- struct vnode *vp;
- struct componentname *cnp;
- struct timespec *tsp;
- struct timespec *dtsp;
+cache_enter_time(struct vnode *dvp, struct vnode *vp, struct componentname *cnp,
+ struct timespec *tsp, struct timespec *dtsp)
{
struct namecache *ncp, *n2;
struct namecache_ts *n3;
@@ -836,9 +825,9 @@ cache_enter_time(dvp, vp, cnp, tsp, dtsp)
* has populated v_cache_dd pointer already.
*/
if (dvp->v_cache_dd != NULL) {
- CACHE_WUNLOCK();
- cache_free(ncp);
- return;
+ CACHE_WUNLOCK();
+ cache_free(ncp);
+ return;
}
KASSERT(vp == NULL || vp->v_type == VDIR,
("wrong vnode type %p", vp));
@@ -846,7 +835,7 @@ cache_enter_time(dvp, vp, cnp, tsp, dtsp)
}
numcache++;
- if (!vp) {
+ if (vp == NULL) {
numneg++;
if (cnp->cn_flags & ISWHITEOUT)
ncp->nc_flag |= NCF_WHITE;
@@ -884,7 +873,7 @@ cache_enter_time(dvp, vp, cnp, tsp, dtsp)
* "negative" cache queue, otherwise, we place it into the
* destination vnode's cache entries queue.
*/
- if (vp) {
+ if (vp != NULL) {
TAILQ_INSERT_HEAD(&vp->v_cache_dst, ncp, nc_dst);
SDT_PROBE3(vfs, namecache, enter, done, dvp, nc_get_name(ncp),
vp);
@@ -975,8 +964,7 @@ cache_changesize(int newmaxvnodes)
* Invalidate all entries to a particular vnode.
*/
void
-cache_purge(vp)
- struct vnode *vp;
+cache_purge(struct vnode *vp)
{
CTR1(KTR_VFS, "cache_purge(%p)", vp);
@@ -999,8 +987,7 @@ cache_purge(vp)
* Invalidate all negative entries for a particular directory vnode.
*/
void
-cache_purge_negative(vp)
- struct vnode *vp;
+cache_purge_negative(struct vnode *vp)
{
struct namecache *cp, *ncp;
@@ -1018,8 +1005,7 @@ cache_purge_negative(vp)
* Flush all entries referencing a particular filesystem.
*/
void
-cache_purgevfs(mp)
- struct mount *mp;
+cache_purgevfs(struct mount *mp)
{
struct nchashhead *ncpp;
struct namecache *ncp, *nnp;
@@ -1042,12 +1028,7 @@ cache_purgevfs(mp)
*/
int
-vfs_cache_lookup(ap)
- struct vop_lookup_args /* {
- struct vnode *a_dvp;
- struct vnode **a_vpp;
- struct componentname *a_cnp;
- } */ *ap;
+vfs_cache_lookup(struct vop_lookup_args *ap)
{
struct vnode *dvp;
int error;
@@ -1088,9 +1069,7 @@ SYSCTL_INT(_debug, OID_AUTO, disablecwd, CTLFLAG_RW, &disablecwd, 0,
/* Implementation of the getcwd syscall. */
int
-sys___getcwd(td, uap)
- struct thread *td;
- struct __getcwd_args *uap;
+sys___getcwd(struct thread *td, struct __getcwd_args *uap)
{
return (kern___getcwd(td, uap->buf, UIO_USERSPACE, uap->buflen,
diff --git a/sys/modules/geom/geom_eli/Makefile b/sys/modules/geom/geom_eli/Makefile
index 51d821a..c42ccf1 100644
--- a/sys/modules/geom/geom_eli/Makefile
+++ b/sys/modules/geom/geom_eli/Makefile
@@ -6,6 +6,7 @@ KMOD= geom_eli
SRCS= g_eli.c
SRCS+= g_eli_crypto.c
SRCS+= g_eli_ctl.c
+SRCS+= g_eli_hmac.c
SRCS+= g_eli_integrity.c
SRCS+= g_eli_key.c
SRCS+= g_eli_key_cache.c
diff --git a/sys/net/route.c b/sys/net/route.c
index 11a5b8d..e09cc23 100644
--- a/sys/net/route.c
+++ b/sys/net/route.c
@@ -754,7 +754,7 @@ ifa_ifwithroute(int flags, const struct sockaddr *dst, struct sockaddr *gateway,
if (ifa == NULL)
ifa = ifa_ifwithnet(gateway, 0, fibnum);
if (ifa == NULL) {
- struct rtentry *rt = rtalloc1_fib(gateway, 0, RTF_RNH_LOCKED, fibnum);
+ struct rtentry *rt = rtalloc1_fib(gateway, 0, 0, fibnum);
if (rt == NULL)
return (NULL);
/*
@@ -1575,7 +1575,7 @@ int
rtrequest1_fib(int req, struct rt_addrinfo *info, struct rtentry **ret_nrt,
u_int fibnum)
{
- int error = 0, needlock = 0;
+ int error = 0;
struct rtentry *rt, *rt_old;
#ifdef FLOWTABLE
struct rtentry *rt0;
@@ -1585,9 +1585,9 @@ rtrequest1_fib(int req, struct rt_addrinfo *info, struct rtentry **ret_nrt,
struct ifaddr *ifa;
struct sockaddr *ndst;
struct sockaddr_storage mdst;
-#define senderr(x) { error = x ; goto bad; }
KASSERT((fibnum < rt_numfibs), ("rtrequest1_fib: bad fibnum"));
+ KASSERT((flags & RTF_RNH_LOCKED) == 0, ("rtrequest1_fib: locked"));
switch (dst->sa_family) {
case AF_INET6:
case AF_INET:
@@ -1604,12 +1604,7 @@ rtrequest1_fib(int req, struct rt_addrinfo *info, struct rtentry **ret_nrt,
rnh = rt_tables_get_rnh(fibnum, dst->sa_family);
if (rnh == NULL)
return (EAFNOSUPPORT);
- needlock = ((flags & RTF_RNH_LOCKED) == 0);
- flags &= ~RTF_RNH_LOCKED;
- if (needlock)
- RADIX_NODE_HEAD_LOCK(rnh);
- else
- RADIX_NODE_HEAD_LOCK_ASSERT(rnh);
+
/*
* If we are adding a host route then we don't want to put
* a netmask in the tree, nor do we want to clone it.
@@ -1624,9 +1619,11 @@ rtrequest1_fib(int req, struct rt_addrinfo *info, struct rtentry **ret_nrt,
dst = (struct sockaddr *)&mdst;
}
+ RADIX_NODE_HEAD_LOCK(rnh);
rt = rt_unlinkrte(rnh, info, &error);
+ RADIX_NODE_HEAD_UNLOCK(rnh);
if (error != 0)
- goto bad;
+ return (error);
rt_notifydelete(rt, info);
@@ -1649,33 +1646,32 @@ rtrequest1_fib(int req, struct rt_addrinfo *info, struct rtentry **ret_nrt,
break;
case RTM_ADD:
if ((flags & RTF_GATEWAY) && !gateway)
- senderr(EINVAL);
+ return (EINVAL);
if (dst && gateway && (dst->sa_family != gateway->sa_family) &&
(gateway->sa_family != AF_UNSPEC) && (gateway->sa_family != AF_LINK))
- senderr(EINVAL);
+ return (EINVAL);
if (info->rti_ifa == NULL) {
error = rt_getifa_fib(info, fibnum);
if (error)
- senderr(error);
+ return (error);
} else
ifa_ref(info->rti_ifa);
ifa = info->rti_ifa;
rt = uma_zalloc(V_rtzone, M_NOWAIT);
if (rt == NULL) {
ifa_free(ifa);
- senderr(ENOBUFS);
+ return (ENOBUFS);
}
rt->rt_flags = RTF_UP | flags;
rt->rt_fibnum = fibnum;
/*
* Add the gateway. Possibly re-malloc-ing the storage for it.
*/
- RT_LOCK(rt);
if ((error = rt_setgate(rt, dst, gateway)) != 0) {
ifa_free(ifa);
uma_zfree(V_rtzone, rt);
- senderr(error);
+ return (error);
}
/*
@@ -1702,14 +1698,18 @@ rtrequest1_fib(int req, struct rt_addrinfo *info, struct rtentry **ret_nrt,
rt_setmetrics(info, rt);
+ RADIX_NODE_HEAD_LOCK(rnh);
+ RT_LOCK(rt);
#ifdef RADIX_MPATH
/* do not permit exactly the same dst/mask/gw pair */
if (rn_mpath_capable(rnh) &&
rt_mpath_conflict(rnh, rt, netmask)) {
+ RADIX_NODE_HEAD_UNLOCK(rnh);
+
ifa_free(rt->rt_ifa);
R_Free(rt_key(rt));
uma_zfree(V_rtzone, rt);
- senderr(EEXIST);
+ return (EEXIST);
}
#endif
@@ -1738,6 +1738,7 @@ rtrequest1_fib(int req, struct rt_addrinfo *info, struct rtentry **ret_nrt,
rn = rnh->rnh_addaddr(ndst, netmask, rnh,
rt->rt_nodes);
}
+ RADIX_NODE_HEAD_UNLOCK(rnh);
if (rt_old != NULL)
RT_UNLOCK(rt_old);
@@ -1754,7 +1755,7 @@ rtrequest1_fib(int req, struct rt_addrinfo *info, struct rtentry **ret_nrt,
if (rt0 != NULL)
RTFREE(rt0);
#endif
- senderr(EEXIST);
+ return (EEXIST);
}
#ifdef FLOWTABLE
else if (rt0 != NULL) {
@@ -1786,16 +1787,15 @@ rtrequest1_fib(int req, struct rt_addrinfo *info, struct rtentry **ret_nrt,
RT_UNLOCK(rt);
break;
case RTM_CHANGE:
+ RADIX_NODE_HEAD_LOCK(rnh);
error = rtrequest1_fib_change(rnh, info, ret_nrt, fibnum);
+ RADIX_NODE_HEAD_UNLOCK(rnh);
break;
default:
error = EOPNOTSUPP;
}
-bad:
- if (needlock)
- RADIX_NODE_HEAD_UNLOCK(rnh);
+
return (error);
-#undef senderr
}
#undef dst
@@ -1945,15 +1945,7 @@ rt_setgate(struct rtentry *rt, struct sockaddr *dst, struct sockaddr *gate)
{
/* XXX dst may be overwritten, can we move this to below */
int dlen = SA_SIZE(dst), glen = SA_SIZE(gate);
-#ifdef INVARIANTS
- struct radix_node_head *rnh;
- rnh = rt_tables_get_rnh(rt->rt_fibnum, dst->sa_family);
-#endif
-
- RT_LOCK_ASSERT(rt);
- RADIX_NODE_HEAD_LOCK_ASSERT(rnh);
-
/*
* Prepare to store the gateway in rt->rt_gateway.
* Both dst and gateway are stored one after the other in the same
diff --git a/sys/netgraph/netflow/netflow.c b/sys/netgraph/netflow/netflow.c
index 9b3f7d8..644d46f 100644
--- a/sys/netgraph/netflow/netflow.c
+++ b/sys/netgraph/netflow/netflow.c
@@ -395,9 +395,8 @@ hash6_insert(priv_p priv, struct flow_hash_entry *hsh6, struct flow6_rec *r,
int plen, uint8_t flags, uint8_t tcp_flags)
{
struct flow6_entry *fle6;
- struct sockaddr_in6 *src, *dst;
+ struct sockaddr_in6 sin6;
struct rtentry *rt;
- struct route_in6 rin6;
mtx_assert(&hsh6->mtx, MA_OWNED);
@@ -425,16 +424,14 @@ hash6_insert(priv_p priv, struct flow_hash_entry *hsh6, struct flow6_rec *r,
* fill in out_ifx, dst_mask, nexthop, and dst_as in future releases.
*/
if ((flags & NG_NETFLOW_CONF_NODSTLOOKUP) == 0) {
- bzero(&rin6, sizeof(struct route_in6));
- dst = (struct sockaddr_in6 *)&rin6.ro_dst;
- dst->sin6_len = sizeof(struct sockaddr_in6);
- dst->sin6_family = AF_INET6;
- dst->sin6_addr = r->dst.r_dst6;
+ bzero(&sin6, sizeof(struct sockaddr_in6));
+ sin6.sin6_len = sizeof(struct sockaddr_in6);
+ sin6.sin6_family = AF_INET6;
+ sin6.sin6_addr = r->dst.r_dst6;
- rin6.ro_rt = rtalloc1_fib((struct sockaddr *)dst, 0, 0, r->fib);
+ rt = rtalloc1_fib((struct sockaddr *)&sin6, 0, 0, r->fib);
- if (rin6.ro_rt != NULL) {
- rt = rin6.ro_rt;
+ if (rt != NULL) {
fle6->f.fle_o_ifx = rt->rt_ifp->if_index;
if (rt->rt_flags & RTF_GATEWAY &&
@@ -453,17 +450,14 @@ hash6_insert(priv_p priv, struct flow_hash_entry *hsh6, struct flow6_rec *r,
if ((flags & NG_NETFLOW_CONF_NOSRCLOOKUP) == 0) {
/* Do route lookup on source address, to fill in src_mask. */
- bzero(&rin6, sizeof(struct route_in6));
- src = (struct sockaddr_in6 *)&rin6.ro_dst;
- src->sin6_len = sizeof(struct sockaddr_in6);
- src->sin6_family = AF_INET6;
- src->sin6_addr = r->src.r_src6;
-
- rin6.ro_rt = rtalloc1_fib((struct sockaddr *)src, 0, 0, r->fib);
+ bzero(&sin6, sizeof(struct sockaddr_in6));
+ sin6.sin6_len = sizeof(struct sockaddr_in6);
+ sin6.sin6_family = AF_INET6;
+ sin6.sin6_addr = r->src.r_src6;
- if (rin6.ro_rt != NULL) {
- rt = rin6.ro_rt;
+ rt = rtalloc1_fib((struct sockaddr *)&sin6, 0, 0, r->fib);
+ if (rt != NULL) {
if (rt_mask(rt))
fle6->f.src_mask = RT_MASK6(rt);
else
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
index a763e46..3a979a0 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -290,7 +290,7 @@ cc_ack_received(struct tcpcb *tp, struct tcphdr *th, uint16_t type)
if (type == CC_ACK) {
if (tp->snd_cwnd > tp->snd_ssthresh) {
tp->t_bytes_acked += min(tp->ccv->bytes_this_ack,
- V_tcp_abc_l_var * tp->t_maxseg);
+ V_tcp_abc_l_var * tcp_maxseg(tp));
if (tp->t_bytes_acked >= tp->snd_cwnd) {
tp->t_bytes_acked -= tp->snd_cwnd;
tp->ccv->flags |= CCF_ABC_SENTAWND;
@@ -313,11 +313,13 @@ cc_conn_init(struct tcpcb *tp)
{
struct hc_metrics_lite metrics;
struct inpcb *inp = tp->t_inpcb;
+ u_int maxseg;
int rtt;
INP_WLOCK_ASSERT(tp->t_inpcb);
tcp_hc_get(&inp->inp_inc, &metrics);
+ maxseg = tcp_maxseg(tp);
if (tp->t_srtt == 0 && (rtt = metrics.rmx_rtt)) {
tp->t_srtt = rtt;
@@ -342,7 +344,7 @@ cc_conn_init(struct tcpcb *tp)
* the slow start threshhold, but set the
* threshold to no less than 2*mss.
*/
- tp->snd_ssthresh = max(2 * tp->t_maxseg, metrics.rmx_ssthresh);
+ tp->snd_ssthresh = max(2 * maxseg, metrics.rmx_ssthresh);
TCPSTAT_INC(tcps_usedssthresh);
}
@@ -359,21 +361,20 @@ cc_conn_init(struct tcpcb *tp)
* requiring us to be cautious.
*/
if (tp->snd_cwnd == 1)
- tp->snd_cwnd = tp->t_maxseg; /* SYN(-ACK) lost */
+ tp->snd_cwnd = maxseg; /* SYN(-ACK) lost */
else if (V_tcp_initcwnd_segments)
- tp->snd_cwnd = min(V_tcp_initcwnd_segments * tp->t_maxseg,
- max(2 * tp->t_maxseg, V_tcp_initcwnd_segments * 1460));
+ tp->snd_cwnd = min(V_tcp_initcwnd_segments * maxseg,
+ max(2 * maxseg, V_tcp_initcwnd_segments * 1460));
else if (V_tcp_do_rfc3390)
- tp->snd_cwnd = min(4 * tp->t_maxseg,
- max(2 * tp->t_maxseg, 4380));
+ tp->snd_cwnd = min(4 * maxseg, max(2 * maxseg, 4380));
else {
/* Per RFC5681 Section 3.1 */
- if (tp->t_maxseg > 2190)
- tp->snd_cwnd = 2 * tp->t_maxseg;
- else if (tp->t_maxseg > 1095)
- tp->snd_cwnd = 3 * tp->t_maxseg;
+ if (maxseg > 2190)
+ tp->snd_cwnd = 2 * maxseg;
+ else if (maxseg > 1095)
+ tp->snd_cwnd = 3 * maxseg;
else
- tp->snd_cwnd = 4 * tp->t_maxseg;
+ tp->snd_cwnd = 4 * maxseg;
}
if (CC_ALGO(tp)->conn_init != NULL)
@@ -383,6 +384,8 @@ cc_conn_init(struct tcpcb *tp)
void inline
cc_cong_signal(struct tcpcb *tp, struct tcphdr *th, uint32_t type)
{
+ u_int maxseg;
+
INP_WLOCK_ASSERT(tp->t_inpcb);
switch(type) {
@@ -402,12 +405,13 @@ cc_cong_signal(struct tcpcb *tp, struct tcphdr *th, uint32_t type)
}
break;
case CC_RTO:
+ maxseg = tcp_maxseg(tp);
tp->t_dupacks = 0;
tp->t_bytes_acked = 0;
EXIT_RECOVERY(tp->t_flags);
tp->snd_ssthresh = max(2, min(tp->snd_wnd, tp->snd_cwnd) / 2 /
- tp->t_maxseg) * tp->t_maxseg;
- tp->snd_cwnd = tp->t_maxseg;
+ maxseg) * maxseg;
+ tp->snd_cwnd = maxseg;
break;
case CC_RTO_ERR:
TCPSTAT_INC(tcps_sndrexmitbad);
@@ -469,13 +473,11 @@ tcp_signature_verify_input(struct mbuf *m, int off0, int tlen, int optlen,
* the ack that opens up a 0-sized window.
* - LRO wasn't used for this segment. We make sure by checking that the
* segment size is not larger than the MSS.
- * - Delayed acks are enabled or this is a half-synchronized T/TCP
- * connection.
*/
#define DELAY_ACK(tp, tlen) \
((!tcp_timer_active(tp, TT_DELACK) && \
(tp->t_flags & TF_RXWIN0SENT) == 0) && \
- (tlen <= tp->t_maxopd) && \
+ (tlen <= tp->t_maxseg) && \
(V_tcp_delack_enabled || (tp->t_flags & TF_NEEDSYN)))
static void inline
@@ -2481,6 +2483,9 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so,
hhook_run_tcp_est_in(tp, th, &to);
if (SEQ_LEQ(th->th_ack, tp->snd_una)) {
+ u_int maxseg;
+
+ maxseg = tcp_maxseg(tp);
if (tlen == 0 &&
(tiwin == tp->snd_wnd ||
(tp->t_flags & TF_SACK_PERMIT))) {
@@ -2560,12 +2565,12 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so,
tp->sackhint.sack_bytes_rexmit;
if (awnd < tp->snd_ssthresh) {
- tp->snd_cwnd += tp->t_maxseg;
+ tp->snd_cwnd += maxseg;
if (tp->snd_cwnd > tp->snd_ssthresh)
tp->snd_cwnd = tp->snd_ssthresh;
}
} else
- tp->snd_cwnd += tp->t_maxseg;
+ tp->snd_cwnd += maxseg;
(void) tp->t_fb->tfb_tcp_output(tp);
goto drop;
} else if (tp->t_dupacks == tcprexmtthresh) {
@@ -2599,18 +2604,18 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so,
TCPSTAT_INC(
tcps_sack_recovery_episode);
tp->sack_newdata = tp->snd_nxt;
- tp->snd_cwnd = tp->t_maxseg;
+ tp->snd_cwnd = maxseg;
(void) tp->t_fb->tfb_tcp_output(tp);
goto drop;
}
tp->snd_nxt = th->th_ack;
- tp->snd_cwnd = tp->t_maxseg;
+ tp->snd_cwnd = maxseg;
(void) tp->t_fb->tfb_tcp_output(tp);
KASSERT(tp->snd_limited <= 2,
("%s: tp->snd_limited too big",
__func__));
tp->snd_cwnd = tp->snd_ssthresh +
- tp->t_maxseg *
+ maxseg *
(tp->t_dupacks - tp->snd_limited);
if (SEQ_GT(onxt, tp->snd_nxt))
tp->snd_nxt = onxt;
@@ -2641,7 +2646,7 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so,
tp->snd_cwnd =
(tp->snd_nxt - tp->snd_una) +
(tp->t_dupacks - tp->snd_limited) *
- tp->t_maxseg;
+ maxseg;
/*
* Only call tcp_output when there
* is new data available to be sent.
@@ -2654,10 +2659,10 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so,
if (avail > 0)
(void) tp->t_fb->tfb_tcp_output(tp);
sent = tp->snd_max - oldsndmax;
- if (sent > tp->t_maxseg) {
+ if (sent > maxseg) {
KASSERT((tp->t_dupacks == 2 &&
tp->snd_limited == 0) ||
- (sent == tp->t_maxseg + 1 &&
+ (sent == maxseg + 1 &&
tp->t_flags & TF_SENTFIN),
("%s: sent too much",
__func__));
@@ -3510,11 +3515,9 @@ tcp_xmit_timer(struct tcpcb *tp, int rtt)
* While looking at the routing entry, we also initialize other path-dependent
* parameters from pre-set or cached values in the routing entry.
*
- * Also take into account the space needed for options that we
- * send regularly. Make maxseg shorter by that amount to assure
- * that we can send maxseg amount of data even when the options
- * are present. Store the upper limit of the length of options plus
- * data in maxopd.
+ * NOTE that resulting t_maxseg doesn't include space for TCP options or
+ * IP options, e.g. IPSEC data, since length of this data may vary, and
+ * thus it is calculated for every segment separately in tcp_output().
*
* NOTE that this routine is only called when we process an incoming
* segment, or an ICMP need fragmentation datagram. Outgoing SYN/ACK MSS
@@ -3528,7 +3531,6 @@ tcp_mss_update(struct tcpcb *tp, int offer, int mtuoffer,
u_long maxmtu = 0;
struct inpcb *inp = tp->t_inpcb;
struct hc_metrics_lite metrics;
- int origoffer;
#ifdef INET6
int isipv6 = ((inp->inp_vflag & INP_IPV6) != 0) ? 1 : 0;
size_t min_protoh = isipv6 ?
@@ -3544,13 +3546,12 @@ tcp_mss_update(struct tcpcb *tp, int offer, int mtuoffer,
KASSERT(offer == -1, ("%s: conflict", __func__));
offer = mtuoffer - min_protoh;
}
- origoffer = offer;
/* Initialize. */
#ifdef INET6
if (isipv6) {
maxmtu = tcp_maxmtu6(&inp->inp_inc, cap);
- tp->t_maxopd = tp->t_maxseg = V_tcp_v6mssdflt;
+ tp->t_maxseg = V_tcp_v6mssdflt;
}
#endif
#if defined(INET) && defined(INET6)
@@ -3559,7 +3560,7 @@ tcp_mss_update(struct tcpcb *tp, int offer, int mtuoffer,
#ifdef INET
{
maxmtu = tcp_maxmtu(&inp->inp_inc, cap);
- tp->t_maxopd = tp->t_maxseg = V_tcp_mssdflt;
+ tp->t_maxseg = V_tcp_mssdflt;
}
#endif
@@ -3583,9 +3584,9 @@ tcp_mss_update(struct tcpcb *tp, int offer, int mtuoffer,
/*
* Offer == 0 means that there was no MSS on the SYN
* segment, in this case we use tcp_mssdflt as
- * already assigned to t_maxopd above.
+ * already assigned to t_maxseg above.
*/
- offer = tp->t_maxopd;
+ offer = tp->t_maxseg;
break;
case -1:
@@ -3657,31 +3658,15 @@ tcp_mss_update(struct tcpcb *tp, int offer, int mtuoffer,
mss = min(mss, offer);
/*
- * Sanity check: make sure that maxopd will be large
+ * Sanity check: make sure that maxseg will be large
* enough to allow some data on segments even if the
* all the option space is used (40bytes). Otherwise
* funny things may happen in tcp_output.
+ *
+ * XXXGL: shouldn't we reserve space for IP/IPv6 options?
*/
mss = max(mss, 64);
- /*
- * maxopd stores the maximum length of data AND options
- * in a segment; maxseg is the amount of data in a normal
- * segment. We need to store this value (maxopd) apart
- * from maxseg, because now every segment carries options
- * and thus we normally have somewhat less data in segments.
- */
- tp->t_maxopd = mss;
-
- /*
- * origoffer==-1 indicates that no segments were received yet.
- * In this case we just guess.
- */
- if ((tp->t_flags & (TF_REQ_TSTMP|TF_NOOPT)) == TF_REQ_TSTMP &&
- (origoffer == -1 ||
- (tp->t_flags & TF_RCVD_TSTMP) == TF_RCVD_TSTMP))
- mss -= TCPOLEN_TSTAMP_APPA;
-
tp->t_maxseg = mss;
}
@@ -3804,7 +3789,8 @@ void
tcp_newreno_partial_ack(struct tcpcb *tp, struct tcphdr *th)
{
tcp_seq onxt = tp->snd_nxt;
- u_long ocwnd = tp->snd_cwnd;
+ u_long ocwnd = tp->snd_cwnd;
+ u_int maxseg = tcp_maxseg(tp);
INP_WLOCK_ASSERT(tp->t_inpcb);
@@ -3815,7 +3801,7 @@ tcp_newreno_partial_ack(struct tcpcb *tp, struct tcphdr *th)
* Set snd_cwnd to one segment beyond acknowledged offset.
* (tp->snd_una has not yet been updated when this function is called.)
*/
- tp->snd_cwnd = tp->t_maxseg + BYTES_THIS_ACK(tp, th);
+ tp->snd_cwnd = maxseg + BYTES_THIS_ACK(tp, th);
tp->t_flags |= TF_ACKNOW;
(void) tp->t_fb->tfb_tcp_output(tp);
tp->snd_cwnd = ocwnd;
@@ -3829,7 +3815,7 @@ tcp_newreno_partial_ack(struct tcpcb *tp, struct tcphdr *th)
tp->snd_cwnd -= BYTES_THIS_ACK(tp, th);
else
tp->snd_cwnd = 0;
- tp->snd_cwnd += tp->t_maxseg;
+ tp->snd_cwnd += maxseg;
}
int
diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c
index 482ead5..3c32d77 100644
--- a/sys/netinet/tcp_output.c
+++ b/sys/netinet/tcp_output.c
@@ -830,11 +830,11 @@ send:
/*
* Adjust data length if insertion of options will
- * bump the packet length beyond the t_maxopd length.
+ * bump the packet length beyond the t_maxseg length.
* Clear the FIN bit because we cut off the tail of
* the segment.
*/
- if (len + optlen + ipoptlen > tp->t_maxopd) {
+ if (len + optlen + ipoptlen > tp->t_maxseg) {
flags &= ~TH_FIN;
if (tso) {
@@ -937,7 +937,7 @@ send:
* fractional unless the send sockbuf can be
* emptied:
*/
- max_len = (tp->t_maxopd - optlen);
+ max_len = (tp->t_maxseg - optlen);
if ((off + len) < sbavail(&so->so_snd)) {
moff = len % max_len;
if (moff != 0) {
@@ -967,7 +967,7 @@ send:
sendalot = 1;
} else {
- len = tp->t_maxopd - optlen - ipoptlen;
+ len = tp->t_maxseg - optlen - ipoptlen;
sendalot = 1;
}
} else
@@ -1277,10 +1277,10 @@ send:
* The TCP pseudo header checksum is always provided.
*/
if (tso) {
- KASSERT(len > tp->t_maxopd - optlen,
+ KASSERT(len > tp->t_maxseg - optlen,
("%s: len <= tso_segsz", __func__));
m->m_pkthdr.csum_flags |= CSUM_TSO;
- m->m_pkthdr.tso_segsz = tp->t_maxopd - optlen;
+ m->m_pkthdr.tso_segsz = tp->t_maxseg - optlen;
}
#ifdef IPSEC
@@ -1348,7 +1348,7 @@ send:
*/
ip6->ip6_plen = htons(m->m_pkthdr.len - sizeof(*ip6));
- if (V_path_mtu_discovery && tp->t_maxopd > V_tcp_minmss)
+ if (V_path_mtu_discovery && tp->t_maxseg > V_tcp_minmss)
tp->t_flags2 |= TF2_PLPMTU_PMTUD;
else
tp->t_flags2 &= ~TF2_PLPMTU_PMTUD;
@@ -1394,7 +1394,7 @@ send:
*
* NB: Don't set DF on small MTU/MSS to have a safe fallback.
*/
- if (V_path_mtu_discovery && tp->t_maxopd > V_tcp_minmss) {
+ if (V_path_mtu_discovery && tp->t_maxseg > V_tcp_minmss) {
ip->ip_off |= htons(IP_DF);
tp->t_flags2 |= TF2_PLPMTU_PMTUD;
} else {
diff --git a/sys/netinet/tcp_stacks/fastpath.c b/sys/netinet/tcp_stacks/fastpath.c
index 85b24f6..a49f85b 100644
--- a/sys/netinet/tcp_stacks/fastpath.c
+++ b/sys/netinet/tcp_stacks/fastpath.c
@@ -158,13 +158,11 @@ static void tcp_do_segment_fastack(struct mbuf *, struct tcphdr *,
* the ack that opens up a 0-sized window.
* - LRO wasn't used for this segment. We make sure by checking that the
* segment size is not larger than the MSS.
- * - Delayed acks are enabled or this is a half-synchronized T/TCP
- * connection.
*/
#define DELAY_ACK(tp, tlen) \
((!tcp_timer_active(tp, TT_DELACK) && \
(tp->t_flags & TF_RXWIN0SENT) == 0) && \
- (tlen <= tp->t_maxopd) && \
+ (tlen <= tp->t_maxseg) && \
(V_tcp_delack_enabled || (tp->t_flags & TF_NEEDSYN)))
/*
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index c2e0696..9f21f11 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -1087,7 +1087,7 @@ tcp_newtcpcb(struct inpcb *inp)
#endif
tp->t_timers = &tm->tt;
/* LIST_INIT(&tp->t_segq); */ /* XXX covered by M_ZERO */
- tp->t_maxseg = tp->t_maxopd =
+ tp->t_maxseg =
#ifdef INET6
isipv6 ? V_tcp_v6mssdflt :
#endif /* INET6 */
@@ -1901,7 +1901,7 @@ tcp_ctlinput(int cmd, struct sockaddr *sa, void *vip)
* Only process the offered MTU if it
* is smaller than the current one.
*/
- if (mtu < tp->t_maxopd +
+ if (mtu < tp->t_maxseg +
sizeof(struct tcpiphdr)) {
bzero(&inc, sizeof(inc));
inc.inc_faddr = faddr;
@@ -2283,6 +2283,59 @@ tcp_maxmtu6(struct in_conninfo *inc, struct tcp_ifcap *cap)
}
#endif /* INET6 */
+/*
+ * Calculate effective SMSS per RFC5681 definition for a given TCP
+ * connection at its current state, taking into account SACK and etc.
+ */
+u_int
+tcp_maxseg(const struct tcpcb *tp)
+{
+ u_int optlen;
+
+ if (tp->t_flags & TF_NOOPT)
+ return (tp->t_maxseg);
+
+ /*
+ * Here we have a simplified code from tcp_addoptions(),
+ * without a proper loop, and having most of paddings hardcoded.
+ * We might make mistakes with padding here in some edge cases,
+ * but this is harmless, since result of tcp_maxseg() is used
+ * only in cwnd and ssthresh estimations.
+ */
+#define PAD(len) ((((len) / 4) + !!((len) % 4)) * 4)
+ if (TCPS_HAVEESTABLISHED(tp->t_state)) {
+ if (tp->t_flags & TF_RCVD_TSTMP)
+ optlen = TCPOLEN_TSTAMP_APPA;
+ else
+ optlen = 0;
+#ifdef TCP_SIGNATURE
+ if (tp->t_flags & TF_SIGNATURE)
+ optlen += PAD(TCPOLEN_SIGNATURE);
+#endif
+ if ((tp->t_flags & TF_SACK_PERMIT) && tp->rcv_numsacks > 0) {
+ optlen += TCPOLEN_SACKHDR;
+ optlen += tp->rcv_numsacks * TCPOLEN_SACK;
+ optlen = PAD(optlen);
+ }
+ } else {
+ if (tp->t_flags & TF_REQ_TSTMP)
+ optlen = TCPOLEN_TSTAMP_APPA;
+ else
+ optlen = PAD(TCPOLEN_MAXSEG);
+ if (tp->t_flags & TF_REQ_SCALE)
+ optlen += PAD(TCPOLEN_WINDOW);
+#ifdef TCP_SIGNATURE
+ if (tp->t_flags & TF_SIGNATURE)
+ optlen += PAD(TCPOLEN_SIGNATURE);
+#endif
+ if (tp->t_flags & TF_SACK_PERMIT)
+ optlen += PAD(TCPOLEN_SACK_PERMITTED);
+ }
+#undef PAD
+ optlen = min(optlen, TCP_MAXOLEN);
+ return (tp->t_maxseg - optlen);
+}
+
#ifdef IPSEC
/* compute ESP/AH header size for TCP, including outer IP header. */
size_t
diff --git a/sys/netinet/tcp_timer.c b/sys/netinet/tcp_timer.c
index 9767eb7..fb4ff11 100644
--- a/sys/netinet/tcp_timer.c
+++ b/sys/netinet/tcp_timer.c
@@ -660,7 +660,6 @@ tcp_timer_rexmt(void * xtp)
*/
if (V_tcp_pmtud_blackhole_detect && (((tp->t_state == TCPS_ESTABLISHED))
|| (tp->t_state == TCPS_FIN_WAIT_1))) {
- int optlen;
#ifdef INET6
int isipv6;
#endif
@@ -684,8 +683,7 @@ tcp_timer_rexmt(void * xtp)
tp->t_flags2 |= TF2_PLPMTU_BLACKHOLE;
/* Keep track of previous MSS. */
- optlen = tp->t_maxopd - tp->t_maxseg;
- tp->t_pmtud_saved_maxopd = tp->t_maxopd;
+ tp->t_pmtud_saved_maxseg = tp->t_maxseg;
/*
* Reduce the MSS to blackhole value or to the default
@@ -694,13 +692,13 @@ tcp_timer_rexmt(void * xtp)
#ifdef INET6
isipv6 = (tp->t_inpcb->inp_vflag & INP_IPV6) ? 1 : 0;
if (isipv6 &&
- tp->t_maxopd > V_tcp_v6pmtud_blackhole_mss) {
+ tp->t_maxseg > V_tcp_v6pmtud_blackhole_mss) {
/* Use the sysctl tuneable blackhole MSS. */
- tp->t_maxopd = V_tcp_v6pmtud_blackhole_mss;
+ tp->t_maxseg = V_tcp_v6pmtud_blackhole_mss;
V_tcp_pmtud_blackhole_activated++;
} else if (isipv6) {
/* Use the default MSS. */
- tp->t_maxopd = V_tcp_v6mssdflt;
+ tp->t_maxseg = V_tcp_v6mssdflt;
/*
* Disable Path MTU Discovery when we switch to
* minmss.
@@ -713,13 +711,13 @@ tcp_timer_rexmt(void * xtp)
else
#endif
#ifdef INET
- if (tp->t_maxopd > V_tcp_pmtud_blackhole_mss) {
+ if (tp->t_maxseg > V_tcp_pmtud_blackhole_mss) {
/* Use the sysctl tuneable blackhole MSS. */
- tp->t_maxopd = V_tcp_pmtud_blackhole_mss;
+ tp->t_maxseg = V_tcp_pmtud_blackhole_mss;
V_tcp_pmtud_blackhole_activated++;
} else {
/* Use the default MSS. */
- tp->t_maxopd = V_tcp_mssdflt;
+ tp->t_maxseg = V_tcp_mssdflt;
/*
* Disable Path MTU Discovery when we switch to
* minmss.
@@ -728,7 +726,6 @@ tcp_timer_rexmt(void * xtp)
V_tcp_pmtud_blackhole_activated_min_mss++;
}
#endif
- tp->t_maxseg = tp->t_maxopd - optlen;
/*
* Reset the slow-start flight size
* as it may depend on the new MSS.
@@ -748,9 +745,7 @@ tcp_timer_rexmt(void * xtp)
(tp->t_rxtshift > 6)) {
tp->t_flags2 |= TF2_PLPMTU_PMTUD;
tp->t_flags2 &= ~TF2_PLPMTU_BLACKHOLE;
- optlen = tp->t_maxopd - tp->t_maxseg;
- tp->t_maxopd = tp->t_pmtud_saved_maxopd;
- tp->t_maxseg = tp->t_maxopd - optlen;
+ tp->t_maxseg = tp->t_pmtud_saved_maxseg;
V_tcp_pmtud_blackhole_failed++;
/*
* Reset the slow-start flight size as it
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index 3435668..76bc8aa 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -904,8 +904,7 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf *m,
/*
* Do implied connect if not yet connected,
* initialize window to default value, and
- * initialize maxseg/maxopd using peer's cached
- * MSS.
+ * initialize maxseg using peer's cached MSS.
*/
#ifdef INET6
if (isipv6)
@@ -964,8 +963,7 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf *m,
/*
* Do implied connect if not yet connected,
* initialize window to default value, and
- * initialize maxseg/maxopd using peer's cached
- * MSS.
+ * initialize maxseg using peer's cached MSS.
*/
#ifdef INET6
if (isipv6)
@@ -2208,8 +2206,8 @@ db_print_tcpcb(struct tcpcb *tp, const char *name, int indent)
"0x%08x\n", tp->snd_ssthresh, tp->snd_recover);
db_print_indent(indent);
- db_printf("t_maxopd: %u t_rcvtime: %u t_startime: %u\n",
- tp->t_maxopd, tp->t_rcvtime, tp->t_starttime);
+ db_printf("t_rcvtime: %u t_startime: %u\n",
+ tp->t_rcvtime, tp->t_starttime);
db_print_indent(indent);
db_printf("t_rttime: %u t_rtsq: 0x%08x\n",
diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h
index 8d76912..6cd4cf0 100644
--- a/sys/netinet/tcp_var.h
+++ b/sys/netinet/tcp_var.h
@@ -180,8 +180,6 @@ struct tcpcb {
u_long snd_spare2; /* unused */
tcp_seq snd_recover; /* for use in NewReno Fast Recovery */
- u_int t_maxopd; /* mss plus options */
-
u_int t_rcvtime; /* inactivity time */
u_int t_starttime; /* time connection was established */
u_int t_rtttime; /* RTT measurement start time */
@@ -192,6 +190,7 @@ struct tcpcb {
int t_rxtcur; /* current retransmit value (ticks) */
u_int t_maxseg; /* maximum segment size */
+ u_int t_pmtud_saved_maxseg; /* pre-blackhole MSS */
int t_srtt; /* smoothed round-trip time */
int t_rttvar; /* variance in round-trip time */
@@ -251,7 +250,6 @@ struct tcpcb {
u_int t_tsomax; /* TSO total burst length limit in bytes */
u_int t_tsomaxsegcount; /* TSO maximum segment count */
u_int t_tsomaxsegsize; /* TSO maximum segment size in bytes */
- u_int t_pmtud_saved_maxopd; /* pre-blackhole MSS */
u_int t_flags2; /* More tcpcb flags storage */
#if defined(_KERNEL) && defined(TCP_RFC7413)
uint32_t t_ispare[6]; /* 5 UTO, 1 TBD */
@@ -775,6 +773,7 @@ int tcp_default_ctloutput(struct socket *so, struct sockopt *sopt, struct inpcb
u_long tcp_maxmtu(struct in_conninfo *, struct tcp_ifcap *);
u_long tcp_maxmtu6(struct in_conninfo *, struct tcp_ifcap *);
+u_int tcp_maxseg(const struct tcpcb *);
void tcp_mss_update(struct tcpcb *, int, int, struct hc_metrics_lite *,
struct tcp_ifcap *);
void tcp_mss(struct tcpcb *, int);
diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c
index 57e78e8..1b77153 100644
--- a/sys/netpfil/pf/pf.c
+++ b/sys/netpfil/pf/pf.c
@@ -73,6 +73,7 @@ __FBSDID("$FreeBSD$");
#include <netinet/in_pcb.h>
#include <netinet/in_var.h>
+#include <netinet/in_fib.h>
#include <netinet/ip.h>
#include <netinet/ip_fw.h>
#include <netinet/ip_icmp.h>
@@ -94,6 +95,8 @@ __FBSDID("$FreeBSD$");
#include <netinet6/nd6.h>
#include <netinet6/ip6_var.h>
#include <netinet6/in6_pcb.h>
+#include <netinet6/in6_fib.h>
+#include <netinet6/scope6_var.h>
#endif /* INET6 */
#include <machine/in_cksum.h>
@@ -2985,49 +2988,35 @@ static u_int16_t
pf_calc_mss(struct pf_addr *addr, sa_family_t af, int rtableid, u_int16_t offer)
{
#ifdef INET
- struct sockaddr_in *dst;
- struct route ro;
+ struct nhop4_basic nh4;
#endif /* INET */
#ifdef INET6
- struct sockaddr_in6 *dst6;
- struct route_in6 ro6;
+ struct nhop6_basic nh6;
+ struct in6_addr dst6;
+ uint32_t scopeid;
#endif /* INET6 */
- struct rtentry *rt = NULL;
int hlen = 0;
- u_int16_t mss = V_tcp_mssdflt;
+ uint16_t mss = 0;
switch (af) {
#ifdef INET
case AF_INET:
hlen = sizeof(struct ip);
- bzero(&ro, sizeof(ro));
- dst = (struct sockaddr_in *)&ro.ro_dst;
- dst->sin_family = AF_INET;
- dst->sin_len = sizeof(*dst);
- dst->sin_addr = addr->v4;
- in_rtalloc_ign(&ro, 0, rtableid);
- rt = ro.ro_rt;
+ if (fib4_lookup_nh_basic(rtableid, addr->v4, 0, 0, &nh4) == 0)
+ mss = nh4.nh_mtu - hlen - sizeof(struct tcphdr);
break;
#endif /* INET */
#ifdef INET6
case AF_INET6:
hlen = sizeof(struct ip6_hdr);
- bzero(&ro6, sizeof(ro6));
- dst6 = (struct sockaddr_in6 *)&ro6.ro_dst;
- dst6->sin6_family = AF_INET6;
- dst6->sin6_len = sizeof(*dst6);
- dst6->sin6_addr = addr->v6;
- in6_rtalloc_ign(&ro6, 0, rtableid);
- rt = ro6.ro_rt;
+ in6_splitscope(&addr->v6, &dst6, &scopeid);
+ if (fib6_lookup_nh_basic(rtableid, &dst6, scopeid, 0,0,&nh6)==0)
+ mss = nh6.nh_mtu - hlen - sizeof(struct tcphdr);
break;
#endif /* INET6 */
}
- if (rt && rt->rt_ifp) {
- mss = rt->rt_ifp->if_mtu - hlen - sizeof(struct tcphdr);
- mss = max(V_tcp_mssdflt, mss);
- RTFREE(rt);
- }
+ mss = max(V_tcp_mssdflt, mss);
mss = min(mss, offer);
mss = max(mss, 64); /* sanity - at least max opt space */
return (mss);
@@ -5194,13 +5183,12 @@ pf_pull_hdr(struct mbuf *m, int off, void *p, int len,
return (p);
}
-int
-pf_routable(struct pf_addr *addr, sa_family_t af, struct pfi_kif *kif,
+#ifdef RADIX_MPATH
+static int
+pf_routable_oldmpath(struct pf_addr *addr, sa_family_t af, struct pfi_kif *kif,
int rtableid)
{
-#ifdef RADIX_MPATH
struct radix_node_head *rnh;
-#endif
struct sockaddr_in *dst;
int ret = 1;
int check_mpath;
@@ -5215,12 +5203,10 @@ pf_routable(struct pf_addr *addr, sa_family_t af, struct pfi_kif *kif,
struct ifnet *ifp;
check_mpath = 0;
-#ifdef RADIX_MPATH
/* XXX: stick to table 0 for now */
rnh = rt_tables_get_rnh(0, af);
if (rnh != NULL && rn_mpath_capable(rnh))
check_mpath = 1;
-#endif
bzero(&ro, sizeof(ro));
switch (af) {
case AF_INET:
@@ -5283,9 +5269,7 @@ pf_routable(struct pf_addr *addr, sa_family_t af, struct pfi_kif *kif,
if (kif->pfik_ifp == ifp)
ret = 1;
-#ifdef RADIX_MPATH
rn = rn_mpath_next(rn);
-#endif
} while (check_mpath == 1 && rn != NULL && ret == 0);
} else
ret = 0;
@@ -5294,6 +5278,72 @@ out:
RTFREE(ro.ro_rt);
return (ret);
}
+#endif
+
+int
+pf_routable(struct pf_addr *addr, sa_family_t af, struct pfi_kif *kif,
+ int rtableid)
+{
+#ifdef INET
+ struct nhop4_basic nh4;
+#endif
+#ifdef INET6
+ struct nhop6_basic nh6;
+#endif
+ struct ifnet *ifp;
+#ifdef RADIX_MPATH
+ struct radix_node_head *rnh;
+
+ /* XXX: stick to table 0 for now */
+ rnh = rt_tables_get_rnh(0, af);
+ if (rnh != NULL && rn_mpath_capable(rnh))
+ return (pf_routable_oldmpath(addr, af, kif, rtableid));
+#endif
+ /*
+ * Skip check for addresses with embedded interface scope,
+ * as they would always match anyway.
+ */
+ if (af == AF_INET6 && IN6_IS_SCOPE_EMBED(&addr->v6))
+ return (1);
+
+ if (af != AF_INET && af != AF_INET6)
+ return (0);
+
+ /* Skip checks for ipsec interfaces */
+ if (kif != NULL && kif->pfik_ifp->if_type == IFT_ENC)
+ return (1);
+
+ ifp = NULL;
+
+ switch (af) {
+#ifdef INET6
+ case AF_INET6:
+ if (fib6_lookup_nh_basic(rtableid, &addr->v6, 0, 0, 0, &nh6)!=0)
+ return (0);
+ ifp = nh6.nh_ifp;
+ break;
+#endif
+#ifdef INET
+ case AF_INET:
+ if (fib4_lookup_nh_basic(rtableid, addr->v4, 0, 0, &nh4) != 0)
+ return (0);
+ ifp = nh4.nh_ifp;
+ break;
+#endif
+ }
+
+ /* No interface given, this is a no-route check */
+ if (kif == NULL)
+ return (1);
+
+ if (kif->pfik_ifp == NULL)
+ return (0);
+
+ /* Perform uRPF check if passed input interface */
+ if (kif->pfik_ifp == ifp)
+ return (1);
+ return (0);
+}
#ifdef INET
static void
@@ -5344,23 +5394,20 @@ pf_route(struct mbuf **m, struct pf_rule *r, int dir, struct ifnet *oifp,
dst.sin_addr = ip->ip_dst;
if (r->rt == PF_FASTROUTE) {
- struct rtentry *rt;
+ struct nhop4_basic nh4;
if (s)
PF_STATE_UNLOCK(s);
- rt = rtalloc1_fib(sintosa(&dst), 0, 0, M_GETFIB(m0));
- if (rt == NULL) {
+
+ if (fib4_lookup_nh_basic(M_GETFIB(m0), ip->ip_dst, 0,
+ m0->m_pkthdr.flowid, &nh4) != 0) {
KMOD_IPSTAT_INC(ips_noroute);
error = EHOSTUNREACH;
goto bad;
}
- ifp = rt->rt_ifp;
- counter_u64_add(rt->rt_pksent, 1);
-
- if (rt->rt_flags & RTF_GATEWAY)
- bcopy(satosin(rt->rt_gateway), &dst, sizeof(dst));
- RTFREE_LOCKED(rt);
+ ifp = nh4.nh_ifp;
+ dst.sin_addr = nh4.nh_addr;
} else {
if (TAILQ_EMPTY(&r->rpool.list)) {
DPFPRINTF(PF_DEBUG_URGENT,
diff --git a/sys/ofed/include/rdma/Kbuild b/sys/ofed/include/rdma/Kbuild
deleted file mode 100644
index e7c0432..0000000
--- a/sys/ofed/include/rdma/Kbuild
+++ /dev/null
@@ -1 +0,0 @@
-header-y += ib_user_mad.h
diff --git a/sys/sys/conf.h b/sys/sys/conf.h
index 4681acd..a0dbc72 100644
--- a/sys/sys/conf.h
+++ b/sys/sys/conf.h
@@ -226,6 +226,28 @@ void clone_cleanup(struct clonedevs **);
#define CLONE_FLAG0 (CLONE_UNITMASK + 1)
int clone_create(struct clonedevs **, struct cdevsw *, int *unit, struct cdev **dev, int extra);
+#define MAKEDEV_REF 0x01
+#define MAKEDEV_WHTOUT 0x02
+#define MAKEDEV_NOWAIT 0x04
+#define MAKEDEV_WAITOK 0x08
+#define MAKEDEV_ETERNAL 0x10
+#define MAKEDEV_CHECKNAME 0x20
+struct make_dev_args {
+ size_t mda_size;
+ int mda_flags;
+ struct cdevsw *mda_devsw;
+ struct ucred *mda_cr;
+ uid_t mda_uid;
+ gid_t mda_gid;
+ int mda_mode;
+ int mda_unit;
+ void *mda_si_drv1;
+ void *mda_si_drv2;
+};
+void make_dev_args_init_impl(struct make_dev_args *_args, size_t _sz);
+#define make_dev_args_init(a) \
+ make_dev_args_init_impl((a), sizeof(struct make_dev_args))
+
int count_dev(struct cdev *_dev);
void delist_dev(struct cdev *_dev);
void destroy_dev(struct cdev *_dev);
@@ -245,12 +267,6 @@ struct cdev *make_dev(struct cdevsw *_devsw, int _unit, uid_t _uid, gid_t _gid,
struct cdev *make_dev_cred(struct cdevsw *_devsw, int _unit,
struct ucred *_cr, uid_t _uid, gid_t _gid, int _perms,
const char *_fmt, ...) __printflike(7, 8);
-#define MAKEDEV_REF 0x01
-#define MAKEDEV_WHTOUT 0x02
-#define MAKEDEV_NOWAIT 0x04
-#define MAKEDEV_WAITOK 0x08
-#define MAKEDEV_ETERNAL 0x10
-#define MAKEDEV_CHECKNAME 0x20
struct cdev *make_dev_credf(int _flags,
struct cdevsw *_devsw, int _unit,
struct ucred *_cr, uid_t _uid, gid_t _gid, int _mode,
@@ -258,6 +274,8 @@ struct cdev *make_dev_credf(int _flags,
int make_dev_p(int _flags, struct cdev **_cdev, struct cdevsw *_devsw,
struct ucred *_cr, uid_t _uid, gid_t _gid, int _mode,
const char *_fmt, ...) __printflike(8, 9);
+int make_dev_s(struct make_dev_args *_args, struct cdev **_cdev,
+ const char *_fmt, ...) __printflike(3, 4);
struct cdev *make_dev_alias(struct cdev *_pdev, const char *_fmt, ...)
__printflike(2, 3);
int make_dev_alias_p(int _flags, struct cdev **_cdev, struct cdev *_pdev,
diff --git a/sys/sys/nv.h b/sys/sys/nv.h
index a985b6d..fcea2b3 100644
--- a/sys/sys/nv.h
+++ b/sys/sys/nv.h
@@ -146,7 +146,7 @@ void nvlist_add_bool(nvlist_t *nvl, const char *name, bool value);
void nvlist_add_number(nvlist_t *nvl, const char *name, uint64_t value);
void nvlist_add_string(nvlist_t *nvl, const char *name, const char *value);
void nvlist_add_stringf(nvlist_t *nvl, const char *name, const char *valuefmt, ...) __printflike(3, 4);
-#ifdef _VA_LIST_DECLARED
+#if !defined(_KERNEL) || defined(_VA_LIST_DECLARED)
void nvlist_add_stringv(nvlist_t *nvl, const char *name, const char *valuefmt, va_list valueap) __printflike(3, 0);
#endif
void nvlist_add_nvlist(nvlist_t *nvl, const char *name, const nvlist_t *value);
diff --git a/sys/x86/include/metadata.h b/sys/x86/include/metadata.h
new file mode 100644
index 0000000..e13eba0
--- /dev/null
+++ b/sys/x86/include/metadata.h
@@ -0,0 +1,57 @@
+/*-
+ * Copyright (c) 2003 Peter Wemm <peter@FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _MACHINE_METADATA_H_
+#define _MACHINE_METADATA_H_
+
+#define MODINFOMD_SMAP 0x1001
+#define MODINFOMD_SMAP_XATTR 0x1002
+#define MODINFOMD_DTBP 0x1003
+#define MODINFOMD_EFI_MAP 0x1004
+#define MODINFOMD_EFI_FB 0x1005
+#define MODINFOMD_MODULEP 0x1006
+
+struct efi_map_header {
+ uint64_t memory_size;
+ uint64_t descriptor_size;
+ uint32_t descriptor_version;
+};
+
+struct efi_fb {
+ uint64_t fb_addr;
+ uint64_t fb_size;
+ uint32_t fb_height;
+ uint32_t fb_width;
+ uint32_t fb_stride;
+ uint32_t fb_mask_red;
+ uint32_t fb_mask_green;
+ uint32_t fb_mask_blue;
+ uint32_t fb_mask_reserved;
+};
+
+#endif /* !_MACHINE_METADATA_H_ */
diff --git a/targets/pseudo/userland/lib/Makefile.depend b/targets/pseudo/userland/lib/Makefile.depend
index c5e2407..e57164a 100644
--- a/targets/pseudo/userland/lib/Makefile.depend
+++ b/targets/pseudo/userland/lib/Makefile.depend
@@ -136,6 +136,7 @@ DIRDEPS = \
lib/libstand \
lib/libstdbuf \
lib/libstdthreads \
+ lib/libsysdecode \
lib/libtacplus \
lib/libtelnet \
lib/libthr \
diff --git a/tools/build/mk/OptionalObsoleteFiles.inc b/tools/build/mk/OptionalObsoleteFiles.inc
index 2f88c8d..064d3f5 100644
--- a/tools/build/mk/OptionalObsoleteFiles.inc
+++ b/tools/build/mk/OptionalObsoleteFiles.inc
@@ -2835,6 +2835,13 @@ OLD_FILES+=usr/share/man/man8/traceroute6.8.gz
OLD_FILES+=rescue/ping6
.endif
+.if ${MK_INETD} == no
+OLD_FILES+=etc/rc.d/inetd
+OLD_FILES+=usr/sbin/inetd
+OLD_FILES+=usr/share/man/man5/inetd.conf.5.gz
+OLD_FILES+=usr/share/man/man8/inetd.8.gz
+.endif
+
.if ${MK_IPFILTER} == no
OLD_FILES+=etc/periodic/security/510.ipfdenied
OLD_FILES+=etc/periodic/security/610.ipf6denied
diff --git a/tools/tools/nanobsd/defaults.sh b/tools/tools/nanobsd/defaults.sh
index 9bc1779..3534ba2 100755
--- a/tools/tools/nanobsd/defaults.sh
+++ b/tools/tools/nanobsd/defaults.sh
@@ -500,10 +500,9 @@ fixup_before_diskimage ( ) (
if [ -n "${NANO_METALOG}" ]; then
pprint 2 "Fixing metalog"
cp ${NANO_METALOG} ${NANO_METALOG}.pre
- (echo "/set uname=${NANO_DEF_UNAME} gname=${NANO_DEF_GNAME}" &&
- cat ${NANO_METALOG}.pre) | \
- ${NANO_TOOLS}/mtree-dedup.awk | \
- sed -e 's/ size=[0-9][0-9]*//' | sort > ${NANO_METALOG}
+ echo "/set uname=${NANO_DEF_UNAME} gname=${NANO_DEF_GNAME}" > ${NANO_METALOG}
+ cat ${NANO_METALOG}.pre | ${NANO_TOOLS}/mtree-dedup.awk | \
+ sed -e 's/ size=[0-9][0-9]*//' | sort >> ${NANO_METALOG}
fi
)
diff --git a/tools/tools/nanobsd/embedded/common b/tools/tools/nanobsd/embedded/common
index 6347911..a1d401a 100644
--- a/tools/tools/nanobsd/embedded/common
+++ b/tools/tools/nanobsd/embedded/common
@@ -449,6 +449,28 @@ typical_embedded ( ) (
)
customize_cmd typical_embedded
+fix_pkg ( ) (
+ chdir ${NANO_WORLDDIR}
+ mkdir -p pkg
+ mkdir -p pkg/db
+ mkdir -p pkg/cache
+ mkdir -p pkg/tmp # Needed for pkg bootstrap
+ mkdir -p usr/local/etc # Will get moved to local/etc
+ (
+ echo 'PKG_DBDIR = "/pkg/db"'
+ echo 'PKG_CACHEDIR = "/pkg/cache"'
+ echo 'DEFAULT_ALWAYS_YES = "yes"'
+ echo 'ASSUME_ALWAYS_YES = "yes"'
+ ) >> usr/local/etc/pkg.conf
+ [ -z ${NANO_NOPRIV_BUILD} ] || (
+ echo "./pkg type=dir uname=root gname=wheel mode=0755"
+ echo "./pkg/cache type=dir uname=root gname=wheel mode=0755"
+ echo "./pkg/db type=dir uname=root gname=wheel mode=0755"
+ echo "./pkg/tmp type=dir uname=root gname=wheel mode=0755"
+ ) >> ${NANO_METALOG}
+)
+customize_cmd fix_pkg
+
save_build ( ) (
VERSION_FILE=${NANO_WORLDDIR}/etc/version
if [ "${SVNREVISION}" = "${REVISION}" ]; then
diff --git a/usr.bin/cap_mkdb/cap_mkdb.c b/usr.bin/cap_mkdb/cap_mkdb.c
index 2f8bd96..bbcedd5 100644
--- a/usr.bin/cap_mkdb/cap_mkdb.c
+++ b/usr.bin/cap_mkdb/cap_mkdb.c
@@ -119,7 +119,7 @@ main(int argc, char *argv[])
(void)snprintf(buf, sizeof(buf), "%s.db", capname ? capname : *argv);
if ((capname = strdup(buf)) == NULL)
errx(1, "strdup failed");
- if ((capdbp = dbopen(capname, O_CREAT | O_TRUNC | O_RDWR,
+ if ((capdbp = dbopen(capname, O_CREAT | O_TRUNC | O_RDWR | O_SYNC,
DEFFILEMODE, DB_HASH, &openinfo)) == NULL)
err(1, "%s", buf);
diff --git a/usr.bin/kdump/Makefile.depend b/usr.bin/kdump/Makefile.depend
index f86656e..83a2492 100644
--- a/usr.bin/kdump/Makefile.depend
+++ b/usr.bin/kdump/Makefile.depend
@@ -6,7 +6,6 @@ DIRDEPS = \
gnu/lib/libgcc \
include \
include/arpa \
- include/rpc \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
@@ -20,8 +19,6 @@ DIRDEPS = \
.if ${DEP_RELDIR} == ${_DEP_RELDIR}
# local dependencies - needed for -jN in clean tree
-ioctl.o: ioctl.c
-ioctl.po: ioctl.c
kdump.o: kdump_subr.h
kdump.o: linux32_syscalls.c
kdump.o: linux_syscalls.c
diff --git a/usr.bin/nfsstat/Makefile.depend b/usr.bin/nfsstat/Makefile.depend
index 34582cd..3646e2e 100644
--- a/usr.bin/nfsstat/Makefile.depend
+++ b/usr.bin/nfsstat/Makefile.depend
@@ -9,8 +9,6 @@ DIRDEPS = \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
- lib/libelf \
- lib/libkvm \
.include <dirdeps.mk>
diff --git a/usr.bin/truss/Makefile.depend.amd64 b/usr.bin/truss/Makefile.depend.amd64
index ad9c8b3..334bb3a 100644
--- a/usr.bin/truss/Makefile.depend.amd64
+++ b/usr.bin/truss/Makefile.depend.amd64
@@ -6,7 +6,6 @@ DIRDEPS = \
gnu/lib/libgcc \
include \
include/arpa \
- include/rpc \
include/xlocale \
lib/${CSU_DIR} \
lib/libc \
@@ -26,6 +25,4 @@ amd64-freebsd32.o: freebsd32_syscalls.h
amd64-freebsd32.po: freebsd32_syscalls.h
amd64-linux32.o: amd64-linux32_syscalls.h
amd64-linux32.po: amd64-linux32_syscalls.h
-ioctl.o: ioctl.c
-ioctl.po: ioctl.c
.endif
diff --git a/usr.sbin/jls/Makefile.depend b/usr.sbin/jls/Makefile.depend
index 4131fa7..50e6f23 100644
--- a/usr.sbin/jls/Makefile.depend
+++ b/usr.sbin/jls/Makefile.depend
@@ -11,6 +11,8 @@ DIRDEPS = \
lib/libc \
lib/libcompiler_rt \
lib/libjail \
+ lib/libutil \
+ lib/libxo \
.include <dirdeps.mk>
diff --git a/usr.sbin/mountd/exports.5 b/usr.sbin/mountd/exports.5
index 88e2219..018a865 100644
--- a/usr.sbin/mountd/exports.5
+++ b/usr.sbin/mountd/exports.5
@@ -131,6 +131,7 @@ The credential includes all the groups to which the user is a member
on the local machine (see
.Xr id 1 ) .
The user may be specified by name or number.
+The user string may be quoted, or use backslash escaping.
.Pp
.Sm off
.Fl maproot Li = Sy user:group1:group2:...
@@ -140,6 +141,7 @@ to be used for remote access by root.
The elements of the list may be either names or numbers.
Note that user: should be used to distinguish a credential containing
no groups from a complete credential for that user.
+The group names may be quoted, or use backslash escaping.
.Pp
.Sm off
.Fl mapall Li = Sy user
diff --git a/usr.sbin/mountd/mountd.c b/usr.sbin/mountd/mountd.c
index 535a3f7..d6da2bc 100644
--- a/usr.sbin/mountd/mountd.c
+++ b/usr.sbin/mountd/mountd.c
@@ -174,6 +174,7 @@ static int check_options(struct dirlist *);
static int checkmask(struct sockaddr *sa);
static int chk_host(struct dirlist *, struct sockaddr *, int *, int *,
int *, int **);
+static char *strsep_quote(char **stringp, const char *delim);
static int create_service(struct netconfig *nconf);
static void complete_service(struct netconfig *nconf, char *port_str);
static void clearout_service(void);
@@ -278,6 +279,73 @@ static int debug = 0;
#endif
/*
+ * Similar to strsep(), but it allows for quoted strings
+ * and escaped characters.
+ *
+ * It returns the string (or NULL, if *stringp is NULL),
+ * which is a de-quoted version of the string if necessary.
+ *
+ * It modifies *stringp in place.
+ */
+static char *
+strsep_quote(char **stringp, const char *delim)
+{
+ char *srcptr, *dstptr, *retval;
+ char quot = 0;
+
+ if (stringp == NULL || *stringp == NULL)
+ return (NULL);
+
+ srcptr = dstptr = retval = *stringp;
+
+ while (*srcptr) {
+ /*
+ * We're looking for several edge cases here.
+ * First: if we're in quote state (quot != 0),
+ * then we ignore the delim characters, but otherwise
+ * process as normal, unless it is the quote character.
+ * Second: if the current character is a backslash,
+ * we take the next character as-is, without checking
+ * for delim, quote, or backslash. Exception: if the
+ * next character is a NUL, that's the end of the string.
+ * Third: if the character is a quote character, we toggle
+ * quote state.
+ * Otherwise: check the current character for NUL, or
+ * being in delim, and end the string if either is true.
+ */
+ if (*srcptr == '\\') {
+ srcptr++;
+ /*
+ * The edge case here is if the next character
+ * is NUL, we want to stop processing. But if
+ * it's not NUL, then we simply want to copy it.
+ */
+ if (*srcptr) {
+ *dstptr++ = *srcptr++;
+ }
+ continue;
+ }
+ if (quot == 0 && (*srcptr == '\'' || *srcptr == '"')) {
+ quot = *srcptr++;
+ continue;
+ }
+ if (quot && *srcptr == quot) {
+ /* End of the quoted part */
+ quot = 0;
+ srcptr++;
+ continue;
+ }
+ if (!quot && strchr(delim, *srcptr))
+ break;
+ *dstptr++ = *srcptr++;
+ }
+
+ *dstptr = 0; /* Terminate the string */
+ *stringp = (*srcptr == '\0') ? NULL : srcptr + 1;
+ return (retval);
+}
+
+/*
* Mountd server for NFS mount protocol as described in:
* NFS: Network File System Protocol Specification, RFC1094, Appendix A
* The optional arguments are the exports file name
@@ -2831,8 +2899,9 @@ parsecred(char *namelist, struct xucred *cr)
/*
* Get the user's password table entry.
*/
- names = strsep(&namelist, " \t\n");
+ names = strsep_quote(&namelist, " \t\n");
name = strsep(&names, ":");
+ /* Bug? name could be NULL here */
if (isdigit(*name) || *name == '-')
pw = getpwuid(atoi(name));
else
diff --git a/usr.sbin/ntp/config.h b/usr.sbin/ntp/config.h
index 5a51e0a..73f83a3 100644
--- a/usr.sbin/ntp/config.h
+++ b/usr.sbin/ntp/config.h
@@ -335,6 +335,9 @@
/* Define to 1 if you have the <arpa/nameser.h> header file. */
#define HAVE_ARPA_NAMESER_H 1
+/* Define to 1 if you have the `atomic_thread_fence' function. */
+/* #undef HAVE_ATOMIC_THREAD_FENCE */
+
/* Do we have audio support? */
#define HAVE_AUDIO /**/
@@ -388,6 +391,9 @@
/* Define to 1 if you have the <errno.h> header file. */
#define HAVE_ERRNO_H 1
+/* Define to 1 if you have the `EVP_MD_do_all_sorted' function. */
+#define HAVE_EVP_MD_DO_ALL_SORTED 1
+
/* Define to 1 if you have the `fchmod' function. */
#define HAVE_FCHMOD 1
@@ -613,6 +619,9 @@
/* Define to 1 if you have the <net/if.h> header file. */
#define HAVE_NET_IF_H 1
+/* Define to 1 if you have the <net/if_var.h> header file. */
+#define HAVE_NET_IF_VAR_H 1
+
/* Define to 1 if you have the <net/route.h> header file. */
#define HAVE_NET_ROUTE_H 1
@@ -820,6 +829,9 @@
/* Define to 1 if you have the <stdarg.h> header file. */
#define HAVE_STDARG_H 1
+/* Define to 1 if you have the <stdatomic.h> header file. */
+#define HAVE_STDATOMIC_H 1
+
/* Define to 1 if you have the <stdbool.h> header file. */
#define HAVE_STDBOOL_H 1
@@ -1132,7 +1144,7 @@
/* #undef HAVE_UNIXWARE_SIGWAIT */
/* Define to 1 if the system has the type `unsigned long long int'. */
-/* #undef HAVE_UNSIGNED_LONG_LONG_INT */
+#define HAVE_UNSIGNED_LONG_LONG_INT 1
/* Define to 1 if you have the `updwtmp' function. */
/* #undef HAVE_UPDWTMP */
@@ -1314,6 +1326,9 @@
/* define to 1 if library is thread safe */
#define LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE 1
+/* leap smear mechanism */
+/* #undef LEAP_SMEAR */
+
/* Define to any value to include libseccomp sandboxing. */
/* #undef LIBSECCOMP */
@@ -1330,6 +1345,10 @@
/* Should we recommend a minimum value for tickadj? */
/* #undef MIN_REC_TICKADJ */
+/* Define to 1 if the compiler does not support C99's structure
+ initialization. */
+/* #undef MISSING_C99_STRUCT_INIT */
+
/* Do we need HPUX adjtime() library support? */
/* #undef NEED_HPUX_ADJTIME */
@@ -1418,7 +1437,7 @@
#define PACKAGE_NAME "ntp"
/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "ntp 4.2.8p4"
+#define PACKAGE_STRING "ntp 4.2.8p5"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "ntp"
@@ -1427,13 +1446,13 @@
#define PACKAGE_URL "http://www.ntp.org./"
/* Define to the version of this package. */
-#define PACKAGE_VERSION "4.2.8p4"
+#define PACKAGE_VERSION "4.2.8p5"
/* data dir */
#define PERLLIBDIR "/usr/local/share/ntp/lib"
/* define to a working POSIX compliant shell */
-#define POSIX_SHELL "/bin/bash"
+#define POSIX_SHELL "/bin/sh"
/* PARSE kernel PLL PPS support */
/* #undef PPS_SYNC */
@@ -1608,7 +1627,7 @@ typedef unsigned int uintptr_t;
/* #undef USE_UDP_SIGPOLL */
/* Version number of package */
-#define VERSION "4.2.8p4"
+#define VERSION "4.2.8p5"
/* vsnprintf expands "%m" to strerror(errno) */
/* #undef VSNPRINTF_PERCENT_M */
@@ -1785,5 +1804,5 @@ typedef union mpinfou {
/*
* FreeBSD specific: Explicitly specify date/time for reproducible build.
*/
-#define MKREPRO_DATE "Oct 22 2015"
-#define MKREPRO_TIME "17:58:31"
+#define MKREPRO_DATE "Jan 8 2016"
+#define MKREPRO_TIME "12:37:48"
diff --git a/usr.sbin/ntp/doc/ntp-keygen.8 b/usr.sbin/ntp/doc/ntp-keygen.8
index 197adbf..a0c0954 100644
--- a/usr.sbin/ntp/doc/ntp-keygen.8
+++ b/usr.sbin/ntp/doc/ntp-keygen.8
@@ -1,11 +1,11 @@
-.Dd October 21 2015
+.Dd January 7 2016
.Dt NTP_KEYGEN 8 User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntp-keygen-opts.mdoc)
.\"
.\" $FreeBSD$
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:40:10 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:32:43 PM by AutoGen 5.18.5
.\" From the definitions ntp-keygen-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/usr.sbin/ntp/doc/ntp.conf.5 b/usr.sbin/ntp/doc/ntp.conf.5
index c7af12d..3f075a1 100644
--- a/usr.sbin/ntp/doc/ntp.conf.5
+++ b/usr.sbin/ntp/doc/ntp.conf.5
@@ -1,11 +1,11 @@
-.Dd October 21 2015
+.Dd January 7 2016
.Dt NTP_CONF 5 File Formats
.Os
.\" EDIT THIS FILE WITH CAUTION (ntp.mdoc)
.\"
.\" $FreeBSD$
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:38:24 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:30:57 PM by AutoGen 5.18.5
.\" From the definitions ntp.conf.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/usr.sbin/ntp/doc/ntp.keys.5 b/usr.sbin/ntp/doc/ntp.keys.5
index b1bcb3c..04dfbcd 100644
--- a/usr.sbin/ntp/doc/ntp.keys.5
+++ b/usr.sbin/ntp/doc/ntp.keys.5
@@ -1,11 +1,11 @@
-.Dd October 21 2015
+.Dd January 7 2016
.Dt NTP_KEYS 5 File Formats
.Os SunOS 5.10
.\" EDIT THIS FILE WITH CAUTION (ntp.mdoc)
.\"
.\" $FreeBSD$
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:38:28 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:31:00 PM by AutoGen 5.18.5
.\" From the definitions ntp.keys.def
.\" and the template file agmdoc-file.tpl
.Sh NAME
diff --git a/usr.sbin/ntp/doc/ntpd.8 b/usr.sbin/ntp/doc/ntpd.8
index 243f96d..70ab88e 100644
--- a/usr.sbin/ntp/doc/ntpd.8
+++ b/usr.sbin/ntp/doc/ntpd.8
@@ -1,11 +1,11 @@
-.Dd October 21 2015
+.Dd January 7 2016
.Dt NTPD 8 User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntpd-opts.mdoc)
.\"
.\" $FreeBSD$
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:38:30 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:31:02 PM by AutoGen 5.18.5
.\" From the definitions ntpd-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/usr.sbin/ntp/doc/ntpdc.8 b/usr.sbin/ntp/doc/ntpdc.8
index 74129c4..3561f2a 100644
--- a/usr.sbin/ntp/doc/ntpdc.8
+++ b/usr.sbin/ntp/doc/ntpdc.8
@@ -1,11 +1,11 @@
-.Dd October 21 2015
+.Dd January 7 2016
.Dt NTPDC 8 User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntpdc-opts.mdoc)
.\"
.\" $FreeBSD$
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:38:57 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:31:29 PM by AutoGen 5.18.5
.\" From the definitions ntpdc-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/usr.sbin/ntp/doc/ntpq.8 b/usr.sbin/ntp/doc/ntpq.8
index bcd1fba..e71a84b 100644
--- a/usr.sbin/ntp/doc/ntpq.8
+++ b/usr.sbin/ntp/doc/ntpq.8
@@ -1,11 +1,11 @@
-.Dd October 21 2015
+.Dd January 7 2016
.Dt NTPQ 8 User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (ntpq-opts.mdoc)
.\"
.\" $FreeBSD$
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:39:29 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:32:02 PM by AutoGen 5.18.5
.\" From the definitions ntpq-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/usr.sbin/ntp/doc/sntp.8 b/usr.sbin/ntp/doc/sntp.8
index 9bcc78d..0d2dd64 100644
--- a/usr.sbin/ntp/doc/sntp.8
+++ b/usr.sbin/ntp/doc/sntp.8
@@ -1,11 +1,11 @@
-.Dd October 21 2015
+.Dd January 7 2016
.Dt SNTP 8 User Commands
.Os
.\" EDIT THIS FILE WITH CAUTION (sntp-opts.mdoc)
.\"
.\" $FreeBSD$
.\"
-.\" It has been AutoGen-ed October 21, 2015 at 12:30:59 PM by AutoGen 5.18.5
+.\" It has been AutoGen-ed January 7, 2016 at 11:23:27 PM by AutoGen 5.18.5
.\" From the definitions sntp-opts.def
.\" and the template file agmdoc-cmd.tpl
.Sh NAME
diff --git a/usr.sbin/services_mkdb/services_mkdb.c b/usr.sbin/services_mkdb/services_mkdb.c
index a91340e..9ea66de 100644
--- a/usr.sbin/services_mkdb/services_mkdb.c
+++ b/usr.sbin/services_mkdb/services_mkdb.c
@@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$");
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <libgen.h>
#include <libutil.h>
#include <ctype.h>
#include <errno.h>
@@ -91,6 +92,8 @@ main(int argc, char *argv[])
size_t cnt = 0;
StringList *sl, ***svc;
size_t port, proto;
+ char *dbname_dir;
+ int dbname_dir_fd = -1;
setprogname(argv[0]);
@@ -138,7 +141,7 @@ main(int argc, char *argv[])
err(1, "Cannot install exit handler");
(void)snprintf(tname, sizeof(tname), "%s.tmp", dbname);
- db = dbopen(tname, O_RDWR | O_CREAT | O_EXCL,
+ db = dbopen(tname, O_RDWR | O_CREAT | O_EXCL | O_SYNC,
(S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH), DB_HASH, &hinfo);
if (!db)
err(1, "Error opening temporary database `%s'", tname);
@@ -164,8 +167,21 @@ main(int argc, char *argv[])
if ((db->close)(db))
err(1, "Error closing temporary database `%s'", tname);
- if (rename(tname, dbname) == -1)
+ /*
+ * Make sure file is safe on disk. To improve performance we will call
+ * fsync() to the directory where file lies
+ */
+ if (rename(tname, dbname) == -1 ||
+ (dbname_dir = dirname(dbname)) == NULL ||
+ (dbname_dir_fd = open(dbname_dir, O_RDONLY|O_DIRECTORY)) == -1 ||
+ fsync(dbname_dir_fd) != 0) {
+ if (dbname_dir_fd != -1)
+ close(dbname_dir_fd);
err(1, "Cannot rename `%s' to `%s'", tname, dbname);
+ }
+
+ if (dbname_dir_fd != -1)
+ close(dbname_dir_fd);
return 0;
}
diff --git a/usr.sbin/sesutil/Makefile.depend b/usr.sbin/sesutil/Makefile.depend
index 3646e2e..6002005 100644
--- a/usr.sbin/sesutil/Makefile.depend
+++ b/usr.sbin/sesutil/Makefile.depend
@@ -9,6 +9,7 @@ DIRDEPS = \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
+ lib/libsbuf \
.include <dirdeps.mk>
OpenPOWER on IntegriCloud