Commit 35bfbc94 authored by Stephen Hemminger's avatar Stephen Hemminger Committed by David S. Miller

[TCP]: Allow autoloading of congestion control via setsockopt.

If user has permision to load modules, then autoload then attempt
autoload of TCP congestion module.
Signed-off-by: default avatarStephen Hemminger <shemminger@osdl.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ce7bc3bf
...@@ -113,7 +113,7 @@ int tcp_set_default_congestion_control(const char *name) ...@@ -113,7 +113,7 @@ int tcp_set_default_congestion_control(const char *name)
spin_lock(&tcp_cong_list_lock); spin_lock(&tcp_cong_list_lock);
ca = tcp_ca_find(name); ca = tcp_ca_find(name);
#ifdef CONFIG_KMOD #ifdef CONFIG_KMOD
if (!ca) { if (!ca && capable(CAP_SYS_MODULE)) {
spin_unlock(&tcp_cong_list_lock); spin_unlock(&tcp_cong_list_lock);
request_module("tcp_%s", name); request_module("tcp_%s", name);
...@@ -236,9 +236,19 @@ int tcp_set_congestion_control(struct sock *sk, const char *name) ...@@ -236,9 +236,19 @@ int tcp_set_congestion_control(struct sock *sk, const char *name)
rcu_read_lock(); rcu_read_lock();
ca = tcp_ca_find(name); ca = tcp_ca_find(name);
/* no change asking for existing value */
if (ca == icsk->icsk_ca_ops) if (ca == icsk->icsk_ca_ops)
goto out; goto out;
#ifdef CONFIG_KMOD
/* not found attempt to autoload module */
if (!ca && capable(CAP_SYS_MODULE)) {
rcu_read_unlock();
request_module("tcp_%s", name);
rcu_read_lock();
ca = tcp_ca_find(name);
}
#endif
if (!ca) if (!ca)
err = -ENOENT; err = -ENOENT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment