xref: /titanic_44/usr/src/cmd/ipf/lib/common/print_toif.c (revision 45916cd2fec6e79bca5dee0421bd39e3c2910d1e)
1 /*
2  * Copyright (C) 1993-2001 by Darren Reed.
3  *
4  * See the IPFILTER.LICENCE file for details on licencing.
5  *
6  * $Id: print_toif.c,v 1.8 2002/01/28 06:50:47 darrenr Exp $
7  *
8  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
9  * Use is subject to license terms.
10  */
11 
12 #pragma ident	"%Z%%M%	%I%	%E% SMI"
13 
14 #include "ipf.h"
15 
16 
17 void print_toif(tag, fdp)
18 char *tag;
19 frdest_t *fdp;
20 {
21 	printf("%s %s", tag, fdp->fd_ifname);
22 	if (opts & OPT_UNDEF) {
23 		if (!fdp->fd_ifp)
24 			printf("(!)");
25 	}
26 #ifdef	USE_INET6
27 	if (use_inet6 && IP6_NOTZERO(&fdp->fd_ip6.in6)) {
28 		char ipv6addr[INET6_ADDRSTRLEN];
29 
30 		inet_ntop(AF_INET6, &fdp->fd_ip6, ipv6addr,
31 			  sizeof(ipv6addr));
32 		printf(":%s", ipv6addr);
33 	} else
34 #endif
35 		if (fdp->fd_ip.s_addr)
36 			printf(":%s", inet_ntoa(fdp->fd_ip));
37 	putchar(' ');
38 }
39