]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - net/ipv4/sysctl_net_ipv4.c
net: implement emergency route cache rebulds when gc_elasticity is exceeded
[net-next-2.6.git] / net / ipv4 / sysctl_net_ipv4.c
index 276d047fb85a94eccf402ab17dc043809884f790..0cc8d31f9ac0edad1012664bab4180d51589013e 100644 (file)
@@ -64,8 +64,8 @@ static int ipv4_local_port_range(ctl_table *table, int write, struct file *filp,
 }
 
 /* Validate changes from sysctl interface. */
-static int ipv4_sysctl_local_port_range(ctl_table *table, int __user *name,
-                                        int nlen, void __user *oldval,
+static int ipv4_sysctl_local_port_range(ctl_table *table,
+                                        void __user *oldval,
                                         size_t __user *oldlenp,
                                        void __user *newval, size_t newlen)
 {
@@ -80,7 +80,7 @@ static int ipv4_sysctl_local_port_range(ctl_table *table, int __user *name,
        };
 
        inet_get_local_port_range(range, range + 1);
-       ret = sysctl_intvec(&tmp, name, nlen, oldval, oldlenp, newval, newlen);
+       ret = sysctl_intvec(&tmp, oldval, oldlenp, newval, newlen);
        if (ret == 0 && newval && newlen) {
                if (range[1] < range[0])
                        ret = -EINVAL;
@@ -109,8 +109,8 @@ static int proc_tcp_congestion_control(ctl_table *ctl, int write, struct file *
        return ret;
 }
 
-static int sysctl_tcp_congestion_control(ctl_table *table, int __user *name,
-                                        int nlen, void __user *oldval,
+static int sysctl_tcp_congestion_control(ctl_table *table,
+                                        void __user *oldval,
                                         size_t __user *oldlenp,
                                         void __user *newval, size_t newlen)
 {
@@ -122,7 +122,7 @@ static int sysctl_tcp_congestion_control(ctl_table *table, int __user *name,
        int ret;
 
        tcp_get_default_congestion_control(val);
-       ret = sysctl_string(&tbl, name, nlen, oldval, oldlenp, newval, newlen);
+       ret = sysctl_string(&tbl, oldval, oldlenp, newval, newlen);
        if (ret == 1 && newval && newlen)
                ret = tcp_set_default_congestion_control(val);
        return ret;
@@ -165,8 +165,8 @@ static int proc_allowed_congestion_control(ctl_table *ctl,
        return ret;
 }
 
-static int strategy_allowed_congestion_control(ctl_table *table, int __user *name,
-                                              int nlen, void __user *oldval,
+static int strategy_allowed_congestion_control(ctl_table *table,
+                                              void __user *oldval,
                                               size_t __user *oldlenp,
                                               void __user *newval,
                                               size_t newlen)
@@ -179,7 +179,7 @@ static int strategy_allowed_congestion_control(ctl_table *table, int __user *nam
                return -ENOMEM;
 
        tcp_get_available_congestion_control(tbl.data, tbl.maxlen);
-       ret = sysctl_string(&tbl, name, nlen, oldval, oldlenp, newval, newlen);
+       ret = sysctl_string(&tbl, oldval, oldlenp, newval, newlen);
        if (ret == 1 && newval && newlen)
                ret = tcp_set_allowed_congestion_control(tbl.data);
        kfree(tbl.data);
@@ -795,6 +795,14 @@ static struct ctl_table ipv4_net_table[] = {
                .mode           = 0644,
                .proc_handler   = &proc_dointvec
        },
+       {
+               .ctl_name       = CTL_UNNUMBERED,
+               .procname       = "rt_cache_rebuild_count",
+               .data           = &init_net.ipv4.sysctl_rt_cache_rebuild_count,
+               .maxlen         = sizeof(int),
+               .mode           = 0644,
+               .proc_handler   = &proc_dointvec
+       },
        { }
 };
 
@@ -827,8 +835,12 @@ static __net_init int ipv4_sysctl_init_net(struct net *net)
                        &net->ipv4.sysctl_icmp_ratelimit;
                table[5].data =
                        &net->ipv4.sysctl_icmp_ratemask;
+               table[6].data =
+                       &net->ipv4.sysctl_rt_cache_rebuild_count;
        }
 
+       net->ipv4.sysctl_rt_cache_rebuild_count = 4;
+
        net->ipv4.ipv4_hdr = register_net_sysctl_table(net,
                        net_ipv4_ctl_path, table);
        if (net->ipv4.ipv4_hdr == NULL)