1 /* $NetBSD: remove_pool.c,v 1.1.1.1 2012/03/23 21:20:10 christos Exp $ */ 2 3 /* 4 * Copyright (C) 2009 by Darren Reed. 5 * 6 * See the IPFILTER.LICENCE file for details on licencing. 7 * 8 * Id 9 */ 10 11 #include <fcntl.h> 12 #include <sys/ioctl.h> 13 #include "ipf.h" 14 #include "netinet/ip_lookup.h" 15 #include "netinet/ip_htable.h" 16 17 18 int 19 remove_pool(poolp, iocfunc) 20 ip_pool_t *poolp; 21 ioctlfunc_t iocfunc; 22 { 23 iplookupop_t op; 24 ip_pool_t pool; 25 26 if (pool_open() == -1) 27 return -1; 28 29 op.iplo_type = IPLT_POOL; 30 op.iplo_unit = poolp->ipo_unit; 31 strncpy(op.iplo_name, poolp->ipo_name, sizeof(op.iplo_name)); 32 op.iplo_size = sizeof(pool); 33 op.iplo_struct = &pool; 34 35 bzero((char *)&pool, sizeof(pool)); 36 pool.ipo_unit = poolp->ipo_unit; 37 strncpy(pool.ipo_name, poolp->ipo_name, sizeof(pool.ipo_name)); 38 pool.ipo_flags = poolp->ipo_flags; 39 40 if (pool_ioctl(iocfunc, SIOCLOOKUPDELTABLE, &op)) 41 if ((opts & OPT_DONOTHING) == 0) { 42 perror("remove_pool:SIOCLOOKUPDELTABLE"); 43 return -1; 44 } 45 46 return 0; 47 } 48