]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 841] Obsolete the "dynamic" keyword and make deferred binding
authorMartin Burnicki <burnicki@ntp.org>
Tue, 5 Aug 2008 07:50:23 +0000 (09:50 +0200)
committerMartin Burnicki <burnicki@ntp.org>
Tue, 5 Aug 2008 07:50:23 +0000 (09:50 +0200)
to local interfaces the default.
Emit a warning if that keyword is used for configuration.

bk: 4898063fMiN6k_W7dbnAB6X_u7t6Eg

ChangeLog
html/confopt.html
html/ntpdc.html
include/ntp.h
include/ntp_request.h
ntpd/ntp_config.c
ntpd/ntp_intres.c
ntpd/ntp_peer.c
ntpd/ntp_request.c
ntpdc/ntpdc_ops.c

index 177b3dff8e672917790ebe47d9c5d3aa65e1fcea..a197f99594bf8fc06b81d777f000c60093bc2bd8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+* [Bug 841] Obsolete the "dynamic" keyword and make deferred binding
+  to local interfaces the default.
+  Emit a warning if that keyword is used for configuration.
 * [Bug 959] Refclock on Windows not properly releasing recvbuffs.
 * [Bug 993] Fix memory leak when fetching system messages.
 * [Bug 987] Wake up the resolver thread/process when a new interface has
index aeb522d101196bd53fe78b3ef27ffb079ab9efb2..e2a04c47cd6693567d966323b3279d1bba39fae1 100644 (file)
@@ -64,8 +64,6 @@
                        <dd>This option is used only with broadcast server and manycast client modes. It specifies the time-to-live <i><tt>ttl</tt></i> to use on broadcast server and multicast server and the maximum <i><tt>ttl</tt></i> for the expanding ring search with manycast client packets. Selection of the proper value, which defaults to 127, is something of a black art and should be coordinated with the network administrator.
                        <dt><tt>version <i>version</i></tt>
                        <dd>Specifies the version number to be used for outgoing NTP packets. Versions 1-4 are the choices, with version 4 the default. This option is valid only with the <tt>server,</tt> <tt>peer</tt> and <tt>broadcast</tt> commands.
-                       <dt><tt>dynamic</tt>
-                       <dd>Allows a server/peer to be configured even if it is not reachable at configuration time. It is assumed that at some point in the future the network environment changes so that this server/peer can be reached. This option is useful to configure servers/peers on mobile systems with intermittent network access (e.g. wlan clients).
                </dl>
                <h4 id="aux">Auxilliary Commands</h4>
                <dl>
