diff options
author | Kozlov Dmitry <dima@server> | 2010-11-30 15:27:59 +0300 |
---|---|---|
committer | Kozlov Dmitry <dima@server> | 2010-11-30 15:27:59 +0300 |
commit | 575d140f9f67ce0ae6b93b9c6b47f6c7098864bb (patch) | |
tree | 27ee88d91fdd1d62b67b7312341fa88b125ca4cf /accel-pptpd/ppp | |
parent | 9f69311cce90c269d3e0c718e40c56484d1788b9 (diff) | |
download | accel-ppp-575d140f9f67ce0ae6b93b9c6b47f6c7098864bb.tar.gz accel-ppp-575d140f9f67ce0ae6b93b9c6b47f6c7098864bb.zip |
ppp: configuration checks
Diffstat (limited to 'accel-pptpd/ppp')
-rw-r--r-- | accel-pptpd/ppp/lcp_opt_mru.c | 16 | ||||
-rw-r--r-- | accel-pptpd/ppp/ppp_fsm.c | 10 |
2 files changed, 23 insertions, 3 deletions
diff --git a/accel-pptpd/ppp/lcp_opt_mru.c b/accel-pptpd/ppp/lcp_opt_mru.c index 7ab75f9..6a8c430 100644 --- a/accel-pptpd/ppp/lcp_opt_mru.c +++ b/accel-pptpd/ppp/lcp_opt_mru.c @@ -2,6 +2,7 @@ #include <string.h> #include <errno.h> #include <stdio.h> +#include <unistd.h> #include <sys/socket.h> #include <arpa/inet.h> #include <sys/ioctl.h> @@ -167,6 +168,21 @@ static void __init mru_opt_init() opt = conf_get_opt("ppp", "max-mtu"); if (opt && atoi(opt) > 0) conf_max_mtu = atoi(opt); + + if (conf_min_mtu > conf_mru) { + log_emerg("min-mtu cann't be greater then mtu/mru\n"); + _exit(-1); + } + + if (conf_min_mtu > 1500) { + log_emerg("min-mtu cann't be greater then 1500\n"); + _exit(-1); + } + + if (conf_mru > 1500 || conf_mtu > 1500) { + log_emerg("mtu/mru cann't be greater then 1500\n"); + _exit(-1); + } lcp_option_register(&mru_opt_hnd); } diff --git a/accel-pptpd/ppp/ppp_fsm.c b/accel-pptpd/ppp/ppp_fsm.c index 46b6215..24e914f 100644 --- a/accel-pptpd/ppp/ppp_fsm.c +++ b/accel-pptpd/ppp/ppp_fsm.c @@ -11,8 +11,8 @@ #include "memdebug.h" static int conf_max_terminate = 2; -static int conf_max_configure = 5; -static int conf_max_failure = 5; +static int conf_max_configure = 10; +static int conf_max_failure = 10; static int conf_timeout = 5; void send_term_req(struct ppp_fsm_t *layer); @@ -253,6 +253,10 @@ void ppp_fsm_recv_conf_req_nak(struct ppp_fsm_t *layer) break; case FSM_Req_Sent: case FSM_Ack_Rcvd: + if (++layer->conf_failure == layer->max_failure) { + if (layer->layer_finished) layer->layer_finished(layer); + return; + } if (layer->send_conf_nak) layer->send_conf_nak(layer); break; case FSM_Opened: @@ -290,7 +294,7 @@ void ppp_fsm_recv_conf_req_rej(struct ppp_fsm_t *layer) case FSM_Req_Sent: case FSM_Ack_Rcvd: if (++layer->conf_failure == layer->max_failure) { - if (layer->layer_down) layer->layer_down(layer); + if (layer->layer_finished) layer->layer_finished(layer); return; } if (layer->send_conf_rej) layer->send_conf_rej(layer); |