From owner-freebsd-net@FreeBSD.ORG Fri Dec 26 12:00:02 2003 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2E92C16A4CE for ; Fri, 26 Dec 2003 12:00:02 -0800 (PST) Received: from relay.pair.com (relay.pair.com [209.68.1.20]) by mx1.FreeBSD.org (Postfix) with SMTP id 5D5DF43D3F for ; Fri, 26 Dec 2003 12:00:00 -0800 (PST) (envelope-from silby@silby.com) Received: (qmail 15704 invoked from network); 26 Dec 2003 19:59:58 -0000 Received: from niwun.pair.com (HELO localhost) (209.68.2.70) by relay.pair.com with SMTP; 26 Dec 2003 19:59:58 -0000 X-pair-Authenticated: 209.68.2.70 Date: Fri, 26 Dec 2003 13:59:57 -0600 (CST) From: Mike Silbersack To: Brett Glass In-Reply-To: <6.0.0.22.2.20031223023730.037cbd28@localhost> Message-ID: <20031226135400.D22953@odysseus.silby.com> References: <200312120312.UAA10720@lariat.org> <20031212074519.GA23452@pit.databus.com> <20031212083522.GA24267@pit.databus.com> <20031212181944.GA33245@pit.databus.com> <20031213001913.GA40544@pit.databus.com> <20031222182913.M2799@odysseus.silby.com> <6.0.0.22.2.20031222222449.03cd58c8@localhost> <6.0.0.22.2.20031223023730.037cbd28@localhost> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: Barney Wolff cc: net@freebsd.org Subject: Re: Controlling ports used by natd X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Dec 2003 20:00:02 -0000 On Tue, 23 Dec 2003, Brett Glass wrote: > At 02:29 AM 12/23/2003, Mike Silbersack wrote: > > >I think that it might be best to keep choosing ports inside of libalias. > >Adding yet another port range would just complicate the kernel more > >without much benefit. > > Actually, it would just change the code in libalias. It wouldn't > change the kernel at all, except that it would make two 16-bit > unsigned quantities available to libalias. (These variables > might be instanced in jails, by the way.) Ah, so you want a central location for all users of libalias to pull settings from. I think that might be better served by a /etc/libalias.conf or something. > Hmmm.... If you want to do this, It might be better to make a global > bitmap whose contents are set by whatever firewall is in operation (IPFW, > ipf, pf) and then masked by allowed port ranges. This would be a simple, > fixed overhead operation. And it would probably speed the random, > nondeterministic process via which libalias currentl picks a port. Yes, > it'd waste some ports if you had snaky firewall rules that only sometimes > blocked a port. But it's not worth the time it would take to test all the > rules, which might depend on src/dst addresses, etc. > > --Brett The problem is that a bitmap is really too simplistic, because you might allow certain ports to certain IPs and not others. I don't think the overhead of checking ipfw would be too great, considering that every packet would normally go through all those rules anyway; my concern is simply that ipfw / ipf do not have a "test" function that will run without a real packet being passed. Well, in any case, I don't have time to work on this project anytime soon. If one of you guys can come up with some relatively simple solution to the problem (perhaps some simple comma-delimited sysctl which lists ports to deny) that works, I'd be happy to look into merging it. Mike "Silby" Silbersack