- * deletes a shared key from the endpoint * ASSUMES INP_WLOCK is already held */
| 1217 | * ASSUMES INP_WLOCK is already held |
| 1218 | */ |
| 1219 | int |
| 1220 | sctp_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 |
no test coverage detected