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

Function key_getsp

freebsd/netipsec/key.c:1400–1418  ·  view source on GitHub ↗

%%% SPD management */ * search SPD * OUT: NULL : not found * others : found, pointer to a SP. */

Source from the content-addressed store, hash-verified

1398 * others : found, pointer to a SP.
1399 */
1400static struct secpolicy *
1401key_getsp(struct secpolicyindex *spidx)
1402{
1403 SPTREE_RLOCK_TRACKER;
1404 struct secpolicy *sp;
1405
1406 IPSEC_ASSERT(spidx != NULL, ("null spidx"));
1407
1408 SPTREE_RLOCK();
1409 TAILQ_FOREACH(sp, &V_sptree[spidx->dir], chain) {
1410 if (key_cmpspidx_exactly(spidx, &sp->spidx)) {
1411 SP_ADDREF(sp);
1412 break;
1413 }
1414 }
1415 SPTREE_RUNLOCK();
1416
1417 return sp;
1418}
1419
1420/*
1421 * get SP by index.

Callers 2

key_spdaddFunction · 0.85
key_spddeleteFunction · 0.85

Calls 1

key_cmpspidx_exactlyFunction · 0.85

Tested by

no test coverage detected