FreeBSD/sys/netpfil/ipfw/ip_fw_sockopt.c
/*
 * Changes set of given rule rannge @rt
 * with each other.
 *
 * Returns 0 on success.
 */
Changes set of given rule rannge @rt
with each other.

Returns 0 on success.
Changes set of given rule rannge @rt with each other . Returns 0 on success .
static int
move_range(struct ip_fw_chain *chain, ipfw_range_tlv *rt)
{
	struct ip_fw *rule;
	int i;
	IPFW_UH_WLOCK(chain);
	if ((i = move_objects(chain, rt)) != 0) {
		IPFW_UH_WUNLOCK(chain);
		return (i);
	}
	for (i = 0; i < chain->n_rules; i++) {
		rule = chain->map[i];
		if (ipfw_match_range(rule, rt) == 0)
			continue;
		rule->set = rt->new_set;
	}
	IPFW_UH_WUNLOCK(chain);
	return (0);
}
static int move_range ( struct ip_fw_chain * chain , ipfw_range_tlv * rt ) { struct ip_fw * rule ; int i ; IPFW_UH_WLOCK ( chain ) ; if ( ( i = move_objects ( chain , rt ) ) != 0 ) { IPFW_UH_WUNLOCK ( chain ) ; return ( i ) ; } for ( i = 0 ; i < chain -> n_rules ; i ++ ) { rule = chain -> map [ i ] ; if ( ipfw_match_range ( rule , rt ) == 0 ) continue ; rule -> set = rt -> new_set ; } IPFW_UH_WUNLOCK ( chain ) ; return ( 0 ) ; }
Changes set of given rule rannge @rt
 with each other.
Changes set of given rule rannge @rt with each other .
/*
	 * Move rules with matching paramenerts to a new set.
	 * This one is much more complex. We have to ensure
	 * that all referenced tables (if any) are referenced
	 * by given rule subset only. Otherwise, we can't move
	 * them to new set and have to return error.
	 */ /* XXX: We have to do swap holding WLOCK */