From 8d5390ef0e836de11da82c6ca43110af524a724e Mon Sep 17 00:00:00 2001
From: Kozlov Dmitry <xeb@mail.ru>
Date: Mon, 23 Jan 2012 07:44:18 +0400
Subject: load necessary kernel modules at startup

---
 accel-pppd/ctrl/l2tp/l2tp.c   | 2 ++
 accel-pppd/ctrl/pppoe/pppoe.c | 2 ++
 accel-pppd/ctrl/pptp/pptp.c   | 4 +++-
 3 files changed, 7 insertions(+), 1 deletion(-)

(limited to 'accel-pppd')

diff --git a/accel-pppd/ctrl/l2tp/l2tp.c b/accel-pppd/ctrl/l2tp/l2tp.c
index 9cde03e..a9ecd58 100644
--- a/accel-pppd/ctrl/l2tp/l2tp.c
+++ b/accel-pppd/ctrl/l2tp/l2tp.c
@@ -1150,6 +1150,8 @@ static void load_config(void)
 
 static void l2tp_init(void)
 {
+	system("modprobe pppol2tp &> /dev/null || modprobe l2tp_ppp &> /dev/null");
+	
 	l2tp_conn = malloc(L2TP_MAX_TID * sizeof(void *));
 	memset(l2tp_conn, 0, L2TP_MAX_TID * sizeof(void *));
 
diff --git a/accel-pppd/ctrl/pppoe/pppoe.c b/accel-pppd/ctrl/pppoe/pppoe.c
index a5a8eb6..ad363c8 100644
--- a/accel-pppd/ctrl/pppoe/pppoe.c
+++ b/accel-pppd/ctrl/pppoe/pppoe.c
@@ -1405,6 +1405,8 @@ static void pppoe_init(void)
 	struct conf_sect_t *s = conf_get_section("pppoe");
 	struct conf_option_t *opt;
 
+	system("modprobe pppoe");
+
 	conn_pool = mempool_create(sizeof(struct pppoe_conn_t));
 	pado_pool = mempool_create(sizeof(struct delayed_pado_t));
 	padi_pool = mempool_create(sizeof(struct padi_t));
diff --git a/accel-pppd/ctrl/pptp/pptp.c b/accel-pppd/ctrl/pptp/pptp.c
index b785b1f..e0875d6 100644
--- a/accel-pppd/ctrl/pptp/pptp.c
+++ b/accel-pppd/ctrl/pptp/pptp.c
@@ -745,7 +745,9 @@ static void pptp_init(void)
 {
 	struct sockaddr_in addr;
 	char *opt;
-	
+
+	system("modprobe pptp");
+
 	serv.hnd.fd = socket(PF_INET, SOCK_STREAM, 0);
   if (serv.hnd.fd < 0) {
     log_emerg("pptp: failed to create server socket: %s\n", strerror(errno));
-- 
cgit v1.2.3