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

Function sctp_auth_setactivekey

freebsd/netinet/sctp_auth.c:1251–1273  ·  view source on GitHub ↗

- * set the active key on an association * ASSUMES TCB_LOCK is already held */

Source from the content-addressed store, hash-verified

1249 * ASSUMES TCB_LOCK is already held
1250 */
1251int
1252sctp_auth_setactivekey(struct sctp_tcb *stcb, uint16_t keyid)
1253{
1254 sctp_sharedkey_t *skey = NULL;
1255
1256 /* find the key on the assoc */
1257 skey = sctp_find_sharedkey(&stcb->asoc.shared_keys, keyid);
1258 if (skey == NULL) {
1259 /* that key doesn't exist */
1260 return (-1);
1261 }
1262 if ((skey->deactivated) && (skey->refcount > 1)) {
1263 /* can't reactivate a deactivated key with other refcounts */
1264 return (-1);
1265 }
1266
1267 /* set the (new) active key */
1268 stcb->asoc.authinfo.active_keyid = keyid;
1269 /* reset the deactivated flag */
1270 skey->deactivated = 0;
1271
1272 return (0);
1273}
1274
1275/*-
1276 * set the active key on an endpoint

Callers 1

sctp_setoptFunction · 0.85

Calls 1

sctp_find_sharedkeyFunction · 0.85

Tested by

no test coverage detected