From owner-freebsd-isp@FreeBSD.ORG Fri Feb 27 02:04:07 2004 Return-Path: Delivered-To: freebsd-isp@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B427416A4CE for ; Fri, 27 Feb 2004 02:04:07 -0800 (PST) Received: from cell.sick.ru (cell.sick.ru [217.72.144.68]) by mx1.FreeBSD.org (Postfix) with ESMTP id C47DE43D1D for ; Fri, 27 Feb 2004 02:04:06 -0800 (PST) (envelope-from glebius@cell.sick.ru) Received: from cell.sick.ru (glebius@localhost [127.0.0.1]) by cell.sick.ru (8.12.9/8.12.8) with ESMTP id i1RA3vQE098077 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 27 Feb 2004 13:03:57 +0300 (MSK) (envelope-from glebius@cell.sick.ru) Received: (from glebius@localhost) by cell.sick.ru (8.12.9/8.12.6/Submit) id i1RA3sAT098076; Fri, 27 Feb 2004 13:03:55 +0300 (MSK) Date: Fri, 27 Feb 2004 13:03:54 +0300 From: Gleb Smirnoff To: fingers Message-ID: <20040227100354.GA98027@cell.sick.ru> References: <20040121114502.GC17802@cell.sick.ru> <20040227102010.O41530@snow.fingers.co.za> <20040227083539.GA97550@cell.sick.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <20040227083539.GA97550@cell.sick.ru> User-Agent: Mutt/1.5.6i cc: freebsd-isp@freebsd.org Subject: Re: ng_netflow: testers are welcome X-BeenThere: freebsd-isp@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Internet Services Providers List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Feb 2004 10:04:07 -0000 On Fri, Feb 27, 2004 at 11:35:39AM +0300, Gleb Smirnoff wrote: T> Dear fingers, T> T> the routing API has changed since 5.1 and release 0.2.1 crashes T> on CURRENT. To fix this you should get netflow.c rev 1.7 from T> anonymous CVS (or WebCVS) on http://SourceForge.net/projects/ng-netflow. SF.net hasn't yet synchronized its anonCVS with development CVS. I've already received two complaints about crashing, so I'll post patch here. -- Totus tuus, Glebius. GLEBIUS-RIPN GLEB-RIPE Index: netflow.c =================================================================== RCS file: /cvsroot/ng-netflow/ng_netflow/ng_netflow/netflow.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- netflow.c 14 Feb 2004 22:26:31 -0000 1.6 +++ netflow.c 24 Feb 2004 19:10:24 -0000 1.7 @@ -31,11 +31,11 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: netflow.c,v 1.6 2004/02/14 22:26:31 glebius Exp $ + * $Id: netflow.c,v 1.7 2004/02/24 19:10:24 glebius Exp $ */ static const char rcs_id[] = - "@(#) $Id: netflow.c,v 1.6 2004/02/14 22:26:31 glebius Exp $"; + "@(#) $Id: netflow.c,v 1.7 2004/02/24 19:10:24 glebius Exp $"; #include #include @@ -204,15 +204,6 @@ fle->i_ifx = iface->info.if_index; - /* The problem is that rtalloc() family returns cloned host - * route, which does not have mask at all. We will try to look - * for mask in the rt_parent route, from which this host route - * was cloned. Sometime this fails, particularly when destination - * is local. - * XXX: we must look for better way to implement route lookups. - * May be try to dig into radix ourselves? - */ - /* First we do route table lookup on destination address. So we can * fill in out_ifx, dst_mask, nexthop, and dst_as in future releases. */ @@ -221,15 +212,14 @@ sin->sin_len = sizeof(*sin); sin->sin_family = AF_INET; sin->sin_addr = fle->r.r_dst; - rtalloc(&ro); +#ifdef RTF_PRCLONING /* disappeared in CURRENT */ + rtalloc_ign(&ro, RTF_CLONING|RTF_PRCLONING); +#else + rtalloc_ign(&ro, RTF_CLONING); +#endif if (ro.ro_rt != NULL) { struct rtentry *rt = ro.ro_rt; - /* This is cloned route, use its parent */ - if (ro.ro_rt->rt_flags & RTF_WASCLONED && - ro.ro_rt->rt_parent) - rt = ro.ro_rt->rt_parent; - fle->o_ifx = rt->rt_ifp->if_index; if (rt->rt_flags & RTF_GATEWAY && @@ -244,7 +234,7 @@ /* Give up. We can't determine mask :( */ fle->dst_mask = 32; - rtfree(ro.ro_rt); + RTFREE(ro.ro_rt); } /* Do route lookup on source address, to fill @@ -256,14 +246,14 @@ sin->sin_len = sizeof(*sin); sin->sin_family = AF_INET; sin->sin_addr = fle->r.r_src; - rtalloc(&ro); +#ifdef RTF_PRCLONING /* disappeared in CURRENT */ + rtalloc_ign(&ro, RTF_CLONING|RTF_PRCLONING); +#else + rtalloc_ign(&ro, RTF_CLONING); +#endif if (ro.ro_rt != NULL) { struct rtentry *rt = ro.ro_rt; - if (ro.ro_rt->rt_flags & RTF_WASCLONED && - ro.ro_rt->rt_parent) - rt = ro.ro_rt->rt_parent; - if (rt_mask(rt)) fle->src_mask = bit_count(((struct sockaddr_in *)rt_mask(rt))->sin_addr.s_addr); @@ -271,7 +261,7 @@ /* Give up. We can't determine mask :( */ fle->src_mask = 32; - rtfree(ro.ro_rt); + RTFREE(ro.ro_rt); } return (0);