diff options
author | Vladislav Grishenko <themiron@mail.ru> | 2013-12-24 11:45:48 +0600 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2014-02-08 09:44:40 +0400 |
commit | 65be5ebef989e62091368c7457ad33f1e8d63ead (patch) | |
tree | d575bcc98ecaee19923ff999c92c9b3f0d40f07c | |
parent | da7bb06e70252ba11751f4e3a9f8b97144500d9e (diff) | |
download | accel-ppp-65be5ebef989e62091368c7457ad33f1e8d63ead.tar.gz accel-ppp-65be5ebef989e62091368c7457ad33f1e8d63ead.zip |
ppp: don't unconditionaly load pppoe/pptp/l2tp modules, fixes false start warning if they're running already
Signed-off-by: Vladislav Grishenko <themiron@mail.ru>
-rw-r--r-- | accel-pppd/ctrl/l2tp/l2tp.c | 7 | ||||
-rw-r--r-- | accel-pppd/ctrl/pppoe/pppoe.c | 6 | ||||
-rw-r--r-- | accel-pppd/ctrl/pptp/pptp.c | 16 |
3 files changed, 21 insertions, 8 deletions
diff --git a/accel-pppd/ctrl/l2tp/l2tp.c b/accel-pppd/ctrl/l2tp/l2tp.c index 599fc4c4..d0140056 100644 --- a/accel-pppd/ctrl/l2tp/l2tp.c +++ b/accel-pppd/ctrl/l2tp/l2tp.c @@ -1261,7 +1261,12 @@ static void load_config(void) static void l2tp_init(void) { - if (system("modprobe -q pppol2tp || modprobe -q l2tp_ppp")) + int fd; + + fd = socket(AF_PPPOX, SOCK_DGRAM, PX_PROTO_OL2TP); + if (fd >= 0) + close(fd); + else if (system("modprobe -q pppol2tp || modprobe -q l2tp_ppp")) log_warn("unable to load l2tp kernel module\n"); l2tp_conn = malloc(L2TP_MAX_TID * sizeof(void *)); diff --git a/accel-pppd/ctrl/pppoe/pppoe.c b/accel-pppd/ctrl/pppoe/pppoe.c index aa6f3d63..a272dc0a 100644 --- a/accel-pppd/ctrl/pppoe/pppoe.c +++ b/accel-pppd/ctrl/pppoe/pppoe.c @@ -1501,8 +1501,12 @@ static void pppoe_init(void) { struct conf_sect_t *s = conf_get_section("pppoe"); struct conf_option_t *opt; + int fd; - if (system("modprobe -q pppoe")) + fd = socket(AF_PPPOX, SOCK_DGRAM, PX_PROTO_OE); + if (fd >= 0) + close(fd); + else if (system("modprobe -q pppoe")) log_warn("failed to load pppoe kernel module\n"); conn_pool = mempool_create(sizeof(struct pppoe_conn_t)); diff --git a/accel-pppd/ctrl/pptp/pptp.c b/accel-pppd/ctrl/pptp/pptp.c index ce7b13df..d67e5cfa 100644 --- a/accel-pppd/ctrl/pptp/pptp.c +++ b/accel-pppd/ctrl/pptp/pptp.c @@ -771,16 +771,20 @@ static void pptp_init(void) { struct sockaddr_in addr; char *opt; + int fd; - if (system("modprobe -q pptp")) + fd = socket(AF_PPPOX, SOCK_DGRAM, PX_PROTO_PPTP); + if (fd >= 0) + close(fd); + else if (system("modprobe -q pptp")) log_warn("failed to load pptp kernel module\n"); 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)); - return; - } - + if (serv.hnd.fd < 0) { + log_emerg("pptp: failed to create server socket: %s\n", strerror(errno)); + return; + } + fcntl(serv.hnd.fd, F_SETFD, fcntl(serv.hnd.fd, F_GETFD) | FD_CLOEXEC); addr.sin_family = AF_INET; |