index 02bc13aec451325e9fd914c8a07f5f33426dd9fe..92fde1de78058bc1091d784d01c7e9b77352c558 100644 (file)
                <dt><tt>addpeer <i>peer_address</i> [
                <i>keyid</i> ] [ <i>version</i> ] [
                <tt>minpoll# | prefer | iburst  | burst | minpoll
-               <i>N</i> | <tt>maxpoll</tt> <i>N</i> [ <i>dynamic</i> ] [...] ]</tt>
+               <i>N</i> | <tt>maxpoll</tt> <i>N</i> [...] ]</tt>
                <dt><tt>addpeer <i>peer_address</i> [
                <tt>prefer | iburst | burst | minpoll
                <i>N</i> | <tt>maxpoll</tt> <i>N</i> | <tt>keyid</tt>
                        ntpd.  See the <a href="confopt.html">Server Options</a> page for further information.
                        Each flag (or its absence) replaces the
                        previous setting. The <tt>prefer</tt> keyword indicates a preferred peer (and thus will be used primarily for clock synchronisation if possible). The preferred peer also determines the validity of the PPS signal - if the preferred peer is suitable for synchronisation so is the PPS signal.
-                       The <tt>dynamic</tt> keyword allows association configuration even when no suitable network interface is found at configuration time. The dynamic interface update mechanism may complete the configuration when new interfaces appear (e.g. WLAN/PPP interfaces) at a later time and thus render the association operable.
                        <dt><tt>addserver <i>peer_address</i> [
                <i>keyid</i> ] [ <i>version</i> ] [
                <tt>minpoll# | prefer | iburst  | burst | minpoll
                <dt><tt>addserver <i>peer_address</i> [
                <tt>prefer | iburst | burst | minpoll
                <i>N</i> | <tt>maxpoll</tt> <i>N</i> | <tt>keyid</tt>
-                       <i>N</i> | <tt>version</tt> <i>N</i> [...] [ <i>dynamic</i> ] ]</tt>
+                       <i>N</i> | <tt>version</tt> <i>N</i> [...] ]</tt>
                        <dd>Identical to the addpeer command, except that the operating mode is client.
                        <dt><tt>broadcast <i>peer_address</i> [
                        <i>keyid</i> ] [ <i>version</i> ] [ <i>prefer</i> ]</tt>
index db08ebb7c76b8e2eedca495c7fa2643bba98f225..dad9de136701925c4f0d5b262272485c16783301 100644 (file)
@@ -433,7 +433,6 @@ struct peer {
 #define FLAG_FIXPOLL   0x1000  /* stick at minpoll */
 #define FLAG_TRUE      0x2000  /* select truechimer */
 #define        FLAG_PREEMPT    0x4000  /* preemptable association */
-#define        FLAG_DYNAMIC    0x8000  /* dynamic addresses - allow configuration even if no interface is found */
 
 /*
  * Definitions for the clear() routine.  We use memset() to clear
index a0cf8057277c53c8396e6df1baa364e359c572a1..eb13fadb8fecb87f99c8410ae3823d468bd41933 100644 (file)
@@ -600,7 +600,6 @@ struct conf_peer {
 #define CONF_FLAG_IBURST       0x08
 #define CONF_FLAG_NOSELECT     0x10
 #define CONF_FLAG_SKEY         0x20
-#define CONF_FLAG_DYNAMIC      0x40
 
 /*
  * Structure for passing peer deletion information.  Currently
index 13dc599da95f890b4d065cea9e67bb76bebd6e77..beb4c4847e7121bd2af14f0445e18c7375fb1f64 100644 (file)
@@ -813,8 +813,10 @@ getconfig(
                                    peerflags |= FLAG_IBURST;
                                    break;
 
-                               case CONF_MOD_DYNAMIC:
-                                   peerflags |= FLAG_DYNAMIC;
+                               case CONF_MOD_DYNAMIC:
+                                   msyslog(LOG_WARNING, 
+                                       "Warning: the \"dynamic\" keyword has been obsoleted"
+                                       " and will be removed in the next release\n");
                                    break;
 
 #ifdef OPENSSL
index 18920285e540451bd05548d7914bfbb570c8e6ca..2a4b51fef7c92ad18d35f8c2aad2c6cd7fd85192 100644 (file)
@@ -1051,7 +1051,7 @@ readconf(
                }
 
                if ((intval[TOK_FLAGS] & ~(FLAG_AUTHENABLE | FLAG_PREFER |
-                   FLAG_NOSELECT | FLAG_BURST | FLAG_IBURST | FLAG_SKEY | FLAG_DYNAMIC))
+                   FLAG_NOSELECT | FLAG_BURST | FLAG_IBURST | FLAG_SKEY))
                    != 0) {
                        msyslog(LOG_ERR, "invalid flags (%ld) in file %s",
                                intval[TOK_FLAGS], name);
@@ -1071,8 +1071,6 @@ readconf(
                    flags |= CONF_FLAG_IBURST;
                if (intval[TOK_FLAGS] & FLAG_SKEY)
                    flags |= CONF_FLAG_SKEY;
-               if (intval[TOK_FLAGS] & FLAG_DYNAMIC)
-                   flags |= CONF_FLAG_DYNAMIC;
 
                /*
                 * This is as good as we can check it.  Add it in.
index 1655d327e2846965011ff866ab02f63980c99915..edd1dc5671757109ac116caed69676399b15d103 100644 (file)
@@ -759,45 +759,25 @@ newpeer(
                    cast_flags, stoa(srcadr)));
 
        ISC_LINK_INIT(peer, ilink);  /* set up interface link chain */
-
-       dstadr = select_peerinterface(peer, srcadr, dstadr, cast_flags);
-       
-       /*
-        * If we can't find an interface to use we return a NULL
-        * unless the DYNAMIC flag is set - then we expect the dynamic
-        * interface detection code to bind us some day to an interface
-        */
-       if (dstadr == NULL && !(flags & FLAG_DYNAMIC))
-       {
-               msyslog(LOG_ERR, "Cannot find existing interface for address %s", stoa(srcadr));
-
-               peer->next = peer_free;
-               peer_free = peer;
-               peer_associations--;
-               peer_free_count++;
-               
-               return (NULL);
-       }
-       
        peer->srcadr = *srcadr;
+       set_peerdstadr(peer, select_peerinterface(peer, srcadr, dstadr,
+           cast_flags));
        peer->hmode = (u_char)hmode;
        peer->version = (u_char)version;
        peer->minpoll = (u_char)max(NTP_MINPOLL, minpoll);
        peer->maxpoll = (u_char)min(NTP_MAXPOLL, maxpoll);
        peer->flags = flags;
-
-       set_peerdstadr(peer, dstadr);
-
 #ifdef DEBUG
        if (debug > 2) {
                if (peer->dstadr)
                        printf("newpeer: using fd %d and our addr %s\n",
-                              peer->dstadr->fd, stoa(&peer->dstadr->sin));
+                                   peer->dstadr->fd,
+                                   stoa(&peer->dstadr->sin));
                else
                        printf("newpeer: local interface currently not bound\n");
        }
 #endif
-       
+
        /*
         * Broadcast needs the socket enabled for broadcast
         */
index 9d03b3527851947d96b7397f6727ee2158649e2b..b1bc99d6f3f8cff3bf72b1aca372c0be1b0b2721 100644 (file)
@@ -1345,7 +1345,7 @@ do_conf(
                    && temp_cp.hmode != MODE_BROADCAST)
                    fl = 1;
                if (temp_cp.flags & ~(CONF_FLAG_AUTHENABLE | CONF_FLAG_PREFER
-                                 | CONF_FLAG_BURST | CONF_FLAG_IBURST | CONF_FLAG_SKEY | CONF_FLAG_DYNAMIC))
+                                 | CONF_FLAG_BURST | CONF_FLAG_IBURST | CONF_FLAG_SKEY))
                    fl = 1;
                cp = (struct conf_peer *)
                    ((char *)cp + INFO_ITEMSIZE(inpkt->mbz_itemsize));
