FreeBSD/sys/net/rtsock.c
/*
 * Fill in @dmask with valid netmask leaving original @smask
 * intact. Mostly used with radix netmasks.
 */
Fill in @dmask with valid netmask leaving original @smask
intact. Mostly used with radix netmasks.
Fill in @dmask with valid netmask leaving original @smask intact . Mostly used with radix netmasks .
static struct sockaddr *
rtsock_fix_netmask(struct sockaddr *dst, struct sockaddr *smask,
    struct sockaddr_storage *dmask)
{
	if (dst == NULL || smask == NULL)
		return (NULL);
	memset(dmask, 0, dst->sa_len);
	memcpy(dmask, smask, smask->sa_len);
	dmask->ss_len = dst->sa_len;
	dmask->ss_family = dst->sa_family;
	return ((struct sockaddr *)dmask);
}
static struct sockaddr * rtsock_fix_netmask ( struct sockaddr * dst , struct sockaddr * smask , struct sockaddr_storage * dmask ) { if ( dst == NULL || smask == NULL ) return ( NULL ) ; memset ( dmask , 0 , dst -> sa_len ) ; memcpy ( dmask , smask , smask -> sa_len ) ; dmask -> ss_len = dst -> sa_len ; dmask -> ss_family = dst -> sa_family ; return ( ( struct sockaddr * ) dmask ) ; }
Fill in @dmask with valid netmask leaving original @smask
 intact.
Fill in @dmask with valid netmask leaving original @smask intact .