4 * Copyright (C) 2002 by Darren Reed.
6 * See the IPFILTER.LICENCE file for details on licencing.
11 #include "netinet/ipl.h"
13 #define PRINTF (void)printf
14 #define FPRINTF (void)fprintf
17 ip_pool_t
*printpool_live(pool
, fd
, name
, opts
)
23 ip_pool_node_t entry
, *top
, *node
;
28 if ((name
!= NULL
) && strncmp(name
, pool
->ipo_name
, FR_GROUPLEN
))
29 return pool
->ipo_next
;
31 printpooldata(pool
, opts
);
33 if ((pool
->ipo_flags
& IPOOL_DELETE
) != 0)
35 if ((opts
& OPT_DEBUG
) == 0)
38 obj
.ipfo_rev
= IPFILTER_VERSION
;
39 obj
.ipfo_type
= IPFOBJ_LOOKUPITER
;
41 obj
.ipfo_size
= sizeof(iter
);
43 iter
.ili_data
= &entry
;
44 iter
.ili_type
= IPLT_POOL
;
45 iter
.ili_otype
= IPFLOOKUPITER_NODE
;
46 iter
.ili_ival
= IPFGENITER_LOOKUP
;
47 iter
.ili_unit
= pool
->ipo_unit
;
48 strncpy(iter
.ili_name
, pool
->ipo_name
, FR_GROUPLEN
);
54 while (!last
&& (ioctl(fd
, SIOCLOOKUPITER
, &obj
) == 0)) {
55 if (entry
.ipn_next
== NULL
)
57 node
= malloc(sizeof(*top
));
60 bcopy(&entry
, node
, sizeof(entry
));
67 (void) printpoolnode(node
, opts
);
68 if ((opts
& OPT_DEBUG
) == 0)
78 if ((opts
& OPT_DEBUG
) == 0)
81 if (ioctl(fd
, SIOCIPFDELTOK
, &iter
.ili_key
) != 0)
82 perror("SIOCIPFDELTOK");
84 return pool
->ipo_next
;