@@ -1378,8 +1378,6 @@ do_conf(
                    fl |= FLAG_IBURST;
                if (temp_cp.flags & CONF_FLAG_SKEY)
                        fl |= FLAG_SKEY;
-               if (temp_cp.flags & CONF_FLAG_DYNAMIC)
-                       fl |= FLAG_DYNAMIC;
                
                if (client_v6_capable && temp_cp.v6_flag != 0) {
                        peeraddr.ss_family = AF_INET6;
index 8d6a23c599dd27eb514802954724dfdedac6fdc5..e40016b901cde8716aebde5d42640d3fd65380b8 100644 (file)
@@ -119,10 +119,10 @@ struct xcmd opcmds[] = {
          { "", "", "", "" },
          "display event timer subsystem statistics" },
        { "addpeer",    addpeer,        { NTP_ADD, OPT|NTP_STR, OPT|NTP_STR, OPT|NTP_STR },
-         { "addr", "keyid", "version", "minpoll#|prefer|burst|iburst|dynamic|'minpoll N'|'maxpoll N'|'keyid N'|'version N' ..." },
+         { "addr", "keyid", "version", "minpoll#|prefer|burst|iburst|'minpoll N'|'maxpoll N'|'keyid N'|'version N' ..." },
          "configure a new peer association" },
        { "addserver",  addserver,      { NTP_ADD, OPT|NTP_STR, OPT|NTP_STR, OPT|NTP_STR },
-         { "addr", "keyid", "version", "minpoll#|prefer|burst|iburst|dynamic|'minpoll N'|'maxpoll N'|'keyid N'|'version N' ..." },
+         { "addr", "keyid", "version", "minpoll#|prefer|burst|iburst|'minpoll N'|'maxpoll N'|'keyid N'|'version N' ..." },
          "configure a new server" },
        { "addrefclock",addrefclock,    { NTP_ADD, OPT|NTP_UINT, OPT|NTP_STR, OPT|NTP_STR },
          { "addr", "mode", "minpoll|prefer", "minpoll|prefer" },
@@ -1333,7 +1333,7 @@ again:
                else if (STREQ(pcmd->argval[items].string, "burst"))
                    flags |= CONF_FLAG_BURST;
                else if (STREQ(pcmd->argval[items].string, "dynamic"))
-                    flags |= CONF_FLAG_DYNAMIC;
+                   (void) fprintf(fp, "Warning: the \"dynamic\" keyword has been obsoleted and will be removed in the next release\n"); 
                else if (STREQ(pcmd->argval[items].string, "iburst"))
                    flags |= CONF_FLAG_IBURST;
                else if (!refc && STREQ(pcmd->argval[items].string, "keyid"))