FreeBSD/contrib/ntp/ntpd/ntp_peer.c
/*
 * attempt to re-rebind interface if necessary
 */
attempt to re-rebind interface if necessary
attempt to re - rebind interface if necessary
static void
peer_refresh_interface(
	struct peer *p
	)
{
	endpt *	niface;
	endpt *	piface;
	niface = select_peerinterface(p, &p->srcadr, NULL);
	DPRINTF(4, (
	    "peer_refresh_interface: %s->%s mode %d vers %d poll %d %d flags 0x%x 0x%x ttl %u key %08x: new interface: ",
	    p->dstadr == NULL ? "<null>" :
	    stoa(&p->dstadr->sin), stoa(&p->srcadr), p->hmode,
	    p->version, p->minpoll, p->maxpoll, p->flags, p->cast_flags,
	    p->ttl, p->keyid));
	if (niface != NULL) {
		DPRINTF(4, (
		    "fd=%d, bfd=%d, name=%.16s, flags=0x%x, ifindex=%u, sin=%s",
		    niface->fd,  niface->bfd, niface->name,
		    niface->flags, niface->ifindex,
		    stoa(&niface->sin)));
		if (niface->flags & INT_BROADCAST)
			DPRINTF(4, (", bcast=%s",
				stoa(&niface->bcast)));
		DPRINTF(4, (", mask=%s\n", stoa(&niface->mask)));
	} else {
		DPRINTF(4, ("<NONE>\n"));
	}
	piface = p->dstadr;
	set_peerdstadr(p, niface);
	if (p->dstadr != NULL) {
		if (p->dstadr != piface && !(MDF_ACAST & p->cast_flags)
		    && MODE_BROADCAST != p->pmode)
			peer_clear(p, "XFAC");
		if (MDF_BCAST & p->cast_flags)
			enable_broadcast(p->dstadr, &p->srcadr);
		if (MDF_MCAST & p->cast_flags)
			enable_multicast_if(p->dstadr, &p->srcadr);
	}
}
static void peer_refresh_interface ( struct peer * p ) { endpt * niface ; endpt * piface ; niface = select_peerinterface ( p , & p -> srcadr , NULL ) ; DPRINTF ( 4 , ( " " , p -> dstadr == NULL ? " " : stoa ( & p -> dstadr -> sin ) , stoa ( & p -> srcadr ) , p -> hmode , p -> version , p -> minpoll , p -> maxpoll , p -> flags , p -> cast_flags , p -> ttl , p -> keyid ) ) ; if ( niface != NULL ) { DPRINTF ( 4 , ( " " , niface -> fd , niface -> bfd , niface -> name , niface -> flags , niface -> ifindex , stoa ( & niface -> sin ) ) ) ; if ( niface -> flags & INT_BROADCAST ) DPRINTF ( 4 , ( " " , stoa ( & niface -> bcast ) ) ) ; DPRINTF ( 4 , ( " \n " , stoa ( & niface -> mask ) ) ) ; } else { DPRINTF ( 4 , ( " \n " ) ) ; } piface = p -> dstadr ; set_peerdstadr ( p , niface ) ; if ( p -> dstadr != NULL ) { if ( p -> dstadr != piface && ! ( MDF_ACAST & p -> cast_flags ) && MODE_BROADCAST != p -> pmode ) peer_clear ( p , " " ) ; if ( MDF_BCAST & p -> cast_flags ) enable_broadcast ( p -> dstadr , & p -> srcadr ) ; if ( MDF_MCAST & p -> cast_flags ) enable_multicast_if ( p -> dstadr , & p -> srcadr ) ; } }
attempt to re-rebind interface if necessary
attempt to re - rebind interface if necessary
/*
		 * clear crypto if we change the local address
		 */ /*
	 	 * Broadcast needs the socket enabled for broadcast
	 	 */ /*
	 	 * Multicast needs the socket interface enabled for
		 * multicast
	 	 */