2 * Copyright (C) 2002 by Darren Reed.
4 * See the IPFILTER.LICENCE file for details on licencing.
6 * $Id: remove_poolnode.c,v 1.3 2003/11/22 10:14:36 darrenr Exp $
10 #include <sys/ioctl.h>
12 #include "netinet/ip_lookup.h"
13 #include "netinet/ip_pool.h"
15 static int poolfd
= -1;
18 int remove_poolnode(unit
, name
, node
, iocfunc
)
27 if ((poolfd
== -1) && ((opts
& OPT_DONOTHING
) == 0))
28 poolfd
= open(IPLOOKUP_NAME
, O_RDWR
);
29 if ((poolfd
== -1) && ((opts
& OPT_DONOTHING
) == 0))
33 op
.iplo_type
= IPLT_POOL
;
35 strncpy(op
.iplo_name
, name
, sizeof(op
.iplo_name
));
37 op
.iplo_size
= sizeof(pn
);
39 bzero((char *)&pn
, sizeof(pn
));
40 bcopy((char *)&node
->ipn_addr
, (char *)&pn
.ipn_addr
,
42 bcopy((char *)&node
->ipn_mask
, (char *)&pn
.ipn_mask
,
44 pn
.ipn_info
= node
->ipn_info
;
45 strncpy(pn
.ipn_name
, node
->ipn_name
, sizeof(pn
.ipn_name
));
47 if ((*iocfunc
)(poolfd
, SIOCLOOKUPDELNODE
, &op
)) {
48 if ((opts
& OPT_DONOTHING
) == 0) {
49 perror("remove_pool:SIOCLOOKUPDELNODE");