]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/ipv4/sysctl_net_ipv4.c
[NET]: unregister_netdevice as void
[linux-2.6-omap-h63xx.git] / net / ipv4 / sysctl_net_ipv4.c
index 15061b3144118d25c491e7eed58ca86394e65b9c..fabf69a9108ca6f6d42f58c3eca46b30f1ffae6b 100644 (file)
@@ -51,8 +51,7 @@ int ipv4_sysctl_forward(ctl_table *ctl, int write, struct file * filp,
 static int ipv4_sysctl_forward_strategy(ctl_table *table,
                         int __user *name, int nlen,
                         void __user *oldval, size_t __user *oldlenp,
-                        void __user *newval, size_t newlen, 
-                        void **context)
+                        void __user *newval, size_t newlen)
 {
        int *valp = table->data;
        int new;
@@ -111,8 +110,7 @@ static int proc_tcp_congestion_control(ctl_table *ctl, int write, struct file *
 static int sysctl_tcp_congestion_control(ctl_table *table, int __user *name,
                                         int nlen, void __user *oldval,
                                         size_t __user *oldlenp,
-                                        void __user *newval, size_t newlen,
-                                        void **context)
+                                        void __user *newval, size_t newlen)
 {
        char val[TCP_CA_NAME_MAX];
        ctl_table tbl = {
@@ -122,13 +120,72 @@ 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,
-                           context);
+       ret = sysctl_string(&tbl, name, nlen, oldval, oldlenp, newval, newlen);
        if (ret == 0 && newval && newlen)
                ret = tcp_set_default_congestion_control(val);
        return ret;
 }
 
+static int proc_tcp_available_congestion_control(ctl_table *ctl,
+                                                int write, struct file * filp,
+                                                void __user *buffer, size_t *lenp,
+                                                loff_t *ppos)
+{
+       ctl_table tbl = { .maxlen = TCP_CA_BUF_MAX, };
+       int ret;
+
+       tbl.data = kmalloc(tbl.maxlen, GFP_USER);
+       if (!tbl.data)
+               return -ENOMEM;
+       tcp_get_available_congestion_control(tbl.data, TCP_CA_BUF_MAX);
+       ret = proc_dostring(&tbl, write, filp, buffer, lenp, ppos);
+       kfree(tbl.data);
+       return ret;
+}
+
+static int proc_allowed_congestion_control(ctl_table *ctl,
+                                          int write, struct file * filp,
+                                          void __user *buffer, size_t *lenp,
+                                          loff_t *ppos)
+{
+       ctl_table tbl = { .maxlen = TCP_CA_BUF_MAX };
+       int ret;
+
+       tbl.data = kmalloc(tbl.maxlen, GFP_USER);
+       if (!tbl.data)
+               return -ENOMEM;
+
+       tcp_get_allowed_congestion_control(tbl.data, tbl.maxlen);
+       ret = proc_dostring(&tbl, write, filp, buffer, lenp, ppos);
+       if (write && ret == 0)
+               ret = tcp_set_allowed_congestion_control(tbl.data);
+       kfree(tbl.data);
+       return ret;
+}
+
+static int strategy_allowed_congestion_control(ctl_table *table, int __user *name,
+                                              int nlen, void __user *oldval,
+                                              size_t __user *oldlenp,
+                                              void __user *newval,
+                                              size_t newlen)
+{
+       ctl_table tbl = { .maxlen = TCP_CA_BUF_MAX };
+       int ret;
+
+       tbl.data = kmalloc(tbl.maxlen, GFP_USER);
+       if (!tbl.data)
+               return -ENOMEM;
+
+       tcp_get_available_congestion_control(tbl.data, tbl.maxlen);
+       ret = sysctl_string(&tbl, name, nlen, oldval, oldlenp, newval, newlen);
+       if (ret == 0 && newval && newlen)
+               ret = tcp_set_allowed_congestion_control(tbl.data);
+       kfree(tbl.data);
+
+       return ret;
+
+}
+
 ctl_table ipv4_table[] = {
         {
                .ctl_name       = NET_IPV4_TCP_TIMESTAMPS,
@@ -731,6 +788,21 @@ ctl_table ipv4_table[] = {
                .proc_handler   = &proc_dointvec,
        },
 #endif /* CONFIG_NETLABEL */
+       {
+               .ctl_name       = NET_TCP_AVAIL_CONG_CONTROL,
+               .procname       = "tcp_available_congestion_control",
+               .maxlen         = TCP_CA_BUF_MAX,
+               .mode           = 0444,
+               .proc_handler   = &proc_tcp_available_congestion_control,
+       },
+       {
+               .ctl_name       = NET_TCP_ALLOWED_CONG_CONTROL,
+               .procname       = "tcp_allowed_congestion_control",
+               .maxlen         = TCP_CA_BUF_MAX,
+               .mode           = 0644,
+               .proc_handler   = &proc_allowed_congestion_control,
+               .strategy       = &strategy_allowed_congestion_control,
+       },
        { .ctl_name = 0 }
 };