freebsd-dev/contrib/ipfilter/lib/printhostmask.c
Cy Schubert 17ff561352 Fix compile-time errors when NO_WERROR and WITHOUT_INET6_SUPPORT
(NO_INET6) are specified.

Approved by:	glebius
MFC after:	1 week
2014-07-05 07:15:19 +00:00

40 lines
612 B
C

/* $FreeBSD$ */
/*
* Copyright (C) 2012 by Darren Reed.
*
* See the IPFILTER.LICENCE file for details on licencing.
*
* $Id$
*/
#include "ipf.h"
void
printhostmask(family, addr, mask)
int family;
u_32_t *addr, *mask;
{
#ifdef USE_INET6
char ipbuf[64];
#else
struct in_addr ipa;
#endif
if ((family == -1) || ((!addr || !*addr) && (!mask || !*mask)))
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
if (mask != NULL)
printmask(family, mask);
}
}