Skip to content

Commit

Permalink
[TCP]: Allow autoloading of congestion control via setsockopt.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Stephen Hemminger authored and David S. Miller committed Dec 3, 2006
1 parent ce7bc3b commit 35bfbc9
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion net/ipv4/tcp_cong.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ int tcp_set_default_congestion_control(const char *name)
spin_lock(&tcp_cong_list_lock);
ca = tcp_ca_find(name);
#ifdef CONFIG_KMOD
if (!ca) {
if (!ca && capable(CAP_SYS_MODULE)) {
spin_unlock(&tcp_cong_list_lock);

request_module("tcp_%s", name);
Expand Down Expand Up @@ -236,9 +236,19 @@ int tcp_set_congestion_control(struct sock *sk, const char *name)

rcu_read_lock();
ca = tcp_ca_find(name);
/* no change asking for existing value */
if (ca == icsk->icsk_ca_ops)
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)
err = -ENOENT;

Expand Down

0 comments on commit 35bfbc9

Please sign in to comment.