From owner-svn-src-head@FreeBSD.ORG Tue Oct 14 17:53:27 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 33E90106568A; Tue, 14 Oct 2008 17:53:27 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2172D8FC16; Tue, 14 Oct 2008 17:53:27 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9EHrRuv012476; Tue, 14 Oct 2008 17:53:27 GMT (envelope-from maxim@svn.freebsd.org) Received: (from maxim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9EHrQUF012474; Tue, 14 Oct 2008 17:53:26 GMT (envelope-from maxim@svn.freebsd.org) Message-Id: <200810141753.m9EHrQUF012474@svn.freebsd.org> From: Maxim Konovalov Date: Tue, 14 Oct 2008 17:53:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r183889 - head/sbin/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Oct 2008 17:53:27 -0000 Author: maxim Date: Tue Oct 14 17:53:26 2008 New Revision: 183889 URL: http://svn.freebsd.org/changeset/base/183889 Log: o Do nothing in show_nat() for a test mode (-n). This prevents show_nat() from endless loop and makes work ipfw -n nat <...>. PR: bin/128064 Submitted by: sem MFC after: 1 month Modified: head/sbin/ipfw/ipfw2.c Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Tue Oct 14 17:48:36 2008 (r183888) +++ head/sbin/ipfw/ipfw2.c Tue Oct 14 17:53:26 2008 (r183889) @@ -3856,9 +3856,6 @@ nospace: } 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 @@ config_nat(int ac, char **av) 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 @@ -6035,6 +6027,9 @@ show_nat(int ac, char **av) lrule = IPFW_DEFAULT_RULE; /* max ipfw rule number */ ac--; av++; + if (test_only) + return; + /* Parse parameters. */ for (cmd = IP_FW_NAT_GET_LOG, do_cfg = 0; ac != 0; ac--, av++) { if (!strncmp(av[0], "config", strlen(av[0]))) { @@ -6059,6 +6054,7 @@ show_nat(int ac, char **av) if (do_cmd(cmd, data, (uintptr_t)&nbytes) < 0) err(EX_OSERR, "getsockopt(IP_FW_GET_%s)", (cmd == IP_FW_NAT_GET_LOG) ? "LOG" : "CONFIG"); + printf("nbytes %b\n", nbytes); } if (nbytes == 0) exit(0);