summaryrefslogtreecommitdiff
path: root/accel-pppd/ppp
diff options
context:
space:
mode:
authorKozlov Dmitry <xeb@mail.ru>2011-12-09 10:16:58 +0400
committerKozlov Dmitry <xeb@mail.ru>2011-12-09 10:16:58 +0400
commitd0391e17b4a77f1762c898ff1e434bc13099052e (patch)
tree5b759359d6971610941607dd5f4bc2fb9541c7d5 /accel-pppd/ppp
parent03c5bd91157b042f9d98c1a1f437dadea6b0531a (diff)
downloadaccel-ppp-d0391e17b4a77f1762c898ff1e434bc13099052e.tar.gz
accel-ppp-d0391e17b4a77f1762c898ff1e434bc13099052e.zip
ppp: don't accept lcp ConfReq and similar packets after lcp was started
Diffstat (limited to 'accel-pppd/ppp')
-rw-r--r--accel-pppd/ppp/ppp_auth.c10
-rw-r--r--accel-pppd/ppp/ppp_lcp.c9
2 files changed, 19 insertions, 0 deletions
diff --git a/accel-pppd/ppp/ppp_auth.c b/accel-pppd/ppp/ppp_auth.c
index 98675d37..1fb3bcf9 100644
--- a/accel-pppd/ppp/ppp_auth.c
+++ b/accel-pppd/ppp/ppp_auth.c
@@ -144,6 +144,16 @@ static int auth_recv_conf_req(struct ppp_lcp_t *lcp, struct lcp_option_t *opt, u
struct auth_data_t *d;
int r;
+ if (auth_opt->started) {
+ if (!auth_opt->auth)
+ return LCP_OPT_REJ;
+
+ if (!ptr || ntohs(opt16->val) != auth_opt->auth->proto)
+ return LCP_OPT_NAK;
+
+ return LCP_OPT_ACK;
+ }
+
if (list_empty(&auth_opt->auth_list))
return LCP_OPT_REJ;
diff --git a/accel-pppd/ppp/ppp_lcp.c b/accel-pppd/ppp/ppp_lcp.c
index 78a145af..58c21dcc 100644
--- a/accel-pppd/ppp/ppp_lcp.c
+++ b/accel-pppd/ppp/ppp_lcp.c
@@ -728,6 +728,9 @@ static void lcp_recv(struct ppp_handler_t*h)
if ((hdr->code == CONFACK || hdr->code == CONFNAK || hdr->code == CONFREJ) && hdr->id != lcp->fsm.id)
return;
+
+ if ((hdr->code == CONFACK || hdr->code == CONFNAK || hdr->code == CONFREJ) && lcp->started)
+ return;
if (lcp->fsm.fsm_state == FSM_Initial || lcp->fsm.fsm_state == FSM_Closed || (lcp->ppp->terminating && (hdr->code != TERMACK && hdr->code != TERMREQ))) {
/*if (conf_ppp_verbose)
@@ -741,6 +744,12 @@ static void lcp_recv(struct ppp_handler_t*h)
switch(hdr->code) {
case CONFREQ:
r = lcp_recv_conf_req(lcp, (uint8_t*)(hdr + 1), ntohs(hdr->len) - PPP_HDRLEN);
+ if (lcp->started) {
+ if (r == LCP_OPT_ACK)
+ send_conf_ack(&lcp->fsm);
+ else
+ r = LCP_OPT_FAIL;
+ }
switch(r) {
case LCP_OPT_ACK:
ppp_fsm_recv_conf_req_ack(&lcp->fsm);