From owner-svn-src-head@FreeBSD.ORG Mon Oct 22 19:22:32 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9EE28424; Mon, 22 Oct 2012 19:22:32 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 854E98FC16; Mon, 22 Oct 2012 19:22:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q9MJMWQb085465; Mon, 22 Oct 2012 19:22:32 GMT (envelope-from melifaro@svn.freebsd.org) Received: (from melifaro@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q9MJMWBl085463; Mon, 22 Oct 2012 19:22:32 GMT (envelope-from melifaro@svn.freebsd.org) Message-Id: <201210221922.q9MJMWBl085463@svn.freebsd.org> From: "Alexander V. Chernikov" Date: Mon, 22 Oct 2012 19:22:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r241908 - head/sys/netpfil/ipfw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 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: Mon, 22 Oct 2012 19:22:32 -0000 Author: melifaro Date: Mon Oct 22 19:22:31 2012 New Revision: 241908 URL: http://svn.freebsd.org/changeset/base/241908 Log: Remove unnecessary chain read lock in ipfw nat 'global' code. Document case when ipfw chain lock must be held while calling ipfw_nat(). MFC after: 2 weeks Modified: head/sys/netpfil/ipfw/ip_fw_nat.c Modified: head/sys/netpfil/ipfw/ip_fw_nat.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_nat.c Mon Oct 22 19:06:00 2012 (r241907) +++ head/sys/netpfil/ipfw/ip_fw_nat.c Mon Oct 22 19:22:31 2012 (r241908) @@ -202,6 +202,13 @@ add_redir_spool_cfg(char *buf, struct cf } } +/* + * ipfw_nat - perform mbuf header translation. + * + * Note V_layer3_chain has to be locked while calling ipfw_nat() in + * 'global' operation mode (t == NULL). + * + */ static int ipfw_nat(struct ip_fw_args *args, struct cfg_nat *t, struct mbuf *m) { @@ -269,7 +276,6 @@ ipfw_nat(struct ip_fw_args *args, struct found = 0; chain = &V_layer3_chain; - IPFW_RLOCK(chain); /* Check every nat entry... */ LIST_FOREACH(t, &chain->nat, _next) { if ((t->mode & PKT_ALIAS_SKIP_GLOBAL) != 0) @@ -282,7 +288,6 @@ ipfw_nat(struct ip_fw_args *args, struct break; } } - IPFW_RUNLOCK(chain); if (found != 1) { /* No instance found, return ignore */ args->m = mcl;