4 * Copyright (C) 2003 by Darren Reed.
6 * See the IPFILTER.LICENCE file for details on licencing.
8 * Id: remove_poolnode.c,v 1.3.2.1 2006/06/16 17:21:16 darrenr Exp
12 #include <sys/ioctl.h>
14 #include "netinet/ip_lookup.h"
15 #include "netinet/ip_pool.h"
17 static int poolfd
= -1;
20 int remove_poolnode(unit
, name
, node
, iocfunc
)
29 if ((poolfd
== -1) && ((opts
& OPT_DONOTHING
) == 0))
30 poolfd
= open(IPLOOKUP_NAME
, O_RDWR
);
31 if ((poolfd
== -1) && ((opts
& OPT_DONOTHING
) == 0))
35 op
.iplo_type
= IPLT_POOL
;
37 strncpy(op
.iplo_name
, name
, sizeof(op
.iplo_name
));
39 op
.iplo_size
= sizeof(pn
);
41 bzero((char *)&pn
, sizeof(pn
));
42 bcopy((char *)&node
->ipn_addr
, (char *)&pn
.ipn_addr
,
44 bcopy((char *)&node
->ipn_mask
, (char *)&pn
.ipn_mask
,
46 pn
.ipn_info
= node
->ipn_info
;
47 strncpy(pn
.ipn_name
, node
->ipn_name
, sizeof(pn
.ipn_name
));
49 if ((*iocfunc
)(poolfd
, SIOCLOOKUPDELNODE
, &op
)) {
50 if ((opts
& OPT_DONOTHING
) == 0) {
51 perror("remove_pool:SIOCLOOKUPDELNODE");