diff options
author | tuexen <tuexen@FreeBSD.org> | 2011-02-10 14:46:37 +0000 |
---|---|---|
committer | tuexen <tuexen@FreeBSD.org> | 2011-02-10 14:46:37 +0000 |
commit | fe85a97406367f92872c732a13d0dffdafb294c6 (patch) | |
tree | a8a261f8f2141a0aa1ef103871b58e399853b300 /sys/netinet/sctp_asconf.c | |
parent | 2fc9b4286f62182bf71595e4ab879e359bde48f5 (diff) | |
download | FreeBSD-src-fe85a97406367f92872c732a13d0dffdafb294c6.zip FreeBSD-src-fe85a97406367f92872c732a13d0dffdafb294c6.tar.gz |
Remove addresses from endpoint when there are no associations.
This fixes a bug reported by brucec@.
MFC after: 3 months.
Diffstat (limited to 'sys/netinet/sctp_asconf.c')
-rw-r--r-- | sys/netinet/sctp_asconf.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/sys/netinet/sctp_asconf.c b/sys/netinet/sctp_asconf.c index 900d816..ed8c118 100644 --- a/sys/netinet/sctp_asconf.c +++ b/sys/netinet/sctp_asconf.c @@ -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; |