]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
Add test of ntpd --saveconfigquit fidelity using new complete.conf.
authorDave Hart <hart@ntp.org>
Sun, 4 Oct 2009 18:14:14 +0000 (18:14 +0000)
committerDave Hart <hart@ntp.org>
Sun, 4 Oct 2009 18:14:14 +0000 (18:14 +0000)
bk: 4ac8e5f6I3I0ZUS49wXqIwwzmwWJrg

ChangeLog
configure.ac
ntpd/Makefile.am
ntpd/complete.conf [new file with mode: 0644]
ntpd/ntp_config.c
ntpdc/Makefile.am

index 38289acb7b46833613c1d8202d4bade37e23ec5c..20eaa53db23d90ede2378060a1aa849fe509a7e7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,4 @@
+* Add test of ntpd --saveconfigquit fidelity using new complete.conf.
 (4.2.5p226) 2009/10/04 Released by Harlan Stenn <stenn@ntp.org>
 [Bug 1318] Allow multiple -g options on ntpd command line.
 [Bug 1327] ntpq, ntpdc, ntp-keygen -d and -D should work with configure
index e3b466d863788ce237af4782b22fdeae79d9c949..7dcfb88d0286d6c605d9883eab0313c6020ff93e 100644 (file)
@@ -4738,9 +4738,12 @@ AC_MSG_CHECKING([if we want the saveconfig mechanism])
 AC_ARG_ENABLE(saveconfig,
     AC_HELP_STRING([--enable-saveconfig], [+ saveconfig mechanism]),
     [ntp_ok=$enableval], [ntp_ok=yes])
+ntp_saveconfig_enabled=0
 if test "$ntp_ok" = "yes"; then
+    ntp_saveconfig_enabled=1
     AC_DEFINE(SAVECONFIG, 1, [saveconfig mechanism])
 fi
+AM_CONDITIONAL([SAVECONFIG_ENABLED], [test x$ntp_saveconfig_enabled = x1])
 AC_MSG_RESULT($ntp_ok)
 
 ###
index a25b10a3e5e055704b2cd1ba6c683a230d8b58d7..1f2648bf370a564d91d9e1c335f380a00f4ea94c 100644 (file)
@@ -15,6 +15,12 @@ AM_CPPFLAGS= -I$(top_srcdir)/include -I$(top_srcdir)/lib/isc/include \
 LDADD= version.o libntpd.a @LIBPARSE@
 AM_YFLAGS=     -d -t -r all
 
+if SAVECONFIG_ENABLED
+CHECK_SAVECONFIG= check-saveconfig
+else
+CHECK_SAVECONFIG=
+endif
+
 #
 # VPHACK and VPHACK_AFTER are enabled on non-GNU makes (such as 
 # BSD make) to work around issues specific to compiling
@@ -70,6 +76,7 @@ ntpdsim_LDADD = $(LDADD) -lm @LCRYPTO@ @LSCF@ $(LIBOPTS_LDADD) ../libntp/libntps
 ntpdsim_CFLAGS = $(CFLAGS) -DSIM
 check_y2k_LDADD = $(LDADD) ../libntp/libntp.a
 DISTCLEANFILES = .version version.c
+CLEANFILES = check-saveconfig compsave.conf
 EXTRA_DIST = ntpd-opts.def ntpdbase-opts.def \
        refclock_msfees.c       \
        refclock_trak.c         \
@@ -83,7 +90,7 @@ std_def_list= $(top_srcdir)/include/autogen-version.def       \
                $(top_srcdir)/include/copyright.def             \
                $(top_srcdir)/include/version.def
 
-check-local: @MAKE_CHECK_Y2K@
+check-local: @MAKE_CHECK_Y2K@ $(CHECK_SAVECONFIG)
        test -z "@MAKE_CHECK_Y2K@" || ./@MAKE_CHECK_Y2K@
 
 ntpd_SOURCES =                 \
