diff options
author | Vladislav Grishenko <themiron@mail.ru> | 2013-12-24 11:45:48 +0600 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2013-12-24 10:19:34 +0400 |
commit | 01fcf87fe35502f6745137d79f56e618368872eb (patch) | |
tree | 78a845ddba89d63651105abe94b9b1efd9552c14 /accel-pppd/ctrl/pptp | |
parent | 4e4b0ad6ab81517fb4bd24ee74331b32111de5e4 (diff) | |
download | accel-ppp-01fcf87fe35502f6745137d79f56e618368872eb.tar.gz accel-ppp-01fcf87fe35502f6745137d79f56e618368872eb.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>
Diffstat (limited to 'accel-pppd/ctrl/pptp')
-rw-r--r-- | accel-pppd/ctrl/pptp/pptp.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/accel-pppd/ctrl/pptp/pptp.c b/accel-pppd/ctrl/pptp/pptp.c index 31ffd007..46e980e0 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; |