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

Function sctp_deact_sharedkey

freebsd/netinet/sctp_auth.c:1298–1326  ·  view source on GitHub ↗

- * deactivates a shared key from the association * ASSUMES INP_WLOCK is already held */

Source from the content-addressed store, hash-verified

1296 * ASSUMES INP_WLOCK is already held
1297 */
1298int
1299sctp_deact_sharedkey(struct sctp_tcb *stcb, uint16_t keyid)
1300{
1301 sctp_sharedkey_t *skey;
1302
1303 if (stcb == NULL)
1304 return (-1);
1305
1306 /* is the keyid the assoc active sending key */
1307 if (keyid == stcb->asoc.authinfo.active_keyid)
1308 return (-1);
1309
1310 /* does the key exist? */
1311 skey = sctp_find_sharedkey(&stcb->asoc.shared_keys, keyid);
1312 if (skey == NULL)
1313 return (-1);
1314
1315 /* are there other refcount holders on the key? */
1316 if (skey->refcount == 1) {
1317 /* no other users, send a notification for this key */
1318 sctp_ulp_notify(SCTP_NOTIFY_AUTH_FREE_KEY, stcb, keyid, 0,
1319 SCTP_SO_LOCKED);
1320 }
1321
1322 /* mark the key as deactivated */
1323 skey->deactivated = 1;
1324
1325 return (0);
1326}
1327
1328/*-
1329 * deactivates a shared key from the endpoint

Callers 1

sctp_setoptFunction · 0.85

Calls 2

sctp_find_sharedkeyFunction · 0.85
sctp_ulp_notifyFunction · 0.85

Tested by

no test coverage detected