1/*	$NetBSD: printhostmask.c,v 1.2 2012/02/15 17:55:07 riz Exp $	*/
2
3/*
4 * Copyright (C) 2000-2005 by Darren Reed.
5 *
6 * See the IPFILTER.LICENCE file for details on licencing.
7 *
8 * Id: printhostmask.c,v 1.8.4.1 2006/06/16 17:21:12 darrenr Exp
9 */
10
11#include "ipf.h"
12
13
14void	printhostmask(v, addr, mask)
15int	v;
16u_32_t	*addr, *mask;
17{
18#ifdef  USE_INET6
19	char ipbuf[64];
20#else
21	struct in_addr ipa;
22#endif
23
24	if (!*addr && !*mask)
25		printf("any");
26	else {
27#ifdef  USE_INET6
28		void *ptr = addr;
29		int af;
30
31		if (v == 4) {
32			ptr = addr;
33			af = AF_INET;
34		} else if (v == 6) {
35			ptr = addr;
36			af = AF_INET6;
37		} else
38			af = 0;
39		printf("%s", inet_ntop(af, ptr, ipbuf, sizeof(ipbuf)));
40#else
41		ipa.s_addr = *addr;
42		printf("%s", inet_ntoa(ipa));
43#endif
44		printmask(mask);
45	}
46}
47