print_toif.c revision 302408
1/* $FreeBSD: stable/11/contrib/ipfilter/lib/print_toif.c 255332 2013-09-06 23:11:19Z cy $ */ 2 3/* 4 * Copyright (C) 2012 by Darren Reed. 5 * 6 * See the IPFILTER.LICENCE file for details on licencing. 7 * 8 * $Id$ 9 */ 10 11#include "ipf.h" 12 13 14void 15print_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