Move /var/svc/log to /var/log/svc
[unleashed/lotheac.git] / usr / src / cmd / ipf / lib / common / remove_pool.c
blobd14529ab40e06136e1a124eafff2e643461ca16b
1 /*
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 $
7 */
9 #include <fcntl.h>
10 #include <sys/ioctl.h>
11 #include "ipf.h"
12 #include "netinet/ip_lookup.h"
13 #include "netinet/ip_htable.h"
15 static int poolfd = -1;
18 int remove_pool(poolp, iocfunc)
19 ip_pool_t *poolp;
20 ioctlfunc_t iocfunc;
22 iplookupop_t op;
23 ip_pool_t pool;
25 if ((poolfd == -1) && ((opts & OPT_DONOTHING) == 0))
26 poolfd = open(IPLOOKUP_NAME, O_RDWR);
27 if ((poolfd == -1) && ((opts & OPT_DONOTHING) == 0))
28 return -1;
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");
44 return -1;
47 return 0;