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

Function sctp_delete_sharedkey_ep

freebsd/netinet/sctp_auth.c:1219–1245  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1217 * ASSUMES INP_WLOCK is already held
1218 */
1219int
1220sctp_delete_sharedkey_ep(struct sctp_inpcb *inp, uint16_t keyid)
1221{
1222 sctp_sharedkey_t *skey;
1223
1224 if (inp == NULL)
1225 return (-1);
1226
1227 /* is the keyid the active sending key on the endpoint */
1228 if (keyid == inp->sctp_ep.default_keyid)
1229 return (-1);
1230
1231 /* does the key exist? */
1232 skey = sctp_find_sharedkey(&inp->sctp_ep.shared_keys, keyid);
1233 if (skey == NULL)
1234 return (-1);
1235
1236 /* endpoint keys are not refcounted */
1237
1238 /* remove it */
1239 LIST_REMOVE(skey, next);
1240 sctp_free_sharedkey(skey); /* frees skey->key as well */
1241
1242 /* clear any cached keys */
1243 sctp_clear_cachedkeys_ep(inp, keyid);
1244 return (0);
1245}
1246
1247/*-
1248 * set the active key on an association

Callers 1

sctp_setoptFunction · 0.85

Calls 3

sctp_find_sharedkeyFunction · 0.85
sctp_free_sharedkeyFunction · 0.85
sctp_clear_cachedkeys_epFunction · 0.85

Tested by

no test coverage detected