Re: ng_netflow: testers are welcome

From: Gleb Smirnoff (glebius_at_cell.sick.ru)
Date: 02/27/04

  • Next message: Arie Kachler: "re: p2p traffic"
    Date: Fri, 27 Feb 2004 13:03:54 +0300
    To: fingers <fingers@fingers.co.za>
    
    

    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 <sys/param.h>
     #include <sys/kernel.h>
    @@ -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);
    _______________________________________________
    freebsd-isp@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-isp
    To unsubscribe, send any mail to "freebsd-isp-unsubscribe@freebsd.org"
    

  • Next message: Arie Kachler: "re: p2p traffic"

    Relevant Pages