From owner-svn-src-all@FreeBSD.ORG Thu Feb 10 14:46:37 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D7430106566B; Thu, 10 Feb 2011 14:46:37 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C6A0F8FC08; Thu, 10 Feb 2011 14:46:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p1AEkbNa025236; Thu, 10 Feb 2011 14:46:37 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p1AEkbCm025234; Thu, 10 Feb 2011 14:46:37 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201102101446.p1AEkbCm025234@svn.freebsd.org> From: Michael Tuexen Date: Thu, 10 Feb 2011 14:46:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r218521 - head/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Feb 2011 14:46:37 -0000 Author: tuexen Date: Thu Feb 10 14:46:37 2011 New Revision: 218521 URL: http://svn.freebsd.org/changeset/base/218521 Log: Remove addresses from endpoint when there are no associations. This fixes a bug reported by brucec@. MFC after: 3 months. Modified: head/sys/netinet/sctp_asconf.c Modified: head/sys/netinet/sctp_asconf.c ============================================================================== --- head/sys/netinet/sctp_asconf.c Thu Feb 10 14:29:34 2011 (r218520) +++ head/sys/netinet/sctp_asconf.c Thu Feb 10 14:46:37 2011 (r218521) @@ -3104,6 +3104,7 @@ sctp_addr_mgmt_ep_sa(struct sctp_inpcb * 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 * 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 * } } } - 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;