2 * ntp_peer.c - management of data maintained for peer associations
12 #include "ntp_stdlib.h"
13 #include <ntp_random.h>
15 #include "openssl/rand.h"
19 extern int accept_wildcard_if_for_winnt;
23 * Table of valid association combinations
24 * ---------------------------------------
27 * peer->mode | UNSPEC ACTIVE PASSIVE CLIENT SERVER BCAST
28 * ---------- | ---------------------------------------------
29 * NO_PEER | e 1 0 1 1 1
30 * ACTIVE | e 1 1 0 0 0
31 * PASSIVE | e 1 e 0 0 0
32 * CLIENT | e 0 0 0 1 1
33 * SERVER | e 0 0 0 0 0
35 * BCLIENT | e 0 0 0 e 1
37 * One point to note here: a packet in BCAST mode can potentially match
38 * a peer in CLIENT mode, but we that is a special case and we check for
39 * that early in the decision process. This avoids having to keep track
40 * of what kind of associations are possible etc... We actually
41 * circumvent that problem by requiring that the first b(m)roadcast
42 * received after the change back to BCLIENT mode sets the clock.
44 #define AM_MODES 7 /* number of rows and columns */
45 #define NO_PEER 0 /* action when no peer is found */
47 int AM[AM_MODES][AM_MODES] = {
48 /* { UNSPEC, ACTIVE, PASSIVE, CLIENT, SERVER, BCAST } */
50 /*NONE*/{ AM_ERR, AM_NEWPASS, AM_NOMATCH, AM_FXMIT, AM_MANYCAST, AM_NEWBCL},
52 /*A*/ { AM_ERR, AM_PROCPKT, AM_PROCPKT, AM_NOMATCH, AM_NOMATCH, AM_NOMATCH},
54 /*P*/ { AM_ERR, AM_PROCPKT, AM_ERR, AM_NOMATCH, AM_NOMATCH, AM_NOMATCH},
56 /*C*/ { AM_ERR, AM_NOMATCH, AM_NOMATCH, AM_NOMATCH, AM_PROCPKT, AM_POSSBCL},
58 /*S*/ { AM_ERR, AM_NOMATCH, AM_NOMATCH, AM_NOMATCH, AM_NOMATCH, AM_NOMATCH},
60 /*BCST*/{ AM_ERR, AM_NOMATCH, AM_NOMATCH, AM_NOMATCH, AM_NOMATCH, AM_NOMATCH},
62 /*BCL*/ { AM_ERR, AM_NOMATCH, AM_NOMATCH, AM_NOMATCH, AM_NOMATCH, AM_PROCPKT},
65 #define MATCH_ASSOC(x,y) AM[(x)][(y)]
68 * These routines manage the allocation of memory to peer structures
69 * and the maintenance of the peer hash table. The two main entry
70 * points are findpeer(), which looks for matching peer sturctures in
71 * the peer list, newpeer(), which allocates a new peer structure and
72 * adds it to the list, and unpeer(), which demobilizes the association
73 * and deallocates the structure.
78 struct peer *peer_hash[NTP_HASH_SIZE]; /* peer hash table */
79 int peer_hash_count[NTP_HASH_SIZE]; /* peers in each bucket */
80 struct peer *assoc_hash[NTP_HASH_SIZE]; /* association ID hash table */
81 int assoc_hash_count[NTP_HASH_SIZE]; /* peers in each bucket */
82 static struct peer *peer_free; /* peer structures free list */
83 int peer_free_count; /* count of free structures */
86 * Association ID. We initialize this value randomly, then assign a new
87 * value every time the peer structure is incremented.
89 static associd_t current_association_ID; /* association ID */
92 * Memory allocation watermarks.
94 #define INIT_PEER_ALLOC 15 /* initialize for 15 peers */
95 #define INC_PEER_ALLOC 5 /* when run out, add 5 more */
98 * Miscellaneous statistic counters which may be queried.
100 u_long peer_timereset; /* time stat counters zeroed */
101 u_long findpeer_calls; /* calls to findpeer */
102 u_long assocpeer_calls; /* calls to findpeerbyassoc */
103 u_long peer_allocations; /* allocations from free list */
104 u_long peer_demobilizations; /* structs freed to free list */
105 int total_peer_structs; /* peer structs */
106 int peer_associations; /* mobilized associations */
107 int peer_preempt; /* preemptable associations */
108 static struct peer init_peer_alloc[INIT_PEER_ALLOC]; /* init alloc */
110 static void getmorepeermem P((void));
111 static struct interface *select_peerinterface P((struct peer *, struct sockaddr_storage *, struct interface *, u_char));
114 * init_peer - initialize peer data structures and counters
116 * N.B. We use the random number routine in here. It had better be
117 * initialized prior to getting here.
125 * Clear hash table and counters.
127 for (i = 0; i < NTP_HASH_SIZE; i++) {
129 peer_hash_count[i] = 0;
131 assoc_hash_count[i] = 0;
135 * Clear stat counters
137 findpeer_calls = peer_allocations = 0;
138 assocpeer_calls = peer_demobilizations = 0;
141 * Initialize peer memory.
144 for (i = 0; i < INIT_PEER_ALLOC; i++) {
145 init_peer_alloc[i].next = peer_free;
146 peer_free = &init_peer_alloc[i];
148 total_peer_structs = INIT_PEER_ALLOC;
149 peer_free_count = INIT_PEER_ALLOC;
152 * Initialize our first association ID
154 while ((current_association_ID = ntp_random() & 0xffff) == 0);
159 * getmorepeermem - add more peer structures to the free list
165 register struct peer *peer;
167 peer = (struct peer *)emalloc(INC_PEER_ALLOC *
168 sizeof(struct peer));
169 for (i = 0; i < INC_PEER_ALLOC; i++) {
170 peer->next = peer_free;
175 total_peer_structs += INC_PEER_ALLOC;
176 peer_free_count += INC_PEER_ALLOC;
181 * findexistingpeer - return a pointer to a peer in the hash table
185 struct sockaddr_storage *addr,
186 struct peer *start_peer,
190 register struct peer *peer;
193 * start_peer is included so we can locate instances of the
194 * same peer through different interfaces in the hash table.
197 peer = peer_hash[NTP_HASH_ADDR(addr)];
199 peer = start_peer->next;
202 if (SOCKCMP(addr, &peer->srcadr)
203 && NSRCPORT(addr) == NSRCPORT(&peer->srcadr)) {
206 else if (peer->hmode == mode)
216 * findpeer - find and return a peer in the hash table.
220 struct sockaddr_storage *srcadr,
221 struct interface *dstadr,
226 register struct peer *peer;
230 hash = NTP_HASH_ADDR(srcadr);
231 for (peer = peer_hash[hash]; peer != NULL; peer = peer->next) {
232 if (SOCKCMP(srcadr, &peer->srcadr) &&
233 NSRCPORT(srcadr) == NSRCPORT(&peer->srcadr)) {
236 * if the association matching rules determine
237 * that this is not a valid combination, then
238 * look for the next valid peer association.
240 *action = MATCH_ASSOC(peer->hmode, pkt_mode);
243 * if an error was returned, exit back right
246 if (*action == AM_ERR)
247 return ((struct peer *)0);
250 * if a match is found, we stop our search.
252 if (*action != AM_NOMATCH)
258 * If no matching association is found
261 *action = MATCH_ASSOC(NO_PEER, pkt_mode);
262 return ((struct peer *)0);
265 set_peerdstadr(peer, dstadr);
271 * findpeerbyassocid - find and return a peer using his association ID
278 register struct peer *peer;
283 hash = assoc & NTP_HASH_MASK;
284 for (peer = assoc_hash[hash]; peer != 0; peer =
286 if (assoc == peer->associd)
294 * clear_all - flush all time values for all associations
299 struct peer *peer, *next_peer;
303 * This routine is called when the clock is stepped, and so all
304 * previously saved time values are untrusted.
306 for (n = 0; n < NTP_HASH_SIZE; n++) {
307 for (peer = peer_hash[n]; peer != 0; peer = next_peer) {
308 next_peer = peer->next;
309 if (!(peer->cast_flags & (MDF_ACAST | MDF_MCAST |
311 peer->hpoll = peer->minpoll;
312 peer_clear(peer, "STEP");
318 printf("clear_all: at %lu\n", current_time);
324 * unpeer - remove peer structure from hash table and free structure
328 struct peer *peer_to_remove
333 char statstr[NTP_MAXSTRLEN]; /* statistics for filegen */
335 if (peer_to_remove->flags & FLAG_SKEY) {
336 sprintf(statstr, "unpeer %d flash %x reach %03o flags %04x",
337 peer_to_remove->associd, peer_to_remove->flash,
338 peer_to_remove->reach, peer_to_remove->flags);
339 record_crypto_stats(&peer_to_remove->srcadr, statstr);
342 printf("peer: %s\n", statstr);
348 printf("demobilize %u %d %d\n", peer_to_remove->associd,
349 peer_associations, peer_preempt);
351 set_peerdstadr(peer_to_remove, NULL);
353 /* XXXMEMLEAK? peer_clear->crypto allocation */
355 hash = NTP_HASH_ADDR(&peer_to_remove->srcadr);
356 peer_hash_count[hash]--;
357 peer_demobilizations++;
359 if (peer_to_remove->flags & FLAG_PREEMPT)
363 * If this peer is actually a clock, shut it down first
365 if (peer_to_remove->flags & FLAG_REFCLOCK)
366 refclock_unpeer(peer_to_remove);
368 peer_to_remove->action = 0; /* disable timeout actions */
369 if (peer_hash[hash] == peer_to_remove)
370 peer_hash[hash] = peer_to_remove->next;
372 register struct peer *peer;
374 peer = peer_hash[hash];
375 while (peer != 0 && peer->next != peer_to_remove)
379 peer_hash_count[hash]++;
380 msyslog(LOG_ERR, "peer struct for %s not in table!",
381 stoa(&peer->srcadr));
383 peer->next = peer_to_remove->next;
388 * Remove him from the association hash as well.
390 hash = peer_to_remove->associd & NTP_HASH_MASK;
391 assoc_hash_count[hash]--;
392 if (assoc_hash[hash] == peer_to_remove)
393 assoc_hash[hash] = peer_to_remove->ass_next;
395 register struct peer *peer;
397 peer = assoc_hash[hash];
398 while (peer != 0 && peer->ass_next != peer_to_remove)
399 peer = peer->ass_next;
402 assoc_hash_count[hash]++;
404 "peer struct for %s not in association table!",
405 stoa(&peer->srcadr));
407 peer->ass_next = peer_to_remove->ass_next;
410 peer_to_remove->next = peer_free;
411 peer_free = peer_to_remove;
417 * peer_config - configure a new association
421 struct sockaddr_storage *srcadr,
422 struct interface *dstadr,
433 register struct peer *peer;
437 * First search from the beginning for an association with given
438 * remote address and mode. If an interface is given, search
439 * from there to find the association which matches that
440 * destination. If the given interface is "any", track down
441 * the actual interface, because that's what gets put into the
444 peer = findexistingpeer(srcadr, (struct peer *)0, hmode);
447 if (peer->dstadr == dstadr)
449 if (dstadr == ANY_INTERFACE_CHOOSE(srcadr) &&
450 peer->dstadr == findinterface(srcadr))
452 peer = findexistingpeer(srcadr, peer, hmode);
457 * We do a dirty little jig to figure the cast flags. This is
458 * probably not the best place to do this, at least until the
459 * configure code is rebuilt. Note only one flag can be set.
464 if(srcadr->ss_family == AF_INET) {
465 if (IN_CLASSD(ntohl(((struct sockaddr_in*)srcadr)->sin_addr.s_addr)))
466 cast_flags = MDF_MCAST;
468 cast_flags = MDF_BCAST;
472 if (IN6_IS_ADDR_MULTICAST(&((struct sockaddr_in6*)srcadr)->sin6_addr))
473 cast_flags = MDF_MCAST;
475 cast_flags = MDF_BCAST;
480 if(srcadr->ss_family == AF_INET) {
481 if (IN_CLASSD(ntohl(((struct sockaddr_in*)srcadr)->sin_addr.s_addr)))
482 cast_flags = MDF_ACAST;
484 cast_flags = MDF_UCAST;
488 if (IN6_IS_ADDR_MULTICAST(&((struct sockaddr_in6*)srcadr)->sin6_addr))
489 cast_flags = MDF_ACAST;
491 cast_flags = MDF_UCAST;
496 cast_flags = MDF_UCAST;
500 * If the peer is already configured, some dope has a duplicate
501 * configureation entry or another dope is wiggling from afar.
504 peer->hmode = (u_char)hmode;
505 peer->version = (u_char) version;
506 peer->minpoll = (u_char) minpoll;
507 peer->maxpoll = (u_char) maxpoll;
508 peer->flags = flags | FLAG_CONFIG |
509 (peer->flags & FLAG_REFCLOCK);
510 peer->cast_flags = cast_flags;
511 peer->ttl = (u_char) ttl;
513 peer->precision = sys_precision;
514 peer_clear(peer, "RMOT");
519 * Here no match has been found, so presumably this is a new
520 * persistent association. Mobilize the thing and initialize its
521 * variables. If emulating ntpdate, force iburst.
524 flags |= FLAG_IBURST;
525 peer = newpeer(srcadr, dstadr, hmode, version, minpoll, maxpoll,
526 flags | FLAG_CONFIG, cast_flags, ttl, key);
531 * setup peer dstadr field keeping it in sync with the interface structures
534 set_peerdstadr(struct peer *peer, struct interface *interface)
536 if (peer->dstadr != interface) {
537 if (interface != NULL &&
538 (peer->cast_flags & MDF_BCLNT) &&
539 (interface->flags & INT_MCASTIF) &&
542 * don't accept updates to a true multicast reception
543 * interface while a BCLNT peer is running it's
549 if (peer->dstadr != NULL)
551 peer->dstadr->peercnt--;
552 ISC_LIST_UNLINK_TYPE(peer->dstadr->peers, peer, ilink, struct peer);
555 DPRINTF(4, ("set_peerdstadr(%s): change interface from %s to %s\n",
557 (peer->dstadr != NULL) ? stoa(&peer->dstadr->sin) : "<null>",
558 (interface != NULL) ? stoa(&interface->sin) : "<null>"));
560 peer->dstadr = interface;
562 if (peer->dstadr != NULL)
564 ISC_LIST_APPEND(peer->dstadr->peers, peer, ilink);
565 peer->dstadr->peercnt++;
571 * attempt to re-rebind interface if necessary
574 peer_refresh_interface(struct peer *peer)
576 struct interface *niface, *piface;
578 niface = select_peerinterface(peer, &peer->srcadr, NULL, peer->cast_flags);
584 "peer_refresh_interface: %s->%s mode %d vers %d poll %d %d flags 0x%x 0x%x ttl %d key %08x: new interface: ",
585 peer->dstadr == NULL ? "<null>" : stoa(&peer->dstadr->sin),
587 peer->hmode, peer->version, peer->minpoll,
588 peer->maxpoll, peer->flags, peer->cast_flags,
589 peer->ttl, peer->keyid);
592 printf("fd=%d, bfd=%d, name=%.16s, flags=0x%x, scope=%d, ",
598 /* Leave these as three printf calls. */
600 stoa((&niface->sin)));
601 if (niface->flags & INT_BROADCAST)
602 printf(", bcast=%s,",
603 stoa((&niface->bcast)));
604 printf(", mask=%s\n",
605 stoa((&niface->mask)));
614 piface = peer->dstadr;
616 set_peerdstadr(peer, niface);
620 * clear crypto if we change the local address
622 if (peer->dstadr != piface && !(peer->cast_flags & MDF_BCLNT)) {
623 peer_crypto_clear(peer);
627 * Broadcast needs the socket enabled for broadcast
629 if (peer->cast_flags & MDF_BCAST) {
630 enable_broadcast(peer->dstadr, &peer->srcadr);
634 * Multicast needs the socket interface enabled for multicast
636 if (peer->cast_flags & MDF_MCAST) {
637 enable_multicast_if(peer->dstadr, &peer->srcadr);
643 * refresh_all_peerinterfaces - see that all interface bindings are up to date
646 refresh_all_peerinterfaces(void)
648 struct peer *peer, *next_peer;
652 * this is called when the interface list has changed
653 * give all peers a chance to find a better interface
655 for (n = 0; n < NTP_HASH_SIZE; n++) {
656 for (peer = peer_hash[n]; peer != 0; peer = next_peer) {
657 next_peer = peer->next;
658 peer_refresh_interface(peer);
665 * find an interface suitable for the src address
667 static struct interface *
668 select_peerinterface(struct peer *peer, struct sockaddr_storage *srcadr, struct interface *dstadr, u_char cast_flags)
670 struct interface *interface;
673 * Initialize the peer structure and dance the interface jig.
674 * Reference clocks step the loopback waltz, the others
675 * squaredance around the interface list looking for a buddy. If
676 * the dance peters out, there is always the wildcard interface.
677 * This might happen in some systems and would preclude proper
678 * operation with public key cryptography.
680 if (ISREFCLOCKADR(srcadr))
681 interface = loopback_interface;
683 if (cast_flags & (MDF_BCLNT | MDF_ACAST | MDF_MCAST | MDF_BCAST)) {
684 interface = findbcastinter(srcadr);
687 if (interface != NULL)
688 printf("Found *-cast interface address %s, for address %s\n",
689 stoa(&(interface)->sin), stoa(srcadr));
691 printf("No *-cast local address found for address %s\n",
696 * If it was a multicast packet, findbcastinter() may not
697 * find it, so try a little harder.
699 if (interface == ANY_INTERFACE_CHOOSE(srcadr))
700 interface = findinterface(srcadr);
702 else if (dstadr != NULL && dstadr != ANY_INTERFACE_CHOOSE(srcadr))
705 interface = findinterface(srcadr);
708 * we do not bind to the wildcard interfaces for output
709 * as our (network) source address would be undefined and
710 * crypto will not work without knowing the own transmit address
712 if (interface != NULL && interface->flags & INT_WILDCARD)
714 if ( !accept_wildcard_if_for_winnt )
723 * newpeer - initialize a new peer association
727 struct sockaddr_storage *srcadr,
728 struct interface *dstadr,
739 register struct peer *peer;
742 char statstr[NTP_MAXSTRLEN]; /* statistics for filegen */
746 * Allocate a new peer structure. Some dirt here, since some of
747 * the initialization requires knowlege of our system state.
749 if (peer_free_count == 0)
752 peer_free = peer->next;
755 if (flags & FLAG_PREEMPT)
757 memset((char *)peer, 0, sizeof(struct peer));
760 * Assign an association ID and increment the system variable.
762 peer->associd = current_association_ID;
763 if (++current_association_ID == 0)
764 ++current_association_ID;
766 DPRINTF(3, ("newpeer: cast flags: 0x%x for address: %s\n",
767 cast_flags, stoa(srcadr)));
769 ISC_LINK_INIT(peer, ilink); /* set up interface link chain */
770 peer->srcadr = *srcadr;
771 set_peerdstadr(peer, select_peerinterface(peer, srcadr, dstadr,
773 peer->hmode = (u_char)hmode;
774 peer->version = (u_char)version;
775 peer->minpoll = (u_char)max(NTP_MINPOLL, minpoll);
776 peer->maxpoll = (u_char)min(NTP_MAXPOLL, maxpoll);
781 printf("newpeer: using fd %d and our addr %s\n",
783 stoa(&peer->dstadr->sin));
785 printf("newpeer: local interface currently not bound\n");
790 * Broadcast needs the socket enabled for broadcast
792 if (cast_flags & MDF_BCAST && peer->dstadr) {
793 enable_broadcast(peer->dstadr, srcadr);
796 * Multicast needs the socket interface enabled for multicast
798 if (cast_flags & MDF_MCAST && peer->dstadr) {
799 enable_multicast_if(peer->dstadr, srcadr);
802 peer->flags |= FLAG_AUTHENABLE;
803 if (key > NTP_MAXKEY)
804 peer->flags |= FLAG_SKEY;
805 peer->cast_flags = cast_flags;
806 peer->ttl = (u_char)ttl;
808 peer->precision = sys_precision;
809 peer->hpoll = peer->minpoll;
810 if (cast_flags & MDF_ACAST)
811 peer_clear(peer, "ACST");
812 else if (cast_flags & MDF_MCAST)
813 peer_clear(peer, "MCST");
814 else if (cast_flags & MDF_BCAST)
815 peer_clear(peer, "BCST");
817 peer_clear(peer, "INIT");
822 * Note time on statistics timers.
824 peer->timereset = current_time;
825 peer->timereachable = current_time;
826 peer->timereceived = current_time;
829 if (ISREFCLOCKADR(&peer->srcadr)) {
832 * We let the reference clock support do clock
833 * dependent initialization. This includes setting
834 * the peer timer, since the clock may have requirements
837 if (!refclock_newpeer(peer)) {
839 * Dump it, something screwed up
841 set_peerdstadr(peer, NULL);
843 peer->next = peer_free;
852 * Put the new peer in the hash tables.
854 i = NTP_HASH_ADDR(&peer->srcadr);
855 peer->next = peer_hash[i];
857 peer_hash_count[i]++;
858 i = peer->associd & NTP_HASH_MASK;
859 peer->ass_next = assoc_hash[i];
860 assoc_hash[i] = peer;
861 assoc_hash_count[i]++;
864 if (peer->flags & FLAG_SKEY) {
865 sprintf(statstr, "newpeer %d", peer->associd);
866 record_crypto_stats(&peer->srcadr, statstr);
867 DPRINTF(1, ("peer: %s\n", statstr));
871 DPRINTF(1, ("newpeer: %s->%s mode %d vers %d poll %d %d flags 0x%x 0x%x ttl %d key %08x\n",
872 peer->dstadr == NULL ? "<null>" : stoa(&peer->dstadr->sin),
874 peer->hmode, peer->version, peer->minpoll,
875 peer->maxpoll, peer->flags, peer->cast_flags,
876 peer->ttl, peer->keyid));
883 * peer_unconfig - remove the configuration bit from a peer
887 struct sockaddr_storage *srcadr,
888 struct interface *dstadr,
892 register struct peer *peer;
896 peer = findexistingpeer(srcadr, (struct peer *)0, mode);
898 if (peer->flags & FLAG_CONFIG
899 && (dstadr == 0 || peer->dstadr == dstadr)) {
903 * Tricky stuff here. If the peer is polling us
904 * in active mode, turn off the configuration
905 * bit and make the mode passive. This allows us
906 * to avoid dumping a lot of history for peers
907 * we might choose to keep track of in passive
908 * mode. The protocol will eventually terminate
909 * undesirables on its own.
911 if (peer->hmode == MODE_ACTIVE
912 && peer->pmode == MODE_ACTIVE) {
913 peer->hmode = MODE_PASSIVE;
914 peer->flags &= ~FLAG_CONFIG;
920 peer = findexistingpeer(srcadr, peer, mode);
926 * peer_clr_stats - clear peer module stat counters
933 peer_allocations = 0;
934 peer_demobilizations = 0;
935 peer_timereset = current_time;
939 * peer_reset - reset stat counters in a peer structure
954 peer->seldisptoolarge = 0;
955 peer->timereset = current_time;
960 * peer_all_reset - reset all peer stat counters
968 for (hash = 0; hash < NTP_HASH_SIZE; hash++)
969 for (peer = peer_hash[hash]; peer != 0; peer = peer->next)
976 * expire_all - flush all crypto data and update timestamps.
981 struct peer *peer, *next_peer;
985 * This routine is called about once per day from the timer
986 * routine and when the client is first synchronized. Search the
987 * peer list for all associations and flush only the key list
988 * and cookie. If a manycast client association, flush
989 * everything. Then, recompute and sign the agreement public
995 for (n = 0; n < NTP_HASH_SIZE; n++) {
996 for (peer = peer_hash[n]; peer != 0; peer = next_peer) {
997 next_peer = peer->next;
998 if (!(peer->flags & FLAG_SKEY)) {
1001 } else if (peer->hmode == MODE_ACTIVE ||
1002 peer->hmode == MODE_PASSIVE) {
1004 peer->crypto &= ~(CRYPTO_FLAG_AUTO |
1010 RAND_bytes((u_char *)&sys_private, 4);
1013 #endif /* OPENSSL */
1017 * findmanycastpeer - find and return a manycast peer
1021 struct recvbuf *rbufp
1024 register struct peer *peer;
1030 * This routine is called upon arrival of a server-mode message
1031 * from a manycast client. Search the peer list for a manycast
1032 * client association where the last transmit timestamp matches
1033 * the originate timestamp. This assumes the transmit timestamps
1034 * for possibly more than one manycast association are unique.
1036 pkt = &rbufp->recv_pkt;
1037 for (i = 0; i < NTP_HASH_SIZE; i++) {
1038 if (peer_hash_count[i] == 0)
1041 for (peer = peer_hash[i]; peer != 0; peer =
1043 if (peer->cast_flags & MDF_ACAST) {
1044 NTOHL_FP(&pkt->org, &p_org);
1045 if (L_ISEQU(&peer->xmt, &p_org))