svn commit: r241908 - head/sys/netpfil/ipfw

Alexander V. Chernikov melifaro at FreeBSD.org
Mon Oct 22 19:22:32 UTC 2012


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;


More information about the svn-src-head mailing list