FreeBSD/sys/netpfil/ipfw/ip_fw_sockopt.c
/*
 * Creates non-existent objects referenced by rule.
 *
 * Return 0 on success.
 */
Creates non-existent objects referenced by rule.
Return 0 on success.
Creates non - existent objects referenced by rule . Return 0 on success .
int
create_objects_compat(struct ip_fw_chain *ch, ipfw_insn *cmd,
    struct obj_idx *oib, struct obj_idx *pidx, struct tid_info *ti)
{
	struct opcode_obj_rewrite *rw;
	struct obj_idx *p;
	uint16_t kidx;
	int error;
	for (p = oib; p < pidx; p++) {
		if (p->kidx != 0)
			continue;
		ti->uidx = p->uidx;
		ti->type = p->type;
		ti->atype = 0;
		rw = find_op_rw(cmd + p->off, NULL, NULL);
		KASSERT(rw != NULL, ("Unable to find handler for op %d",
		    (cmd + p->off)->opcode));
		if (rw->create_object == NULL)
			error = EOPNOTSUPP;
		else
			error = rw->create_object(ch, ti, &kidx);
		if (error == 0) {
			p->kidx = kidx;
			continue;
		}
		IPFW_UH_WLOCK(ch);
		unref_oib_objects(ch, cmd, oib, pidx);
		IPFW_UH_WUNLOCK(ch);
		return (error);
	}
	return (0);
}
int create_objects_compat ( struct ip_fw_chain * ch , ipfw_insn * cmd , struct obj_idx * oib , struct obj_idx * pidx , struct tid_info * ti ) { struct opcode_obj_rewrite * rw ; struct obj_idx * p ; uint16_t kidx ; int error ; for ( p = oib ; p < pidx ; p ++ ) { if ( p -> kidx != 0 ) continue ; ti -> uidx = p -> uidx ; ti -> type = p -> type ; ti -> atype = 0 ; rw = find_op_rw ( cmd + p -> off , NULL , NULL ) ; KASSERT ( rw != NULL , ( " " , ( cmd + p -> off ) -> opcode ) ) ; if ( rw -> create_object == NULL ) error = EOPNOTSUPP ; else error = rw -> create_object ( ch , ti , & kidx ) ; if ( error == 0 ) { p -> kidx = kidx ; continue ; } IPFW_UH_WLOCK ( ch ) ; unref_oib_objects ( ch , cmd , oib , pidx ) ; IPFW_UH_WUNLOCK ( ch ) ; return ( error ) ; } return ( 0 ) ; }
Creates non-existent objects referenced by rule.
Creates non - existent objects referenced by rule .
/*
	 * Compatibility stuff: do actual creation for non-existing,
	 * but referenced objects.
	 */ /*
		 * Error happened. We have to rollback everything.
		 * Drop all already acquired references.
		 */