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

Function sctp_deact_sharedkey_ep

freebsd/netinet/sctp_auth.c:1332–1356  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1330 * ASSUMES INP_WLOCK is already held
1331 */
1332int
1333sctp_deact_sharedkey_ep(struct sctp_inpcb *inp, uint16_t keyid)
1334{
1335 sctp_sharedkey_t *skey;
1336
1337 if (inp == NULL)
1338 return (-1);
1339
1340 /* is the keyid the active sending key on the endpoint */
1341 if (keyid == inp->sctp_ep.default_keyid)
1342 return (-1);
1343
1344 /* does the key exist? */
1345 skey = sctp_find_sharedkey(&inp->sctp_ep.shared_keys, keyid);
1346 if (skey == NULL)
1347 return (-1);
1348
1349 /* endpoint keys are not refcounted */
1350
1351 /* remove it */
1352 LIST_REMOVE(skey, next);
1353 sctp_free_sharedkey(skey); /* frees skey->key as well */
1354
1355 return (0);
1356}
1357
1358/*
1359 * get local authentication parameters from cookie (from INIT-ACK)

Callers 1

sctp_setoptFunction · 0.85

Calls 2

sctp_find_sharedkeyFunction · 0.85
sctp_free_sharedkeyFunction · 0.85

Tested by

no test coverage detected