From owner-svn-src-all@FreeBSD.ORG Mon Feb 4 09:58:54 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 37F6E290; Mon, 4 Feb 2013 09:58:54 +0000 (UTC) (envelope-from zec@fer.hr) Received: from mail.fer.hr (mail.fer.hr [161.53.72.233]) by mx1.freebsd.org (Postfix) with ESMTP id BF72D8A0; Mon, 4 Feb 2013 09:58:53 +0000 (UTC) Received: from sluga.fer.hr (161.53.72.14) by MAIL.fer.hr (161.53.72.233) with Microsoft SMTP Server id 14.1.438.0; Mon, 4 Feb 2013 10:58:49 +0100 Received: from localhost ([161.53.19.63]) by sluga.fer.hr over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Mon, 4 Feb 2013 10:58:49 +0100 From: Marko Zec To: Andriy Gapon Subject: Re: svn commit: r246245 - head/sys/netgraph Date: Mon, 4 Feb 2013 10:58:45 +0100 User-Agent: KMail/1.9.10 References: <201302021154.r12Bs0tp030831@svn.freebsd.org> <201302040927.43559.zec@fer.hr> <510F8287.7030708@FreeBSD.org> In-Reply-To: <510F8287.7030708@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-ID: <201302041058.45725.zec@fer.hr> X-OriginalArrivalTime: 04 Feb 2013 09:58:49.0441 (UTC) FILETIME=[3AD51D10:01CE02BE] Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, Mark Johnston , src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 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: Mon, 04 Feb 2013 09:58:54 -0000 On Monday 04 February 2013 10:42:31 Andriy Gapon wrote: > on 04/02/2013 10:27 Marko Zec said the following: > > On Monday 04 February 2013 08:41:32 Andriy Gapon wrote: > >> + /* Only ethernet interfaces are of interest. */ > >> + if (ifp->if_type != IFT_ETHER) > >> + return; > > > > And what about IFT_FDDI, IFT_XETHER, IFT_ISO88025, IFT_L2VLAN, > > IFT_BRIDGE, IFT_ARCNET, IFT_IEEE8023ADLAG, IFT_IEEE80211? > > Oh, I didn't realize that many drivers changed if_type after if_alloc. > Honestly, the networking code is not my strong skill, I ventured here > only because nobody else did... > > So what do you suggest? if_alloctype or a different approach? > I'd like to prevent if_l2com being mis-interpreted as struct arpcom. We already have this in vnet_ng_ether_init(): 865 TAILQ_FOREACH(ifp, &V_ifnet, if_link) { 866 if (ifp->if_type == IFT_ETHER 867 || ifp->if_type == IFT_L2VLAN) 868 ng_ether_attach(ifp); 869 } So at least in ng_ether_ifnet_arrival_event() we should do a check consistent to the above code. OTOH we don't check for interface types on entry into ng_ether_attach(), and perhaps a better strategy would be to move your ifp->if_type check there. Perhaps the check could be #defined as a macro to ensure consistency between vnet_ng_ether_init() and ng_ether_attach()? Marko