2 * Copyright (C) 2002 by Darren Reed.
4 * See the IPFILTER.LICENCE file for details on licencing.
6 * $Id: remove_pool.c,v 1.1 2003/04/13 06:40:14 darrenr Exp $
10 #include <sys/ioctl.h>
12 #include "netinet/ip_lookup.h"
13 #include "netinet/ip_htable.h"
15 static int poolfd
= -1;
18 int remove_pool(poolp
, iocfunc
)
25 if ((poolfd
== -1) && ((opts
& OPT_DONOTHING
) == 0))
26 poolfd
= open(IPLOOKUP_NAME
, O_RDWR
);
27 if ((poolfd
== -1) && ((opts
& OPT_DONOTHING
) == 0))
30 op
.iplo_type
= IPLT_POOL
;
31 op
.iplo_unit
= poolp
->ipo_unit
;
32 strncpy(op
.iplo_name
, poolp
->ipo_name
, sizeof(op
.iplo_name
));
33 op
.iplo_size
= sizeof(pool
);
34 op
.iplo_struct
= &pool
;
36 bzero((char *)&pool
, sizeof(pool
));
37 pool
.ipo_unit
= poolp
->ipo_unit
;
38 strncpy(pool
.ipo_name
, poolp
->ipo_name
, sizeof(pool
.ipo_name
));
39 pool
.ipo_flags
= poolp
->ipo_flags
;
41 if ((*iocfunc
)(poolfd
, SIOCLOOKUPDELTABLE
, &op
))
42 if ((opts
& OPT_DONOTHING
) == 0) {
43 perror("remove_pool:SIOCLOOKUPDELTABLE");