Author: tuexen
Date: Fri Feb 10 19:54:18 2012
New Revision: 231416
URL: http://svn.freebsd.org/changeset/base/231416

Log:
  MFC r218521:
  Remove addresses from endpoint when there are no associations.
  This fixes a bug reported by brucec@.

Modified:
  stable/8/sys/netinet/sctp_asconf.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/boot/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/e1000/   (props changed)

Modified: stable/8/sys/netinet/sctp_asconf.c
==============================================================================
--- stable/8/sys/netinet/sctp_asconf.c  Fri Feb 10 19:52:18 2012        
(r231415)
+++ stable/8/sys/netinet/sctp_asconf.c  Fri Feb 10 19:54:18 2012        
(r231416)
@@ -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;
 
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to