FreeBSD/contrib/ntp/ntpd/ntp_io.c
/*
 * remove interface from known interface list and clean up
 * associated resources
 */
remove interface from known interface list and clean up
associated resources
remove interface from known interface list and clean up associated resources
static void
remove_interface(
	endpt *	ep
	)
{
	endpt *		unlinked;
	endpt **	pmclisthead;
	sockaddr_u	resmask;
	UNLINK_SLIST(unlinked, ep_list, ep, elink, endpt);
	if (!ep->ignore_packets && INT_MULTICAST & ep->flags) {
		pmclisthead = (AF_INET == ep->family)
				 ? &mc4_list
				 : &mc6_list;
		UNLINK_SLIST(unlinked, *pmclisthead, ep, mclink, endpt);
		DPRINTF(4, ("%s %s IPv%s multicast-capable unicast local address list\n",
			stoa(&ep->sin),
			(unlinked != NULL)
			    ? "removed from"
			    : "not found on",
			(AF_INET == ep->family)
			    ? "4"
			    : "6"));
	}
	delete_interface_from_list(ep);
	if (ep->fd != INVALID_SOCKET) {
		msyslog(LOG_INFO,
			"Deleting interface #%d %s, %s#%d, interface stats: received=%ld, sent=%ld, dropped=%ld, active_time=%ld secs",
			ep->ifnum,
			ep->name,
			stoa(&ep->sin),
			SRCPORT(&ep->sin),
			ep->received,
			ep->sent,
			ep->notsent,
			current_time - ep->starttime);
#	    ifdef HAVE_IO_COMPLETION_PORT
		io_completion_port_remove_socket(ep->fd, ep);
#	    endif
		close_and_delete_fd_from_list(ep->fd);
		ep->fd = INVALID_SOCKET;
	}
	if (ep->bfd != INVALID_SOCKET) {
		msyslog(LOG_INFO,
			"stop listening for broadcasts to %s on interface #%d %s",
			stoa(&ep->bcast), ep->ifnum, ep->name);
#	    ifdef HAVE_IO_COMPLETION_PORT
		io_completion_port_remove_socket(ep->bfd, ep);
#	    endif
		close_and_delete_fd_from_list(ep->bfd);
		ep->bfd = INVALID_SOCKET;
	}
#   ifdef HAVE_IO_COMPLETION_PORT
	io_completion_port_remove_interface(ep);
#   endif
	ninterfaces--;
	mon_clearinterface(ep);
	SET_HOSTMASK(&resmask, AF(&ep->sin));
	hack_restrict(RESTRICT_REMOVEIF, &ep->sin, &resmask,
		      RESM_NTPONLY | RESM_INTERFACE, RES_IGNORE, 0);
}
static void remove_interface ( endpt * ep ) { endpt * unlinked ; endpt * * pmclisthead ; sockaddr_u resmask ; UNLINK_SLIST ( unlinked , ep_list , ep , elink , endpt ) ; if ( ! ep -> ignore_packets && INT_MULTICAST & ep -> flags ) { pmclisthead = ( AF_INET == ep -> family ) ? & mc4_list : & mc6_list ; UNLINK_SLIST ( unlinked , * pmclisthead , ep , mclink , endpt ) ; DPRINTF ( 4 , ( " \n " , stoa ( & ep -> sin ) , ( unlinked != NULL ) ? " " : " " , ( AF_INET == ep -> family ) ? " " : " " ) ) ; } delete_interface_from_list ( ep ) ; if ( ep -> fd != INVALID_SOCKET ) { msyslog ( LOG_INFO , " " , ep -> ifnum , ep -> name , stoa ( & ep -> sin ) , SRCPORT ( & ep -> sin ) , ep -> received , ep -> sent , ep -> notsent , current_time - ep -> starttime ) ; #	    ifdef HAVE_IO_COMPLETION_PORT io_completion_port_remove_socket ( ep -> fd , ep ) ; #	    endif close_and_delete_fd_from_list ( ep -> fd ) ; ep -> fd = INVALID_SOCKET ; } if ( ep -> bfd != INVALID_SOCKET ) { msyslog ( LOG_INFO , " " , stoa ( & ep -> bcast ) , ep -> ifnum , ep -> name ) ; #	    ifdef HAVE_IO_COMPLETION_PORT io_completion_port_remove_socket ( ep -> bfd , ep ) ; #	    endif close_and_delete_fd_from_list ( ep -> bfd ) ; ep -> bfd = INVALID_SOCKET ; } #   ifdef HAVE_IO_COMPLETION_PORT io_completion_port_remove_interface ( ep ) ; #   endif ninterfaces -- ; mon_clearinterface ( ep ) ; SET_HOSTMASK ( & resmask , AF ( & ep -> sin ) ) ; hack_restrict ( RESTRICT_REMOVEIF , & ep -> sin , & resmask , RESM_NTPONLY | RESM_INTERFACE , RES_IGNORE , 0 ) ; }
remove interface from known interface list and clean up
 associated resources
remove interface from known interface list and clean up associated resources
/* remove restrict interface entry */