From owner-freebsd-questions Tue Nov 20 13:33:43 2001 Delivered-To: freebsd-questions@freebsd.org Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by hub.freebsd.org (Postfix) with ESMTP id 735FC37B416 for ; Tue, 20 Nov 2001 13:33:41 -0800 (PST) Received: (from dan@localhost) by dan.emsphone.com (8.11.6/8.11.6) id fAKLXa769468; Tue, 20 Nov 2001 15:33:36 -0600 (CST) (envelope-from dan) Date: Tue, 20 Nov 2001 15:33:35 -0600 From: Dan Nelson To: Sheldon Hearn Cc: freebsd-questions@FreeBSD.ORG Subject: Re: Specififying IPFW unpriveleged port ranges with a mask Message-ID: <20011120213335.GA44741@dan.emsphone.com> References: <20011120193021.GE13254@dan.emsphone.com> <6463.1006291210@axl.seasidesoftware.co.za> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6463.1006291210@axl.seasidesoftware.co.za> User-Agent: Mutt/1.3.23.2i X-OS: FreeBSD 5.0-CURRENT X-message-flag: Outlook Error Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG In the last episode (Nov 20), Sheldon Hearn said: > On Tue, 20 Nov 2001 13:30:21 CST, Dan Nelson wrote: > > How about just use range syntax: 1024-65535? I'm not sure why > > someone would want to use port:mask notation. > > Because of the IP_FW_MAX_PORTS limitation? See ipfw(8). Have I > misunderstood the page? To store a port range or port:mask, ipfw uses 2 entries in the ports array to store lo+hi, or port+mask, and sets a bit in the rule's 'flags' field saying "first 2 ports are a range / mask". Take a look at /usr/include/netinet/ip_fw.h, and the flags: IP_FW_F_SRNG IP_FW_F_DRNG IP_FW_F_SMSK IP_FW_F_DMSK A side-effect of this is that you may only use a one range or port:mask clause (and not both) in each rule, and up to IP_FW_MAX_PORTS-2 other ports. -- Dan Nelson dnelson@allantgroup.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message