From owner-freebsd-current Mon May 18 13:21:49 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id NAA22935 for freebsd-current-outgoing; Mon, 18 May 1998 13:21:49 -0700 (PDT) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from alpo.whistle.com (alpo.whistle.com [207.76.204.38]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id NAA22851 for ; Mon, 18 May 1998 13:21:24 -0700 (PDT) (envelope-from julian@whistle.com) Received: (from daemon@localhost) by alpo.whistle.com (8.8.5/8.8.5) id NAA16259; Mon, 18 May 1998 13:11:23 -0700 (PDT) Received: from current1.whistle.com(207.76.205.22) via SMTP by alpo.whistle.com, id smtpd016244; Mon May 18 20:11:18 1998 Date: Mon, 18 May 1998 13:11:11 -0700 (PDT) From: Julian Elischer To: Luigi Rizzo cc: current@FreeBSD.ORG Subject: Re: struct ifnet handling... In-Reply-To: <199805181458.QAA07273@labinfo.iet.unipi.it> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG NO I have reference counting patches checked in in a branch called WHISTLE_NET_BRANCH_1 (e.g. check out the cvs log for if.c, route.c and a few others.) It's absolutly needed for dynamic interfaces (endpoints) julian On Mon, 18 May 1998, Luigi Rizzo wrote: > 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 ? > > cheers > luigi > -----------------------------+-------------------------------------- > Luigi Rizzo | Dip. di Ingegneria dell'Informazione > email: luigi@iet.unipi.it | Universita' di Pisa > tel: +39-50-568533 | via Diotisalvi 2, 56126 PISA (Italy) > fax: +39-50-568522 | http://www.iet.unipi.it/~luigi/ > _____________________________|______________________________________ > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-current" in the body of the message > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message