mirror of https://github.com/ARMmbed/mbed-os.git
Corrected PPP debug trace flagging
Some parts of PPP debug traces were enabled also on non-debug builds. Now they are correctly disabled. Corrected also compiler warnings that became visible when trace macros were flagged (if clauses without brackets).pull/12195/head
parent
244422d470
commit
9e41f1fc7d
|
@ -648,6 +648,8 @@ int str_to_epdisc (struct epdisc *, char *); /* endpt disc. from str */
|
||||||
#define multilink_master 0
|
#define multilink_master 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if PPP_DEBUG
|
||||||
|
|
||||||
/* Procedures exported from utils.c. */
|
/* Procedures exported from utils.c. */
|
||||||
void ppp_print_string(const u_char *p, int len, void (*printer) (void *, const char *, ...), void *arg); /* Format a string for output */
|
void ppp_print_string(const u_char *p, int len, void (*printer) (void *, const char *, ...), void *arg); /* Format a string for output */
|
||||||
int ppp_slprintf(char *buf, int buflen, const char *fmt, ...); /* sprintf++ */
|
int ppp_slprintf(char *buf, int buflen, const char *fmt, ...); /* sprintf++ */
|
||||||
|
@ -665,6 +667,22 @@ void ppp_dump_packet(ppp_pcb *pcb, const char *tag, unsigned char *p, int len);
|
||||||
/* dump packet to debug log if interesting */
|
/* dump packet to debug log if interesting */
|
||||||
#endif /* PRINTPKT_SUPPORT */
|
#endif /* PRINTPKT_SUPPORT */
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define ppp_print_string(...)
|
||||||
|
#define ppp_slprintf(...)
|
||||||
|
#define ppp_vslprintf(...)
|
||||||
|
#define ppp_strlcpy(...)
|
||||||
|
#define ppp_strlcat(...)
|
||||||
|
#define ppp_dbglog(...)
|
||||||
|
#define ppp_info(...)
|
||||||
|
#define ppp_notice(...)
|
||||||
|
#define ppp_warn(...)
|
||||||
|
#define ppp_error(...)
|
||||||
|
#define ppp_fatal(...)
|
||||||
|
|
||||||
|
#endif /* PPP_DEBUG */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Number of necessary timers analysis.
|
* Number of necessary timers analysis.
|
||||||
*
|
*
|
||||||
|
|
|
@ -630,12 +630,13 @@ void link_terminated(ppp_pcb *pcb) {
|
||||||
#endif /* UNUSED */
|
#endif /* UNUSED */
|
||||||
|
|
||||||
if (!doing_multilink) {
|
if (!doing_multilink) {
|
||||||
ppp_notice("Connection terminated.");
|
ppp_notice("Connection terminated.");
|
||||||
#if PPP_STATS_SUPPORT
|
#if PPP_STATS_SUPPORT
|
||||||
print_link_stats();
|
print_link_stats();
|
||||||
#endif /* PPP_STATS_SUPPORT */
|
#endif /* PPP_STATS_SUPPORT */
|
||||||
} else
|
} else {
|
||||||
ppp_notice("Link terminated.");
|
ppp_notice("Link terminated.");
|
||||||
|
}
|
||||||
|
|
||||||
lcp_lowerdown(pcb);
|
lcp_lowerdown(pcb);
|
||||||
|
|
||||||
|
@ -1131,13 +1132,17 @@ void auth_withpeer_fail(ppp_pcb *pcb, int protocol) {
|
||||||
*/
|
*/
|
||||||
void auth_withpeer_success(ppp_pcb *pcb, int protocol, int prot_flavor) {
|
void auth_withpeer_success(ppp_pcb *pcb, int protocol, int prot_flavor) {
|
||||||
int bit;
|
int bit;
|
||||||
|
#if PPP_DEBUG
|
||||||
const char *prot = "";
|
const char *prot = "";
|
||||||
|
#endif
|
||||||
|
|
||||||
switch (protocol) {
|
switch (protocol) {
|
||||||
#if CHAP_SUPPORT
|
#if CHAP_SUPPORT
|
||||||
case PPP_CHAP:
|
case PPP_CHAP:
|
||||||
bit = CHAP_WITHPEER;
|
bit = CHAP_WITHPEER;
|
||||||
|
#if PPP_DEBUG
|
||||||
prot = "CHAP";
|
prot = "CHAP";
|
||||||
|
#endif
|
||||||
switch (prot_flavor) {
|
switch (prot_flavor) {
|
||||||
case CHAP_MD5:
|
case CHAP_MD5:
|
||||||
bit |= CHAP_MD5_WITHPEER;
|
bit |= CHAP_MD5_WITHPEER;
|
||||||
|
@ -1158,13 +1163,17 @@ void auth_withpeer_success(ppp_pcb *pcb, int protocol, int prot_flavor) {
|
||||||
#if PAP_SUPPORT
|
#if PAP_SUPPORT
|
||||||
case PPP_PAP:
|
case PPP_PAP:
|
||||||
bit = PAP_WITHPEER;
|
bit = PAP_WITHPEER;
|
||||||
|
#if PPP_DEBUG
|
||||||
prot = "PAP";
|
prot = "PAP";
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
#endif /* PAP_SUPPORT */
|
#endif /* PAP_SUPPORT */
|
||||||
#if EAP_SUPPORT
|
#if EAP_SUPPORT
|
||||||
case PPP_EAP:
|
case PPP_EAP:
|
||||||
bit = EAP_WITHPEER;
|
bit = EAP_WITHPEER;
|
||||||
|
#if PPP_DEBUG
|
||||||
prot = "EAP";
|
prot = "EAP";
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
#endif /* EAP_SUPPORT */
|
#endif /* EAP_SUPPORT */
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -205,9 +205,10 @@ void chap_auth_with_peer(ppp_pcb *pcb, const char *our_name, int digest_code) {
|
||||||
if (dp->code == digest_code)
|
if (dp->code == digest_code)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (dp == NULL)
|
if (dp == NULL) {
|
||||||
ppp_fatal("CHAP digest 0x%x requested but not available",
|
ppp_fatal("CHAP digest 0x%x requested but not available",
|
||||||
digest_code);
|
digest_code);
|
||||||
|
}
|
||||||
|
|
||||||
pcb->chap_client.digest = dp;
|
pcb->chap_client.digest = dp;
|
||||||
pcb->chap_client.name = our_name;
|
pcb->chap_client.name = our_name;
|
||||||
|
@ -519,10 +520,11 @@ static void chap_handle_status(ppp_pcb *pcb, int code, int id,
|
||||||
msg = "CHAP authentication failed";
|
msg = "CHAP authentication failed";
|
||||||
}
|
}
|
||||||
if (msg) {
|
if (msg) {
|
||||||
if (len > 0)
|
if (len > 0) {
|
||||||
ppp_info("%s: %.*v", msg, len, pkt);
|
ppp_info("%s: %.*v", msg, len, pkt);
|
||||||
else
|
} else {
|
||||||
ppp_info("%s", msg);
|
ppp_info("%s", msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (code == CHAP_SUCCESS)
|
if (code == CHAP_SUCCESS)
|
||||||
auth_withpeer_success(pcb, PPP_CHAP, pcb->chap_client.digest->code);
|
auth_withpeer_success(pcb, PPP_CHAP, pcb->chap_client.digest->code);
|
||||||
|
|
|
@ -589,8 +589,9 @@ static void fsm_rtermreq(fsm *f, int id, u_char *p, int len) {
|
||||||
case PPP_FSM_OPENED:
|
case PPP_FSM_OPENED:
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
ppp_info("%s terminated by peer (%0.*v)", PROTO_NAME(f), len, p);
|
ppp_info("%s terminated by peer (%0.*v)", PROTO_NAME(f), len, p);
|
||||||
} else
|
} else {
|
||||||
ppp_info("%s terminated by peer", PROTO_NAME(f));
|
ppp_info("%s terminated by peer", PROTO_NAME(f));
|
||||||
|
}
|
||||||
f->retransmits = 0;
|
f->retransmits = 0;
|
||||||
f->state = PPP_FSM_STOPPING;
|
f->state = PPP_FSM_STOPPING;
|
||||||
if (f->callbacks->down)
|
if (f->callbacks->down)
|
||||||
|
@ -643,15 +644,19 @@ static void fsm_rtermack(fsm *f) {
|
||||||
* fsm_rcoderej - Receive an Code-Reject.
|
* fsm_rcoderej - Receive an Code-Reject.
|
||||||
*/
|
*/
|
||||||
static void fsm_rcoderej(fsm *f, u_char *inp, int len) {
|
static void fsm_rcoderej(fsm *f, u_char *inp, int len) {
|
||||||
|
#if PPP_DEBUG
|
||||||
u_char code, id;
|
u_char code, id;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (len < HEADERLEN) {
|
if (len < HEADERLEN) {
|
||||||
FSMDEBUG(("fsm_rcoderej: Rcvd short Code-Reject packet!"));
|
FSMDEBUG(("fsm_rcoderej: Rcvd short Code-Reject packet!"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#if PPP_DEBUG
|
||||||
GETCHAR(code, inp);
|
GETCHAR(code, inp);
|
||||||
GETCHAR(id, inp);
|
GETCHAR(id, inp);
|
||||||
ppp_warn("%s: Rcvd Code-Reject for code %d, id %d", PROTO_NAME(f), code, id);
|
ppp_warn("%s: Rcvd Code-Reject for code %d, id %d", PROTO_NAME(f), code, id);
|
||||||
|
#endif
|
||||||
|
|
||||||
if( f->state == PPP_FSM_ACKRCVD )
|
if( f->state == PPP_FSM_ACKRCVD )
|
||||||
f->state = PPP_FSM_REQSENT;
|
f->state = PPP_FSM_REQSENT;
|
||||||
|
|
|
@ -2087,13 +2087,16 @@ static void ipcp_up(fsm *f) {
|
||||||
wo->ouraddr = go->ouraddr;
|
wo->ouraddr = go->ouraddr;
|
||||||
|
|
||||||
ppp_notice("local IP address %I", go->ouraddr);
|
ppp_notice("local IP address %I", go->ouraddr);
|
||||||
if (ho->hisaddr != 0)
|
if (ho->hisaddr != 0) {
|
||||||
ppp_notice("remote IP address %I", ho->hisaddr);
|
ppp_notice("remote IP address %I", ho->hisaddr);
|
||||||
|
}
|
||||||
#if PPP_DNS
|
#if PPP_DNS
|
||||||
if (go->dnsaddr[0])
|
if (go->dnsaddr[0]) {
|
||||||
ppp_notice("primary DNS address %I", go->dnsaddr[0]);
|
ppp_notice("primary DNS address %I", go->dnsaddr[0]);
|
||||||
if (go->dnsaddr[1])
|
}
|
||||||
|
if (go->dnsaddr[1]) {
|
||||||
ppp_notice("secondary DNS address %I", go->dnsaddr[1]);
|
ppp_notice("secondary DNS address %I", go->dnsaddr[1]);
|
||||||
|
}
|
||||||
#endif /* PPP_DNS */
|
#endif /* PPP_DNS */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -328,7 +328,9 @@ static enum script_state {
|
||||||
static pid_t ipv6cp_script_pid;
|
static pid_t ipv6cp_script_pid;
|
||||||
#endif /* UNUSED */
|
#endif /* UNUSED */
|
||||||
|
|
||||||
|
#if PPP_DEBUG
|
||||||
static char *llv6_ntoa(eui64_t ifaceid);
|
static char *llv6_ntoa(eui64_t ifaceid);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if PPP_OPTIONS
|
#if PPP_OPTIONS
|
||||||
/*
|
/*
|
||||||
|
@ -409,6 +411,7 @@ printifaceid(opt, printer, arg)
|
||||||
/*
|
/*
|
||||||
* Make a string representation of a network address.
|
* Make a string representation of a network address.
|
||||||
*/
|
*/
|
||||||
|
#if PPP_DEBUG
|
||||||
static char *
|
static char *
|
||||||
llv6_ntoa(eui64_t ifaceid)
|
llv6_ntoa(eui64_t ifaceid)
|
||||||
{
|
{
|
||||||
|
@ -420,7 +423,7 @@ llv6_ntoa(eui64_t ifaceid)
|
||||||
|
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ipv6cp_init - Initialize IPV6CP.
|
* ipv6cp_init - Initialize IPV6CP.
|
||||||
|
@ -1245,6 +1248,7 @@ static void ipv6cp_up(fsm *f) {
|
||||||
ipv6cp_close(f->pcb, "Interface configuration failed");
|
ipv6cp_close(f->pcb, "Interface configuration failed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if DEMAND_SUPPORT
|
#if DEMAND_SUPPORT
|
||||||
sifnpmode(f->pcb, PPP_IPV6, NPMODE_PASS);
|
sifnpmode(f->pcb, PPP_IPV6, NPMODE_PASS);
|
||||||
#endif /* DEMAND_SUPPORT */
|
#endif /* DEMAND_SUPPORT */
|
||||||
|
|
|
@ -2664,8 +2664,9 @@ static void LcpEchoCheck(fsm *f) {
|
||||||
/*
|
/*
|
||||||
* Start the timer for the next interval.
|
* Start the timer for the next interval.
|
||||||
*/
|
*/
|
||||||
if (pcb->lcp_echo_timer_running)
|
if (pcb->lcp_echo_timer_running) {
|
||||||
ppp_warn("assertion lcp_echo_timer_running==0 failed");
|
ppp_warn("assertion lcp_echo_timer_running==0 failed");
|
||||||
|
}
|
||||||
TIMEOUT (LcpEchoTimeout, f, pcb->settings.lcp_echo_interval);
|
TIMEOUT (LcpEchoTimeout, f, pcb->settings.lcp_echo_interval);
|
||||||
pcb->lcp_echo_timer_running = 1;
|
pcb->lcp_echo_timer_running = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
|
|
||||||
#include "ppp_opts.h"
|
#include "ppp_opts.h"
|
||||||
#if PPP_SUPPORT /* don't build if not configured for use in ppp_opts.h */
|
#if PPP_SUPPORT /* don't build if not configured for use in ppp_opts.h */
|
||||||
|
#if PPP_DEBUG
|
||||||
|
|
||||||
#if 0 /* UNUSED */
|
#if 0 /* UNUSED */
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -955,4 +956,5 @@ unlock()
|
||||||
|
|
||||||
#endif /* Unused */
|
#endif /* Unused */
|
||||||
|
|
||||||
|
#endif /* PPP_DEBUG */
|
||||||
#endif /* PPP_SUPPORT */
|
#endif /* PPP_SUPPORT */
|
||||||
|
|
Loading…
Reference in New Issue