FreeBSD/sys/netipsec/key.c
/*
 * Set port in struct sockaddr. Port is in network byte order.
 */
Set port in struct sockaddr. Port is in network byte order.
Set port in struct sockaddr . Port is in network byte order .
static void
key_porttosaddr(struct sockaddr *sa, u_int16_t port)
{
	switch (sa->sa_family) {
#ifdef INET
	case AF_INET:
		((struct sockaddr_in *)sa)->sin_port = port;
		break;
#endif
#ifdef INET6
	case AF_INET6:
		((struct sockaddr_in6 *)sa)->sin6_port = port;
		break;
#endif
	default:
		ipseclog((LOG_DEBUG, "%s: unexpected address family %d.\n",
			__func__, sa->sa_family));
		break;
	}
}
static void key_porttosaddr ( struct sockaddr * sa , u_int16_t port ) { switch ( sa -> sa_family ) { #ifdef INET case AF_INET : ( ( struct sockaddr_in * ) sa ) -> sin_port = port ; break ; #endif #ifdef INET6 case AF_INET6 : ( ( struct sockaddr_in6 * ) sa ) -> sin6_port = port ; break ; #endif default : ipseclog ( ( LOG_DEBUG , " \n " , __func__ , sa -> sa_family ) ) ; break ; } }
Set port in struct sockaddr.
Set port in struct sockaddr .