@@ -177,6 +184,12 @@ $(srcdir)/ntpd-opts.texi $(srcdir)/ntpd-opts.menu: $(srcdir)/ntpd-opts.def $(src
 
 $(PROGRAMS): $(LDADD)
 
+compsave.conf: ntpd $(srcdir)/complete.conf
+       ./ntpd --configfile $(srcdir)/complete.conf --saveconfigquit $@
+
+check-saveconfig: $(srcdir)/complete.conf compsave.conf
+       cmp $(srcdir)/complete.conf compsave.conf && echo stamp > $@
+
 ../libntp/libntp.a:
        cd ../libntp && $(MAKE) libntp.a
 
diff --git a/ntpd/complete.conf b/ntpd/complete.conf
new file mode 100644 (file)
index 0000000..c570d2f
--- /dev/null
@@ -0,0 +1,54 @@
+saveconfigdir "/etc/ntp/conf"
+driftfile "/etc/ntp.drift"
+logfile "/var/log/ntp.log"
+logconfig =all -allinfo -allevents -allstatistics -allstatus +allall -clockinfo -clockevents -clockstatistics -clockstatus +clockall -syncinfo -syncevents -syncstatistics -syncstatus +syncall -sysinfo -sysevents -sysstatistics -sysstatus +sysall
+statsdir "/etc/ntp/stats"
+statistics loopstats peerstats
+filegen clockstats file clockstats type none enable
+filegen cryptostats file cryptostats type pid link disable
+filegen loopstats file loopstats type day nolink enable
+filegen peerstats file peerstats type week enable
+filegen protostats file stats type month enable
+filegen rawstats file rawstats type year nolink enable
+filegen sysstats file sysstats type age enable
+filegen timingstats file timingstats type none disable
+crypto host hostname ident id pw cryptopass randfile /.rnd
+revoke 10
+keysdir "/etc/ntp/keys"
+keys "/etc/ntp.keys"
+trustedkey 1 2 3 4 5 6 7 8 9 10 11 12
+controlkey 12
+requestkey 12
+enable auth ntp monitor
+disable bclient calibrate kernel
+tos beacon 3600 ceiling 16 cohort 0 floor 1 maxclock 10 maxdist 1.5 minclock 3 mindist 0.001 minsane 1 orphan 16
+tinker allan 1500 dispersion 15 freq 0 huffpuff 7200 panic 1000 step 0.128 stepout 900
+broadcastclient
+server 127.127.1.0 mode 64 prefer true
+fudge 127.127.1.0 time1 0 time2 1.1 stratum 7 refid Abcd
+pool 0.north-america.pool.ntp.org. iburst preempt
+server 1.north-america.pool.ntp.org. iburst
+server -4 2.north-america.pool.ntp.org. minpoll 6 maxpoll 10 iburst
+server -6 ntp.davehart.net. minpoll 6 maxpoll 10 version 5 burst iburst
+peer -6 davehart.broker.freenet6.net. xleave autokey
+peer -4 192.168.192.168 key 1 bias 3.1416 noselect
+broadcast 192.168.192.255
+manycastclient 224.0.1.1
+manycastclient ff05::101
+manycastserver 224.0.1.1 ff05::101
+discard minimum 1 average 3 monitor 1
+restrict default nomodify limited kod
+restrict trusted.host.name.example.com. nomodify
+restrict [fe80::1] mask [ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff]
+restrict 127.0.0.1 mask 255.255.255.255
+restrict ::1
+interface drop ipv6
+interface ignore ipv4
+interface drop wildcard
+interface listen eth0
+interface listen ipv6
+interface listen 192.168.192.0/24
+interface listen 192.168.193.1
+setvar vanity = "name plate"
+trap 127.0.0.1 interface 127.0.0.1 port 1234
+trap 127.0.0.2
index 44b5f4166cd0357cad7a6e3b0e79fa05a0b5d319..806d38d9f4c43dab2a250cb8c37127012c7d2b40 100644 (file)
@@ -821,8 +821,13 @@ dump_config_tree(
                if (peer->maxpoll != 0)
                        fprintf(df, " maxpoll %d", peer->maxpoll);
 
-               if (peer->ttl != 0)
-                       fprintf(df, " ttl %d", peer->ttl);
+               if (peer->ttl != 0) {
+                       if (strlen(addr->address) > 8
+                           && !memcmp(addr->address, "127.127.", 8))
+                               fprintf(df, " mode %d", peer->ttl);
+                       else
+                               fprintf(df, " ttl %d", peer->ttl);
+               }
 
                if (peer->peerversion != NTP_VERSION)
                        fprintf(df, " version %d", peer->peerversion);
@@ -3842,22 +3847,6 @@ getconfig(
                free_netinfo_config(config_netinfo);
 #endif /* HAVE_NETINFO */
 
-#ifdef SAVECONFIG
-       if (HAVE_OPT( SAVECONFIGQUIT )) {
-               FILE *dumpfile;
-               int dumpfailed;
-
-               dumpfile = fopen(OPT_ARG( SAVECONFIGQUIT ), "w");
-               dumpfailed = dump_all_config_trees(dumpfile, 0);
-               if (dumpfailed)
-                       fprintf(stderr,
-                               "--saveconfigquit %s error %d\n",
-                               OPT_ARG( SAVECONFIGQUIT ),
-                               dumpfailed);
-               exit(dumpfailed);
-       }
-#endif /* SAVECONFIG */
-
        /*
        printf("getconfig: res_fp <%p> call_resolver: %d", res_fp, call_resolver);
        */
@@ -3887,8 +3876,39 @@ save_and_apply_config_tree(void)
        memcpy(ptree, &cfgt, sizeof(*ptree));
        memset(&cfgt, 0, sizeof(cfgt));
        
-       LINK_TAIL_SLIST(cfg_tree_history, ptree, link, struct config_tree);
+       LINK_TAIL_SLIST(cfg_tree_history, ptree, link,
+                       struct config_tree);
 
+#ifdef SAVECONFIG
+       if (HAVE_OPT( SAVECONFIGQUIT )) {
+               FILE *dumpfile;
+               int err;
+               int dumpfailed;
+
+               dumpfile = fopen(OPT_ARG( SAVECONFIGQUIT ), "w");
+               if (NULL == dumpfile) {
+                       err = errno;
+                       fprintf(stderr,
+                               "can not create save file %s, error %d %s\n",
+                               OPT_ARG( SAVECONFIGQUIT ), err,
+                               strerror(err));
+                       exit(err);
+               }
+               
+               dumpfailed = dump_all_config_trees(dumpfile, 0);
+               if (dumpfailed)
+                       fprintf(stderr,
+                               "--saveconfigquit %s error %d\n",
+                               OPT_ARG( SAVECONFIGQUIT ),
+                               dumpfailed);
+               else
+                       fprintf(stderr,
+                               "configuration saved to %s\n",
+                               OPT_ARG( SAVECONFIGQUIT ));
+
+               exit(dumpfailed);
+       }
+#endif /* SAVECONFIG */
 
        /* The actual configuration done depends on whether we are configuring the
         * simulator or the daemon. Perform a check and call the appropriate
index 64d546ed6d42ce680ed400be182f9375d255c684..968119faf5768bb9b5df6cd57fb298c6a915648b 100644 (file)
@@ -46,7 +46,7 @@ ntpdc-layout.o: nl.c
 layout.here: ntpdc-layout
        ./ntpdc-layout > $@
 
-check-layout: ntpdc-layout layout.std layout.here
+check-layout: ntpdc-layout $(srcdir)/layout.std layout.here
        cmp $(srcdir)/layout.std layout.here && echo stamp > $@
 
 $(PROGRAMS): $(LDADD)