From owner-cvs-src@FreeBSD.ORG Mon Feb 2 16:06:38 2004 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4179916A4E2; Mon, 2 Feb 2004 16:06:38 -0800 (PST) Received: from odin.ac.hmc.edu (Odin.AC.HMC.Edu [134.173.32.75]) by mx1.FreeBSD.org (Postfix) with ESMTP id 618C043D3F; Mon, 2 Feb 2004 16:06:34 -0800 (PST) (envelope-from brdavis@odin.ac.hmc.edu) Received: from odin.ac.hmc.edu (IDENT:brdavis@localhost.localdomain [127.0.0.1]) by odin.ac.hmc.edu (8.12.10/8.12.3) with ESMTP id i1306N2h026043; Mon, 2 Feb 2004 16:06:26 -0800 Received: (from brdavis@localhost) by odin.ac.hmc.edu (8.12.10/8.12.3/Submit) id i1306MqR026033; Mon, 2 Feb 2004 16:06:22 -0800 Date: Mon, 2 Feb 2004 16:06:22 -0800 From: Brooks Davis To: Andre Oppermann Message-ID: <20040203000622.GA19568@Odin.AC.HMC.Edu> References: <200402022253.i12MrGkO091411@repoman.freebsd.org> <20040202232614.GA24019@Odin.AC.HMC.Edu> <401EE109.D45B606@freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="HlL+5n6rz5pIUxbD" Content-Disposition: inline In-Reply-To: <401EE109.D45B606@freebsd.org> User-Agent: Mutt/1.5.4i X-Virus-Scanned: by amavisd-milter (http://amavis.org/) on odin.ac.hmc.edu cc: Brooks Davis cc: cvs-src@freebsd.org cc: src-committers@freebsd.org cc: cvs-all@freebsd.org Subject: Re: cvs commit: src/sys/netinet ip_icmp.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Feb 2004 00:06:38 -0000 --HlL+5n6rz5pIUxbD Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Feb 03, 2004 at 12:45:13AM +0100, Andre Oppermann wrote: > Brooks Davis wrote: > >=20 > > On Mon, Feb 02, 2004 at 02:53:16PM -0800, Andre Oppermann wrote: > > > andre 2004/02/02 14:53:16 PST > > > > > > FreeBSD src repository > > > > > > Modified files: > > > sys/netinet ip_icmp.c > > > Log: > > > Add sysctl net.inet.icmp.reply_src to specify the interface name > > > used for the ICMP reply source in reponse to packets which are not > > > directly addressed to us. By default continue with with normal > > > source selection. > >=20 > > Please consider storing the interface index rather then the name. It is > > much cheaper to go from index to ifp then name to ifp and the index will > > be invariant as long as the interface exists. Sometime in the next week > > the name will no longer be invariant. >=20 > I considered storing the ifp but the moment a stored ipf disappears > you get an instant panic. There is no way to verify if the interface > pointer is still valid. And with interface cloning I considered the > panic risk too high. The only other way would be to check the ifp every > time a interface is manipulated and to purge the ifp if its interface is > gone. I thought that was too intrusive. I'm not sugguesting caching the ifp. I'm suggesting storing the value of ifp->if_index. You then use ifnet_byindex to get then the ifp when needed. You have to check that it isn't NULL, but you should to be doing that for the ifunit() call as well since it will return NULL and cause a panic if the admin makes a typo. As Juli commented, a SYSCTL_PROC to allow the administrator to get/set the interface by name is probably the right approach. -- Brooks --=20 Any statement of the form "X is the one, true Y" is FALSE. PGP fingerprint 655D 519C 26A7 82E7 2529 9BF0 5D8E 8BE9 F238 1AD4 --HlL+5n6rz5pIUxbD Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQFAHuX9XY6L6fI4GtQRAhX0AJ0SUxcyO/Mni2/v4p2Dc2uIEkfIrwCgj/3L iXiM97LVw0m6QG6yJDNlFmM= =8AF4 -----END PGP SIGNATURE----- --HlL+5n6rz5pIUxbD--