FreeBSD/sys/netinet/sctp_auth.c
/*-
 * set the active key on an association
 * ASSUMES TCB_LOCK is already held
 */
set the active key on an association
ASSUMES TCB_LOCK is already held
set the active key on an association ASSUMES TCB_LOCK is already held
int
sctp_auth_setactivekey(struct sctp_tcb *stcb, uint16_t keyid)
{
	sctp_sharedkey_t *skey = NULL;
	skey = sctp_find_sharedkey(&stcb->asoc.shared_keys, keyid);
	if (skey == NULL) {
		return (-1);
	}
	if ((skey->deactivated) && (skey->refcount > 1)) {
		return (-1);
	}
	stcb->asoc.authinfo.active_keyid = keyid;
	skey->deactivated = 0;
	return (0);
}
int sctp_auth_setactivekey ( struct sctp_tcb * stcb , uint16_t keyid ) { sctp_sharedkey_t * skey = NULL ; skey = sctp_find_sharedkey ( & stcb -> asoc . shared_keys , keyid ) ; if ( skey == NULL ) { return ( -1 ) ; } if ( ( skey -> deactivated ) && ( skey -> refcount > 1 ) ) { return ( -1 ) ; } stcb -> asoc . authinfo . active_keyid = keyid ; skey -> deactivated = 0 ; return ( 0 ) ; }
set the active key on an association
 ASSUMES TCB_LOCK is already held
set the active key on an association ASSUMES TCB_LOCK is already held
/* find the key on the assoc */ /* that key doesn't exist */ /* can't reactivate a deactivated key with other refcounts */ /* set the (new) active key */ /* reset the deactivated flag */