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

Function sctp_del_remote_addr

freebsd/netinet/sctp_pcb.c:4466–4500  ·  view source on GitHub ↗

* remove a remote endpoint address from an association, it will fail if the * address does not exist. */

Source from the content-addressed store, hash-verified

4464 * address does not exist.
4465 */
4466int
4467sctp_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
4502void
4503sctp_delete_from_timewait(uint32_t tag, uint16_t lport, uint16_t rport)

Callers 1

Calls 2

sctp_cmpaddrFunction · 0.85
sctp_remove_netFunction · 0.85

Tested by

no test coverage detected