From: Martin Burnicki Date: Tue, 5 Aug 2008 07:50:23 +0000 (+0200) Subject: [Bug 841] Obsolete the "dynamic" keyword and make deferred binding X-Git-Tag: NTP_4_2_4P5_RC2~4^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f6f750ec8c3eeaab459ff22409caf2850ba9e201;p=thirdparty%2Fntp.git [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. bk: 4898063fMiN6k_W7dbnAB6X_u7t6Eg --- diff --git a/ChangeLog b/ChangeLog index 177b3dff8..a197f9959 100644 --- 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 diff --git a/html/confopt.html b/html/confopt.html index aeb522d10..e2a04c47c 100644 --- a/html/confopt.html +++ b/html/confopt.html @@ -64,8 +64,6 @@
This option is used only with broadcast server and manycast client modes. It specifies the time-to-live ttl to use on broadcast server and multicast server and the maximum ttl 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.
version version
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 server, peer and broadcast commands. -
dynamic -
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).

Auxilliary Commands

diff --git a/html/ntpdc.html b/html/ntpdc.html index 02bc13aec..92fde1de7 100644 --- a/html/ntpdc.html +++ b/html/ntpdc.html @@ -134,7 +134,7 @@
addpeer peer_address [ keyid ] [ version ] [ minpoll# | prefer | iburst | burst | minpoll - N | maxpoll N [ dynamic ] [...] ] + N | maxpoll N [...] ]
addpeer peer_address [ prefer | iburst | burst | minpoll N | maxpoll N | keyid @@ -163,7 +163,6 @@ ntpd. See the Server Options page for further information. Each flag (or its absence) replaces the previous setting. The prefer 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 dynamic 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.
addserver peer_address [ keyid ] [ version ] [ minpoll# | prefer | iburst | burst | minpoll @@ -171,7 +170,7 @@
addserver peer_address [ prefer | iburst | burst | minpoll N | maxpoll N | keyid - N | version N [...] [ dynamic ] ] + N | version N [...] ]
Identical to the addpeer command, except that the operating mode is client.
broadcast peer_address [ keyid ] [ version ] [ prefer ] diff --git a/include/ntp.h b/include/ntp.h index db08ebb7c..dad9de136 100644 --- a/include/ntp.h +++ b/include/ntp.h @@ -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 diff --git a/include/ntp_request.h b/include/ntp_request.h index a0cf80572..eb13fadb8 100644 --- a/include/ntp_request.h +++ b/include/ntp_request.h @@ -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 diff --git a/ntpd/ntp_config.c b/ntpd/ntp_config.c index 13dc599da..beb4c4847 100644 --- a/ntpd/ntp_config.c +++ b/ntpd/ntp_config.c @@ -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 diff --git a/ntpd/ntp_intres.c b/ntpd/ntp_intres.c index 18920285e..2a4b51fef 100644 --- a/ntpd/ntp_intres.c +++ b/ntpd/ntp_intres.c @@ -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. diff --git a/ntpd/ntp_peer.c b/ntpd/ntp_peer.c index 1655d327e..edd1dc567 100644 --- a/ntpd/ntp_peer.c +++ b/ntpd/ntp_peer.c @@ -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 */ diff --git a/ntpd/ntp_request.c b/ntpd/ntp_request.c index 9d03b3527..b1bc99d6f 100644 --- a/ntpd/ntp_request.c +++ b/ntpd/ntp_request.c @@ -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; diff --git a/ntpdc/ntpdc_ops.c b/ntpdc/ntpdc_ops.c index 8d6a23c59..e40016b90 100644 --- a/ntpdc/ntpdc_ops.c +++ b/ntpdc/ntpdc_ops.c @@ -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"))