xref: /illumos-gate/usr/src/cmd/ipf/lib/print_toif.c (revision e00bdde3c6d406f40f53f3025defadc22f7ec31a)
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