]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
ChangeLog, ntp_peer.c, ntp_proto.c:
authorHarlan Stenn <stenn@ntp.org>
Mon, 4 Dec 2000 00:22:58 +0000 (00:22 -0000)
committerHarlan Stenn <stenn@ntp.org>
Mon, 4 Dec 2000 00:22:58 +0000 (00:22 -0000)
  * ntpd/ntp_proto.c (receive): That any_interface is now an
  rbufp->dstadr.
  Various other doc and code cleanup.
  * ntpd/ntp_peer.c (findmanycastpeer): Fixes
  From Dave Mills

bk: 3a2ae3e2KRqwyekoV_7T0pSRtTBQQA

ChangeLog
ntpd/ntp_peer.c
ntpd/ntp_proto.c

index 731635847339848c86e8ef244de3243df67d5dfa..1f1dc4198a2e77722cb8dae9cb210dfb3ddba30d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2000-12-03  Harlan Stenn  <stenn@whimsy.udel.edu>
+
+       * ntpd/ntp_proto.c (receive): That any_interface is now an
+       rbufp->dstadr.
+       Various other doc and code cleanup.
+       * ntpd/ntp_peer.c (findmanycastpeer): Fixes
+       From Dave Mills
+
 2000-12-02  Harlan Stenn  <stenn@whimsy.udel.edu>
 
        * ntpd/ntp_request.c (do_conf): call peer_config with
