mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2025-12-10 08:46:40 +08:00
make ppp_trace only called from PPP DEBUG macros if debug is on.More cleanups needed in the PPP debug system
This commit is contained in:
parent
1163a1c3ce
commit
26507e5ab5
@ -194,7 +194,7 @@ void link_terminated(int unit)
|
|||||||
if (logged_in)
|
if (logged_in)
|
||||||
logout();
|
logout();
|
||||||
lcp_phase[unit] = PHASE_DEAD;
|
lcp_phase[unit] = PHASE_DEAD;
|
||||||
ppp_trace(LOG_NOTICE, "Connection terminated.\n");
|
AUTHDEBUG((LOG_NOTICE, "Connection terminated.\n"));
|
||||||
pppMainWakeup(unit);
|
pppMainWakeup(unit);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -257,7 +257,7 @@ void link_established(int unit)
|
|||||||
* of "" and a password of "". If that's not OK, boot it out.
|
* of "" and a password of "". If that's not OK, boot it out.
|
||||||
*/
|
*/
|
||||||
if (!wo->neg_upap || !null_login(unit)) {
|
if (!wo->neg_upap || !null_login(unit)) {
|
||||||
ppp_trace(LOG_WARNING, "peer refused to authenticate\n");
|
AUTHDEBUG((LOG_WARNING, "peer refused to authenticate\n"));
|
||||||
lcp_close(unit, "peer refused to authenticate");
|
lcp_close(unit, "peer refused to authenticate");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -294,7 +294,7 @@ void link_established(int unit)
|
|||||||
if (ppp_settings.passwd[0] == 0) {
|
if (ppp_settings.passwd[0] == 0) {
|
||||||
passwd_from_file = 1;
|
passwd_from_file = 1;
|
||||||
if (!get_pap_passwd(unit, ppp_settings.user, ppp_settings.passwd))
|
if (!get_pap_passwd(unit, ppp_settings.user, ppp_settings.passwd))
|
||||||
ppp_trace(LOG_ERR, "No secret found for PAP login\n");
|
AUTHDEBUG((LOG_ERR, "No secret found for PAP login\n"));
|
||||||
}
|
}
|
||||||
upap_authwithpeer(unit, ppp_settings.user, ppp_settings.passwd);
|
upap_authwithpeer(unit, ppp_settings.user, ppp_settings.passwd);
|
||||||
auth |= PAP_WITHPEER;
|
auth |= PAP_WITHPEER;
|
||||||
@ -337,8 +337,8 @@ void auth_peer_success(int unit, u16_t protocol, char *name, int namelen)
|
|||||||
pbit = PAP_PEER;
|
pbit = PAP_PEER;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ppp_trace(LOG_WARNING, "auth_peer_success: unknown protocol %x\n",
|
AUTHDEBUG((LOG_WARNING, "auth_peer_success: unknown protocol %x\n",
|
||||||
protocol);
|
protocol));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -400,8 +400,8 @@ void auth_withpeer_success(int unit, u16_t protocol)
|
|||||||
pbit = PAP_WITHPEER;
|
pbit = PAP_WITHPEER;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ppp_trace(LOG_WARNING, "auth_peer_success: unknown protocol %x\n",
|
AUTHDEBUG((LOG_WARNING, "auth_peer_success: unknown protocol %x\n",
|
||||||
protocol);
|
protocol));
|
||||||
pbit = 0;
|
pbit = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -541,7 +541,7 @@ int check_passwd(
|
|||||||
* On 10'th, drop the connection.
|
* On 10'th, drop the connection.
|
||||||
*/
|
*/
|
||||||
if (attempts++ >= 10) {
|
if (attempts++ >= 10) {
|
||||||
ppp_trace(LOG_WARNING, "%d LOGIN FAILURES BY %s\n", attempts, user);
|
AUTHDEBUG((LOG_WARNING, "%d LOGIN FAILURES BY %s\n", attempts, user));
|
||||||
/*ppp_panic("Excess Bad Logins");*/
|
/*ppp_panic("Excess Bad Logins");*/
|
||||||
}
|
}
|
||||||
if (attempts > 3) {
|
if (attempts > 3) {
|
||||||
@ -616,7 +616,7 @@ int get_secret(
|
|||||||
|
|
||||||
len = strlen(ppp_settings.passwd);
|
len = strlen(ppp_settings.passwd);
|
||||||
if (len > MAXSECRETLEN) {
|
if (len > MAXSECRETLEN) {
|
||||||
ppp_trace(LOG_ERR, "Secret for %s on %s is too long\n", client, server);
|
AUTHDEBUG((LOG_ERR, "Secret for %s on %s is too long\n", client, server));
|
||||||
len = MAXSECRETLEN;
|
len = MAXSECRETLEN;
|
||||||
}
|
}
|
||||||
BCOPY(ppp_settings.passwd, secret, len);
|
BCOPY(ppp_settings.passwd, secret, len);
|
||||||
@ -640,7 +640,7 @@ int get_secret(
|
|||||||
|
|
||||||
len = strlen(secbuf);
|
len = strlen(secbuf);
|
||||||
if (len > MAXSECRETLEN) {
|
if (len > MAXSECRETLEN) {
|
||||||
ppp_trace(LOG_ERR, "Secret for %s on %s is too long\n", client, server);
|
AUTHDEBUG((LOG_ERR, "Secret for %s on %s is too long\n", client, server));
|
||||||
len = MAXSECRETLEN;
|
len = MAXSECRETLEN;
|
||||||
}
|
}
|
||||||
BCOPY(secbuf, secret, len);
|
BCOPY(secbuf, secret, len);
|
||||||
@ -753,7 +753,7 @@ static void check_idle(void *arg)
|
|||||||
itime = LWIP_MIN(idle.xmit_idle, idle.recv_idle);
|
itime = LWIP_MIN(idle.xmit_idle, idle.recv_idle);
|
||||||
if (itime >= ppp_settings.idle_time_limit) {
|
if (itime >= ppp_settings.idle_time_limit) {
|
||||||
/* link is idle: shut it down. */
|
/* link is idle: shut it down. */
|
||||||
ppp_trace(LOG_INFO, "Terminating connection due to lack of activity.\n");
|
AUTHDEBUG((LOG_INFO, "Terminating connection due to lack of activity.\n"));
|
||||||
lcp_close(0, "Link inactive");
|
lcp_close(0, "Link inactive");
|
||||||
} else {
|
} else {
|
||||||
TIMEOUT(check_idle, NULL, ppp_settings.idle_time_limit - itime);
|
TIMEOUT(check_idle, NULL, ppp_settings.idle_time_limit - itime);
|
||||||
@ -767,7 +767,7 @@ static void connect_time_expired(void *arg)
|
|||||||
{
|
{
|
||||||
(void)arg;
|
(void)arg;
|
||||||
|
|
||||||
ppp_trace(LOG_INFO, "Connect time expired\n");
|
AUTHDEBUG((LOG_INFO, "Connect time expired\n"));
|
||||||
lcp_close(0, "Connect time expired"); /* Close connection */
|
lcp_close(0, "Connect time expired"); /* Close connection */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -245,7 +245,7 @@ static void ChapChallengeTimeout(void *arg)
|
|||||||
|
|
||||||
if (cstate->chal_transmits >= cstate->max_transmits) {
|
if (cstate->chal_transmits >= cstate->max_transmits) {
|
||||||
/* give up on peer */
|
/* give up on peer */
|
||||||
ppp_trace(LOG_ERR, "Peer failed to respond to CHAP challenge\n");
|
CHAPDEBUG((LOG_ERR, "Peer failed to respond to CHAP challenge\n"));
|
||||||
cstate->serverstate = CHAPSS_BADAUTH;
|
cstate->serverstate = CHAPSS_BADAUTH;
|
||||||
auth_peer_fail(cstate->unit, PPP_CHAP);
|
auth_peer_fail(cstate->unit, PPP_CHAP);
|
||||||
return;
|
return;
|
||||||
@ -405,7 +405,7 @@ static void ChapInput(int unit, u_char *inpacket, int packet_len)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default: /* Need code reject? */
|
default: /* Need code reject? */
|
||||||
ppp_trace(LOG_WARNING, "Unknown CHAP code (%d) received.\n", code);
|
CHAPDEBUG((LOG_WARNING, "Unknown CHAP code (%d) received.\n", code));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -466,7 +466,7 @@ static void ChapReceiveChallenge(chap_state *cstate, u_char *inp, int id, int le
|
|||||||
if (!get_secret(cstate->unit, cstate->resp_name, rhostname,
|
if (!get_secret(cstate->unit, cstate->resp_name, rhostname,
|
||||||
secret, &secret_len, 0)) {
|
secret, &secret_len, 0)) {
|
||||||
secret_len = 0; /* assume null secret if can't find one */
|
secret_len = 0; /* assume null secret if can't find one */
|
||||||
ppp_trace(LOG_WARNING, "No CHAP secret found for authenticating us to %s\n", rhostname);
|
CHAPDEBUG((LOG_WARNING, "No CHAP secret found for authenticating us to %s\n", rhostname));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* cancel response send timeout if necessary */
|
/* cancel response send timeout if necessary */
|
||||||
@ -576,8 +576,8 @@ static void ChapReceiveResponse(chap_state *cstate, u_char *inp, int id, int len
|
|||||||
if (!get_secret(cstate->unit, rhostname, cstate->chal_name,
|
if (!get_secret(cstate->unit, rhostname, cstate->chal_name,
|
||||||
secret, &secret_len, 1)) {
|
secret, &secret_len, 1)) {
|
||||||
/* CHAPDEBUG((LOG_WARNING, TL_CHAP, "No CHAP secret found for authenticating %s\n", rhostname)); */
|
/* CHAPDEBUG((LOG_WARNING, TL_CHAP, "No CHAP secret found for authenticating %s\n", rhostname)); */
|
||||||
ppp_trace(LOG_WARNING, "No CHAP secret found for authenticating %s\n",
|
CHAPDEBUG((LOG_WARNING, "No CHAP secret found for authenticating %s\n",
|
||||||
rhostname);
|
rhostname));
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
/* generate MD based on negotiated type */
|
/* generate MD based on negotiated type */
|
||||||
@ -614,7 +614,7 @@ static void ChapReceiveResponse(chap_state *cstate, u_char *inp, int id, int len
|
|||||||
if (cstate->chal_interval != 0)
|
if (cstate->chal_interval != 0)
|
||||||
TIMEOUT(ChapRechallenge, cstate, cstate->chal_interval);
|
TIMEOUT(ChapRechallenge, cstate, cstate->chal_interval);
|
||||||
} else {
|
} else {
|
||||||
ppp_trace(LOG_ERR, "CHAP peer authentication failed\n");
|
CHAPDEBUG((LOG_ERR, "CHAP peer authentication failed\n"));
|
||||||
cstate->serverstate = CHAPSS_BADAUTH;
|
cstate->serverstate = CHAPSS_BADAUTH;
|
||||||
auth_peer_fail(cstate->unit, PPP_CHAP);
|
auth_peer_fail(cstate->unit, PPP_CHAP);
|
||||||
}
|
}
|
||||||
@ -675,7 +675,7 @@ static void ChapReceiveFailure(chap_state *cstate, u_char *inp, u_char id, int l
|
|||||||
if (len > 0)
|
if (len > 0)
|
||||||
PRINTMSG(inp, len);
|
PRINTMSG(inp, len);
|
||||||
|
|
||||||
ppp_trace(LOG_ERR, "CHAP authentication failed\n");
|
CHAPDEBUG((LOG_ERR, "CHAP authentication failed\n"));
|
||||||
auth_withpeer_fail(cstate->unit, PPP_CHAP);
|
auth_withpeer_fail(cstate->unit, PPP_CHAP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1192,12 +1192,12 @@ static void ipcp_up(fsm *f)
|
|||||||
ho->hisaddr = wo->hisaddr;
|
ho->hisaddr = wo->hisaddr;
|
||||||
|
|
||||||
if (ho->hisaddr == 0) {
|
if (ho->hisaddr == 0) {
|
||||||
ppp_trace(LOG_ERR, "Could not determine remote IP address\n");
|
IPCPDEBUG((LOG_ERR, "Could not determine remote IP address\n"));
|
||||||
ipcp_close(f->unit, "Could not determine remote IP address");
|
ipcp_close(f->unit, "Could not determine remote IP address");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (go->ouraddr == 0) {
|
if (go->ouraddr == 0) {
|
||||||
ppp_trace(LOG_ERR, "Could not determine local IP address\n");
|
IPCPDEBUG((LOG_ERR, "Could not determine local IP address\n"));
|
||||||
ipcp_close(f->unit, "Could not determine local IP address");
|
ipcp_close(f->unit, "Could not determine local IP address");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1210,8 +1210,8 @@ static void ipcp_up(fsm *f)
|
|||||||
* Check that the peer is allowed to use the IP address it wants.
|
* Check that the peer is allowed to use the IP address it wants.
|
||||||
*/
|
*/
|
||||||
if (!auth_ip_addr(f->unit, ho->hisaddr)) {
|
if (!auth_ip_addr(f->unit, ho->hisaddr)) {
|
||||||
ppp_trace(LOG_ERR, "Peer is not authorized to use remote address %s\n",
|
IPCPDEBUG((LOG_ERR, "Peer is not authorized to use remote address %s\n",
|
||||||
inet_ntoa(ho->hisaddr));
|
inet_ntoa(ho->hisaddr)));
|
||||||
ipcp_close(f->unit, "Unauthorized remote IP address");
|
ipcp_close(f->unit, "Unauthorized remote IP address");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -216,7 +216,7 @@ static void upap_timeout(void *arg)
|
|||||||
|
|
||||||
if (u->us_transmits >= u->us_maxtransmits) {
|
if (u->us_transmits >= u->us_maxtransmits) {
|
||||||
/* give up in disgust */
|
/* give up in disgust */
|
||||||
ppp_trace(LOG_ERR, "No response to PAP authenticate-requests\n");
|
UPAPDEBUG((LOG_ERR, "No response to PAP authenticate-requests\n"));
|
||||||
u->us_clientstate = UPAPCS_BADAUTH;
|
u->us_clientstate = UPAPCS_BADAUTH;
|
||||||
auth_withpeer_fail(u->us_unit, PPP_PAP);
|
auth_withpeer_fail(u->us_unit, PPP_PAP);
|
||||||
return;
|
return;
|
||||||
@ -299,11 +299,11 @@ static void upap_protrej(int unit)
|
|||||||
upap_state *u = &upap[unit];
|
upap_state *u = &upap[unit];
|
||||||
|
|
||||||
if (u->us_clientstate == UPAPCS_AUTHREQ) {
|
if (u->us_clientstate == UPAPCS_AUTHREQ) {
|
||||||
ppp_trace(LOG_ERR, "PAP authentication failed due to protocol-reject\n");
|
UPAPDEBUG((LOG_ERR, "PAP authentication failed due to protocol-reject\n"));
|
||||||
auth_withpeer_fail(unit, PPP_PAP);
|
auth_withpeer_fail(unit, PPP_PAP);
|
||||||
}
|
}
|
||||||
if (u->us_serverstate == UPAPSS_LISTEN) {
|
if (u->us_serverstate == UPAPSS_LISTEN) {
|
||||||
ppp_trace(LOG_ERR, "PAP authentication of peer failed (protocol-reject)\n");
|
UPAPDEBUG((LOG_ERR, "PAP authentication of peer failed (protocol-reject)\n"));
|
||||||
auth_peer_fail(unit, PPP_PAP);
|
auth_peer_fail(unit, PPP_PAP);
|
||||||
}
|
}
|
||||||
upap_lowerdown(unit);
|
upap_lowerdown(unit);
|
||||||
@ -518,7 +518,7 @@ static void upap_rauthnak(
|
|||||||
|
|
||||||
u->us_clientstate = UPAPCS_BADAUTH;
|
u->us_clientstate = UPAPCS_BADAUTH;
|
||||||
|
|
||||||
ppp_trace(LOG_ERR, "PAP authentication failed\n");
|
UPAPDEBUG((LOG_ERR, "PAP authentication failed\n"));
|
||||||
auth_withpeer_fail(u->us_unit, PPP_PAP);
|
auth_withpeer_fail(u->us_unit, PPP_PAP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -208,8 +208,11 @@ enum NPmode {
|
|||||||
#define BCMP(s0, s1, l) memcmp((u_char *)(s0), (u_char *)(s1), (l))
|
#define BCMP(s0, s1, l) memcmp((u_char *)(s0), (u_char *)(s1), (l))
|
||||||
#define BCOPY(s, d, l) memcpy((d), (s), (l))
|
#define BCOPY(s, d, l) memcpy((d), (s), (l))
|
||||||
#define BZERO(s, n) memset(s, 0, n)
|
#define BZERO(s, n) memset(s, 0, n)
|
||||||
|
#if PPP_DEBUG
|
||||||
#define PRINTMSG(m, l) { m[l] = '\0'; ppp_trace(LOG_INFO, "Remote message: %s\n", m); }
|
#define PRINTMSG(m, l) { m[l] = '\0'; ppp_trace(LOG_INFO, "Remote message: %s\n", m); }
|
||||||
|
#else
|
||||||
|
#define PRINTMSG(m, l)
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* MAKEHEADER - Add PPP Header fields to a packet.
|
* MAKEHEADER - Add PPP Header fields to a packet.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user