FreeBSD/usr.sbin/rpcbind/tests/addrmerge_test.c
/*
 * Variant of do_addrmerge4 where the caller has an IPv6 address
 * param recvdstaddr	If non-null, the uaddr on which the request was received
 */
Variant of do_addrmerge4 where the caller has an IPv6 address
param recvdstaddr    If non-null, the uaddr on which the request was received
Variant of do_addrmerge4 where the caller has an IPv6 address param recvdstaddr If non - null the uaddr on which the request was received
static char*
do_addrmerge6(const char* recvdstaddr)
{
	struct netbuf caller;
	struct sockaddr_in6 caller_in6;
	const char *serv_uaddr, *clnt_uaddr, *netid;
	caller.maxlen = sizeof(struct sockaddr_storage);
	caller.len = sizeof(caller_in6);
	caller_in6.sin6_family = AF_INET6;
	caller_in6.sin6_len = sizeof(caller_in6);
	caller_in6.sin6_port = 1234;
	ATF_REQUIRE_EQ(1, inet_pton(AF_INET6, "2001:db8::1",
	    (void*)&caller_in6.sin6_addr));
	caller.buf = (void*)&caller_in6;
	if (recvdstaddr != NULL)
		clnt_uaddr = recvdstaddr;
	else
		clnt_uaddr = "2001:db8::1.3.46";
	serv_uaddr = "::1.3.46";
	netid = "udp6";
	return (addrmerge(&caller, serv_uaddr, clnt_uaddr, netid));
}
static char * do_addrmerge6 ( const char * recvdstaddr ) { struct netbuf caller ; struct sockaddr_in6 caller_in6 ; const char * serv_uaddr , * clnt_uaddr , * netid ; caller . maxlen = sizeof ( struct sockaddr_storage ) ; caller . len = sizeof ( caller_in6 ) ; caller_in6 . sin6_family = AF_INET6 ; caller_in6 . sin6_len = sizeof ( caller_in6 ) ; caller_in6 . sin6_port = 1234 ; ATF_REQUIRE_EQ ( 1 , inet_pton ( AF_INET6 , " " , ( void * ) & caller_in6 . sin6_addr ) ) ; caller . buf = ( void * ) & caller_in6 ; if ( recvdstaddr != NULL ) clnt_uaddr = recvdstaddr ; else clnt_uaddr = " " ; serv_uaddr = " " ; netid = " " ; return ( addrmerge ( & caller , serv_uaddr , clnt_uaddr , netid ) ) ; }
Variant of do_addrmerge4 where the caller has an IPv6 address
 param recvdstaddr    If non-null, the uaddr on which the request was received
Variant of do_addrmerge4 where the caller has an IPv6 address param recvdstaddr If non - null the uaddr on which the request was received
/* caller contains the client's IP address */ /* assume server is bound in INADDR_ANY port 814 */