xref: /illumos-gate/usr/src/cmd/ipf/lib/print_toif.c (revision 1a2d662a91cee3bf82f41cd47c7ae6f3825d9db2)
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 #include "ipf.h"
13 
14 
15 void print_toif(tag, fdp)
16 char *tag;
17 frdest_t *fdp;
18 {
19 	printf("%s %s", tag, fdp->fd_ifname);
20 	if (opts & OPT_UNDEF) {
21 		if (!fdp->fd_ifp)
22 			printf("(!)");
23 	}
24 #ifdef	USE_INET6
25 	if (use_inet6 && IP6_NOTZERO(&fdp->fd_ip6.in6)) {
26 		char ipv6addr[INET6_ADDRSTRLEN];
27 
28 		inet_ntop(AF_INET6, &fdp->fd_ip6, ipv6addr,
29 			  sizeof(ipv6addr));
30 		printf(":%s", ipv6addr);
31 	} else
32 #endif
33 		if (fdp->fd_ip.s_addr)
34 			printf(":%s", inet_ntoa(fdp->fd_ip));
35 	putchar(' ');
36 }
37