* remove a remote endpoint address from an association, it will fail if the * address does not exist. */
| 4464 | * address does not exist. |
| 4465 | */ |
| 4466 | int |
| 4467 | sctp_del_remote_addr(struct sctp_tcb *stcb, struct sockaddr *remaddr) |
| 4468 | { |
| 4469 | /* |
| 4470 | * Here we need to remove a remote address. This is quite simple, we |
| 4471 | * first find it in the list of address for the association |
| 4472 | * (tasoc->asoc.nets) and then if it is there, we do a LIST_REMOVE |
| 4473 | * on that item. Note we do not allow it to be removed if there are |
| 4474 | * no other addresses. |
| 4475 | */ |
| 4476 | struct sctp_association *asoc; |
| 4477 | struct sctp_nets *net, *nnet; |
| 4478 | |
| 4479 | asoc = &stcb->asoc; |
| 4480 | |
| 4481 | /* locate the address */ |
| 4482 | TAILQ_FOREACH_SAFE(net, &asoc->nets, sctp_next, nnet) { |
| 4483 | if (net->ro._l_addr.sa.sa_family != remaddr->sa_family) { |
| 4484 | continue; |
| 4485 | } |
| 4486 | if (sctp_cmpaddr((struct sockaddr *)&net->ro._l_addr, |
| 4487 | remaddr)) { |
| 4488 | /* we found the guy */ |
| 4489 | if (asoc->numnets < 2) { |
| 4490 | /* Must have at LEAST two remote addresses */ |
| 4491 | return (-1); |
| 4492 | } else { |
| 4493 | sctp_remove_net(stcb, net); |
| 4494 | return (0); |
| 4495 | } |
| 4496 | } |
| 4497 | } |
| 4498 | /* not found. */ |
| 4499 | return (-2); |
| 4500 | } |
| 4501 | |
| 4502 | void |
| 4503 | sctp_delete_from_timewait(uint32_t tag, uint16_t lport, uint16_t rport) |
no test coverage detected