From nicko@stbernard.com  Wed Jul  7 21:13:36 2004
Return-Path: <nicko@stbernard.com>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 4FBC516A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Wed,  7 Jul 2004 21:13:36 +0000 (GMT)
Received: from mail01.stbernard.com (mail01.stbernard.com [199.245.188.4])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 2CD9E43D53
	for <FreeBSD-gnats-submit@freebsd.org>; Wed,  7 Jul 2004 21:13:36 +0000 (GMT)
	(envelope-from nicko@stbernard.com)
Received: from greenroom.rapid.stbernard.com ([192.168.3.6]) by mail01.stbernard.com with Microsoft SMTPSVC(5.0.2195.6713);
	 Wed, 7 Jul 2004 14:13:35 -0700
Message-Id: <20040707141211.B9678@greenroom.rapid.stbernard.com>
Date: Wed, 7 Jul 2004 14:13:05 -0700 (PDT)
From: Nicolas Dehaine <nicko@stbernard.com>
To: FreeBSD-gnats-submit@freebsd.org
Subject: Incorrect parsing of 0.0.0.0/0 as 'me' in ipfw(8) (fwd)

>Number:         68785
>Category:       bin
>Synopsis:       Incorrect parsing of 0.0.0.0/0 as 'me' in ipfw(8)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jul 07 21:20:23 GMT 2004
>Closed-Date:    Thu Jul 08 03:49:51 GMT 2004
>Last-Modified:  Thu Jul 08 03:49:51 GMT 2004
>Originator:     Nicolas Dehaine
>Release:        FreeBSD 5.2.1-RELEASE i386
>Organization:
St Bernard
>Environment:
System: FreeBSD nks 5.2.1-RELEASE FreeBSD 5.2.1-RELEASE #0: Tue Apr 20 15:49:16 PDT 2004 root@nks:/usr/src/sys/i386/compile/KERNEL i386


>Description:
	ipfw(8) parses 0.0.0.0/0 as "me" instead of "any" when adding a forward rule
>How-To-Repeat:
	/sbin/ipfw "add fwd 127.0.0.1,80 tcp from 0.0.0.0/0 to 0.0.0.0/0 dst-port 80 in via fxp1"
	00100 fwd 127.0.0.1 tcp from me to me dst-port 80 in via fxp1
>Fix:

The following works for me :

Index: ipfw2.c
===================================================================
RCS file: /usr/cvsroot/freebsd5/src/sbin/ipfw/ipfw2.c,v
retrieving revision 1.1.1.2
diff -c -r1.1.1.2 ipfw2.c
*** ipfw2.c     18 Mar 2004 02:10:47 -0000      1.1.1.2
--- ipfw2.c     7 Jul 2004 16:51:12 -0000
***************
*** 2040,2045 ****
--- 2040,2048 ----
			if (av == NULL && len == 0) /* only this entry */
				errx(EX_DATAERR, "not any never matches");
		}
+		/* if x.x.x.x/0 is the only entry, return any */
+		if (av == NULL && len == 0) /* only this entry */
+			return;
		/* else do nothing and skip this entry */
		continue;
	}

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: maxim 
State-Changed-When: Thu Jul 8 03:48:40 GMT 2004 
State-Changed-Why:  
Fixed in rev. 1.46 sbin/ipfw/ipfw2.c three months ago. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=68785 
>Unformatted:
