From owner-freebsd-net@FreeBSD.ORG Wed Jun 3 13:37:04 2015 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B9A46760 for ; Wed, 3 Jun 2015 13:37:04 +0000 (UTC) (envelope-from gpillai@vmware.com) Received: from smtp-outbound-1.vmware.com (smtp-outbound-1.vmware.com [208.91.2.12]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7C6311823 for ; Wed, 3 Jun 2015 13:37:04 +0000 (UTC) (envelope-from gpillai@vmware.com) Received: from sc9-mailhost2.vmware.com (sc9-mailhost2.vmware.com [10.113.161.72]) by smtp-outbound-1.vmware.com (Postfix) with ESMTP id 8E65928BD3 for ; Wed, 3 Jun 2015 06:31:38 -0700 (PDT) Received: from EX13-CAS-004.vmware.com (EX13-CAS-004.vmware.com [10.113.191.54]) by sc9-mailhost2.vmware.com (Postfix) with ESMTP id 8BF1BB02F0 for ; Wed, 3 Jun 2015 06:31:38 -0700 (PDT) Received: from EX13-MBX-TERM.vmware.com (10.113.191.143) by EX13-MBX-014.vmware.com (10.113.191.34) with Microsoft SMTP Server (TLS) id 15.0.913.22; Wed, 3 Jun 2015 06:31:38 -0700 Received: from EX13-MBX-018.vmware.com (10.113.191.38) by EX13-MBX-TERM.vmware.com (10.113.191.143) with Microsoft SMTP Server (TLS) id 15.0.913.22; Wed, 3 Jun 2015 06:31:25 -0700 Received: from EX13-MBX-018.vmware.com ([fe80::7cdc:b1ba:f507:8b02]) by EX13-MBX-018.vmware.com ([fe80::7cdc:b1ba:f507:8b02%15]) with mapi id 15.00.0913.011; Wed, 3 Jun 2015 06:31:07 -0700 From: Gopakumar Pillai To: "freebsd-net@freebsd.org" Subject: FreeBSD 8.x - ifa -> ifp refcount Thread-Topic: FreeBSD 8.x - ifa -> ifp refcount Thread-Index: AQHQngGLdHP5Ry4nnkua+5BDM/r4iA== Date: Wed, 3 Jun 2015 13:31:06 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.113.160.246] MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Jun 2015 13:37:04 -0000 Hi, I am using FreeBSD 8.x with some modifications. The question I have is that no reference count is taken when ifa is pointed= to ifp. There are cases when I encounter issues like ifa is alive and has = a pointer to ifp, but ifp itself is deleted. Looks like we expect all ifa entries to be gone when ifp is being deleted. = In FreeBSD 8.x we store the ifa address inside mbufs (for IPv6), which take= s an ifa refcount when one accesses it (but not when added, which is probab= ly wrong). Hence there are more chances that the mbuf may be around (and t= he ifa) when an interface is being deleted. Solution: Was thinking of incrementing the refcount of ifp when ifa points = to it, thus the ifp goes away only after the last ifa (or the last mbuf wit= h the ifa pointer) is gone. I do not see that FreeBSD 11.x is doing this either. There must be a reason= as to why it is so. Can one of the gurus explain why it is so or whether = I am wrong in my assumption. Thank You -Gopu