From owner-freebsd-bugs@FreeBSD.ORG Mon Jul 14 02:10:09 2003 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7604637B401 for ; Mon, 14 Jul 2003 02:10:09 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id D0BCD43FCB for ; Mon, 14 Jul 2003 02:10:07 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with ESMTP id h6E9A7Up084412 for ; Mon, 14 Jul 2003 02:10:07 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.9/8.12.9/Submit) id h6E9A7Tq084411; Mon, 14 Jul 2003 02:10:07 -0700 (PDT) Resent-Date: Mon, 14 Jul 2003 02:10:07 -0700 (PDT) Resent-Message-Id: <200307140910.h6E9A7Tq084411@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, HATANOU Tomomi Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 32A7E37B401 for ; 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 ; 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 To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 cc: hatanou@infolab.ne.jp Subject: bin/54467: ipfw command (ipfw2) does not accept comments in rule-file. X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: HATANOU Tomomi List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Jul 2003 09:10:09 -0000 >Number: 54467 >Category: bin >Synopsis: ipfw command (ipfw2) does not accept comments in rule-file. >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Jul 14 02:10:07 PDT 2003 >Closed-Date: >Last-Modified: >Originator: HATANOU Tomomi >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: >Unformatted: