printmask.c revision 259065
1/* $FreeBSD: releng/10.0/contrib/ipfilter/lib/printmask.c 255332 2013-09-06 23:11:19Z cy $ */ 2 3/* 4 * Copyright (C) 2012 by Darren Reed. 5 * 6 * See the IPFILTER.LICENCE file for details on licencing. 7 * 8 * $Id$ 9 */ 10 11#include "ipf.h" 12 13 14void 15printmask(family, mask) 16 int family; 17 u_32_t *mask; 18{ 19 struct in_addr ipa; 20 int ones; 21 22 if (family == AF_INET6) { 23 PRINTF("/%d", count6bits(mask)); 24 } else if ((ones = count4bits(*mask)) == -1) { 25 ipa.s_addr = *mask; 26 PRINTF("/%s", inet_ntoa(ipa)); 27 } else { 28 PRINTF("/%d", ones); 29 } 30} 31