1 /* 2 * Copyright (C) 2012 by Darren Reed. 3 * 4 * See the IPFILTER.LICENCE file for details on licencing. 5 * 6 * Added redirect stuff and a variety of bug fixes. (mcn@EnGarde.com) 7 */ 8 9 #include "ipf.h" 10 #include "kmem.h" 11 12 13 #if !defined(lint) 14 static const char rcsid[] = "@(#)$Id: printnataddr.c,v 1.4.2.2 2012/07/22 08:04:24 darren_r Exp $"; 15 #endif 16 17 18 void 19 printnataddr(v, base, addr, ifidx) 20 int v; 21 char *base; 22 nat_addr_t *addr; 23 int ifidx; 24 { 25 switch (v) 26 { 27 case 4 : 28 if (addr->na_atype == FRI_NORMAL && 29 addr->na_addr[0].in4.s_addr == 0) { 30 PRINTF("0/%d", count4bits(addr->na_addr[1].in4.s_addr)); 31 } else { 32 printaddr(AF_INET, addr->na_atype, base, ifidx, 33 (u_32_t *)&addr->na_addr[0].in4.s_addr, 34 (u_32_t *)&addr->na_addr[1].in4.s_addr); 35 } 36 break; 37 #ifdef USE_INET6 38 case 6 : 39 printaddr(AF_INET6, addr->na_atype, base, ifidx, 40 (u_32_t *)&addr->na_addr[0].in6, 41 (u_32_t *)&addr->na_addr[1].in6); 42 break; 43 #endif 44 default : 45 printf("{v=%d}", v); 46 break; 47 } 48 } 49