FreeBSD/sys/netinet/sctp_auth.c
/*-
 * deactivates a shared key from the association
 * ASSUMES INP_WLOCK is already held
 */
deactivates a shared key from the association
ASSUMES INP_WLOCK is already held
deactivates a shared key from the association ASSUMES INP_WLOCK is already held
int
sctp_deact_sharedkey(struct sctp_tcb *stcb, uint16_t keyid)
{
	sctp_sharedkey_t *skey;
	if (stcb == NULL)
		return (-1);
	if (keyid == stcb->asoc.authinfo.active_keyid)
		return (-1);
	skey = sctp_find_sharedkey(&stcb->asoc.shared_keys, keyid);
	if (skey == NULL)
		return (-1);
	if (skey->refcount == 1) {
		sctp_ulp_notify(SCTP_NOTIFY_AUTH_FREE_KEY, stcb, keyid, 0,
		    SCTP_SO_LOCKED);
	}
	skey->deactivated = 1;
	return (0);
}
int sctp_deact_sharedkey ( struct sctp_tcb * stcb , uint16_t keyid ) { sctp_sharedkey_t * skey ; if ( stcb == NULL ) return ( -1 ) ; if ( keyid == stcb -> asoc . authinfo . active_keyid ) return ( -1 ) ; skey = sctp_find_sharedkey ( & stcb -> asoc . shared_keys , keyid ) ; if ( skey == NULL ) return ( -1 ) ; if ( skey -> refcount == 1 ) { sctp_ulp_notify ( SCTP_NOTIFY_AUTH_FREE_KEY , stcb , keyid , 0 , SCTP_SO_LOCKED ) ; } skey -> deactivated = 1 ; return ( 0 ) ; }
deactivates a shared key from the association
 ASSUMES INP_WLOCK is already held
deactivates a shared key from the association ASSUMES INP_WLOCK is already held
/* is the keyid the assoc active sending key */ /* does the key exist? */ /* are there other refcount holders on the key? */ /* no other users, send a notification for this key */ /* mark the key as deactivated */