diff options
Diffstat (limited to 'sbin/ipf/libipf/printhost.c')
| -rw-r--r-- | sbin/ipf/libipf/printhost.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/sbin/ipf/libipf/printhost.c b/sbin/ipf/libipf/printhost.c new file mode 100644 index 000000000000..e04882ffe614 --- /dev/null +++ b/sbin/ipf/libipf/printhost.c @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2012 by Darren Reed. + * + * See the IPFILTER.LICENCE file for details on licencing. + * + * $Id: printhost.c,v 1.3.2.2 2012/07/22 08:04:24 darren_r Exp $ + */ + +#include "ipf.h" + + +void +printhost(int family, u_32_t *addr) +{ +#ifdef USE_INET6 + char ipbuf[64]; +#else + struct in_addr ipa; +#endif + + if ((family == -1) || !*addr) + PRINTF("any"); + else { +#ifdef USE_INET6 + void *ptr = addr; + + PRINTF("%s", inet_ntop(family, ptr, ipbuf, sizeof(ipbuf))); +#else + ipa.s_addr = *addr; + PRINTF("%s", inet_ntoa(ipa)); +#endif + } +} |
