MCPcopy Create free account
hub / github.com/F-Stack/f-stack / key_insertsp

Function key_insertsp

freebsd/netipsec/key.c:1232–1250  ·  view source on GitHub ↗

* insert a secpolicy into the SP database. Lower priorities first */

Source from the content-addressed store, hash-verified

1230 * insert a secpolicy into the SP database. Lower priorities first
1231 */
1232static void
1233key_insertsp(struct secpolicy *newsp)
1234{
1235 struct secpolicy *sp;
1236
1237 SPTREE_WLOCK_ASSERT();
1238 TAILQ_FOREACH(sp, &V_sptree[newsp->spidx.dir], chain) {
1239 if (newsp->priority < sp->priority) {
1240 TAILQ_INSERT_BEFORE(sp, newsp, chain);
1241 goto done;
1242 }
1243 }
1244 TAILQ_INSERT_TAIL(&V_sptree[newsp->spidx.dir], newsp, chain);
1245done:
1246 LIST_INSERT_HEAD(SPHASH_HASH(newsp->id), newsp, idhash);
1247 newsp->state = IPSEC_SPSTATE_ALIVE;
1248 V_spd_size++;
1249 V_sp_genid++;
1250}
1251
1252/*
1253 * Insert a bunch of VTI secpolicies into the SPDB.

Callers 1

key_spdaddFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected