FreeBSD/sys/netpfil/ipfw/ip_fw_sockopt.c
/*
 * Unreferences all already-referenced objects in given @cmd rule,
 * using information in @oib.
 *
 * Used to rollback partially converted rule on error.
 */
Unreferences all already-referenced objects in given @cmd rule,
using information in @oib.

Used to rollback partially converted rule on error.
Unreferences all already - referenced objects in given @cmd rule using information in @oib . Used to rollback partially converted rule on error .
static void
unref_oib_objects(struct ip_fw_chain *ch, ipfw_insn *cmd, struct obj_idx *oib,
    struct obj_idx *end)
{
	struct opcode_obj_rewrite *rw;
	struct named_object *no;
	struct obj_idx *p;
	IPFW_UH_WLOCK_ASSERT(ch);
	for (p = oib; p < end; p++) {
		if (p->kidx == 0)
			continue;
		rw = find_op_rw(cmd + p->off, NULL, NULL);
		KASSERT(rw != NULL, ("Unable to find handler for op %d",
		    (cmd + p->off)->opcode));
		no = rw->find_bykidx(ch, p->kidx);
		KASSERT(no != NULL, ("Ref'd object %d disappeared", p->kidx));
		no->refcnt--;
	}
}
static void unref_oib_objects ( struct ip_fw_chain * ch , ipfw_insn * cmd , struct obj_idx * oib , struct obj_idx * end ) { struct opcode_obj_rewrite * rw ; struct named_object * no ; struct obj_idx * p ; IPFW_UH_WLOCK_ASSERT ( ch ) ; for ( p = oib ; p < end ; p ++ ) { if ( p -> kidx == 0 ) continue ; rw = find_op_rw ( cmd + p -> off , NULL , NULL ) ; KASSERT ( rw != NULL , ( " " , ( cmd + p -> off ) -> opcode ) ) ; no = rw -> find_bykidx ( ch , p -> kidx ) ; KASSERT ( no != NULL , ( " " , p -> kidx ) ) ; no -> refcnt -- ; } }
Unreferences all already-referenced objects in given @cmd rule,
 using information in @oib.
Unreferences all already - referenced objects in given @cmd rule using information in @oib .
/* Find & unref by existing idx */