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

Function key_delsav

freebsd/netipsec/key.c:3094–3115  ·  view source on GitHub ↗

* free() SA variable entry. */

Source from the content-addressed store, hash-verified

3092 * free() SA variable entry.
3093 */
3094static void
3095key_delsav(struct secasvar *sav)
3096{
3097 IPSEC_ASSERT(sav != NULL, ("null sav"));
3098 IPSEC_ASSERT(sav->state == SADB_SASTATE_DEAD,
3099 ("attempt to free non DEAD SA %p", sav));
3100 IPSEC_ASSERT(sav->refcnt == 0, ("reference count %u > 0",
3101 sav->refcnt));
3102
3103 /*
3104 * SA must be unlinked from the chain and hashtbl.
3105 * If SA was cloned, we leave all fields untouched,
3106 * except NAT-T config.
3107 */
3108 key_cleansav(sav);
3109 if ((sav->flags & SADB_X_EXT_F_CLONED) == 0) {
3110 mtx_destroy(sav->lock);
3111 free(sav->lock, M_IPSEC_MISC);
3112 uma_zfree_pcpu(V_key_lft_zone, sav->lft_c);
3113 }
3114 free(sav, M_IPSEC_SA);
3115}
3116
3117/*
3118 * search SAH.

Callers 1

key_freesavFunction · 0.85

Calls 3

key_cleansavFunction · 0.85
freeFunction · 0.50
uma_zfree_pcpuFunction · 0.50

Tested by

no test coverage detected