FreeBSD/sys/netipsec/key.c
/*
 * insert a secpolicy into the SP database. Lower priorities first
 */
insert a secpolicy into the SP database. Lower priorities first
insert a secpolicy into the SP database . Lower priorities first
static void
key_insertsp(struct secpolicy *newsp)
{
	struct secpolicy *sp;
	SPTREE_WLOCK();
	TAILQ_FOREACH(sp, &V_sptree[newsp->spidx.dir], chain) {
		if (newsp->priority < sp->priority) {
			TAILQ_INSERT_BEFORE(sp, newsp, chain);
			goto done;
		}
	}
	TAILQ_INSERT_TAIL(&V_sptree[newsp->spidx.dir], newsp, chain);
done:
	newsp->state = IPSEC_SPSTATE_ALIVE;
	SPTREE_WUNLOCK();
}
static void key_insertsp ( struct secpolicy * newsp ) { struct secpolicy * sp ; SPTREE_WLOCK ( ) ; TAILQ_FOREACH ( sp , & V_sptree [ newsp -> spidx . dir ] , chain ) { if ( newsp -> priority < sp -> priority ) { TAILQ_INSERT_BEFORE ( sp , newsp , chain ) ; goto done ; } } TAILQ_INSERT_TAIL ( & V_sptree [ newsp -> spidx . dir ] , newsp , chain ) ; done : newsp -> state = IPSEC_SPSTATE_ALIVE ; SPTREE_WUNLOCK ( ) ; }
insert a secpolicy into the SP database.
insert a secpolicy into the SP database .