From 35d38d2c3f3db22216d43604b8750ecb6089e525 Mon Sep 17 00:00:00 2001 From: Kozlov Dmitry Date: Thu, 9 Sep 2010 18:26:02 +0400 Subject: iprange: implemneted modules iprange to validate ip addresses of controlling connection and tunnel It will check that ip address of tunnel is not in range of clients ip addresses. This will avoid kernel softlockups due to loopback occured. --- accel-pptpd/ctrl/pptp.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'accel-pptpd/ctrl') diff --git a/accel-pptpd/ctrl/pptp.c b/accel-pptpd/ctrl/pptp.c index 3a3c242..38f8473 100644 --- a/accel-pptpd/ctrl/pptp.c +++ b/accel-pptpd/ctrl/pptp.c @@ -17,7 +17,7 @@ #include "triton.h" #include "log.h" #include "ppp.h" - +#include "iprange.h" #define STATE_IDLE 0 #define STATE_ESTB 1 @@ -477,6 +477,12 @@ static int pptp_connect(struct triton_md_handler_t *h) log_info("pptp: new connection from %s\n", inet_ntoa(addr.sin_addr)); + if (iprange_client_check(addr.sin_addr.s_addr)) { + log_warn("pptp: IP is out of client-ip-range, droping connection...\n"); + close(sock); + continue; + } + if (fcntl(sock, F_SETFL, O_NONBLOCK)) { log_error("pptp: failed to set nonblocking mode: %s, closing connection...\n", strerror(errno)); close(sock); -- cgit v1.2.3