aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@osdl.org>2006-11-09 19:36:36 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-12-03 00:21:50 -0500
commit35bfbc94070e480f350c868abc4ff9f77e7f2051 (patch)
tree4d6f9405aae719308ab5ff36818c048e0062996c /net
parentce7bc3bf15cbf5dc5a5587ccb6b04c5b4dde4336 (diff)
[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: Stephen Hemminger <shemminger@osdl.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/tcp_cong.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/net/ipv4/tcp_cong.c b/net/ipv4/tcp_cong.c
index 343d6197c92e..5ca7723d0798 100644
--- a/net/ipv4/tcp_cong.c
+++ b/net/ipv4/tcp_cong.c
@@ -113,7 +113,7 @@ int tcp_set_default_congestion_control(const char *name)
113 spin_lock(&tcp_cong_list_lock); 113 spin_lock(&tcp_cong_list_lock);
114 ca = tcp_ca_find(name); 114 ca = tcp_ca_find(name);
115#ifdef CONFIG_KMOD 115#ifdef CONFIG_KMOD
116 if (!ca) { 116 if (!ca && capable(CAP_SYS_MODULE)) {
117 spin_unlock(&tcp_cong_list_lock); 117 spin_unlock(&tcp_cong_list_lock);
118 118
119 request_module("tcp_%s", name); 119 request_module("tcp_%s", name);
@@ -236,9 +236,19 @@ int tcp_set_congestion_control(struct sock *sk, const char *name)
236 236
237 rcu_read_lock(); 237 rcu_read_lock();
238 ca = tcp_ca_find(name); 238 ca = tcp_ca_find(name);
239 /* no change asking for existing value */
239 if (ca == icsk->icsk_ca_ops) 240 if (ca == icsk->icsk_ca_ops)
240 goto out; 241 goto out;
241 242
243#ifdef CONFIG_KMOD
244 /* not found attempt to autoload module */
245 if (!ca && capable(CAP_SYS_MODULE)) {
246 rcu_read_unlock();
247 request_module("tcp_%s", name);
248 rcu_read_lock();
249 ca = tcp_ca_find(name);
250 }
251#endif
242 if (!ca) 252 if (!ca)
243 err = -ENOENT; 253 err = -ENOENT;
244 254