From owner-p4-projects@FreeBSD.ORG Mon Oct 16 21:15:11 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id B071816A492; Mon, 16 Oct 2006 21:15:11 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6D07A16A47B for ; Mon, 16 Oct 2006 21:15:11 +0000 (UTC) (envelope-from piso@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 198C343D46 for ; Mon, 16 Oct 2006 21:15:11 +0000 (GMT) (envelope-from piso@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k9GLFAh7084565 for ; Mon, 16 Oct 2006 21:15:10 GMT (envelope-from piso@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k9GLFAkg084562 for perforce@freebsd.org; Mon, 16 Oct 2006 21:15:10 GMT (envelope-from piso@freebsd.org) Date: Mon, 16 Oct 2006 21:15:10 GMT Message-Id: <200610162115.k9GLFAkg084562@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to piso@freebsd.org using -f From: Paolo Pisati To: Perforce Change Reviews Cc: Subject: PERFORCE change 107999 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Oct 2006 21:15:12 -0000 http://perforce.freebsd.org/chv.cgi?CH=107999 Change 107999 by piso@piso_newluxor on 2006/10/16 21:14:16 Start moving nat_chain under layer3_chain. Affected files ... .. //depot/projects/soc2005/libalias/sys/netinet/ip_fw2.c#20 edit Differences ... ==== //depot/projects/soc2005/libalias/sys/netinet/ip_fw2.c#20 (text+ko) ==== @@ -137,6 +137,7 @@ struct ip_fw_chain { struct ip_fw *rules; /* list of rules */ struct ip_fw *reap; /* list of rules to reap */ + LIST_HEAD(, cfg_nat) nat; /* list of nat entries */ struct radix_node_head *tables[IPFW_TABLES_MAX]; struct rwlock rwmtx; }; @@ -305,7 +306,6 @@ MODULE_DEPEND(ipfw, libalias, 1, 1, 1); struct rwlock nat_chain_rwl; -LIST_HEAD(nat_chain, cfg_nat) nat_chain = LIST_HEAD_INITIALIZER(foo); #define NAT_LOCK_INIT(_chain) \ rw_init(_chain, "NAT instances") @@ -2066,7 +2066,7 @@ lookup_nat(const int i) { struct cfg_nat *ptr; - LIST_FOREACH(ptr, &nat_chain, _next) + LIST_FOREACH(ptr, &layer3_chain.nat, _next) if (ptr->id == i) return(ptr); return (NULL); @@ -4321,7 +4321,7 @@ NAT_WLOCK(&nat_chain_rwl); /* Check every nat entry... */ - LIST_FOREACH(ptr, &nat_chain, _next) { + LIST_FOREACH(ptr, &layer3_chain.nat, _next) { /* ...using nic 'ifp->if_xname' as dynamic alias address. */ if (strncmp(ptr->if_name, ifp->if_xname, IF_NAMESIZE) == 0) { mtx_lock(&ifp->if_addr_mtx); @@ -4624,7 +4624,7 @@ ptr); /* Add new entries. */ free(buf, M_IPFW); NAT_WLOCK(&nat_chain_rwl); - HOOK_NAT(&nat_chain, ptr); + HOOK_NAT(&layer3_chain.nat, ptr); NAT_WUNLOCK(&nat_chain_rwl); } break; @@ -4667,7 +4667,7 @@ return (ENOSPC); NAT_RLOCK(&nat_chain_rwl); /* Serialize all the data. */ - LIST_FOREACH(n, &nat_chain, _next) { + LIST_FOREACH(n, &layer3_chain.nat, _next) { nat_cnt++; if (off + sof_nat < NAT_BUF_LEN) { bcopy(n, &data[off], sof_nat); @@ -4710,7 +4710,7 @@ NAT_RLOCK(&nat_chain_rwl); size = i = 0; - LIST_FOREACH(ptr, &nat_chain, _next) { + LIST_FOREACH(ptr, &layer3_chain.nat, _next) { if (ptr->lib->logDesc == NULL) continue; cnt++; @@ -4903,6 +4903,7 @@ ip_fw_ctl_ptr = ipfw_ctl; ip_fw_chk_ptr = ipfw_chk; callout_reset(&ipfw_timeout, hz, ipfw_tick, NULL); + LIST_INIT(&layer3_chain.nat); NAT_LOCK_INIT(&nat_chain_rwl); ifaddr_event_tag = EVENTHANDLER_REGISTER(ifaddr_event, ifaddr_change, NULL, EVENTHANDLER_PRI_ANY); @@ -4921,7 +4922,7 @@ IPFW_WLOCK(&layer3_chain); flush_tables(&layer3_chain); NAT_WLOCK(&nat_chain_rwl); - LIST_FOREACH_SAFE(ptr, &nat_chain, _next, ptr_temp) { + LIST_FOREACH_SAFE(ptr, &layer3_chain.nat, _next, ptr_temp) { LIST_REMOVE(ptr, _next); del_redir_spool_cfg(ptr, &ptr->redir_chain); LibAliasUninit(ptr->lib);