1 /* 2 * Copyright (C) 2012 by Darren Reed. 3 * 4 * See the IPFILTER.LICENCE file for details on licencing. 5 * 6 * $Id$ 7 */ 8 9 #include "ipf.h" 10 11 void 12 printaddr(family, type, base, ifidx, addr, mask) 13 int family, type, ifidx; 14 char *base; 15 u_32_t *addr, *mask; 16 { 17 char *suffix; 18 19 switch (type) 20 { 21 case FRI_BROADCAST : 22 suffix = "bcast"; 23 break; 24 25 case FRI_DYNAMIC : 26 PRINTF("%s", base + ifidx); 27 printmask(family, mask); 28 suffix = NULL; 29 break; 30 31 case FRI_NETWORK : 32 suffix = "net"; 33 break; 34 35 case FRI_NETMASKED : 36 suffix = "netmasked"; 37 break; 38 39 case FRI_PEERADDR : 40 suffix = "peer"; 41 break; 42 43 case FRI_LOOKUP : 44 suffix = NULL; 45 printlookup(base, (i6addr_t *)addr, (i6addr_t *)mask); 46 break; 47 48 case FRI_NONE : 49 case FRI_NORMAL : 50 printhostmask(family, addr, mask); 51 suffix = NULL; 52 break; 53 case FRI_RANGE : 54 printhost(family, addr); 55 putchar('-'); 56 printhost(family, mask); 57 suffix = NULL; 58 break; 59 case FRI_SPLIT : 60 printhost(family, addr); 61 putchar(','); 62 printhost(family, mask); 63 suffix = NULL; 64 break; 65 default : 66 PRINTF("<%d>", type); 67 printmask(family, mask); 68 suffix = NULL; 69 break; 70 } 71 72 if (suffix != NULL) { 73 PRINTF("%s/%s", base + ifidx, suffix); 74 } 75 } 76