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