%%% SPD management */ * search SPD * OUT: NULL : not found * others : found, pointer to a SP. */
| 1398 | * others : found, pointer to a SP. |
| 1399 | */ |
| 1400 | static struct secpolicy * |
| 1401 | key_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. |
no test coverage detected