From hatanou@infolab.ne.jp  Mon Jul 14 02:00:36 2003
Return-Path: <hatanou@infolab.ne.jp>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 32A7E37B401
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 14 Jul 2003 02:00:36 -0700 (PDT)
Received: from ryoko.infolab.ne.jp (ryoko.infolab.ne.jp [210.166.231.77])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 275C743FCB
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 14 Jul 2003 02:00:35 -0700 (PDT)
	(envelope-from hatanou@infolab.ne.jp)
Received: from ryoko.infolab.ne.jp (localhost [127.0.0.1])
	by ryoko.infolab.ne.jp (8.12.9/8.12.9) with ESMTP id h6E90Xft000974;
	Mon, 14 Jul 2003 18:00:33 +0900 (JST)
	(envelope-from hatanou@ryoko.infolab.ne.jp)
Received: (from hatanou@localhost)
	by ryoko.infolab.ne.jp (8.12.9/8.12.9/Submit) id h6E90XtZ000973;
	Mon, 14 Jul 2003 18:00:33 +0900 (JST)
	(envelope-from hatanou)
Message-Id: <200307140900.h6E90XtZ000973@ryoko.infolab.ne.jp>
Date: Mon, 14 Jul 2003 18:00:33 +0900 (JST)
From: HATANOU Tomomi <hatanou@infolab.ne.jp>
Reply-To: HATANOU Tomomi <hatanou@infolab.ne.jp>
To: FreeBSD-gnats-submit@freebsd.org
Cc: hatanou@infolab.ne.jp
Subject: ipfw command (ipfw2) does not accept comments in rule-file.
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         54467
>Category:       bin
>Synopsis:       ipfw command (ipfw2) does not accept comments in rule-file.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    luigi
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jul 14 02:10:07 PDT 2003
>Closed-Date:    Mon Jul 14 02:28:45 PDT 2003
>Last-Modified:  Mon Jul 14 02:28:45 PDT 2003
>Originator:     HATANOU Tomomi <hatanou@infolab.ne.jp>
>Release:        FreeBSD 5.1-CURRENT i386
>Organization:
Infolab, inc.
>Environment:
System: FreeBSD ryoko.infolab.ne.jp 5.1-CURRENT FreeBSD 5.1-CURRENT #0: Sun Jul 13 17:31:11 JST 2003 hatanou@ryoko.infolab.ne.jp:/usr/obj/usr/src/sys/LETSNOTE i386
	Panasonic CF-B5FR notebook w/ 192M RAM

>Description:
	ipfw2 does not accept comments, beginning with '#' character,
	in firewall rule file.  Instead, it shows usage.

>How-To-Repeat:
	Put comments in your firewall-rule file, and try:

# ipfw /path/to/your/rulefile

	And you will get the message:

usage: ipfw [options]
do "ipfw -h" or see ipfw manpage for details

>Fix:
	Apply this patch.

--- ipfw2.c.orig	Sat Jul 12 19:26:36 2003
+++ ipfw2.c	Mon Jul 14 17:39:52 2003
@@ -3897,10 +3897,22 @@
 	while (fgets(buf, BUFSIZ, f)) {		/* read commands */
 		char linename[10];
 		char *args[1];
+		char *p;
 
 		lineno++;
 		sprintf(linename, "Line %d", lineno);
 		setprogname(linename); /* XXX */
+
+		/* Check comment */
+		if ((p = strchr(buf, '#'))) {
+			*p = '\0';
+		}
+
+		/* Ignore whitespace-only line */
+		for (p = buf; *p == ' '; p++);
+		if (*p == '\0')
+			continue;
+
 		args[0] = buf;
 		ipfw_main(1, args);
 	}

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->luigi 
Responsible-Changed-By: maxim 
Responsible-Changed-When: Mon Jul 14 02:16:01 PDT 2003 
Responsible-Changed-Why:  
Luigi, it looks like the bug correlates with your recent changes. 
Could you please take a look at it? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=54467 
State-Changed-From-To: open->closed 
State-Changed-By: luigi 
State-Changed-When: Mon Jul 14 02:27:48 PDT 2003 
State-Changed-Why:  
just committed a fix for this bug. 


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