From owner-freebsd-bugs@FreeBSD.ORG Mon Oct 13 15:10:05 2008 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C0F9F10656FC for ; Mon, 13 Oct 2008 15:10:04 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 955D78FC1C for ; Mon, 13 Oct 2008 15:10:04 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id m9DFA4Oo053013 for ; Mon, 13 Oct 2008 15:10:04 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id m9DFA4PB053012; Mon, 13 Oct 2008 15:10:04 GMT (envelope-from gnats) Resent-Date: Mon, 13 Oct 2008 15:10:04 GMT Resent-Message-Id: <200810131510.m9DFA4PB053012@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, Sergey Matveychuk Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 183E31065698 for ; Mon, 13 Oct 2008 15:00:41 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 0775B8FC14 for ; Mon, 13 Oct 2008 15:00:41 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id m9DF0ex2065610 for ; Mon, 13 Oct 2008 15:00:40 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id m9DF0eaF065608; Mon, 13 Oct 2008 15:00:40 GMT (envelope-from nobody) Message-Id: <200810131500.m9DF0eaF065608@www.freebsd.org> Date: Mon, 13 Oct 2008 15:00:40 GMT From: Sergey Matveychuk To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: bin/128064: [ipfw][patch] ipfw -n nat N config caused error X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Oct 2008 15:10:05 -0000 >Number: 128064 >Category: bin >Synopsis: [ipfw][patch] ipfw -n nat N config caused error >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Oct 13 15:10:04 UTC 2008 >Closed-Date: >Last-Modified: >Originator: Sergey Matveychuk >Release: >Organization: >Environment: ipfw(8) does not check for -n flag when configured nat. >Description: ipfw -n nat N config caused an error because of an infinity loop. When -n flag specified ipfw should not do anything except syntax analyze. >How-To-Repeat: # ipfw -n nat 1 config if em0 ipfw: realloc: Cannot allocate memory >Fix: When it does nat config, it tries to show a result rule. pipe/queue config does not show resuls. I think nat config should not too. A patch in an attach. But If a committer who'll take the PR is not agree with me, he can apply a patch bellow: --- ipfw2.c.orig 2008-10-13 18:47:14.000000000 +0400 +++ ipfw2.c 2008-10-13 18:51:43.000000000 +0400 @@ -4067,6 +4067,9 @@ if (i) err(1, "setsockopt(%s)", "IP_FW_NAT_CFG"); + if (test_only) + return; + /* After every modification, we show the resultant rule. */ int _ac = 3; char *_av[] = {"show", "config", id}; Patch attached with submission follows: --- ipfw2.c.orig 2008-10-13 18:47:14.000000000 +0400 +++ ipfw2.c 2008-10-13 18:53:25.000000000 +0400 @@ -3855,9 +3855,6 @@ } static void -show_nat(int ac, char **av); - -static void print_nat_config(char *buf) { struct cfg_nat *n; int i, cnt, flag, off; @@ -4066,11 +4063,6 @@ i = do_cmd(IP_FW_NAT_CFG, buf, off); if (i) err(1, "setsockopt(%s)", "IP_FW_NAT_CFG"); - - /* After every modification, we show the resultant rule. */ - int _ac = 3; - char *_av[] = {"show", "config", id}; - show_nat(_ac, _av); } static void >Release-Note: >Audit-Trail: >Unformatted: