duplicate ephemeral associations without broadcastdelay.
* [Bug 2072] from 4.2.6p5-RC2: Orphan parent selection metric needs
ntohl().
+* [Bug 2073] Correct ntpq billboard's MODE_PASSIVE t from 'u' to 'S'.
* from 4.2.6p5-RC2: Exclude not-yet-determined sys_refid from use in
loopback TEST12 (from Dave Mills).
* Restore 4.2.6 clock_combine() weighting to ntp-dev, reverting to pre-
- 4.2.7p70 logic and avoiding divide-by-zero (from Dave Mills).
+ 4.2.7p70 method while also avoiding divide-by-zero (from Dave Mills).
+* Round l_fp traffic interval when converting to integer in rate limit
+ and KoD calculation.
(4.2.7p236) 2011/11/16 Released by Harlan Stenn <stenn@ntp.org>
* Documentation updates from Dave Mills.
(4.2.7p235) 2011/11/16 Released by Harlan Stenn <stenn@ntp.org>
#define MDF_POOL 0x08 /* pool client solicitor */
#define MDF_ACAST 0x10 /* manycast client solicitor */
#define MDF_BCLNT 0x20 /* eph. broadcast/multicast client */
-#define MDF_UCLNT 0x40 /* eph. manycast or pool client */
+#define MDF_UCLNT 0x40 /* preemptible manycast or pool client */
/*
* In the context of struct peer in ntpd, three of the cast_flags bits
* represent configured associations which never receive packets, and
u_short flags
)
{
+ l_fp interval_fp;
struct pkt * pkt;
mon_entry * mon;
mon_entry * oldest;
u_short restrict_mask;
u_char mode;
u_char version;
- l_fp interval_fp;
int interval;
int head; /* headway increment */
int leak; /* new headway */
if (mon != NULL) {
interval_fp = rbufp->recv_time;
L_SUB(&interval_fp, &mon->last);
+ /* add one-half second to round up */
+ L_ADDUF(&interval_fp, 0x80000000);
interval = interval_fp.l_i;
mon->last = rbufp->recv_time;
NSRCPORT(&mon->rmtadr) = NSRCPORT(&rbufp->recv_srcadr);
if (oldest != NULL) {
interval_fp = rbufp->recv_time;
L_SUB(&interval_fp, &oldest->last);
+ /* add one-half second to round up */
+ L_ADDUF(&interval_fp, 0x80000000);
oldest_age = interval_fp.l_i;
}
/* note -1 is legal for mru_maxage (disables) */
{
struct peer *peer;
+ DPRINTF(2, ("findexistingpeer_addr(%s, %s, %d, 0x%x)\n",
+ sptoa(addr),
+ (start_peer)
+ ? sptoa(&start_peer->srcadr)
+ : "NULL",
+ mode, (u_int)cast_flags));
+
/*
* start_peer is included so we can locate instances of the
* same peer through different interfaces in the hash table.
peer = start_peer->adr_link;
while (peer != NULL) {
+ DPRINTF(3, ("%s %s %d %d 0x%x 0x%x ", sptoa(addr),
+ sptoa(&peer->srcadr), mode, peer->hmode,
+ (u_int)cast_flags, (u_int)peer->cast_flags));
if ((-1 == mode || peer->hmode == mode ||
((MDF_BCLNT & peer->cast_flags) &&
(MDF_BCLNT & cast_flags))) &&
- ADDR_PORT_EQ(addr, &peer->srcadr))
+ ADDR_PORT_EQ(addr, &peer->srcadr)) {
+ DPRINTF(3, ("found.\n"));
break;
+ }
+ DPRINTF(3, ("\n"));
peer = peer->adr_link;
}
* multicast) and preemptible (manycast and pool) client
* associations.
*/
- if (peer != NULL)
+ if (peer != NULL) {
+ DPRINTF(2, ("newpeer(%s) found existing association\n",
+ (hostname)
+ ? hostname
+ : stoa(srcadr)));
return NULL;
+ }
/*
* Allocate a new peer structure. Some dirt here, since some of
peer_ntpdate--;
if (peer_ntpdate == 0) {
msyslog(LOG_NOTICE,
- "ntpd: no servers found");
- printf(
"ntpd: no servers found\n");
+ if (!msyslog_term)
+ printf(
+ "ntpd: no servers found\n");
exit (0);
}
}
sys_limitrejected++;
if (!(restrict_mask & RES_KOD) || hismode ==
MODE_BROADCAST)
+ //if (MODE_SERVER == hismode)
+ // DPRINTF(1, ("Possibly self-induced rate limiting of MODE_SERVER from %s\n",
+ // stoa(&rbufp->recv_srcadr)));
return; /* rate exceeded */
-
if (hismode == MODE_CLIENT)
fast_xmit(rbufp, MODE_SERVER, skeyid,
restrict_mask);
}
/*
- * Do not respond if synchronized and stratum is either
+ * Do not respond if synchronized and if stratum is
* below the floor or at or above the ceiling. Note,
* this allows an unsynchronized peer to synchronize to
* us. It would be very strange if he did and then was
* nipped, but that could only happen if we were
- * operating at the top end of the range.
+ * operating at the top end of the range. It also means
+ * we will spin an ephemeral association in response to
+ * MODE_ACTIVE KoDs, which will time out eventually.
*/
if (hisleap != LEAP_NOTINSYNC && (hisstratum <
sys_floor || hisstratum >= sys_ceiling)) {
* sending in a burst, use the earliest time. When not in a
* burst but with a reply pending, send at the earliest time
* unless the next scheduled time has not advanced. This can
- * only happen if multiple replies are peinding in the same
+ * only happen if multiple replies are pending in the same
* response interval. Otherwise, send at the later of the next
* scheduled time and the earliest time.
*
localmet = ntohl(peer->dstadr->addr_refid);
peermet = ntohl(addr2refid(&peer->srcadr));
- if (peermet < orphmet &&
- (current_time <= orphwait || peermet < localmet)) {
+ if (peermet < localmet && peermet < orphmet) {
typeorphan = peer;
orphmet = peermet;
}
y = z = w = 0;
for (i = 0; i < npeers; i++) {
d = root_distance(peers[i]);
- if (0. == d)
- d = 1e-6; /* hart avoid div by 0 */
x = 1. / d;
y += x;
z += peers[i]->offset * x;
break;
case MODE_ACTIVE:
- type = 's'; /* symmetric */
- break;
+ type = 's'; /* symmetric active */
+ break; /* configured */
+
+ case MODE_PASSIVE:
+ type = 'S'; /* symmetric passive */
+ break; /* ephemeral */
}
/*