xref: /titanic_50/usr/src/cmd/ipf/lib/common/printaddr.c (revision ff3124eff995e6cd8ebd8c6543648e0670920034)
1 /*
2  * Copyright (C) 2005 by Darren Reed.
3  *
4  * See the IPFILTER.LICENCE file for details on licencing.
5  *
6  */
7 
8 #pragma ident	"%Z%%M%	%I%	%E% SMI"
9 
10 #include "ipf.h"
11 
12 
13 void printaddr(v, type, ifname, addr, mask)
14 int v, type;
15 char *ifname;
16 u_32_t *addr, *mask;
17 {
18 	char *suffix;
19 
20 	switch (type)
21 	{
22 	case FRI_BROADCAST :
23 		suffix = "/bcast";
24 		break;
25 
26 	case FRI_DYNAMIC :
27 		printf("%s", ifname);
28 		printmask(v, mask);
29 		suffix = NULL;
30 		break;
31 
32 	case FRI_NETWORK :
33 		suffix = "/net";
34 		break;
35 
36 	case FRI_NETMASKED :
37 		suffix = "/netmasked";
38 		break;
39 
40 	case FRI_PEERADDR :
41 		suffix = "/peer";
42 		break;
43 
44 	case FRI_LOOKUP :
45 		suffix = NULL;
46 		printlookup((i6addr_t *)addr, (i6addr_t *)mask);
47 		break;
48 
49 	case FRI_NORMAL :
50 		printhostmask(v, addr, mask);
51 		suffix = NULL;
52 		break;
53 	default :
54 		printf("<%d>", type);
55 		printmask(v, mask);
56 		suffix = NULL;
57 		break;
58 	}
59 
60 	if (suffix != NULL) {
61 		printf("%s/%s", ifname, suffix);
62 	}
63 }
64