diff options
author | David S. Miller <davem@davemloft.net> | 2011-01-28 17:01:25 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-01-28 17:01:25 -0500 |
commit | 9c150e82ac50a611237bbebd508d17f6347d577c (patch) | |
tree | 7c79c013857cc13570595e805de0dbdb8f00332e /net/ipv4 | |
parent | a4daad6b0923030fbd3b00a01f570e4c3eef446b (diff) |
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>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/fib_semantics.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index 9aff11d7278f..363ec39228d3 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c | |||
@@ -152,6 +152,7 @@ static void free_fib_info_rcu(struct rcu_head *head) | |||
152 | { | 152 | { |
153 | struct fib_info *fi = container_of(head, struct fib_info, rcu); | 153 | struct fib_info *fi = container_of(head, struct fib_info, rcu); |
154 | 154 | ||
155 | kfree(fi->fib_metrics); | ||
155 | kfree(fi); | 156 | kfree(fi); |
156 | } | 157 | } |
157 | 158 | ||
@@ -742,6 +743,9 @@ struct fib_info *fib_create_info(struct fib_config *cfg) | |||
742 | fi = kzalloc(sizeof(*fi)+nhs*sizeof(struct fib_nh), GFP_KERNEL); | 743 | fi = kzalloc(sizeof(*fi)+nhs*sizeof(struct fib_nh), GFP_KERNEL); |
743 | if (fi == NULL) | 744 | if (fi == NULL) |
744 | goto failure; | 745 | goto failure; |
746 | fi->fib_metrics = kzalloc(sizeof(u32) * RTAX_MAX, GFP_KERNEL); | ||
747 | if (!fi->fib_metrics) | ||
748 | goto failure; | ||
745 | fib_info_cnt++; | 749 | fib_info_cnt++; |
746 | 750 | ||
747 | fi->fib_net = hold_net(net); | 751 | fi->fib_net = hold_net(net); |