src/sys/netipsec/key.c
/*
 * free secreg entry registered.
 * XXX: I want to do free a socket marked done SADB_RESIGER to socket.
 */
free secreg entry registered.
XXX: I want to do free a socket marked done SADB_RESIGER to socket.
free secreg entry registered . XXX : I want to do free a socket marked done SADB_RESIGER to socket .
void
key_freereg(struct socket *so)
{
	struct secreg *reg;
	int i;
	IPSEC_ASSERT(so != NULL, ("NULL so"));
	REGTREE_LOCK();
	for (i = 0; i <= SADB_SATYPE_MAX; i++) {
		LIST_FOREACH(reg, &V_regtree[i], chain) {
			if (reg->so == so && __LIST_CHAINED(reg)) {
				LIST_REMOVE(reg, chain);
				free(reg, M_IPSEC_SAR);
				break;
			}
		}
	}
	REGTREE_UNLOCK();
}
void key_freereg ( struct socket * so ) { struct secreg * reg ; int i ; IPSEC_ASSERT ( so != NULL , ( " " ) ) ; REGTREE_LOCK ( ) ; for ( i = 0 ; i <= SADB_SATYPE_MAX ; i ++ ) { LIST_FOREACH ( reg , & V_regtree [ i ] , chain ) { if ( reg -> so == so && __LIST_CHAINED ( reg ) ) { LIST_REMOVE ( reg , chain ) ; free ( reg , M_IPSEC_SAR ) ; break ; } } } REGTREE_UNLOCK ( ) ; }
free secreg entry registered.
free secreg entry registered .
/*
	 * check whether existing or not.
	 * check all type of SA, because there is a potential that
	 * one socket is registered to multiple type of SA.
	 */