Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Mar 2012 12:51:30 +0000
From:      "Bjoern A. Zeeb" <bz@FreeBSD.org>
To:        Alexander V. Chernikov <melifaro@FreeBSD.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r232921 - in head/sys: modules/netgraph/netflow netgraph/netflow
Message-ID:  <1FC92093-FAEA-4C84-8A27-7726C4930CD6@FreeBSD.org>
In-Reply-To: <201203131108.q2DB8e5d040995@svn.freebsd.org>
References:  <201203131108.q2DB8e5d040995@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 13. Mar 2012, at 11:08 , Alexander V. Chernikov wrote:

> Author: melifaro
> Date: Tue Mar 13 11:08:40 2012
> New Revision: 232921
> URL: http://svn.freebsd.org/changeset/base/232921
>=20
> Log:
>  Use rt_numfibs variable instead of compile-time RT_NUMFIBS.

Thanks a lot for doing this!

This will allow us to go ahead and get rid of the mandatory kernel =
option now.  I'll try to find my patch from last year and post it for =
your review.

Are you intending to MFC this?


Requested by:	bz (a while ago with low prio)
>  Reviewed by:    glebius (previous version)
>  Approved by:    kib(mentor), ae(mentor)
>=20
> Modified:
>  head/sys/modules/netgraph/netflow/Makefile
>  head/sys/netgraph/netflow/netflow.c
>  head/sys/netgraph/netflow/ng_netflow.c
>  head/sys/netgraph/netflow/ng_netflow.h
>=20
> Modified: head/sys/modules/netgraph/netflow/Makefile
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/modules/netgraph/netflow/Makefile	Tue Mar 13 =
10:54:14 2012	(r232920)
> +++ head/sys/modules/netgraph/netflow/Makefile	Tue Mar 13 =
11:08:40 2012	(r232921)
> @@ -17,8 +17,6 @@ opt_inet6.h:
> 	echo "#define INET6 1" > ${.TARGET}
> .endif
>=20
> -opt_route.h:
> -	echo "#define ROUTETABLES RT_MAXFIBS" > ${.TARGET}
> .endif
>=20
> .include <bsd.kmod.mk>
>=20
> Modified: head/sys/netgraph/netflow/netflow.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/netgraph/netflow/netflow.c	Tue Mar 13 10:54:14 2012	=
(r232920)
> +++ head/sys/netgraph/netflow/netflow.c	Tue Mar 13 11:08:40 2012	=
(r232921)
> @@ -630,7 +630,7 @@ ng_netflow_cache_flush(priv_p priv)
> 		free(priv->hash6, M_NETFLOW_HASH);
> #endif
>=20
> -	for (i =3D 0; i < RT_NUMFIBS; i++) {
> +	for (i =3D 0; i < priv->maxfibs; i++) {
> 		if ((fe =3D priv_to_fib(priv, i)) =3D=3D NULL)
> 			continue;
>=20
>=20
> Modified: head/sys/netgraph/netflow/ng_netflow.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/netgraph/netflow/ng_netflow.c	Tue Mar 13 10:54:14 2012	=
(r232920)
> +++ head/sys/netgraph/netflow/ng_netflow.c	Tue Mar 13 11:08:40 2012	=
(r232921)
> @@ -225,6 +225,11 @@ ng_netflow_constructor(node_p node)
> 	/* Initialize private data */
> 	priv =3D malloc(sizeof(*priv), M_NETGRAPH, M_WAITOK | M_ZERO);
>=20
> +	/* Initialize fib data */
> +	priv->maxfibs =3D rt_numfibs;
> +	priv->fib_data =3D malloc(sizeof(fib_export_p) * priv->maxfibs,
> +	    M_NETGRAPH, M_WAITOK | M_ZERO);
> +
> 	/* Make node and its data point at each other */
> 	NG_NODE_SET_PRIVATE(node, priv);
> 	priv->node =3D node;
> @@ -901,8 +906,10 @@ loopend:
> =09
> 	/* Check packet FIB */
> 	fib =3D M_GETFIB(m);
> -	if (fib >=3D RT_NUMFIBS) {
> -		CTR2(KTR_NET, "ng_netflow_rcvdata(): packet fib %d is =
out of range of available fibs: 0 .. %d", fib, RT_NUMFIBS);
> +	if (fib >=3D priv->maxfibs) {
> +		CTR2(KTR_NET, "ng_netflow_rcvdata(): packet fib %d is =
out of "
> +		    "range of available fibs: 0 .. %d",
> +		    fib, priv->maxfibs);
> 		goto bypass;
> 	}
>=20
> @@ -973,6 +980,7 @@ ng_netflow_rmnode(node_p node)
> 	NG_NODE_SET_PRIVATE(node, NULL);
> 	NG_NODE_UNREF(priv->node);
>=20
> +	free(priv->fib_data, M_NETGRAPH);
> 	free(priv, M_NETGRAPH);
>=20
> 	return (0);
>=20
> Modified: head/sys/netgraph/netflow/ng_netflow.h
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/sys/netgraph/netflow/ng_netflow.h	Tue Mar 13 10:54:14 2012	=
(r232920)
> +++ head/sys/netgraph/netflow/ng_netflow.h	Tue Mar 13 11:08:40 2012	=
(r232921)
> @@ -413,7 +413,8 @@ struct netflow {
> 	struct flow_hash_entry	*hash6;
> #endif
> 	/* Multiple FIB support */
> -	fib_export_p		fib_data[RT_NUMFIBS]; /* array of =
pointers to fib-specific data */
> +	fib_export_p		*fib_data; /* array of pointers to =
per-fib data */
> +	uint16_t		maxfibs; /* number of allocated fibs */
>=20
> 	/*
> 	 * RFC 3954 clause 7.3

--=20
Bjoern A. Zeeb                                 You have to have visions!
   It does not matter how good you are. It matters what good you do!




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1FC92093-FAEA-4C84-8A27-7726C4930CD6>