summaryrefslogtreecommitdiff
path: root/lib/printhashdata.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/printhashdata.c')
-rw-r--r--lib/printhashdata.c52
1 files changed, 17 insertions, 35 deletions
diff --git a/lib/printhashdata.c b/lib/printhashdata.c
index d278c365a69f7..ea2d41636e461 100644
--- a/lib/printhashdata.c
+++ b/lib/printhashdata.c
@@ -1,23 +1,22 @@
/*
- * Copyright (C) 2002 by Darren Reed.
+ * Copyright (C) 2012 by Darren Reed.
*
* See the IPFILTER.LICENCE file for details on licencing.
*/
#include "ipf.h"
+#include <ctype.h>
-#define PRINTF (void)printf
-#define FPRINTF (void)fprintf
-
-void printhashdata(hp, opts)
-iphtable_t *hp;
-int opts;
+void
+printhashdata(hp, opts)
+ iphtable_t *hp;
+ int opts;
{
if ((opts & OPT_DEBUG) == 0) {
if ((hp->iph_type & IPHASH_ANON) == IPHASH_ANON)
- PRINTF("# 'anonymous' table\n");
+ PRINTF("# 'anonymous' table refs %d\n", hp->iph_ref);
if ((hp->iph_flags & IPHASH_DELETE) == IPHASH_DELETE)
PRINTF("# ");
switch (hp->iph_type & ~IPHASH_ANON)
@@ -38,10 +37,10 @@ int opts;
PRINTF("%#x", hp->iph_type);
break;
}
- PRINTF(" role = ");
+ PRINTF(" role=");
} else {
PRINTF("Hash Table %s: %s",
- isdigit(*hp->iph_name) ? "Number" : "Name",
+ ISDIGIT(*hp->iph_name) ? "Number" : "Name",
hp->iph_name);
if ((hp->iph_type & IPHASH_ANON) == IPHASH_ANON)
PRINTF("(anon)");
@@ -49,33 +48,16 @@ int opts;
PRINTF("Role: ");
}
- switch (hp->iph_unit)
- {
- case IPL_LOGNAT :
- PRINTF("nat");
- break;
- case IPL_LOGIPF :
- PRINTF("ipf");
- break;
- case IPL_LOGAUTH :
- PRINTF("auth");
- break;
- case IPL_LOGCOUNT :
- PRINTF("count");
- break;
- default :
- PRINTF("#%d", hp->iph_unit);
- break;
- }
+ printunit(hp->iph_unit);
if ((opts & OPT_DEBUG) == 0) {
if ((hp->iph_type & ~IPHASH_ANON) == IPHASH_LOOKUP)
- PRINTF(" type = hash");
- PRINTF(" %s = %s size = %lu",
- isdigit(*hp->iph_name) ? "number" : "name",
+ PRINTF(" type=hash");
+ PRINTF(" %s=%s size=%lu",
+ ISDIGIT(*hp->iph_name) ? "number" : "name",
hp->iph_name, (u_long)hp->iph_size);
if (hp->iph_seed != 0)
- PRINTF(" seed = %lu", hp->iph_seed);
+ PRINTF(" seed=%lu", hp->iph_seed);
putchar('\n');
} else {
PRINTF(" Type: ");
@@ -95,7 +77,7 @@ int opts;
PRINTF("\t\tSize: %lu\tSeed: %lu",
(u_long)hp->iph_size, hp->iph_seed);
PRINTF("\tRef. Count: %d\tMasks: %#x\n", hp->iph_ref,
- hp->iph_masks);
+ hp->iph_maskset[0]);
}
if ((opts & OPT_DEBUG) != 0) {
@@ -103,8 +85,8 @@ int opts;
int i;
for (i = 0; i < 32; i++) {
- if ((1 << i) & hp->iph_masks) {
- ntomask(4, i, &m.s_addr);
+ if ((1 << i) & hp->iph_maskset[0]) {
+ ntomask(AF_INET, i, &m.s_addr);
PRINTF("\t\tMask: %s\n", inet_ntoa(m));
}
}