1 /* 2 * Copyright (C) 1993-2001 by Darren Reed. 3 * 4 * See the IPFILTER.LICENCE file for details on licencing. 5 * 6 * $Id: printmask.c,v 1.5 2002/06/15 04:48:33 darrenr Exp $ 7 * 8 * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 9 * Use is subject to license terms. 10 */ 11 12 #include "ipf.h" 13 14 15 void printmask(v, mask) 16 int v; 17 u_32_t *mask; 18 { 19 struct in_addr ipa; 20 int ones; 21 22 #ifdef USE_INET6 23 if (v == 6) 24 printf("/%d", count6bits(mask)); 25 else 26 #endif 27 if ((ones = count4bits(*mask)) == -1) { 28 ipa.s_addr = *mask; 29 printf("/%s", inet_ntoa(ipa)); 30 } else 31 printf("/%d", ones); 32 } 33