diff options
Diffstat (limited to 'accel-pppd/ppp/ppp_ccp.c')
-rw-r--r-- | accel-pppd/ppp/ppp_ccp.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/accel-pppd/ppp/ppp_ccp.c b/accel-pppd/ppp/ppp_ccp.c index d40d21b..a8b813d 100644 --- a/accel-pppd/ppp/ppp_ccp.c +++ b/accel-pppd/ppp/ppp_ccp.c @@ -609,7 +609,7 @@ static void ccp_recv(struct ppp_handler_t*h) struct ppp_ccp_t *ccp = container_of(h, typeof(*ccp), hnd); int r; - if (ccp->fsm.fsm_state == FSM_Initial || ccp->fsm.fsm_state == FSM_Closed || ccp->fsm.fsm_state == FSM_Opened || ccp->ppp->terminating) { + if (ccp->fsm.fsm_state == FSM_Initial || ccp->fsm.fsm_state == FSM_Closed || ccp->ppp->terminating) { if (conf_ppp_verbose) log_ppp_warn("CCP: discarding packet\n"); if (ccp->fsm.fsm_state == FSM_Closed || !conf_ccp) @@ -636,16 +636,23 @@ static void ccp_recv(struct ppp_handler_t*h) switch(hdr->code) { case CONFREQ: r = ccp_recv_conf_req(ccp, (uint8_t*)(hdr + 1), ntohs(hdr->len) - PPP_HDRLEN); - switch(r) { - case CCP_OPT_ACK: - ppp_fsm_recv_conf_req_ack(&ccp->fsm); - break; - case CCP_OPT_NAK: - ppp_fsm_recv_conf_req_nak(&ccp->fsm); - break; - case CCP_OPT_REJ: - ppp_fsm_recv_conf_req_rej(&ccp->fsm); - break; + if (ccp->started) { + if (r == CCP_OPT_ACK) + send_conf_ack(&ccp->fsm); + else + r = CCP_OPT_FAIL; + } else { + switch(r) { + case CCP_OPT_ACK: + ppp_fsm_recv_conf_req_ack(&ccp->fsm); + break; + case CCP_OPT_NAK: + ppp_fsm_recv_conf_req_nak(&ccp->fsm); + break; + case CCP_OPT_REJ: + ppp_fsm_recv_conf_req_rej(&ccp->fsm); + break; + } } ccp_free_conf_req(ccp); |