[L2TP]: Add the ability to autoload a pppox protocol module.
authorJames Chapman <jchapman@katalix.com>
Mon, 30 Apr 2007 07:21:02 +0000 (00:21 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 30 Apr 2007 07:21:02 +0000 (00:21 -0700)
This patch allows a name "pppox-proto-nnn" to be used in modprobe.conf
to autoload a PPPoX protocol nnn.

Signed-off-by: James Chapman <jchapman@katalix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/pppox.c

index 3f8115db4d54b2e54fab90efbf376baad483f6a9..f3e47d0c2b3ce2cb253d96844e33ffb8b03b2552 100644 (file)
@@ -31,6 +31,7 @@
 #include <linux/ppp_defs.h>
 #include <linux/if_ppp.h>
 #include <linux/ppp_channel.h>
+#include <linux/kmod.h>
 
 #include <net/sock.h>
 
@@ -114,6 +115,13 @@ static int pppox_create(struct socket *sock, int protocol)
                goto out;
 
        rc = -EPROTONOSUPPORT;
+#ifdef CONFIG_KMOD
+       if (!pppox_protos[protocol]) {
+               char buffer[32];
+               sprintf(buffer, "pppox-proto-%d", protocol);
+               request_module(buffer);
+       }
+#endif
        if (!pppox_protos[protocol] ||
            !try_module_get(pppox_protos[protocol]->owner))
                goto out;