1*0Sstevel@tonic-gate 
2*0Sstevel@tonic-gate #include "ipf.h"
3*0Sstevel@tonic-gate 
4*0Sstevel@tonic-gate char *hostname(v, ip)
5*0Sstevel@tonic-gate int v;
6*0Sstevel@tonic-gate void *ip;
7*0Sstevel@tonic-gate {
8*0Sstevel@tonic-gate #ifdef  USE_INET6
9*0Sstevel@tonic-gate 	static char hostbuf[MAXHOSTNAMELEN+1];
10*0Sstevel@tonic-gate #endif
11*0Sstevel@tonic-gate 	struct in_addr ipa;
12*0Sstevel@tonic-gate 
13*0Sstevel@tonic-gate 	if (v == 4) {
14*0Sstevel@tonic-gate 		ipa.s_addr = *(u_32_t *)ip;
15*0Sstevel@tonic-gate 		return inet_ntoa(ipa);
16*0Sstevel@tonic-gate 	}
17*0Sstevel@tonic-gate #ifdef  USE_INET6
18*0Sstevel@tonic-gate 	(void) inet_ntop(AF_INET6, ip, hostbuf, sizeof(hostbuf) - 1);
19*0Sstevel@tonic-gate 	hostbuf[MAXHOSTNAMELEN] = '\0';
20*0Sstevel@tonic-gate 	return hostbuf;
21*0Sstevel@tonic-gate #else
22*0Sstevel@tonic-gate 	return "IPv6";
23*0Sstevel@tonic-gate #endif
24*0Sstevel@tonic-gate }
25