]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ipv4: Allocate fib metrics dynamically.
authorDavid S. Miller <davem@davemloft.net>
Fri, 28 Jan 2011 22:01:25 +0000 (14:01 -0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 28 Jan 2011 22:01:25 +0000 (14:01 -0800)
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>
include/net/ip_fib.h
net/ipv4/fib_semantics.c

index 65d1fcdbc63be173cb7840b96c46ffccc5598741..2c0508a6e07c9354587e6f0a857950e30cbc34af 100644 (file)
@@ -77,7 +77,7 @@ struct fib_info {
        int                     fib_protocol;
        __be32                  fib_prefsrc;
        u32                     fib_priority;
-       u32                     fib_metrics[RTAX_MAX];
+       u32                     *fib_metrics;
 #define fib_mtu fib_metrics[RTAX_MTU-1]
 #define fib_window fib_metrics[RTAX_WINDOW-1]
 #define fib_rtt fib_metrics[RTAX_RTT-1]
index 9aff11d7278f5bf31305b4582ee5e0eff75ffd4a..363ec39228d347901660807897b5d74683d7ed41 100644 (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);