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

Function key_do_allocsp

freebsd/netipsec/key.c:854–873  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

852}
853
854struct secpolicy *
855key_do_allocsp(struct secpolicyindex *spidx, u_int dir)
856{
857 SPTREE_RLOCK_TRACKER;
858 struct secpolicy *sp;
859
860 IPSEC_ASSERT(spidx != NULL, ("null spidx"));
861 IPSEC_ASSERT(dir == IPSEC_DIR_INBOUND || dir == IPSEC_DIR_OUTBOUND,
862 ("invalid direction %u", dir));
863
864 SPTREE_RLOCK();
865 TAILQ_FOREACH(sp, &V_sptree[dir], chain) {
866 if (key_cmpspidx_withmask(&sp->spidx, spidx)) {
867 SP_ADDREF(sp);
868 break;
869 }
870 }
871 SPTREE_RUNLOCK();
872 return (sp);
873}
874
875/*
876 * allocating a SP for OUTBOUND or INBOUND packet.

Callers 1

key_allocspFunction · 0.85

Calls 1

key_cmpspidx_withmaskFunction · 0.85

Tested by

no test coverage detected