ipv4: Allocate fib metrics dynamically.

This is the initial gateway towards super-sharing metrics
if they are all set to zero for a route.

Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
David S. Miller
2011-01-28 14:01:25 -08:00
parent a4daad6b09
commit 9c150e82ac
2 changed files with 5 additions and 1 deletions

View File

@@ -152,6 +152,7 @@ static void free_fib_info_rcu(struct rcu_head *head)
{
struct fib_info *fi = container_of(head, struct fib_info, rcu);
kfree(fi->fib_metrics);
kfree(fi);
}
@@ -742,6 +743,9 @@ struct fib_info *fib_create_info(struct fib_config *cfg)
fi = kzalloc(sizeof(*fi)+nhs*sizeof(struct fib_nh), GFP_KERNEL);
if (fi == NULL)
goto failure;
fi->fib_metrics = kzalloc(sizeof(u32) * RTAX_MAX, GFP_KERNEL);
if (!fi->fib_metrics)
goto failure;
fib_info_cnt++;
fi->fib_net = hold_net(net);