1 /* $FreeBSD$ */ 2 3 /* 4 * Copyright (C) 2012 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(ip_pool_t *poolp, ioctlfunc_t iocfunc) 20 { 21 iplookupop_t op; 22 ip_pool_t pool; 23 24 if (pool_open() == -1) 25 return (-1); 26 27 op.iplo_type = IPLT_POOL; 28 op.iplo_unit = poolp->ipo_unit; 29 strncpy(op.iplo_name, poolp->ipo_name, sizeof(op.iplo_name)); 30 op.iplo_size = sizeof(pool); 31 op.iplo_struct = &pool; 32 33 bzero((char *)&pool, sizeof(pool)); 34 pool.ipo_unit = poolp->ipo_unit; 35 strncpy(pool.ipo_name, poolp->ipo_name, sizeof(pool.ipo_name)); 36 pool.ipo_flags = poolp->ipo_flags; 37 38 if (pool_ioctl(iocfunc, SIOCLOOKUPDELTABLE, &op)) { 39 if ((opts & OPT_DONOTHING) == 0) { 40 return (ipf_perror_fd(pool_fd(), iocfunc, 41 "delete lookup pool")); 42 } 43 } 44 return (0); 45 } 46