diff options
Diffstat (limited to 'lib/printmask.c')
-rw-r--r-- | lib/printmask.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/printmask.c b/lib/printmask.c new file mode 100644 index 0000000..27b3e6c --- /dev/null +++ b/lib/printmask.c @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2000-2005 by Darren Reed. + * + * See the IPFILTER.LICENCE file for details on licencing. + * + * $Id: printmask.c,v 1.5.4.1 2006/06/16 17:21:13 darrenr Exp $ + */ + +#include "ipf.h" + + +void printmask(mask) +u_32_t *mask; +{ + struct in_addr ipa; + int ones; + +#ifdef USE_INET6 + if (use_inet6) + printf("/%d", count6bits(mask)); + else +#endif + if ((ones = count4bits(*mask)) == -1) { + ipa.s_addr = *mask; + printf("/%s", inet_ntoa(ipa)); + } else + printf("/%d", ones); +} |