FreeBSD/sys/netipsec/key.c
/*
 * Must be called after calling key_allocsa().
 * This function is called by key_freesp() to free some SA allocated
 * for a policy.
 */
Must be called after calling key_allocsa().
This function is called by key_freesp() to free some SA allocated
for a policy.
Must be called after calling key_allocsa () . This function is called by key_freesp () to free some SA allocated for a policy .
void
key_freesav(struct secasvar **psav, const char* where, int tag)
{
	struct secasvar *sav = *psav;
	IPSEC_ASSERT(sav != NULL, ("null sav"));
	if (sa_delref(sav)) {
		KEYDEBUG(KEYDEBUG_IPSEC_STAMP,
			printf("DP %s SA:%p (SPI %u) from %s:%u; refcnt now %u\n",
				__func__, sav, ntohl(sav->spi), where, tag, sav->refcnt));
		*psav = NULL;
		key_delsav(sav);
	} else {
		KEYDEBUG(KEYDEBUG_IPSEC_STAMP,
			printf("DP %s SA:%p (SPI %u) from %s:%u; refcnt now %u\n",
				__func__, sav, ntohl(sav->spi), where, tag, sav->refcnt));
	}
}
void key_freesav ( struct secasvar * * psav , const char * where , int tag ) { struct secasvar * sav = * psav ; IPSEC_ASSERT ( sav != NULL , ( " " ) ) ; if ( sa_delref ( sav ) ) { KEYDEBUG ( KEYDEBUG_IPSEC_STAMP , printf ( " \n " , __func__ , sav , ntohl ( sav -> spi ) , where , tag , sav -> refcnt ) ) ; * psav = NULL ; key_delsav ( sav ) ; } else { KEYDEBUG ( KEYDEBUG_IPSEC_STAMP , printf ( " \n " , __func__ , sav , ntohl ( sav -> spi ) , where , tag , sav -> refcnt ) ) ; } }
Must be called after calling key_allocsa().
Must be called after calling key_allocsa () .