Remove addresses from endpoint when there are no associations.
This fixes a bug reported by brucec@. MFC after: 3 months.
This commit is contained in:
parent
3502f01f20
commit
2678fe1ee9
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=218521
@ -3104,6 +3104,7 @@ sctp_addr_mgmt_ep_sa(struct sctp_inpcb *inp, struct sockaddr *sa,
|
||||
uint32_t type, uint32_t vrf_id, struct sctp_ifa *sctp_ifap)
|
||||
{
|
||||
struct sctp_ifa *ifa;
|
||||
struct sctp_laddr *laddr, *nladdr;
|
||||
|
||||
if (sa->sa_len == 0) {
|
||||
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_ASCONF, EINVAL);
|
||||
@ -3124,8 +3125,6 @@ sctp_addr_mgmt_ep_sa(struct sctp_inpcb *inp, struct sockaddr *sa,
|
||||
if (type == SCTP_ADD_IP_ADDRESS) {
|
||||
sctp_add_local_addr_ep(inp, ifa, type);
|
||||
} else if (type == SCTP_DEL_IP_ADDRESS) {
|
||||
struct sctp_laddr *laddr;
|
||||
|
||||
if (inp->laddr_count < 2) {
|
||||
/* can't delete the last local address */
|
||||
SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_ASCONF, EINVAL);
|
||||
@ -3139,11 +3138,19 @@ sctp_addr_mgmt_ep_sa(struct sctp_inpcb *inp, struct sockaddr *sa,
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!LIST_EMPTY(&inp->sctp_asoc_list)) {
|
||||
if (LIST_EMPTY(&inp->sctp_asoc_list)) {
|
||||
/*
|
||||
* There is no need to start the iterator if the inp
|
||||
* has no associations.
|
||||
*/
|
||||
if (type == SCTP_DEL_IP_ADDRESS) {
|
||||
LIST_FOREACH_SAFE(laddr, &inp->sctp_addr_list, sctp_nxt_addr, nladdr) {
|
||||
if (laddr->ifa == ifa) {
|
||||
sctp_del_local_addr_ep(inp, ifa);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
struct sctp_asconf_iterator *asc;
|
||||
struct sctp_laddr *wi;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user