From owner-freebsd-current Mon May 18 19:38:38 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id TAA16024 for freebsd-current-outgoing; Mon, 18 May 1998 19:38:38 -0700 (PDT) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from implode.root.com (implode.root.com [198.145.90.17]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id TAA15918 for ; Mon, 18 May 1998 19:37:59 -0700 (PDT) (envelope-from root@implode.root.com) Received: from implode.root.com (localhost [127.0.0.1]) by implode.root.com (8.8.5/8.8.5) with ESMTP id TAA11949; Mon, 18 May 1998 19:38:02 -0700 (PDT) Message-Id: <199805190238.TAA11949@implode.root.com> To: Luigi Rizzo cc: current@FreeBSD.ORG Subject: Re: struct ifnet handling... In-reply-to: Your message of "Mon, 18 May 1998 16:58:54 +0200." <199805181458.QAA07273@labinfo.iet.unipi.it> From: David Greenman Reply-To: dg@root.com Date: Mon, 18 May 1998 19:38:02 -0700 Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG >While trying to optimise interface matches in the firewall code (see >below), i noticed that there is no if_detach() call. This would be >consistent with the absence of reference counts for the "struct >ifnet" . Can i safely assume that this will continue to be true >in the future ? > >The reason i am interested in this: currently, interface names in the >firewall code are done using strncmp(). However, if interfaces are >never deallocated, one can > 1) make sure that two interface with the same name also have the > same pointer in if_name (this actually already happens, since the > code to initialize it is the same e.g. > > ifp->if_name = "tun" ; > > but i realized that after writing the 10 lines or so to implement > it). > > 2) when adding ipfw rules, match the string passed as the interface > name with some of the if_name fields (possibly returning an error > if the name does not match any of the existing ones) and replace > the string with a pointer to the same string as used in struct > ifnet. > >When this is done, matching interface names requires only a pointer >comparison (and furthermore, a NULL pointer can be used as an >indication that no interface match is required). > >Comments ? I think depending on there being no if_detach in the future would be a mistake. With PCCARD and hot-swap PCI, it seems likely that a mechanism for removing ifnet's will be necessary at some point. -DG David Greenman Co-founder/Principal Architect, The FreeBSD Project To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message