1 /* $NetBSD: print_toif.c,v 1.2 2012/07/22 14:27:36 darrenr Exp $ */
2
3 /*
4 * Copyright (C) 2012 by Darren Reed.
5 *
6 * See the IPFILTER.LICENCE file for details on licencing.
7 *
8 * Id: print_toif.c,v 1.1.1.2 2012/07/22 13:44:40 darrenr Exp $
9 */
10
11 #include "ipf.h"
12
13
14 void
print_toif(family,tag,base,fdp)15 print_toif(family, tag, base, fdp)
16 int family;
17 char *tag;
18 char *base;
19 frdest_t *fdp;
20 {
21 switch (fdp->fd_type)
22 {
23 case FRD_NORMAL :
24 PRINTF("%s %s%s", tag, base + fdp->fd_name,
25 (fdp->fd_ptr || (long)fdp->fd_ptr == -1) ? "" : "(!)");
26 #ifdef USE_INET6
27 if (family == AF_INET6) {
28 if (IP6_NOTZERO(&fdp->fd_ip6)) {
29 char ipv6addr[80];
30
31 inet_ntop(AF_INET6, &fdp->fd_ip6, ipv6addr,
32 sizeof(fdp->fd_ip6));
33 PRINTF(":%s", ipv6addr);
34 }
35 } else
36 #endif
37 if (fdp->fd_ip.s_addr)
38 PRINTF(":%s", inet_ntoa(fdp->fd_ip));
39 putchar(' ');
40 break;
41
42 case FRD_DSTLIST :
43 PRINTF("%s dstlist/%s ", tag, base + fdp->fd_name);
44 break;
45
46 default :
47 PRINTF("%s <%d>", tag, fdp->fd_type);
48 break;
49 }
50 }
51