2 * Copyright (C) 2002 by Darren Reed.
4 * See the IPFILTER.LICENCE file for details on licencing.
9 #include "netinet/ipl.h"
11 #define PRINTF (void)printf
12 #define FPRINTF (void)fprintf
15 ip_pool_t *printpool_live(pool, fd, name, opts)
21 ip_pool_node_t entry, *top, *node;
26 if ((name != NULL) && strncmp(name, pool->ipo_name, FR_GROUPLEN))
27 return pool->ipo_next;
29 printpooldata(pool, opts);
31 if ((pool->ipo_flags & IPOOL_DELETE) != 0)
33 if ((opts & OPT_DEBUG) == 0)
36 obj.ipfo_rev = IPFILTER_VERSION;
37 obj.ipfo_type = IPFOBJ_LOOKUPITER;
39 obj.ipfo_size = sizeof(iter);
41 iter.ili_data = &entry;
42 iter.ili_type = IPLT_POOL;
43 iter.ili_otype = IPFLOOKUPITER_NODE;
44 iter.ili_ival = IPFGENITER_LOOKUP;
45 iter.ili_unit = pool->ipo_unit;
46 strncpy(iter.ili_name, pool->ipo_name, FR_GROUPLEN);
52 while (!last && (ioctl(fd, SIOCLOOKUPITER, &obj) == 0)) {
53 if (entry.ipn_next == NULL)
55 node = malloc(sizeof(*top));
58 bcopy(&entry, node, sizeof(entry));
65 (void) printpoolnode(node, opts);
66 if ((opts & OPT_DEBUG) == 0)
76 if ((opts & OPT_DEBUG) == 0)
79 if (ioctl(fd, SIOCIPFDELTOK, &iter.ili_key) != 0)
80 perror("SIOCIPFDELTOK");
82 return pool->ipo_next;