summaryrefslogtreecommitdiff
path: root/accel-pppd/ppp/ppp_ipcp.c
diff options
context:
space:
mode:
authorKozlov Dmitry <dima@server>2011-05-16 15:30:42 +0400
committerKozlov Dmitry <dima@server>2011-05-16 15:30:42 +0400
commitd2cb39985cd33f5678cad3e68b69cca51894bd58 (patch)
treef6a58e00a2bd993cb72f041bf71a82e799c39dc1 /accel-pppd/ppp/ppp_ipcp.c
parentcac666a65bef987c6004acb70bb17c0393cc335f (diff)
downloadaccel-ppp-d2cb39985cd33f5678cad3e68b69cca51894bd58.tar.gz
accel-ppp-d2cb39985cd33f5678cad3e68b69cca51894bd58.zip
ppp: discard packets with invalid id before passing it to fsm
ppp: default fsm timeout increased to 3 sec. ppp: accept LCP TermReq/TermAck packets in terminating phase
Diffstat (limited to 'accel-pppd/ppp/ppp_ipcp.c')
-rw-r--r--accel-pppd/ppp/ppp_ipcp.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/accel-pppd/ppp/ppp_ipcp.c b/accel-pppd/ppp/ppp_ipcp.c
index f8b2f480..8890f2c2 100644
--- a/accel-pppd/ppp/ppp_ipcp.c
+++ b/accel-pppd/ppp/ppp_ipcp.c
@@ -434,11 +434,11 @@ static int ipcp_recv_conf_rej(struct ppp_ipcp_t *ipcp, uint8_t *data, int size)
if (conf_ppp_verbose)
log_ppp_info2("recv [IPCP ConfRej id=%x", ipcp->fsm.recv_id);
- if (ipcp->fsm.recv_id != ipcp->fsm.id) {
+ /*if (ipcp->fsm.recv_id != ipcp->fsm.id) {
if (conf_ppp_verbose)
log_ppp_info2(": id mismatch ]\n");
return 0;
- }
+ }*/
while (size > 0) {
hdr = (struct ipcp_opt_hdr_t *)data;
@@ -472,11 +472,11 @@ static int ipcp_recv_conf_nak(struct ppp_ipcp_t *ipcp, uint8_t *data, int size)
if (conf_ppp_verbose)
log_ppp_info2("recv [IPCP ConfNak id=%x", ipcp->fsm.recv_id);
- if (ipcp->fsm.recv_id != ipcp->fsm.id) {
+ /*if (ipcp->fsm.recv_id != ipcp->fsm.id) {
if (conf_ppp_verbose)
log_ppp_info2(": id mismatch ]\n");
return 0;
- }
+ }*/
while (size > 0) {
hdr = (struct ipcp_opt_hdr_t *)data;
@@ -512,11 +512,11 @@ static int ipcp_recv_conf_ack(struct ppp_ipcp_t *ipcp, uint8_t *data, int size)
if (conf_ppp_verbose)
log_ppp_info2("recv [IPCP ConfAck id=%x", ipcp->fsm.recv_id);
- if (ipcp->fsm.recv_id != ipcp->fsm.id) {
+ /*if (ipcp->fsm.recv_id != ipcp->fsm.id) {
if (conf_ppp_verbose)
log_ppp_info2(": id mismatch ]\n");
return 0;
- }
+ }*/
while (size > 0) {
hdr = (struct ipcp_opt_hdr_t *)data;
@@ -583,7 +583,7 @@ static void ipcp_recv(struct ppp_handler_t*h)
struct ppp_ipcp_t *ipcp = container_of(h, typeof(*ipcp), hnd);
int r;
- if (ipcp->fsm.fsm_state == FSM_Initial || ipcp->fsm.fsm_state == FSM_Closed || ipcp->ppp->terminating) {
+ if (ipcp->fsm.fsm_state == FSM_Initial || ipcp->fsm.fsm_state == FSM_Closed || ipcp->fsm.fsm_state == FSM_Opened || ipcp->ppp->terminating) {
if (conf_ppp_verbose)
log_ppp_warn("IPCP: discarding packet\n");
return;
@@ -599,8 +599,12 @@ static void ipcp_recv(struct ppp_handler_t*h)
log_ppp_warn("IPCP: short packet received\n");
return;
}
+
+ if ((hdr->code == CONFACK || hdr->code == CONFNAK || hdr->code == CONFREJ) && hdr->id != ipcp->fsm.id)
+ return;
ipcp->fsm.recv_id = hdr->id;
+
switch(hdr->code) {
case CONFREQ:
r = ipcp_recv_conf_req(ipcp,(uint8_t*)(hdr + 1), ntohs(hdr->len) - PPP_HDRLEN);