summaryrefslogtreecommitdiffstats
path: root/sys/netinet/sctp_asconf.c
diff options
context:
space:
mode:
authortuexen <tuexen@FreeBSD.org>2011-02-10 14:46:37 +0000
committertuexen <tuexen@FreeBSD.org>2011-02-10 14:46:37 +0000
commitfe85a97406367f92872c732a13d0dffdafb294c6 (patch)
treea8a261f8f2141a0aa1ef103871b58e399853b300 /sys/netinet/sctp_asconf.c
parent2fc9b4286f62182bf71595e4ab879e359bde48f5 (diff)
downloadFreeBSD-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.c13
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;
OpenPOWER on IntegriCloud