Deleted Added
full compact
30c30
< * $FreeBSD: head/sys/net/route.c 191734 2009-05-02 05:02:28Z zec $
---
> * $FreeBSD: head/sys/net/route.c 193232 2009-06-01 15:49:42Z bz $
93a94
> struct radix_node_head *rt_tables;
95,103d95
< /* by default only the first 'row' of tables will be accessed. */
< /*
< * XXXMRT When we fix netstat, and do this differnetly,
< * we can allocate this dynamically. As long as we are keeping
< * things backwards compaitble we need to allocate this
< * statically.
< */
< struct radix_node_head *rt_tables[RT_MAXFIBS][AF_MAX+1];
<
160a153,178
> static __inline struct radix_node_head **
> rt_tables_get_rnh_ptr(int table, int fam)
> {
> INIT_VNET_NET(curvnet);
> struct radix_node_head **rnh;
>
> KASSERT(table >= 0 && table < rt_numfibs, ("%s: table out of bounds.",
> __func__));
> KASSERT(fam >= 0 && fam < (AF_MAX+1), ("%s: fam out of bounds.",
> __func__));
>
> /* rnh is [fib=0][af=0]. */
> rnh = (struct radix_node_head **)V_rt_tables;
> /* Get the offset to the requested table and fam. */
> rnh += table * (AF_MAX+1) + fam;
>
> return (rnh);
> }
>
> struct radix_node_head *
> rt_tables_get_rnh(int table, int fam)
> {
>
> return (*rt_tables_get_rnh_ptr(table, fam));
> }
>
182d199
< int table;
183a201,202
> struct radix_node_head **rnh;
> int table;
185a205,207
> V_rt_tables = malloc(rt_numfibs * (AF_MAX+1) *
> sizeof(struct radix_node_head *), M_RTABLE, M_WAITOK|M_ZERO);
>
201,202c223,226
< dom->dom_rtattach(
< (void **)&V_rt_tables[table][fam],
---
> rnh = rt_tables_get_rnh_ptr(table, fam);
> if (rnh == NULL)
> panic("%s: rnh NULL", __func__);
> dom->dom_rtattach((void **)rnh,
303c327
< rnh = V_rt_tables[fibnum][dst->sa_family];
---
> rnh = rt_tables_get_rnh(fibnum, dst->sa_family);
365c389
< rnh = V_rt_tables[rt->rt_fibnum][rt_key(rt)->sa_family];
---
> rnh = rt_tables_get_rnh(rt->rt_fibnum, rt_key(rt)->sa_family);
466,467c490
< struct radix_node_head *rnh =
< V_rt_tables[fibnum][dst->sa_family];
---
> struct radix_node_head *rnh;
468a492,497
> rnh = rt_tables_get_rnh(fibnum, dst->sa_family);
> if (rnh == NULL) {
> error = EAFNOSUPPORT;
> goto out;
> }
>
777c806
< rnh = V_rt_tables[rt->rt_fibnum][rt_key(rt)->sa_family];
---
> rnh = rt_tables_get_rnh(rt->rt_fibnum, rt_key(rt)->sa_family);
945c974
< rnh = V_rt_tables[fibnum][dst->sa_family];
---
> rnh = rt_tables_get_rnh(fibnum, dst->sa_family);
1137,1139c1166,1168
< INIT_VNET_NET(curvnet);
< struct radix_node_head *rnh =
< V_rt_tables[rt->rt_fibnum][dst->sa_family];
---
> struct radix_node_head *rnh;
>
> rnh = rt_tables_get_rnh(rt->rt_fibnum, dst->sa_family);
1206d1234
< INIT_VNET_NET(curvnet);
1276c1304,1305
< if ((rnh = V_rt_tables[fibnum][dst->sa_family]) == NULL)
---
> rnh = rt_tables_get_rnh(fibnum, dst->sa_family);
> if (rnh == NULL)