]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/ipfilter/lib/printhost.c
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / ipfilter / lib / printhost.c
1 /*
2  * Copyright (C) 2012 by Darren Reed.
3  *
4  * See the IPFILTER.LICENCE file for details on licencing.
5  *
6  * $Id: printhost.c,v 1.3.2.2 2012/07/22 08:04:24 darren_r Exp $
7  */
8
9 #include "ipf.h"
10
11
12 void
13 printhost(family, addr)
14         int     family;
15         u_32_t  *addr;
16 {
17 #ifdef  USE_INET6
18         char ipbuf[64];
19 #else
20         struct in_addr ipa;
21 #endif
22
23         if ((family == -1) || !*addr)
24                 PRINTF("any");
25         else {
26                 void *ptr = addr;
27
28 #ifdef  USE_INET6
29                 PRINTF("%s", inet_ntop(family, ptr, ipbuf, sizeof(ipbuf)));
30 #else
31                 ipa.s_addr = *addr;
32                 PRINTF("%s", inet_ntoa(ipa));
33 #endif
34         }
35 }