FreeBSD/contrib/ntp/ntpd/ntp_io.c
/*
 * Enable a broadcast address to a given socket
 * The socket is in the ep_list all we need to do is enable
 * broadcasting. It is not this function's job to select the socket
 */
Enable a broadcast address to a given socket
The socket is in the ep_list all we need to do is enable
broadcasting. It is not this function's job to select the socket
Enable a broadcast address to a given socket The socket is in the ep_list all we need to do is enable broadcasting . It is not this function ' s job to select the socket
static isc_boolean_t
socket_broadcast_enable(
	struct interface *	iface,
	SOCKET			fd,
	sockaddr_u *		baddr
	)
{
#ifdef SO_BROADCAST
	int on = 1;
	if (IS_IPV4(baddr)) {
		if (setsockopt(fd, SOL_SOCKET, SO_BROADCAST,
			       (char *)&on, sizeof(on)))
			msyslog(LOG_ERR,
				"setsockopt(SO_BROADCAST) enable failure on address %s: %m",
				stoa(baddr));
		else
			DPRINTF(2, ("Broadcast enabled on socket %d for address %s\n",
				    fd, stoa(baddr)));
	}
	iface->flags |= INT_BCASTXMIT;
	return ISC_TRUE;
#else
	return ISC_FALSE;
#endif 
}
static isc_boolean_t socket_broadcast_enable ( struct interface * iface , SOCKET fd , sockaddr_u * baddr ) { #ifdef SO_BROADCAST int on = 1 ; if ( IS_IPV4 ( baddr ) ) { if ( setsockopt ( fd , SOL_SOCKET , SO_BROADCAST , ( char * ) & on , sizeof ( on ) ) ) msyslog ( LOG_ERR , " " , stoa ( baddr ) ) ; else DPRINTF ( 2 , ( " \n " , fd , stoa ( baddr ) ) ) ; } iface -> flags |= INT_BCASTXMIT ; return ISC_TRUE ; #else return ISC_FALSE ; #endif }
Enable a broadcast address to a given socket
 The socket is in the ep_list all we need to do is enable
 broadcasting.
Enable a broadcast address to a given socket The socket is in the ep_list all we need to do is enable broadcasting .
/* if this interface can support broadcast, set SO_BROADCAST */ /* SO_BROADCAST */