2 * Copyright (C) 2002 by Darren Reed.
4 * See the IPFILTER.LICENCE file for details on licencing.
6 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
7 * Use is subject to license terms.
10 #pragma ident "%Z%%M% %I% %E% SMI"
12 #include <sys/ioctl.h>
14 #include "netinet/ipl.h"
16 #define PRINTF (void)printf
17 #define FPRINTF (void)fprintf
20 iphtable_t
*printhash_live(hp
, fd
, name
, opts
)
26 iphtent_t entry
, *top
, *node
;
31 if ((name
!= NULL
) && strncmp(name
, hp
->iph_name
, FR_GROUPLEN
))
34 printhashdata(hp
, opts
);
36 if ((opts
& OPT_DEBUG
) == 0)
39 obj
.ipfo_rev
= IPFILTER_VERSION
;
40 obj
.ipfo_type
= IPFOBJ_LOOKUPITER
;
42 obj
.ipfo_size
= sizeof(iter
);
44 iter
.ili_data
= &entry
;
45 iter
.ili_type
= IPLT_HASH
;
46 iter
.ili_otype
= IPFLOOKUPITER_NODE
;
47 iter
.ili_ival
= IPFGENITER_LOOKUP
;
48 iter
.ili_unit
= hp
->iph_unit
;
49 strncpy(iter
.ili_name
, hp
->iph_name
, FR_GROUPLEN
);
54 while (!last
&& (ioctl(fd
, SIOCLOOKUPITER
, &obj
) == 0)) {
55 if (entry
.ipe_snext
== NULL
)
57 entry
.ipe_snext
= top
;
58 top
= malloc(sizeof(*top
));
61 bcopy(&entry
, top
, sizeof(entry
));
66 (void) printhashnode(hp
, node
, bcopywrap
, opts
);
67 top
= node
->ipe_snext
;
71 if ((opts
& OPT_DEBUG
) == 0)
78 if ((opts
& OPT_DEBUG
) == 0)