index 36c6e3109325e55dd2028918667a9f712fd14947..f901da730e891e8c9c5a3d8d36a88518b1600797 100644 (file)
@@ -356,8 +356,7 @@ findmanycastpeer(
 
                for (peer = peer_hash[i]; peer != 0; peer =
                    peer->next) {
-                       if (peer->cast_flags & MDF_ACAST &&
-                           peer->flags & FLAG_CONFIG) {
+                       if (peer->cast_flags & MDF_ACAST) {
                                NTOHL_FP(&pkt->org, &p_org);
                                if (L_ISEQU(&peer->xmt, &p_org))
                                        return(peer);
@@ -383,9 +382,9 @@ resetmanycast(void)
 
                for (peer = peer_hash[i]; peer != 0; peer =
                    peer->next) {
-                       if (peer->cast_flags & MDF_ACAST &&
-                           peer->flags & FLAG_CONFIG)
+                       if (peer->cast_flags & MDF_ACAST)
                                poll_update(peer, peer->minpoll);
+
                }
        }
 }
@@ -659,9 +658,11 @@ newpeer(
         */
        memset((char *)peer, 0, sizeof(struct peer));
        peer->srcadr = *srcadr;
+/*
        if (dstadr == any_interface)
                peer->dstadr = findinterface(srcadr);
        else
+*/
                peer->dstadr = dstadr;
        peer->cast_flags = cast_flags;
        peer->hmode = (u_char)hmode;
index a60f053aa1a93d5b0e517860e2b3aa2404c03692..639fcf9ee43ebba7fc9feee125cf4caa93b5fc80 100644 (file)
@@ -534,18 +534,14 @@ receive(
                 * there is no match, that's curious but nonfatal. Just
                 * ignore it. Bad manners to respond if we are not
                 * synchronized to something.
+                *
+                * There is an implosion hazard at the sender.
                 */
                peer2 = findmanycastpeer(rbufp);
                if (peer2 == 0)
                        return;
 
-               /*
-                * Create a new association and copy the peer variables
-                * to it. If something goes wrong, just ignore it. We
-                * know the packet failed authentication, anyway, so
-                * just toss it.
-                */
-               peer = newpeer(&rbufp->recv_srcadr, any_interface,
+               peer = newpeer(&rbufp->recv_srcadr, rbufp->dstadr,
                    MODE_CLIENT, PKT_VERSION(pkt->li_vn_mode),
                    NTP_MINDPOLL, NTP_MAXDPOLL, FLAG_IBURST |
                    (peer2->flags & (FLAG_AUTHENABLE | FLAG_SKEY)),
@@ -593,15 +589,24 @@ receive(
        case AM_NEWBCL:
 
                /*
-                * Broadcast client being set up now. Do this only if
-                * the packet is properly authenticated.
+                * We have received a broadcast and are about to set
+                * up a broadcast client association. But, we don't
+                * know if the broadcaster knows its own interface
+                * address and can properly construct the cryptosum.
+                * Therefore, there could be an authentication
+                * failure from a legitimate 'caster. Being as devlishly
+                * clever as we are, we just toss back a client mode
+                * packet to cause the 'caster to bind its own interface.
+                * I did not admit this. I was never there.
+                *
+                * There is a sender implosion hazard here.
                 */
                if ((restrict_mask & RES_NOPEER) || !sys_bclient ||
                    (sys_authenticate && !is_authentic)) {
-                       is_error = 1;
-                       break;
+                       fast_xmit(rbufp, MODE_CLIENT, 0);
+                       return;
                }
-               peer = newpeer(&rbufp->recv_srcadr, any_interface,
+               peer = newpeer(&rbufp->recv_srcadr, rbufp->dstadr,
                    MODE_MCLIENT, PKT_VERSION(pkt->li_vn_mode),
                    NTP_MINDPOLL, NTP_MAXDPOLL, FLAG_MCAST1 | FLAG_MCAST2 |
                    FLAG_BURST, MDF_UCAST, 0, skeyid);
@@ -633,15 +638,8 @@ receive(
        if (is_error) {
 
                /*
-                * Error stub. If we get here, something broke. We
-                * scuttle the autokey if necessary and sink the ship.
-                * This can occur only upon mobilization, so we can
-                * throw the structure away without fear of breaking
-                * anything.
+                * Error stub. If we get here, something broke.
                 */
-               if (peer != 0)
-                       if (!(peer->flags & FLAG_CONFIG))
-                               unpeer(peer);
 #ifdef DEBUG
                if (debug)
                        printf("receive: bad protocol %d\n", retcode);
@@ -1082,8 +1080,8 @@ poll_update(
 #endif /* AUTOKEY */
 
        /*
-        * The wiggle-the-poll-interval dance. Broadcasters dance only
-        * the minpoll beat. Reference clock partners sit this one out.
+        * The wiggle-the-poll-interval dance. Broadcasters and anycasters
+        * dance the band. Reference clock partners sit this one out.
         * Dancers surviving the clustering algorithm beat to the system
         * poll. Broadcast clients are usually lead by their broadcast
         * partner, but faster in the initial mating dance.
@@ -1097,6 +1095,8 @@ poll_update(
                peer->hpoll = sys_poll;
        else
                peer->hpoll = hpoll;
+       if (peer->cast_flags & (MDF_BCAST | MDF_ACAST))
+               peer->ppoll = peer->hpoll;
        if (peer->hpoll > peer->maxpoll)
                peer->hpoll = peer->maxpoll;
        else if (peer->hpoll < peer->minpoll)
@@ -1375,7 +1375,6 @@ clock_select(void)
         * Initialize. If a prefer peer does not survive this thing,
         * the pps stratum will remain unspec.
         */
-       sys_survivors = 0;
        sys_prefer = 0;
        nreach = nlist = 0;
        low = 1e9;
@@ -1561,6 +1560,8 @@ clock_select(void)
                                msyslog(LOG_INFO,
                                    "synchronisation lost");
                        }
+                       sys_survivors = 0;
+                       resetmanycast();
                        return;
                }
        }
@@ -2184,8 +2185,6 @@ fast_xmit(
         * Initialize transmit packet header fields from the receive
         * buffer provided. We leave some fields intact as received.
         */
-       if (rbufp->dstadr == any_interface)
-               rbufp->dstadr = findinterface(&rbufp->srcadr);
        rpkt = &rbufp->recv_pkt;
        xpkt.li_vn_mode = PKT_LI_VN_MODE(sys_leap,
            PKT_VERSION(rpkt->li_vn_mode), xmode);