FreeBSD/sys/netinet/udp_usrreq.c
/*
 * Notify a udp user of an asynchronous error; just wake up so that they can
 * collect error status.
 */
Notify a udp user of an asynchronous error; just wake up so that they can
collect error status.
Notify a udp user of an asynchronous error ; just wake up so that they can collect error status .
struct inpcb *
udp_notify(struct inpcb *inp, int errno)
{
	INP_LOCK_ASSERT(inp);
	if ((errno == EHOSTUNREACH || errno == ENETUNREACH ||
	     errno == EHOSTDOWN) && inp->inp_route.ro_rt) {
		RTFREE(inp->inp_route.ro_rt);
		inp->inp_route.ro_rt = (struct rtentry *)NULL;
	}
	inp->inp_socket->so_error = errno;
	sorwakeup(inp->inp_socket);
	sowwakeup(inp->inp_socket);
	return (inp);
}
struct inpcb * udp_notify ( struct inpcb * inp , int errno ) { INP_LOCK_ASSERT ( inp ) ; if ( ( errno == EHOSTUNREACH || errno == ENETUNREACH || errno == EHOSTDOWN ) && inp -> inp_route . ro_rt ) { RTFREE ( inp -> inp_route . ro_rt ) ; inp -> inp_route . ro_rt = ( struct rtentry * ) NULL ; } inp -> inp_socket -> so_error = errno ; sorwakeup ( inp -> inp_socket ) ; sowwakeup ( inp -> inp_socket ) ; return ( inp ) ; }
Notify a udp user of an asynchronous error; just wake up so that they can
 collect error status.
Notify a udp user of an asynchronous error ; just wake up so that they can collect error status .
/*
	 * While udp_ctlinput() always calls udp_notify() with a read lock
	 * when invoking it directly, in_pcbnotifyall() currently uses write
	 * locks due to sharing code with TCP.  For now, accept either a read
	 * or a write lock, but a read lock is sufficient.
	 */