Subject: [RFC] tcp: setsockopt congestion control autoload

From: Stephen Hemminger <[email-masked]>
Date: Wed, 25 Oct 2006 11:08:43 -0700

If user asks for a congestion control type with setsockopt() then it
may be available as a module not included in the kernel already. 
It should be autoloaded if needed.  This is done already when
the default selection is change with sysctl, but not when application
requests via sysctl.

Only reservation is are there any bad security implications from this?

Signed-off-by: Stephen Hemminger <[email-masked]>

--- orig/net/ipv4/tcp_cong.c	2006-10-25 13:55:34.000000000 -0700
+++ new/net/ipv4/tcp_cong.c	2006-10-25 13:58:39.000000000 -0700
@@ -153,9 +153,19 @@
 
 	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) {
+		rcu_read_unlock();
+		request_module("tcp_%s", name);
+		rcu_read_lock();
+		ca = tcp_ca_find(name);
+	}
+#endif
 	if (!ca)
 		err = -ENOENT;