Move /var/svc/log to /var/log/svc
[unleashed/lotheac.git] / usr / src / cmd / ipf / lib / common / printhostmask.c
blobbd8a798b9fce7470060ec81945ff8e3414a8a6e8
1 /*
2 * Copyright (C) 2000-2005 by Darren Reed.
4 * See the IPFILTER.LICENCE file for details on licencing.
6 * $Id: printhostmask.c,v 1.8 2002/04/11 15:01:19 darrenr Exp $
8 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
9 * Use is subject to license terms.
12 #pragma ident "%Z%%M% %I% %E% SMI"
14 #include "ipf.h"
17 void printhostmask(v, addr, mask)
18 int v;
19 u_32_t *addr, *mask;
21 #ifdef USE_INET6
22 char ipbuf[INET6_ADDRSTRLEN];
23 #else
24 struct in_addr ipa;
25 #endif
27 if ((v == 4) && (!*addr) && (!*mask))
28 printf("any");
29 else {
30 #ifdef USE_INET6
31 void *ptr = addr;
32 int af;
34 if (v == 4)
35 af = AF_INET;
36 else if (v == 6)
37 af = AF_INET6;
38 else
39 af = 0;
40 printf("%s", inet_ntop(af, ptr, ipbuf, sizeof(ipbuf)));
41 #else
42 ipa.s_addr = *addr;
43 printf("%s", inet_ntoa(ipa));
44 #endif
45 if (mask != NULL)
46 printmask(v, mask);