FreeBSD/sys/netpfil/ipfw/ip_fw_sockopt.c
/*
 * Removes one or more sockopt handlers from the global array.
 */
Removes one or more sockopt handlers from the global array.
Removes one or more sockopt handlers from the global array .
int
ipfw_del_sopt_handler(struct ipfw_sopt_handler *sh, size_t count)
{
	size_t sz;
	struct ipfw_sopt_handler *tmp, *h;
	int i;
	CTL3_LOCK();
	for (i = 0; i < count; i++) {
		tmp = &sh[i];
		h = find_sh(tmp->opcode, tmp->version, tmp->handler);
		if (h == NULL)
			continue;
		sz = (ctl3_handlers + ctl3_hsize - (h + 1)) * sizeof(*h);
		memmove(h, h + 1, sz);
		ctl3_hsize--;
	}
	if (ctl3_hsize == 0) {
		if (ctl3_handlers != NULL)
			free(ctl3_handlers, M_IPFW);
		ctl3_handlers = NULL;
	}
	ctl3_gencnt++;
	CTL3_UNLOCK();
	return (0);
}
int ipfw_del_sopt_handler ( struct ipfw_sopt_handler * sh , size_t count ) { size_t sz ; struct ipfw_sopt_handler * tmp , * h ; int i ; CTL3_LOCK ( ) ; for ( i = 0 ; i < count ; i ++ ) { tmp = & sh [ i ] ; h = find_sh ( tmp -> opcode , tmp -> version , tmp -> handler ) ; if ( h == NULL ) continue ; sz = ( ctl3_handlers + ctl3_hsize - ( h + 1 ) ) * sizeof ( * h ) ; memmove ( h , h + 1 , sz ) ; ctl3_hsize -- ; } if ( ctl3_hsize == 0 ) { if ( ctl3_handlers != NULL ) free ( ctl3_handlers , M_IPFW ) ; ctl3_handlers = NULL ; } ctl3_gencnt ++ ; CTL3_UNLOCK ( ) ; return ( 0 ) ; }
Removes one or more sockopt handlers from the global array.
Removes one or more sockopt handlers from the global array .