diff --git a/src/netif/ppp/auth.c b/src/netif/ppp/auth.c index 34cdd3b1..4f800e4f 100644 --- a/src/netif/ppp/auth.c +++ b/src/netif/ppp/auth.c @@ -728,7 +728,6 @@ void link_established(ppp_pcb *pcb) { #if PPP_AUTH_SUPPORT int auth; #if PPP_SERVER - int errcode; lcp_options *wo = &pcb->lcp_wantoptions; lcp_options *go = &pcb->lcp_gotoptions; #endif /* PPP_SERVER */ @@ -783,8 +782,7 @@ void link_established(ppp_pcb *pcb) { #if 0 /* UNUSED */ status = EXIT_PEER_AUTH_FAILED; #endif /* UNUSED */ - errcode = PPPERR_AUTHFAIL; - ppp_ioctl(pcb, PPPCTLS_ERRCODE, &errcode); + pcb->err_code = PPPERR_AUTHFAIL; lcp_close(pcb, "peer refused to authenticate"); return; } @@ -1001,7 +999,6 @@ void continue_networks(ppp_pcb *pcb) { * The peer has failed to authenticate himself using `protocol'. */ void auth_peer_fail(ppp_pcb *pcb, int protocol) { - int errcode = PPPERR_AUTHFAIL; LWIP_UNUSED_ARG(protocol); /* * Authentication failure: take the link down @@ -1009,7 +1006,7 @@ void auth_peer_fail(ppp_pcb *pcb, int protocol) { #if 0 /* UNUSED */ status = EXIT_PEER_AUTH_FAILED; #endif /* UNUSED */ - ppp_ioctl(pcb, PPPCTLS_ERRCODE, &errcode); + pcb->err_code = PPPERR_AUTHFAIL; lcp_close(pcb, "Authentication failed"); } @@ -1083,7 +1080,6 @@ void auth_peer_success(ppp_pcb *pcb, int protocol, int prot_flavor, const char * * We have failed to authenticate ourselves to the peer using `protocol'. */ void auth_withpeer_fail(ppp_pcb *pcb, int protocol) { - int errcode = PPPERR_AUTHFAIL; LWIP_UNUSED_ARG(protocol); /* * We've failed to authenticate ourselves to our peer. @@ -1095,7 +1091,7 @@ void auth_withpeer_fail(ppp_pcb *pcb, int protocol) { * He'll probably take the link down, and there's not much * we can do except wait for that. */ - ppp_ioctl(pcb, PPPCTLS_ERRCODE, &errcode); + pcb->err_code = PPPERR_AUTHFAIL; lcp_close(pcb, "Failed to authenticate ourselves to peer"); } @@ -1306,10 +1302,9 @@ static void check_idle(void *arg) { } #endif /* UNUSED */ if (tlim <= 0) { - int errcode = PPPERR_IDLETIMEOUT; /* link is idle: shut it down. */ ppp_notice("Terminating connection due to lack of activity."); - ppp_ioctl(pcb, PPPCTLS_ERRCODE, &errcode); + pcb->err_code = PPPERR_IDLETIMEOUT; lcp_close(pcb, "Link inactive"); #if 0 /* UNUSED */ need_holdoff = 0; @@ -1325,10 +1320,9 @@ static void check_idle(void *arg) { * connect_time_expired - log a message and close the connection. */ static void connect_time_expired(void *arg) { - int errcode = PPPERR_CONNECTTIME; ppp_pcb *pcb = (ppp_pcb*)arg; ppp_info("Connect time expired"); - ppp_ioctl(pcb, PPPCTLS_ERRCODE, &errcode); + pcb->err_code = PPPERR_CONNECTTIME; lcp_close(pcb, "Connect time expired"); /* Close connection */ } #endif /* PPP_MAXCONNECT */ diff --git a/src/netif/ppp/lcp.c b/src/netif/ppp/lcp.c index d4f5c8a4..f10b3da3 100644 --- a/src/netif/ppp/lcp.c +++ b/src/netif/ppp/lcp.c @@ -1467,9 +1467,8 @@ static int lcp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) { if (f->state != PPP_FSM_OPENED) { if (looped_back) { if (++try_.numloops >= pcb->settings.lcp_loopbackfail) { - int errcode = PPPERR_LOOPBACK; ppp_notice("Serial line is looped back."); - ppp_ioctl(pcb, PPPCTLS_ERRCODE, &errcode); + pcb->err_code = PPPERR_LOOPBACK; lcp_close(f->pcb, "Loopback detected"); } } else @@ -2547,10 +2546,9 @@ static int lcp_printpkt(u_char *p, int plen, static void LcpLinkFailure(fsm *f) { ppp_pcb *pcb = f->pcb; if (f->state == PPP_FSM_OPENED) { - int errcode = PPPERR_PEERDEAD; ppp_info("No response to %d echo-requests", pcb->lcp_echos_pending); ppp_notice("Serial link appears to be disconnected."); - ppp_ioctl(pcb, PPPCTLS_ERRCODE, &errcode); + pcb->err_code = PPPERR_PEERDEAD; lcp_close(pcb, "Peer not responding"); } }