xref: /titanic_50/usr/src/cmd/ipf/lib/common/print_toif.c (revision b3700b074e637f8c6991b70754c88a2cfffb246b)
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 2006 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