]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
ntp_peer.c:
authorFrank Kardel <kardel@ntp.org>
Sun, 25 Mar 2007 20:07:31 +0000 (20:07 +0000)
committerFrank Kardel <kardel@ntp.org>
Sun, 25 Mar 2007 20:07:31 +0000 (20:07 +0000)
  [Bug 789] avoid broadcast/multicast client associations
  getting confused when multicast packets arrive
  during the autokey/delay dance

bk: 4606d683zOERvaE4P-gA5j9Bu-Bj0A

ntpd/ntp_peer.c

index e57a4a813918cc748b9b308e7232b77d925e90d3..69c5e3e1431ecec0e5543a972382b8c96b3ef238 100644 (file)
@@ -530,6 +530,18 @@ void
 set_peerdstadr(struct peer *peer, struct interface *interface)
 {
        if (peer->dstadr != interface) {
+               if (interface != NULL &&
+                   (peer->cast_flags & MDF_BCLNT) &&
+                   (interface->flags & INT_MCASTIF) &&
+                   peer->burst) {
+                       /*
+                        * don't accept updates to a true multicast reception
+                        * interface while a BCLNT peer is running it's
+                        * unicast protocol
+                        */
+                       return;
+               }
+
                if (peer->dstadr != NULL)
                {
                        peer->dstadr->peercnt--;
@@ -603,9 +615,9 @@ peer_refresh_interface(struct peer *peer)
                 /*
                  * clear crypto if we change the local address
                  */
-                if (peer->dstadr != piface) {
-                        peer_crypto_clear(peer);
-                }
+                if (peer->dstadr != piface && !(peer->cast_flags & MDF_BCLNT)) {
+                       peer_crypto_clear(peer);
+               }
 
                /*
                 * Broadcast needs the socket enabled for broadcast