FreeBSD/sys/netpfil/ipfw/ip_fw_sockopt.c
/*
 * Marks every object index used in @rule with bit in @bmask.
 * Used to generate bitmask of referenced tables/objects for given ruleset
 * or its part.
 *
 * Returns number of newly-referenced objects.
 */
Marks every object index used in @rule with bit in @bmask.
Used to generate bitmask of referenced tables/objects for given ruleset
or its part.

Returns number of newly-referenced objects.
Marks every object index used in @rule with bit in @bmask . Used to generate bitmask of referenced tables / objects for given ruleset or its part . Returns number of newly - referenced objects .
static int
mark_object_kidx(struct ip_fw_chain *ch, struct ip_fw *rule,
    uint32_t *bmask)
{
	struct opcode_obj_rewrite *rw;
	ipfw_insn *cmd;
	int bidx, cmdlen, l, count;
	uint16_t kidx;
	uint8_t subtype;
	l = rule->cmd_len;
	cmd = rule->cmd;
	cmdlen = 0;
	count = 0;
	for ( ;	l > 0 ; l -= cmdlen, cmd += cmdlen) {
		cmdlen = F_LEN(cmd);
		rw = find_op_rw(cmd, &kidx, &subtype);
		if (rw == NULL)
			continue;
		bidx = kidx / 32;
		if (rw->etlv != IPFW_TLV_TBL_NAME)
			bidx += IPFW_TABLES_MAX / 32;
		if ((bmask[bidx] & (1 << (kidx % 32))) == 0)
			count++;
		bmask[bidx] |= 1 << (kidx % 32);
	}
	return (count);
}
static int mark_object_kidx ( struct ip_fw_chain * ch , struct ip_fw * rule , uint32_t * bmask ) { struct opcode_obj_rewrite * rw ; ipfw_insn * cmd ; int bidx , cmdlen , l , count ; uint16_t kidx ; uint8_t subtype ; l = rule -> cmd_len ; cmd = rule -> cmd ; cmdlen = 0 ; count = 0 ; for ( ; l > 0 ; l -= cmdlen , cmd += cmdlen ) { cmdlen = F_LEN ( cmd ) ; rw = find_op_rw ( cmd , & kidx , & subtype ) ; if ( rw == NULL ) continue ; bidx = kidx / 32 ; if ( rw -> etlv != IPFW_TLV_TBL_NAME ) bidx += IPFW_TABLES_MAX / 32 ; if ( ( bmask [ bidx ] & ( 1 << ( kidx % 32 ) ) ) == 0 ) count ++ ; bmask [ bidx ] |= 1 << ( kidx % 32 ) ; } return ( count ) ; }
Marks every object index used in @rule with bit in @bmask.
Marks every object index used in @rule with bit in @bmask .
/*
		 * Maintain separate bitmasks for table and
		 * non-table objects.
		 */