From owner-svn-src-head@FreeBSD.ORG Thu Jun 25 08:37:38 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 80685106564A; Thu, 25 Jun 2009 08:37:38 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6E8C08FC1E; Thu, 25 Jun 2009 08:37:38 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5P8bc2v044943; Thu, 25 Jun 2009 08:37:38 GMT (envelope-from rwatson@svn.freebsd.org) Received: (from rwatson@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5P8bcjB044941; Thu, 25 Jun 2009 08:37:38 GMT (envelope-from rwatson@svn.freebsd.org) Message-Id: <200906250837.n5P8bcjB044941@svn.freebsd.org> From: Robert Watson Date: Thu, 25 Jun 2009 08:37:38 +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: r194943 - head/sys/netinet6 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jun 2009 08:37:38 -0000 Author: rwatson Date: Thu Jun 25 08:37:38 2009 New Revision: 194943 URL: http://svn.freebsd.org/changeset/base/194943 Log: Clean up reference management in in6_update_ifa and in6_unlink_ifa, and in particular, add a reference for in6_ifaddrhead since we do remove a reference for it when an IPv6 address is removed. This fixes ifconfig delete of an IPv6 alias. Reported by: tegge MFC after: 6 weeks Modified: head/sys/netinet6/in6.c Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Thu Jun 25 07:25:39 2009 (r194942) +++ head/sys/netinet6/in6.c Thu Jun 25 08:37:38 2009 (r194943) @@ -831,6 +831,7 @@ in6_update_ifa(struct ifnet *ifp, struct TAILQ_INSERT_TAIL(&ifp->if_addrhead, &ia->ia_ifa, ifa_link); IF_ADDR_UNLOCK(ifp); + ifa_ref(&ia->ia_ifa); /* in6_if_addrhead */ TAILQ_INSERT_TAIL(&V_in6_ifaddrhead, ia, ia_link); } @@ -1147,8 +1148,8 @@ in6_update_ifa(struct ifnet *ifp, struct * anyway. */ if (hostIsNew) { - ifa_free(&ia->ia_ifa); in6_unlink_ifa(ia, ifp); + ifa_free(&ia->ia_ifa); } return (error); @@ -1376,6 +1377,7 @@ in6_unlink_ifa(struct in6_ifaddr *ia, st ifa_free(&ia->ia_ifa); /* if_addrhead */ TAILQ_REMOVE(&V_in6_ifaddrhead, ia, ia_link); + ifa_free(&ia->ia_ifa); /* in6_ifaddrhead */ /* * Release the reference to the base prefix. There should be a @@ -1399,12 +1401,6 @@ in6_unlink_ifa(struct in6_ifaddr *ia, st pfxlist_onlink_check(); } - /* - * release another refcnt for the link from in6_ifaddr. - * Note that we should decrement the refcnt at least once for all *BSD. - */ - ifa_free(&ia->ia_ifa); - splx(s); }