From owner-cvs-all@FreeBSD.ORG Thu Aug 18 18:36:45 2005 Return-Path: X-Original-To: cvs-all@FreeBSD.org Delivered-To: cvs-all@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9E19A16A4D8; Thu, 18 Aug 2005 18:36:44 +0000 (GMT) (envelope-from brooks@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2852643D69; Thu, 18 Aug 2005 18:36:40 +0000 (GMT) (envelope-from brooks@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id j7IIadvK058646; Thu, 18 Aug 2005 18:36:39 GMT (envelope-from brooks@repoman.freebsd.org) Received: (from brooks@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id j7IIadbw058645; Thu, 18 Aug 2005 18:36:39 GMT (envelope-from brooks) Message-Id: <200508181836.j7IIadbw058645@repoman.freebsd.org> From: Brooks Davis Date: Thu, 18 Aug 2005 18:36:39 +0000 (UTC) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Cc: Subject: cvs commit: src/sys/net if.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2005 18:36:45 -0000 brooks 2005-08-18 18:36:39 UTC FreeBSD src repository Modified files: sys/net if.c Log: When we started calling if_findindex() from if_alloc() with an empty struct ifnet most of if_findindex() become a complex no-op. Remove it and replace it with a corrected version of the four line for loop it devolved to plus some error handling. This should probably be replaced with subr_unit at some point. Switch from checking ifaddr_byindex to ifnet_byindex when looking for empty indexes. Since we're doing this from if_alloc/if_free, we can only be sure that ifnet_byindex will be correct. This fixes panics when loading the ef(4) module. The panics were caused by the fact that if_alloc was called four time before if_attach was called and thus ifaddr_byindex was not set and the same unit was allocated again. This in turn caused the first if_attach to fail because the ifp was not the one in ifnet_byindex(ifp->if_index). Reported by: "Wojciech A. Koszek" PR: kern/84987 MFC After: 1 day Revision Changes Path 1.244 +16 -56 src/sys/net/if.c