printmask.c revision 1.1.1.1
1/* $NetBSD: printmask.c,v 1.1.1.1 2012/03/23 21:20:09 christos Exp $ */ 2 3/* 4 * Copyright (C) 2009 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 (use_inet6 || (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