From 96c532726a1f9434b8b1da16cea64a9c00291c59 Mon Sep 17 00:00:00 2001 From: Dmitry Kozlov Date: Fri, 3 Dec 2010 21:59:02 +0300 Subject: ppp: implemented ccp option to enable/disable CCP negotation --- accel-pptpd/accel-pptp.conf | 1 + accel-pptpd/accel-pptp.conf.5 | 3 +++ accel-pptpd/ppp/ppp_ccp.c | 14 +++++++++++--- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/accel-pptpd/accel-pptp.conf b/accel-pptpd/accel-pptp.conf index aab1a1b..f8693b8 100644 --- a/accel-pptpd/accel-pptp.conf +++ b/accel-pptpd/accel-pptp.conf @@ -26,6 +26,7 @@ verbose=1 min-mtu=1000 mtu=1200 mru=1200 +#ccp=0 [lcp] echo-interval=30 diff --git a/accel-pptpd/accel-pptp.conf.5 b/accel-pptpd/accel-pptp.conf.5 index c0e257b..d972e70 100644 --- a/accel-pptpd/accel-pptp.conf.5 +++ b/accel-pptpd/accel-pptp.conf.5 @@ -94,6 +94,9 @@ MTU which will be negotiated if client's MRU will be not acceptable. .BI "mru=" n Prefered MRU. .TP +.BI "ccp=" n +Disable CCP negotiation if this parameter is zero. +.TP .SH [lcp] .br PPP LCP module configuration diff --git a/accel-pptpd/ppp/ppp_ccp.c b/accel-pptpd/ppp/ppp_ccp.c index 2cad386..7a3012d 100644 --- a/accel-pptpd/ppp/ppp_ccp.c +++ b/accel-pptpd/ppp/ppp_ccp.c @@ -23,6 +23,8 @@ struct recv_opt_t struct ccp_option_t *lopt; }; +static int conf_ccp = 1; + static struct ppp_layer_t ccp_layer; static LIST_HEAD(option_handlers); @@ -129,7 +131,7 @@ int ccp_layer_start(struct ppp_layer_data_t *ld) log_ppp_debug("ccp_layer_start\n"); - if (list_empty(&ccp->options)) { + if (list_empty(&ccp->options) || !conf_ccp) { ppp_layer_started(ccp->ppp, &ccp->ld); return 0; } @@ -611,8 +613,8 @@ static void ccp_recv(struct ppp_handler_t*h) if (ccp->fsm.fsm_state == FSM_Initial || ccp->fsm.fsm_state == FSM_Closed) { if (conf_ppp_verbose) log_ppp_warn("CCP: discarding packet\n"); - if (ccp->fsm.fsm_state == FSM_Closed) - lcp_send_proto_rej(ccp->ppp, htons(PPP_CCP)); + if (ccp->fsm.fsm_state == FSM_Closed || !conf_ccp) + lcp_send_proto_rej(ccp->ppp, PPP_CCP); return; } @@ -739,6 +741,12 @@ static struct ppp_layer_t ccp_layer= static void __init ccp_init(void) { + const char *opt; + ppp_register_layer("ccp", &ccp_layer); + + opt = conf_get_opt("ppp", "ccp"); + if (opt && atoi(opt) >= 0) + conf_ccp = atoi(opt); } -- cgit v1.2.3