FreeBSD/sys/netpfil/ipfw/ip_fw_sockopt.c
/*
 * Removes one or more object rewrite handlers from the global array.
 */
Removes one or more object rewrite handlers from the global array.
Removes one or more object rewrite handlers from the global array .
int
ipfw_del_obj_rewriter(struct opcode_obj_rewrite *rw, size_t count)
{
	size_t sz;
	struct opcode_obj_rewrite *ctl3_max, *ktmp, *lo, *hi;
	int i;
	CTL3_LOCK();
	for (i = 0; i < count; i++) {
		if (find_op_rw_range(rw[i].opcode, &lo, &hi) != 0)
			continue;
		for (ktmp = lo; ktmp <= hi; ktmp++) {
			if (ktmp->classifier != rw[i].classifier)
				continue;
			ctl3_max = ctl3_rewriters + ctl3_rsize;
			sz = (ctl3_max - (ktmp + 1)) * sizeof(*ktmp);
			memmove(ktmp, ktmp + 1, sz);
			ctl3_rsize--;
			break;
		}
	}
	if (ctl3_rsize == 0) {
		if (ctl3_rewriters != NULL)
			free(ctl3_rewriters, M_IPFW);
		ctl3_rewriters = NULL;
	}
	CTL3_UNLOCK();
	return (0);
}
int ipfw_del_obj_rewriter ( struct opcode_obj_rewrite * rw , size_t count ) { size_t sz ; struct opcode_obj_rewrite * ctl3_max , * ktmp , * lo , * hi ; int i ; CTL3_LOCK ( ) ; for ( i = 0 ; i < count ; i ++ ) { if ( find_op_rw_range ( rw [ i ] . opcode , & lo , & hi ) != 0 ) continue ; for ( ktmp = lo ; ktmp <= hi ; ktmp ++ ) { if ( ktmp -> classifier != rw [ i ] . classifier ) continue ; ctl3_max = ctl3_rewriters + ctl3_rsize ; sz = ( ctl3_max - ( ktmp + 1 ) ) * sizeof ( * ktmp ) ; memmove ( ktmp , ktmp + 1 , sz ) ; ctl3_rsize -- ; break ; } } if ( ctl3_rsize == 0 ) { if ( ctl3_rewriters != NULL ) free ( ctl3_rewriters , M_IPFW ) ; ctl3_rewriters = NULL ; } CTL3_UNLOCK ( ) ; return ( 0 ) ; }
Removes one or more object rewrite handlers from the global array.
Removes one or more object rewrite handlers from the global array .