FreeBSD/contrib/ntp/ntpd/ntp_io.c
/*
 * refresh_interface
 *
 * some OSes have been observed to keep
 * cached routes even when more specific routes
 * become available.
 * this can be mitigated by re-binding
 * the socket.
 */
refresh_interface
some OSes have been observed to keep
cached routes even when more specific routes
become available.
this can be mitigated by re-binding
the socket.
refresh_interface some OSes have been observed to keep cached routes even when more specific routes become available . this can be mitigated by re - binding the socket .
static int
refresh_interface(
	struct interface * interface
	)
{
#ifdef  OS_MISSES_SPECIFIC_ROUTE_UPDATES
	if (interface->fd != INVALID_SOCKET) {
		int bcast = (interface->flags & INT_BCASTXMIT) != 0;
		if (bcast)
			socket_broadcast_disable(interface, &interface->sin);
		close_and_delete_fd_from_list(interface->fd);
		interface->fd = open_socket(&interface->sin,
					    bcast, 0, interface);
		interface->last_ttl = 0;
		return (interface->fd != INVALID_SOCKET);
	} else
		return 0;	
#else 
	return (interface->fd != INVALID_SOCKET);
#endif 
}
static int refresh_interface ( struct interface * interface ) { #ifdef OS_MISSES_SPECIFIC_ROUTE_UPDATES if ( interface -> fd != INVALID_SOCKET ) { int bcast = ( interface -> flags & INT_BCASTXMIT ) != 0 ; if ( bcast ) socket_broadcast_disable ( interface , & interface -> sin ) ; close_and_delete_fd_from_list ( interface -> fd ) ; interface -> fd = open_socket ( & interface -> sin , bcast , 0 , interface ) ; interface -> last_ttl = 0 ; return ( interface -> fd != INVALID_SOCKET ) ; } else return 0 ; #else return ( interface -> fd != INVALID_SOCKET ) ; #endif }
refresh_interface
 some OSes have been observed to keep
 cached routes even when more specific routes
 become available.
refresh_interface some OSes have been observed to keep cached routes even when more specific routes become available .
/* as we forcibly close() the socket remove the
		   broadcast permission indication */ /* create new socket picking up a new first hop binding
		   at connect() time */ /*
		  * reset TTL indication so TTL is is set again
		  * next time around
		  */ /* invalid sockets are not refreshable */ /* !OS_MISSES_SPECIFIC_ROUTE_UPDATES */ /* !OS_MISSES_SPECIFIC_ROUTE_UPDATES */