From bf1285e3c9832a4c2f75394e6f8d06e0cc420602 Mon Sep 17 00:00:00 2001 From: Simon Goldschmidt Date: Fri, 10 Jan 2020 21:42:45 +0100 Subject: [PATCH] ppp: don't link debug functions if disabled This converts all ppp_*() debug functions to ppp_*(()) macros that ensure the code is left out by the linker if the corresponding debug setting is disabled. Downside is that many lines of code are touched, but since these already differ to upstream PPP sources, I figured that's ok... See bug #55199 Signed-off-by: Simon Goldschmidt --- src/include/netif/ppp/ppp_impl.h | 21 +++-- src/netif/ppp/auth.c | 68 ++++++++--------- src/netif/ppp/ccp.c | 44 +++++------ src/netif/ppp/chap-new.c | 28 +++---- src/netif/ppp/chap_ms.c | 14 ++-- src/netif/ppp/eap.c | 160 +++++++++++++++++++-------------------- src/netif/ppp/fsm.c | 14 ++-- src/netif/ppp/ipcp.c | 36 ++++----- src/netif/ppp/ipv6cp.c | 16 ++-- src/netif/ppp/lcp.c | 32 ++++---- src/netif/ppp/ppp.c | 8 +- src/netif/ppp/upap.c | 12 +-- src/netif/ppp/utils.c | 36 ++++----- 13 files changed, 248 insertions(+), 241 deletions(-) diff --git a/src/include/netif/ppp/ppp_impl.h b/src/include/netif/ppp/ppp_impl.h index 40843d5a..4642227c 100644 --- a/src/include/netif/ppp/ppp_impl.h +++ b/src/include/netif/ppp/ppp_impl.h @@ -539,7 +539,7 @@ void update_link_stats(int u); /* Get stats at link termination */ #define BZERO(s, n) memset(s, 0, n) #define BCMP(s1, s2, l) memcmp(s1, s2, l) -#define PRINTMSG(m, l) { ppp_info("Remote message: %0.*v", l, m); } +#define PRINTMSG(m, l) { ppp_info(("Remote message: %0.*v", l, m)); } /* * MAKEHEADER - Add Header fields to a packet. @@ -614,12 +614,19 @@ int ppp_slprintf(char *buf, int buflen, const char *fmt, ...); /* spr int ppp_vslprintf(char *buf, int buflen, const char *fmt, va_list args); /* vsprintf++ */ size_t ppp_strlcpy(char *dest, const char *src, size_t len); /* safe strcpy */ size_t ppp_strlcat(char *dest, const char *src, size_t len); /* safe strncpy */ -void ppp_dbglog(const char *fmt, ...); /* log a debug message */ -void ppp_info(const char *fmt, ...); /* log an informational message */ -void ppp_notice(const char *fmt, ...); /* log a notice-level message */ -void ppp_warn(const char *fmt, ...); /* log a warning message */ -void ppp_error(const char *fmt, ...); /* log an error message */ -void ppp_fatal(const char *fmt, ...); /* log an error message and die(1) */ +void ppp_dbglog_impl(const char *fmt, ...); /* log a debug message */ +void ppp_info_impl(const char *fmt, ...); /* log an informational message */ +void ppp_notice_impl(const char *fmt, ...); /* log a notice-level message */ +void ppp_warn_impl(const char *fmt, ...); /* log a warning message */ +void ppp_error_impl(const char *fmt, ...); /* log an error message */ +void ppp_fatal_impl(const char *fmt, ...); /* log an error message and die(1) */ +/* wrap all the above functions so they will only be linked when enabled */ +#define ppp_dbglog(x) do { if (LWIP_DEBUG_ENABLED(LOG_DEBUG)) { ppp_dbglog_impl x; }} while(0) +#define ppp_info(x) do { if (LWIP_DEBUG_ENABLED(LOG_INFO)) { ppp_info_impl x; }} while(0) +#define ppp_notice(x) do { if (LWIP_DEBUG_ENABLED(LOG_NOTICE)) { ppp_notice_impl x; }} while(0) +#define ppp_warn(x) do { if (LWIP_DEBUG_ENABLED(LOG_WARNING)) { ppp_warn_impl x; }} while(0) +#define ppp_error(x) do { if (LWIP_DEBUG_ENABLED(LOG_ERR)) { ppp_error_impl x; }} while(0) +#define ppp_fatal(x) do { if (LWIP_DEBUG_ENABLED(LOG_CRITICAL)) { ppp_fatal_impl x; }} while(0) #if PRINTPKT_SUPPORT void ppp_dump_packet(ppp_pcb *pcb, const char *tag, unsigned char *p, int len); /* dump packet to debug log if interesting */ diff --git a/src/netif/ppp/auth.c b/src/netif/ppp/auth.c index c8673ad0..7a74292c 100644 --- a/src/netif/ppp/auth.c +++ b/src/netif/ppp/auth.c @@ -591,9 +591,9 @@ void start_link(unit) * incoming events (reply, timeout, etc.). */ if (ifunit >= 0) - ppp_notice("Connect: %s <--> %s", ifname, ppp_devnam); + ppp_notice(("Connect: %s <--> %s", ifname, ppp_devnam)); else - ppp_notice("Starting negotiation on %s", ppp_devnam); + ppp_notice(("Starting negotiation on %s", ppp_devnam)); add_fd(fd_ppp); new_phase(pcb, PPP_PHASE_ESTABLISH); @@ -634,12 +634,12 @@ void link_terminated(ppp_pcb *pcb) { #endif /* UNUSED */ if (!doing_multilink) { - ppp_notice("Connection terminated."); + ppp_notice(("Connection terminated.")); #if PPP_STATS_SUPPORT print_link_stats(); #endif /* PPP_STATS_SUPPORT */ } else - ppp_notice("Link terminated."); + ppp_notice(("Link terminated.")); lcp_lowerdown(pcb); @@ -791,7 +791,7 @@ void link_established(ppp_pcb *pcb) { || !wo->neg_upap #endif /* PAP_SUPPORT */ ) { - ppp_warn("peer refused to authenticate: terminating link"); + ppp_warn(("peer refused to authenticate: terminating link")); #if 0 /* UNUSED */ status = EXIT_PEER_AUTH_FAILED; #endif /* UNUSED */ @@ -868,7 +868,7 @@ static void network_phase(ppp_pcb *pcb) { #if 0 /* UNUSED */ /* Log calling number. */ if (*remote_number) - ppp_notice("peer from calling number %q authorized", remote_number); + ppp_notice(("peer from calling number %q authorized", remote_number)); #endif /* UNUSED */ #if PPP_NOTIFY @@ -1082,7 +1082,7 @@ void auth_peer_success(ppp_pcb *pcb, int protocol, int prot_flavor, const char * break; #endif /* EAP_SUPPORT */ default: - ppp_warn("auth_peer_success: unknown protocol %x", protocol); + ppp_warn(("auth_peer_success: unknown protocol %x", protocol)); return; } @@ -1172,12 +1172,12 @@ void auth_withpeer_success(ppp_pcb *pcb, int protocol, int prot_flavor) { break; #endif /* EAP_SUPPORT */ default: - ppp_warn("auth_withpeer_success: unknown protocol %x", protocol); + ppp_warn(("auth_withpeer_success: unknown protocol %x", protocol)); bit = 0; /* no break */ } - ppp_notice("%s authentication succeeded", prot); + ppp_notice(("%s authentication succeeded", prot)); /* Save the authentication method for later. */ pcb->auth_done |= bit; @@ -1300,7 +1300,7 @@ check_maxoctets(arg) break; } if (used > maxoctets) { - ppp_notice("Traffic limit reached. Limit: %u Used: %u", maxoctets, used); + ppp_notice(("Traffic limit reached. Limit: %u Used: %u", maxoctets, used)); status = EXIT_TRAFFIC_LIMIT; lcp_close(pcb, "Traffic limit"); #if 0 /* UNUSED */ @@ -1338,7 +1338,7 @@ static void check_idle(void *arg) { #endif /* UNUSED */ if (tlim <= 0) { /* link is idle: shut it down. */ - ppp_notice("Terminating connection due to lack of activity."); + ppp_notice(("Terminating connection due to lack of activity.")); pcb->err_code = PPPERR_IDLETIMEOUT; lcp_close(pcb, "Link inactive"); #if 0 /* UNUSED */ @@ -1356,7 +1356,7 @@ static void check_idle(void *arg) { */ static void connect_time_expired(void *arg) { ppp_pcb *pcb = (ppp_pcb*)arg; - ppp_info("Connect time expired"); + ppp_info(("Connect time expired")); pcb->err_code = PPPERR_CONNECTTIME; lcp_close(pcb, "Connect time expired"); /* Close connection */ } @@ -1495,7 +1495,7 @@ auth_check_options() * Early check for remote number authorization. */ if (!auth_number()) { - ppp_warn("calling number %q is not authorized", remote_number); + ppp_warn(("calling number %q is not authorized", remote_number)); exit(EXIT_CNID_AUTH_FAILED); } } @@ -1609,12 +1609,12 @@ check_passwd(unit, auser, userlen, apasswd, passwdlen, msg) ret = UPAP_AUTHNAK; f = fopen(filename, "r"); if (f == NULL) { - ppp_error("Can't open PAP password file %s: %m", filename); + ppp_error(("Can't open PAP password file %s: %m", filename)); } else { check_access(f, filename); if (scan_authfile(f, ppp_settings.user, our_name, secret, &addrs, &opts, filename, 0) < 0) { - ppp_warn("no PAP secret found for %s", user); + ppp_warn(("no PAP secret found for %s", user)); } else { /* * If the secret is "@login", it means to check @@ -1629,7 +1629,7 @@ check_passwd(unit, auser, userlen, apasswd, passwdlen, msg) } } else if (session_mgmt) { if (session_check(ppp_settings.user, NULL, devnam, NULL) == 0) { - ppp_warn("Peer %q failed PAP Session verification", user); + ppp_warn(("Peer %q failed PAP Session verification", user)); ret = UPAP_AUTHNAK; } } @@ -1653,7 +1653,7 @@ check_passwd(unit, auser, userlen, apasswd, passwdlen, msg) * On 10'th, drop the connection. */ if (attempts++ >= 10) { - ppp_warn("%d LOGIN FAILURES ON %s, %s", attempts, devnam, user); + ppp_warn(("%d LOGIN FAILURES ON %s, %s", attempts, devnam, user)); lcp_close(pcb, "login failed"); } if (attempts > 3) @@ -1912,7 +1912,7 @@ int get_secret(ppp_pcb *pcb, const char *client, const char *server, char *secre len = (int)strlen(pcb->settings.passwd); if (len > MAXSECRETLEN) { - ppp_error("Secret for %s on %s is too long", client, server); + ppp_error(("Secret for %s on %s is too long", client, server)); len = MAXSECRETLEN; } @@ -1933,8 +1933,8 @@ int get_secret(ppp_pcb *pcb, const char *client, const char *server, char *secre strlcpy(secbuf, ppp_settings.passwd, sizeof(secbuf)); } else if (!am_server && chap_passwd_hook) { if ( (*chap_passwd_hook)(client, secbuf) < 0) { - ppp_error("Unable to obtain CHAP password for %s on %s from plugin", - client, server); + ppp_error(("Unable to obtain CHAP password for %s on %s from plugin", + client, server)); return 0; } } else { @@ -1944,7 +1944,7 @@ int get_secret(ppp_pcb *pcb, const char *client, const char *server, char *secre f = fopen(filename, "r"); if (f == NULL) { - ppp_error("Can't open chap secret file %s: %m", filename); + ppp_error(("Can't open chap secret file %s: %m", filename)); return 0; } check_access(f, filename); @@ -1964,7 +1964,7 @@ int get_secret(ppp_pcb *pcb, const char *client, const char *server, char *secre len = strlen(secbuf); if (len > MAXSECRETLEN) { - ppp_error("Secret for %s on %s is too long", client, server); + ppp_error(("Secret for %s on %s is too long", client, server)); len = MAXSECRETLEN; } MEMCPY(secret, secbuf, len); @@ -2004,7 +2004,7 @@ get_srp_secret(unit, client, server, secret, am_server) fp = fopen(filename, "r"); if (fp == NULL) { - ppp_error("Can't open srp secret file %s: %m", filename); + ppp_error(("Can't open srp secret file %s: %m", filename)); return 0; } check_access(fp, filename); @@ -2098,8 +2098,8 @@ set_allowed_addrs(unit, addrs, opts) bit_count = (int) strtol (ptr_mask+1, &endp, 10); if (bit_count <= 0 || bit_count > 32) { - ppp_warn("invalid address length %v in auth. address list", - ptr_mask+1); + ppp_warn(("invalid address length %v in auth. address list", + ptr_mask+1)); continue; } bit_count = 32 - bit_count; /* # bits in host part */ @@ -2108,7 +2108,7 @@ set_allowed_addrs(unit, addrs, opts) ++endp; } if (*endp != 0) { - ppp_warn("invalid address length syntax: %v", ptr_mask+1); + ppp_warn(("invalid address length syntax: %v", ptr_mask+1)); continue; } *ptr_mask = '\0'; @@ -2141,13 +2141,13 @@ set_allowed_addrs(unit, addrs, opts) *ptr_mask = '/'; if (a == (u32_t)-1L) { - ppp_warn("unknown host %s in auth. address list", ap->word); + ppp_warn(("unknown host %s in auth. address list", ap->word)); continue; } if (offset != 0) { if (offset >= ~mask) { - ppp_warn("interface unit %d too large for subnet %v", - ifunit, ptr_word); + ppp_warn(("interface unit %d too large for subnet %v", + ifunit, ptr_word)); continue; } a = lwip_htonl((lwip_ntohl(a) & mask) + offset); @@ -2295,10 +2295,10 @@ check_access(f, filename) struct stat sbuf; if (fstat(fileno(f), &sbuf) < 0) { - ppp_warn("cannot stat secret file %s: %m", filename); + ppp_warn(("cannot stat secret file %s: %m", filename)); } else if ((sbuf.st_mode & (S_IRWXG | S_IRWXO)) != 0) { - ppp_warn("Warning - secret file %s has world and/or group access", - filename); + ppp_warn(("Warning - secret file %s has world and/or group access", + filename)); } } @@ -2408,12 +2408,12 @@ scan_authfile(f, client, server, secret, addrs, opts, filename, flags) if (word[0] == '@' && word[1] == '/') { strlcpy(atfile, word+1, sizeof(atfile)); if ((sf = fopen(atfile, "r")) == NULL) { - ppp_warn("can't open indirect secret file %s", atfile); + ppp_warn(("can't open indirect secret file %s", atfile)); continue; } check_access(sf, atfile); if (!getword(sf, word, &xxx, atfile)) { - ppp_warn("no secret in indirect secret file %s", atfile); + ppp_warn(("no secret in indirect secret file %s", atfile)); fclose(sf); continue; } diff --git a/src/netif/ppp/ccp.c b/src/netif/ppp/ccp.c index f8519ebe..6c2dadc9 100644 --- a/src/netif/ppp/ccp.c +++ b/src/netif/ppp/ccp.c @@ -463,10 +463,10 @@ static void ccp_input(ppp_pcb *pcb, u_char *p, int len) { oldstate = f->state; fsm_input(f, p, len); if (oldstate == PPP_FSM_OPENED && p[0] == TERMREQ && f->state != PPP_FSM_OPENED) { - ppp_notice("Compression disabled by peer."); + ppp_notice(("Compression disabled by peer.")); #if MPPE_SUPPORT if (go->mppe) { - ppp_error("MPPE disabled, closing LCP"); + ppp_error(("MPPE disabled, closing LCP")); lcp_close(pcb, "MPPE disabled by peer"); } #endif /* MPPE_SUPPORT */ @@ -528,7 +528,7 @@ static void ccp_protrej(ppp_pcb *pcb) { #if MPPE_SUPPORT if (go->mppe) { - ppp_error("MPPE required but peer negotiation failed"); + ppp_error(("MPPE required but peer negotiation failed")); lcp_close(pcb, "MPPE required but peer negotiation failed"); } #endif /* MPPE_SUPPORT */ @@ -589,20 +589,20 @@ static void ccp_resetci(fsm *f) { auth_mschap_bits >>= 1; } while (auth_mschap_bits); if (numbits > 1) { - ppp_error("MPPE required, but auth done in both directions."); + ppp_error(("MPPE required, but auth done in both directions.")); lcp_close(pcb, "MPPE required but not available"); return; } if (!numbits) { - ppp_error("MPPE required, but MS-CHAP[v2] auth not performed."); + ppp_error(("MPPE required, but MS-CHAP[v2] auth not performed.")); lcp_close(pcb, "MPPE required but not available"); return; } /* A plugin (eg radius) may not have obtained key material. */ if (!pcb->mppe_keys_set) { - ppp_error("MPPE required, but keys are not available. " - "Possible plugin problem?"); + ppp_error(("MPPE required, but keys are not available. " + "Possible plugin problem?")); lcp_close(pcb, "MPPE required but not available"); return; } @@ -611,7 +611,7 @@ static void ccp_resetci(fsm *f) { if (pcb->auth_done & (CHAP_MS_WITHPEER | CHAP_MS_PEER)) { /* This might be noise */ if (go->mppe & MPPE_OPT_40) { - ppp_notice("Disabling 40-bit MPPE; MS-CHAP LM not supported"); + ppp_notice(("Disabling 40-bit MPPE; MS-CHAP LM not supported")); go->mppe &= ~MPPE_OPT_40; wo->mppe &= ~MPPE_OPT_40; } @@ -620,7 +620,7 @@ static void ccp_resetci(fsm *f) { /* Last check: can we actually negotiate something? */ if (!(go->mppe & (MPPE_OPT_40 | MPPE_OPT_128))) { /* Could be misconfig, could be 40-bit disabled above. */ - ppp_error("MPPE required, but both 40-bit and 128-bit disabled."); + ppp_error(("MPPE required, but both 40-bit and 128-bit disabled.")); lcp_close(pcb, "MPPE required but not available"); return; } @@ -949,7 +949,7 @@ static int ccp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) { */ MPPE_CI_TO_OPTS(&p[2], try_.mppe); if ((try_.mppe & MPPE_OPT_STATEFUL) && pcb->settings.refuse_mppe_stateful) { - ppp_error("Refusing MPPE stateful mode offered by peer"); + ppp_error(("Refusing MPPE stateful mode offered by peer")); try_.mppe = 0; } else if (((go->mppe | MPPE_OPT_STATEFUL) & try_.mppe) != try_.mppe) { /* Peer must have set options we didn't request (suggest) */ @@ -957,7 +957,7 @@ static int ccp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) { } if (!try_.mppe) { - ppp_error("MPPE required but peer negotiation failed"); + ppp_error(("MPPE required but peer negotiation failed")); lcp_close(pcb, "MPPE required but peer negotiation failed"); } } @@ -1035,7 +1035,7 @@ static int ccp_rejci(fsm *f, u_char *p, int len) { #if MPPE_SUPPORT if (go->mppe && len >= CILEN_MPPE && p[0] == CI_MPPE && p[1] == CILEN_MPPE) { - ppp_error("MPPE required but peer refused"); + ppp_error(("MPPE required but peer refused")); lcp_close(pcb, "MPPE required but peer refused"); p += CILEN_MPPE; len -= CILEN_MPPE; @@ -1164,7 +1164,7 @@ static int ccp_reqci(fsm *f, u_char *p, int *lenp, int dont_nak) { * the Internet -- which is where we expect MPPE. */ if (pcb->settings.refuse_mppe_stateful) { - ppp_error("Refusing MPPE stateful mode offered by peer"); + ppp_error(("Refusing MPPE stateful mode offered by peer")); newret = CONFREJ; break; } @@ -1375,7 +1375,7 @@ static int ccp_reqci(fsm *f, u_char *p, int *lenp, int dont_nak) { } #if MPPE_SUPPORT if (ret == CONFREJ && ao->mppe && rej_for_ci_mppe) { - ppp_error("MPPE required but peer negotiation failed"); + ppp_error(("MPPE required but peer negotiation failed")); lcp_close(pcb, "MPPE required but peer negotiation failed"); } #endif /* MPPE_SUPPORT */ @@ -1466,16 +1466,16 @@ static void ccp_up(fsm *f) { if (ccp_anycompress(go)) { if (ccp_anycompress(ho)) { if (go->method == ho->method) { - ppp_notice("%s compression enabled", method_name(go, ho)); + ppp_notice(("%s compression enabled", method_name(go, ho))); } else { ppp_strlcpy(method1, method_name(go, NULL), sizeof(method1)); - ppp_notice("%s / %s compression enabled", - method1, method_name(ho, NULL)); + ppp_notice(("%s / %s compression enabled", + method1, method_name(ho, NULL))); } } else - ppp_notice("%s receive compression enabled", method_name(go, NULL)); + ppp_notice(("%s receive compression enabled", method_name(go, NULL))); } else if (ccp_anycompress(ho)) - ppp_notice("%s transmit compression enabled", method_name(ho, NULL)); + ppp_notice(("%s transmit compression enabled", method_name(ho, NULL))); #if MPPE_SUPPORT if (go->mppe) { continue_networks(pcb); /* Bring up IP et al */ @@ -1501,7 +1501,7 @@ static void ccp_down(fsm *f) { go->mppe = 0; if (pcb->lcp_fsm.state == PPP_FSM_OPENED) { /* If LCP is not already going down, make sure it does. */ - ppp_error("MPPE disabled"); + ppp_error(("MPPE disabled")); lcp_close(pcb, "MPPE disabled"); } } @@ -1671,14 +1671,14 @@ static void ccp_datainput(ppp_pcb *pcb, u_char *pkt, int len) { /* * Disable compression by taking CCP down. */ - ppp_error("Lost compression sync: disabling compression"); + ppp_error(("Lost compression sync: disabling compression")); ccp_close(pcb, "Lost compression sync"); #if MPPE_SUPPORT /* * If we were doing MPPE, we must also take the link down. */ if (go->mppe) { - ppp_error("Too many MPPE errors, closing LCP"); + ppp_error(("Too many MPPE errors, closing LCP")); lcp_close(pcb, "Too many MPPE errors"); } #endif /* MPPE_SUPPORT */ diff --git a/src/netif/ppp/chap-new.c b/src/netif/ppp/chap-new.c index 485122d2..2f7532be 100644 --- a/src/netif/ppp/chap-new.c +++ b/src/netif/ppp/chap-new.c @@ -166,15 +166,15 @@ void chap_auth_peer(ppp_pcb *pcb, const char *our_name, int digest_code) { int i; if (pcb->chap_server.flags & AUTH_STARTED) { - ppp_error("CHAP: peer authentication already started!"); + ppp_error(("CHAP: peer authentication already started!")); return; } for (i = 0; (dp = chap_digests[i]) != NULL; ++i) if (dp->code == digest_code) break; if (dp == NULL) - ppp_fatal("CHAP digest 0x%x requested but not available", - digest_code); + ppp_fatal(("CHAP digest 0x%x requested but not available", + digest_code)); pcb->chap_server.digest = dp; pcb->chap_server.name = our_name; @@ -198,7 +198,7 @@ void chap_auth_with_peer(ppp_pcb *pcb, const char *our_name, int digest_code) { return; if (pcb->chap_client.flags & AUTH_STARTED) { - ppp_error("CHAP: authentication with peer already started!"); + ppp_error(("CHAP: authentication with peer already started!")); return; } for (i = 0; (dp = chap_digests[i]) != NULL; ++i) @@ -206,8 +206,8 @@ void chap_auth_with_peer(ppp_pcb *pcb, const char *our_name, int digest_code) { break; if (dp == NULL) - ppp_fatal("CHAP digest 0x%x requested but not available", - digest_code); + ppp_fatal(("CHAP digest 0x%x requested but not available", + digest_code)); pcb->chap_client.digest = dp; pcb->chap_client.name = our_name; @@ -337,7 +337,7 @@ static void chap_handle_response(ppp_pcb *pcb, int id, #endif /* UNUSED */ if (!ok) { pcb->chap_server.flags |= AUTH_FAILED; - ppp_warn("Peer %q failed CHAP authentication", name); + ppp_warn(("Peer %q failed CHAP authentication", name)); } } else if ((pcb->chap_server.flags & AUTH_DONE) == 0) return; @@ -381,7 +381,7 @@ static void chap_handle_response(ppp_pcb *pcb, int id, if (session_mgmt && session_check(name, NULL, devnam, NULL) == 0) { pcb->chap_server.flags |= AUTH_FAILED; - ppp_warn("Peer %q failed CHAP Session verification", name); + ppp_warn(("Peer %q failed CHAP Session verification", name)); } #endif /* UNUSED */ @@ -418,7 +418,7 @@ static int chap_verify_response(ppp_pcb *pcb, const char *name, const char *ourn /* Get the secret that the peer is supposed to know */ if (!get_secret(pcb, name, ourname, (char *)secret, &secret_len, 1)) { - ppp_error("No CHAP secret found for authenticating %q", name); + ppp_error(("No CHAP secret found for authenticating %q", name)); return 0; } ok = digest->verify_response(pcb, id, name, secret, secret_len, challenge, @@ -468,7 +468,7 @@ static void chap_respond(ppp_pcb *pcb, int id, /* get secret for authenticating ourselves with the specified host */ if (!get_secret(pcb, pcb->chap_client.name, rname, secret, &secret_len, 0)) { secret_len = 0; /* assume null secret if can't find one */ - ppp_warn("No CHAP secret found for authenticating us to %q", rname); + ppp_warn(("No CHAP secret found for authenticating us to %q", rname)); } outp = (u_char*)p->payload; @@ -519,15 +519,15 @@ static void chap_handle_status(ppp_pcb *pcb, int code, int id, } if (msg) { if (len > 0) - ppp_info("%s: %.*v", msg, len, pkt); + ppp_info(("%s: %.*v", msg, len, pkt)); else - ppp_info("%s", msg); + ppp_info(("%s", msg)); } if (code == CHAP_SUCCESS) auth_withpeer_success(pcb, PPP_CHAP, pcb->chap_client.digest->code); else { pcb->chap_client.flags |= AUTH_FAILED; - ppp_error("CHAP authentication failed"); + ppp_error(("CHAP authentication failed")); auth_withpeer_fail(pcb, PPP_CHAP); } } @@ -577,7 +577,7 @@ static void chap_protrej(ppp_pcb *pcb) { #endif /* PPP_SERVER */ if ((pcb->chap_client.flags & (AUTH_STARTED|AUTH_DONE)) == AUTH_STARTED) { pcb->chap_client.flags &= ~AUTH_STARTED; - ppp_error("CHAP authentication failed due to protocol-reject"); + ppp_error(("CHAP authentication failed due to protocol-reject")); auth_withpeer_fail(pcb, PPP_CHAP); } } diff --git a/src/netif/ppp/chap_ms.c b/src/netif/ppp/chap_ms.c index 5a989c9b..75b478d0 100644 --- a/src/netif/ppp/chap_ms.c +++ b/src/netif/ppp/chap_ms.c @@ -264,7 +264,7 @@ static int chapms_verify_response(ppp_pcb *pcb, int id, const char *name, #ifndef MSLANMAN if (!response[MS_CHAP_USENT]) { /* Should really propagate this into the error packet. */ - ppp_notice("Peer request for LANMAN auth not supported"); + ppp_notice(("Peer request for LANMAN auth not supported")); goto bad; } #endif @@ -404,7 +404,7 @@ static int chapms2_check_success(ppp_pcb *pcb, unsigned char *msg, int len, unsi if ((len < MS_AUTH_RESPONSE_LENGTH + 2) || strncmp((char *)msg, "S=", 2) != 0) { /* Packet does not start with "S=" */ - ppp_error("MS-CHAPv2 Success packet is badly formed."); + ppp_error(("MS-CHAPv2 Success packet is badly formed.")); return 0; } msg += 2; @@ -412,7 +412,7 @@ static int chapms2_check_success(ppp_pcb *pcb, unsigned char *msg, int len, unsi if (len < MS_AUTH_RESPONSE_LENGTH || memcmp(msg, private_, MS_AUTH_RESPONSE_LENGTH)) { /* Authenticator Response did not match expected. */ - ppp_error("MS-CHAPv2 mutual authentication failed."); + ppp_error(("MS-CHAPv2 mutual authentication failed.")); return 0; } /* Authenticator Response matches. */ @@ -422,7 +422,7 @@ static int chapms2_check_success(ppp_pcb *pcb, unsigned char *msg, int len, unsi msg += 3; /* Eat the delimiter */ } else if (len) { /* Packet has extra text which does not begin " M=" */ - ppp_error("MS-CHAPv2 Success packet is badly formed."); + ppp_error(("MS-CHAPv2 Success packet is badly formed.")); return 0; } return 1; @@ -483,14 +483,14 @@ static void chapms_handle_failure(ppp_pcb *pcb, unsigned char *inp, int len) { break; default: - ppp_error("Unknown MS-CHAP authentication failure: %.*v", - len, inp); + ppp_error(("Unknown MS-CHAP authentication failure: %.*v", + len, inp)); return; } } print_msg: if (p != NULL) - ppp_error("MS-CHAP authentication failed: %v", p); + ppp_error(("MS-CHAP authentication failed: %v", p)); } static void ChallengeResponse(const u_char *challenge, diff --git a/src/netif/ppp/eap.c b/src/netif/ppp/eap.c index 8fb56368..a48f5bce 100644 --- a/src/netif/ppp/eap.c +++ b/src/netif/ppp/eap.c @@ -211,7 +211,7 @@ static void eap_client_timeout(void *arg) { if (!eap_client_active(pcb)) return; - ppp_error("EAP: timeout waiting for Request from peer"); + ppp_error(("EAP: timeout waiting for Request from peer")); auth_withpeer_fail(pcb, PPP_EAP); pcb->eap.es_client.ea_state = eapBadAuth; } @@ -471,8 +471,8 @@ static void eap_figure_next_state(ppp_pcb *pcb, int status) { toffs -= 86400; /* FIXME: if we want to do SRP, we need to find a way to pass the PolarSSL des_context instead of using static memory */ if (!DesDecrypt(secbuf, clear)) { - ppp_dbglog("no DES here; cannot decode " - "pseudonym"); + ppp_dbglog(("no DES here; cannot decode " + "pseudonym")); return; } id = *(unsigned char *)clear; @@ -502,11 +502,11 @@ static void eap_figure_next_state(ppp_pcb *pcb, int status) { } pcb->eap.es_server.ea_peer[ pcb->eap.es_server.ea_peerlen] = '\0'; - ppp_dbglog("decoded pseudonym to \"%.*q\"", + ppp_dbglog(("decoded pseudonym to \"%.*q\"", pcb->eap.es_server.ea_peerlen, - pcb->eap.es_server.ea_peer); + pcb->eap.es_server.ea_peer)); } else { - ppp_dbglog("failed to decode real name"); + ppp_dbglog(("failed to decode real name")); /* Stay in eapIdentfy state; requery */ break; } @@ -676,9 +676,9 @@ static void eap_send_request(ppp_pcb *pcb) { if (pcb->settings.eap_max_transmits > 0 && pcb->eap.es_server.ea_requests >= pcb->settings.eap_max_transmits) { if (pcb->eap.es_server.ea_responses > 0) - ppp_error("EAP: too many Requests sent"); + ppp_error(("EAP: too many Requests sent")); else - ppp_error("EAP: no response to Requests"); + ppp_error(("EAP: no response to Requests")); eap_send_failure(pcb); return; } @@ -786,7 +786,7 @@ static void eap_send_request(ppp_pcb *pcb) { cp += j; /* FIXME: if we want to do SRP, we need to find a way to pass the PolarSSL des_context instead of using static memory */ if (!DesEncrypt(clear, cipher)) { - ppp_dbglog("no DES here; not generating pseudonym"); + ppp_dbglog(("no DES here; not generating pseudonym")); break; } BZERO(&b64, sizeof (b64)); @@ -997,12 +997,12 @@ static void eap_lowerdown(ppp_pcb *pcb) { static void eap_protrej(ppp_pcb *pcb) { if (eap_client_active(pcb)) { - ppp_error("EAP authentication failed due to Protocol-Reject"); + ppp_error(("EAP authentication failed due to Protocol-Reject")); auth_withpeer_fail(pcb, PPP_EAP); } #if PPP_SERVER if (eap_server_active(pcb)) { - ppp_error("EAP authentication of peer failed on Protocol-Reject"); + ppp_error(("EAP authentication of peer failed on Protocol-Reject")); auth_peer_fail(pcb, PPP_EAP); } #endif /* PPP_SERVER */ @@ -1213,7 +1213,7 @@ name_of_pn_file() return (NULL); (void) slprintf(path, pl, "%s/%s", user, file); if (!pnlogged) { - ppp_dbglog("pseudonym file: %s", path); + ppp_dbglog(("pseudonym file: %s", path)); pnlogged = 1; } return (path); @@ -1284,22 +1284,22 @@ int len, id; /* Now check that the result is sane */ if (olen <= 0 || *inp + 1 > olen) { - ppp_dbglog("EAP: decoded pseudonym is unusable <%.*B>", olen, inp); + ppp_dbglog(("EAP: decoded pseudonym is unusable <%.*B>", olen, inp)); return; } /* Save it away */ fd = open_pn_file(O_WRONLY | O_CREAT | O_TRUNC); if (fd < 0) { - ppp_dbglog("EAP: error saving pseudonym: %m"); + ppp_dbglog(("EAP: error saving pseudonym: %m")); return; } len = write(fd, inp + 1, *inp); if (close(fd) != -1 && len == *inp) { - ppp_dbglog("EAP: saved pseudonym"); + ppp_dbglog(("EAP: saved pseudonym")); pcb->eap.es_usedpseudo = 0; } else { - ppp_dbglog("EAP: failed to save pseudonym"); + ppp_dbglog(("EAP: failed to save pseudonym")); remove_pn_file(); } } @@ -1334,7 +1334,7 @@ static void eap_request(ppp_pcb *pcb, u_char *inp, int id, int len) { pcb->eap.es_client.ea_requests++; if (pcb->settings.eap_allow_req != 0 && pcb->eap.es_client.ea_requests > pcb->settings.eap_allow_req) { - ppp_info("EAP: received too many Request messages"); + ppp_info(("EAP: received too many Request messages")); if (pcb->settings.eap_req_time > 0) { UNTIMEOUT(eap_client_timeout, pcb); } @@ -1343,7 +1343,7 @@ static void eap_request(ppp_pcb *pcb, u_char *inp, int id, int len) { } if (len <= 0) { - ppp_error("EAP: empty Request message discarded"); + ppp_error(("EAP: empty Request message discarded")); return; } @@ -1353,7 +1353,7 @@ static void eap_request(ppp_pcb *pcb, u_char *inp, int id, int len) { switch (typenum) { case EAPT_IDENTITY: if (len > 0) - ppp_info("EAP: Identity prompt \"%.*q\"", len, inp); + ppp_info(("EAP: Identity prompt \"%.*q\"", len, inp)); #ifdef USE_SRP if (pcb->eap.es_usepseudo && (pcb->eap.es_usedpseudo == 0 || @@ -1387,7 +1387,7 @@ static void eap_request(ppp_pcb *pcb, u_char *inp, int id, int len) { case EAPT_NOTIFICATION: if (len > 0) - ppp_info("EAP: Notification \"%.*q\"", len, inp); + ppp_info(("EAP: Notification \"%.*q\"", len, inp)); eap_send_response(pcb, id, typenum, NULL, 0); break; @@ -1396,21 +1396,21 @@ static void eap_request(ppp_pcb *pcb, u_char *inp, int id, int len) { * Avoid the temptation to send Response Nak in reply * to Request Nak here. It can only lead to trouble. */ - ppp_warn("EAP: unexpected Nak in Request; ignored"); + ppp_warn(("EAP: unexpected Nak in Request; ignored")); /* Return because we're waiting for something real. */ return; case EAPT_MD5CHAP: if (len < 1) { - ppp_error("EAP: received MD5-Challenge with no data"); + ppp_error(("EAP: received MD5-Challenge with no data")); /* Bogus request; wait for something real. */ return; } GETCHAR(vallen, inp); len--; if (vallen < 8 || vallen > len) { - ppp_error("EAP: MD5-Challenge with bad length %d (8..%d)", - vallen, len); + ppp_error(("EAP: MD5-Challenge with bad length %d (8..%d)", + vallen, len)); /* Try something better. */ eap_send_nak(pcb, id, EAPT_SRP); break; @@ -1418,7 +1418,7 @@ static void eap_request(ppp_pcb *pcb, u_char *inp, int id, int len) { /* Not so likely to happen. */ if (vallen >= len + sizeof (rhostname)) { - ppp_dbglog("EAP: trimming really long peer name down"); + ppp_dbglog(("EAP: trimming really long peer name down")); MEMCPY(rhostname, inp + vallen, sizeof (rhostname) - 1); rhostname[sizeof (rhostname) - 1] = '\0'; } else { @@ -1439,7 +1439,7 @@ static void eap_request(ppp_pcb *pcb, u_char *inp, int id, int len) { */ if (!get_secret(pcb, pcb->eap.es_client.ea_name, rhostname, secret, &secret_len, 0)) { - ppp_dbglog("EAP: no MD5 secret for auth to %q", rhostname); + ppp_dbglog(("EAP: no MD5 secret for auth to %q", rhostname)); eap_send_nak(pcb, id, EAPT_SRP); break; } @@ -1459,7 +1459,7 @@ static void eap_request(ppp_pcb *pcb, u_char *inp, int id, int len) { #ifdef USE_SRP case EAPT_SRP: if (len < 1) { - ppp_error("EAP: received empty SRP Request"); + ppp_error(("EAP: received empty SRP Request")); /* Bogus request; wait for something real. */ return; } @@ -1492,8 +1492,8 @@ static void eap_request(ppp_pcb *pcb, u_char *inp, int id, int len) { GETCHAR(vallen, inp); len--; if (vallen >= len) { - ppp_error("EAP: badly-formed SRP Challenge" - " (name)"); + ppp_error(("EAP: badly-formed SRP Challenge" + " (name)")); /* Ignore badly-formed messages */ return; } @@ -1523,8 +1523,8 @@ static void eap_request(ppp_pcb *pcb, u_char *inp, int id, int len) { GETCHAR(vallen, inp); len--; if (vallen >= len) { - ppp_error("EAP: badly-formed SRP Challenge" - " (s)"); + ppp_error(("EAP: badly-formed SRP Challenge" + " (s)")); /* Ignore badly-formed messages */ return; } @@ -1536,8 +1536,8 @@ static void eap_request(ppp_pcb *pcb, u_char *inp, int id, int len) { GETCHAR(vallen, inp); len--; if (vallen > len) { - ppp_error("EAP: badly-formed SRP Challenge" - " (g)"); + ppp_error(("EAP: badly-formed SRP Challenge" + " (g)")); /* Ignore badly-formed messages */ return; } @@ -1584,7 +1584,7 @@ static void eap_request(ppp_pcb *pcb, u_char *inp, int id, int len) { case EAPSRP_SKEY: tc = (struct t_client *)pcb->eap.es_client.ea_session; if (tc == NULL) { - ppp_warn("EAP: peer sent Subtype 2 without 1"); + ppp_warn(("EAP: peer sent Subtype 2 without 1")); eap_send_nak(pcb, id, EAPT_MD5CHAP); break; } @@ -1594,9 +1594,9 @@ static void eap_request(ppp_pcb *pcb, u_char *inp, int id, int len) { * if it does (but otherwise ignore). */ if (id != pcb->eap.es_client.ea_id) { - ppp_warn("EAP: ID changed from %d to %d " + ppp_warn(("EAP: ID changed from %d to %d " "in SRP Subtype 2 rexmit", - pcb->eap.es_client.ea_id, id); + pcb->eap.es_client.ea_id, id)); } } else { if (get_srp_secret(pcb->eap.es_unit, @@ -1618,7 +1618,7 @@ static void eap_request(ppp_pcb *pcb, u_char *inp, int id, int len) { t_clientgetkey(tc, &Bval); if (pcb->eap.es_client.ea_skey == NULL) { /* Server is rogue; stop now */ - ppp_error("EAP: SRP server is rogue"); + ppp_error(("EAP: SRP server is rogue")); goto client_failure; } } @@ -1629,7 +1629,7 @@ static void eap_request(ppp_pcb *pcb, u_char *inp, int id, int len) { case EAPSRP_SVALIDATOR: tc = (struct t_client *)pcb->eap.es_client.ea_session; if (tc == NULL || pcb->eap.es_client.ea_skey == NULL) { - ppp_warn("EAP: peer sent Subtype 3 without 1/2"); + ppp_warn(("EAP: peer sent Subtype 3 without 1/2")); eap_send_nak(pcb, id, EAPT_MD5CHAP); break; } @@ -1640,16 +1640,16 @@ static void eap_request(ppp_pcb *pcb, u_char *inp, int id, int len) { */ if (pcb->eap.es_client.ea_state == eapOpen) { if (id != pcb->eap.es_client.ea_id) { - ppp_warn("EAP: ID changed from %d to %d " + ppp_warn(("EAP: ID changed from %d to %d " "in SRP Subtype 3 rexmit", - pcb->eap.es_client.ea_id, id); + pcb->eap.es_client.ea_id, id)); } } else { len -= sizeof (u32_t) + SHA_DIGESTSIZE; if (len < 0 || t_clientverify(tc, inp + sizeof (u32_t)) != 0) { - ppp_error("EAP: SRP server verification " - "failed"); + ppp_error(("EAP: SRP server verification " + "failed")); goto client_failure; } GETLONG(pcb->eap.es_client.ea_keyflags, inp); @@ -1669,7 +1669,7 @@ static void eap_request(ppp_pcb *pcb, u_char *inp, int id, int len) { case EAPSRP_LWRECHALLENGE: if (len < 4) { - ppp_warn("EAP: malformed Lightweight rechallenge"); + ppp_warn(("EAP: malformed Lightweight rechallenge")); return; } SHA1Init(&ctxt); @@ -1686,7 +1686,7 @@ static void eap_request(ppp_pcb *pcb, u_char *inp, int id, int len) { break; default: - ppp_error("EAP: unknown SRP Subtype %d", vallen); + ppp_error(("EAP: unknown SRP Subtype %d", vallen)); eap_send_nak(pcb, id, EAPT_MD5CHAP); break; } @@ -1694,7 +1694,7 @@ static void eap_request(ppp_pcb *pcb, u_char *inp, int id, int len) { #endif /* USE_SRP */ default: - ppp_info("EAP: unknown authentication type %d; Naking", typenum); + ppp_info(("EAP: unknown authentication type %d; Naking", typenum)); eap_send_nak(pcb, id, EAPT_SRP); break; } @@ -1738,15 +1738,15 @@ static void eap_response(ppp_pcb *pcb, u_char *inp, int id, int len) { #endif /* USE_SRP */ if (pcb->eap.es_server.ea_id != id) { - ppp_dbglog("EAP: discarding Response %d; expected ID %d", id, - pcb->eap.es_server.ea_id); + ppp_dbglog(("EAP: discarding Response %d; expected ID %d", id, + pcb->eap.es_server.ea_id)); return; } pcb->eap.es_server.ea_responses++; if (len <= 0) { - ppp_error("EAP: empty Response message discarded"); + ppp_error(("EAP: empty Response message discarded")); return; } @@ -1756,11 +1756,11 @@ static void eap_response(ppp_pcb *pcb, u_char *inp, int id, int len) { switch (typenum) { case EAPT_IDENTITY: if (pcb->eap.es_server.ea_state != eapIdentify) { - ppp_dbglog("EAP discarding unwanted Identify \"%.q\"", len, - inp); + ppp_dbglog(("EAP discarding unwanted Identify \"%.q\"", len, + inp)); break; } - ppp_info("EAP: unauthenticated peer name \"%.*q\"", len, inp); + ppp_info(("EAP: unauthenticated peer name \"%.*q\"", len, inp)); if (len > MAXNAMELEN) { len = MAXNAMELEN; } @@ -1771,12 +1771,12 @@ static void eap_response(ppp_pcb *pcb, u_char *inp, int id, int len) { break; case EAPT_NOTIFICATION: - ppp_dbglog("EAP unexpected Notification; response discarded"); + ppp_dbglog(("EAP unexpected Notification; response discarded")); break; case EAPT_NAK: if (len < 1) { - ppp_info("EAP: Nak Response with no suggested protocol"); + ppp_info(("EAP: Nak Response with no suggested protocol")); eap_figure_next_state(pcb, 1); break; } @@ -1806,7 +1806,7 @@ static void eap_response(ppp_pcb *pcb, u_char *inp, int id, int len) { break; default: - ppp_dbglog("EAP: peer requesting unknown Type %d", vallen); + ppp_dbglog(("EAP: peer requesting unknown Type %d", vallen)); switch (pcb->eap.es_server.ea_state) { case eapSRP1: case eapSRP2: @@ -1827,26 +1827,26 @@ static void eap_response(ppp_pcb *pcb, u_char *inp, int id, int len) { case EAPT_MD5CHAP: if (pcb->eap.es_server.ea_state != eapMD5Chall) { - ppp_error("EAP: unexpected MD5-Response"); + ppp_error(("EAP: unexpected MD5-Response")); eap_figure_next_state(pcb, 1); break; } if (len < 1) { - ppp_error("EAP: received MD5-Response with no data"); + ppp_error(("EAP: received MD5-Response with no data")); eap_figure_next_state(pcb, 1); break; } GETCHAR(vallen, inp); len--; if (vallen != 16 || vallen > len) { - ppp_error("EAP: MD5-Response with bad length %d", vallen); + ppp_error(("EAP: MD5-Response with bad length %d", vallen)); eap_figure_next_state(pcb, 1); break; } /* Not so likely to happen. */ if (vallen >= len + sizeof (rhostname)) { - ppp_dbglog("EAP: trimming really long peer name down"); + ppp_dbglog(("EAP: trimming really long peer name down")); MEMCPY(rhostname, inp + vallen, sizeof (rhostname) - 1); rhostname[sizeof (rhostname) - 1] = '\0'; } else { @@ -1867,7 +1867,7 @@ static void eap_response(ppp_pcb *pcb, u_char *inp, int id, int len) { */ if (!get_secret(pcb, rhostname, pcb->eap.es_server.ea_name, secret, &secret_len, 1)) { - ppp_dbglog("EAP: no MD5 secret for auth of %q", rhostname); + ppp_dbglog(("EAP: no MD5 secret for auth of %q", rhostname)); eap_send_failure(pcb); break; } @@ -1893,7 +1893,7 @@ static void eap_response(ppp_pcb *pcb, u_char *inp, int id, int len) { #ifdef USE_SRP case EAPT_SRP: if (len < 1) { - ppp_error("EAP: empty SRP Response"); + ppp_error(("EAP: empty SRP Response")); eap_figure_next_state(pcb, 1); break; } @@ -1902,7 +1902,7 @@ static void eap_response(ppp_pcb *pcb, u_char *inp, int id, int len) { switch (typenum) { case EAPSRP_CKEY: if (pcb->eap.es_server.ea_state != eapSRP1) { - ppp_error("EAP: unexpected SRP Subtype 1 Response"); + ppp_error(("EAP: unexpected SRP Subtype 1 Response")); eap_figure_next_state(pcb, 1); break; } @@ -1913,7 +1913,7 @@ static void eap_response(ppp_pcb *pcb, u_char *inp, int id, int len) { pcb->eap.es_server.ea_skey = t_servergetkey(ts, &A); if (pcb->eap.es_server.ea_skey == NULL) { /* Client's A value is bogus; terminate now */ - ppp_error("EAP: bogus A value from client"); + ppp_error(("EAP: bogus A value from client")); eap_send_failure(pcb); } else { eap_figure_next_state(pcb, 0); @@ -1922,13 +1922,13 @@ static void eap_response(ppp_pcb *pcb, u_char *inp, int id, int len) { case EAPSRP_CVALIDATOR: if (pcb->eap.es_server.ea_state != eapSRP2) { - ppp_error("EAP: unexpected SRP Subtype 2 Response"); + ppp_error(("EAP: unexpected SRP Subtype 2 Response")); eap_figure_next_state(pcb, 1); break; } if (len < sizeof (u32_t) + SHA_DIGESTSIZE) { - ppp_error("EAP: M1 length %d < %d", len, - sizeof (u32_t) + SHA_DIGESTSIZE); + ppp_error(("EAP: M1 length %d < %d", len, + sizeof (u32_t) + SHA_DIGESTSIZE)); eap_figure_next_state(pcb, 1); break; } @@ -1936,7 +1936,7 @@ static void eap_response(ppp_pcb *pcb, u_char *inp, int id, int len) { ts = (struct t_server *)pcb->eap.es_server.ea_session; assert(ts != NULL); if (t_serververify(ts, inp)) { - ppp_info("EAP: unable to validate client identity"); + ppp_info(("EAP: unable to validate client identity")); eap_send_failure(pcb); break; } @@ -1945,7 +1945,7 @@ static void eap_response(ppp_pcb *pcb, u_char *inp, int id, int len) { case EAPSRP_ACK: if (pcb->eap.es_server.ea_state != eapSRP3) { - ppp_error("EAP: unexpected SRP Subtype 3 Response"); + ppp_error(("EAP: unexpected SRP Subtype 3 Response")); eap_send_failure(esp); break; } @@ -1962,12 +1962,12 @@ static void eap_response(ppp_pcb *pcb, u_char *inp, int id, int len) { case EAPSRP_LWRECHALLENGE: if (pcb->eap.es_server.ea_state != eapSRP4) { - ppp_info("EAP: unexpected SRP Subtype 4 Response"); + ppp_info(("EAP: unexpected SRP Subtype 4 Response")); return; } if (len != SHA_DIGESTSIZE) { - ppp_error("EAP: bad Lightweight rechallenge " - "response"); + ppp_error(("EAP: bad Lightweight rechallenge " + "response")); return; } SHA1Init(&ctxt); @@ -1980,7 +1980,7 @@ static void eap_response(ppp_pcb *pcb, u_char *inp, int id, int len) { pcb->eap.es_server.ea_peerlen); SHA1Final(dig, &ctxt); if (BCMP(dig, inp, SHA_DIGESTSIZE) != 0) { - ppp_error("EAP: failed Lightweight rechallenge"); + ppp_error(("EAP: failed Lightweight rechallenge")); eap_send_failure(pcb); break; } @@ -1995,7 +1995,7 @@ static void eap_response(ppp_pcb *pcb, u_char *inp, int id, int len) { default: /* This can't happen. */ - ppp_error("EAP: unknown Response type %d; ignored", typenum); + ppp_error(("EAP: unknown Response type %d; ignored", typenum)); return; } @@ -2018,9 +2018,9 @@ static void eap_success(ppp_pcb *pcb, u_char *inp, int id, int len) { LWIP_UNUSED_ARG(id); if (pcb->eap.es_client.ea_state != eapOpen && !eap_client_active(pcb)) { - ppp_dbglog("EAP unexpected success message in state %s (%d)", + ppp_dbglog(("EAP unexpected success message in state %s (%d)", eap_state_name(pcb->eap.es_client.ea_state), - pcb->eap.es_client.ea_state); + pcb->eap.es_client.ea_state)); return; } @@ -2044,7 +2044,7 @@ static void eap_failure(ppp_pcb *pcb, u_char *inp, int id, int len) { LWIP_UNUSED_ARG(id); if (!eap_client_active(pcb)) { - ppp_dbglog("EAP unexpected failure message in state %s (%d)", + ppp_dbglog(("EAP unexpected failure message in state %s (%d)", eap_state_name(pcb->eap.es_client.ea_state), pcb->eap.es_client.ea_state); } @@ -2060,7 +2060,7 @@ static void eap_failure(ppp_pcb *pcb, u_char *inp, int id, int len) { pcb->eap.es_client.ea_state = eapBadAuth; - ppp_error("EAP: peer reports authentication failure"); + ppp_error(("EAP: peer reports authentication failure")); auth_withpeer_fail(pcb, PPP_EAP); } @@ -2076,15 +2076,15 @@ static void eap_input(ppp_pcb *pcb, u_char *inp, int inlen) { * drop it. */ if (inlen < EAP_HEADERLEN) { - ppp_error("EAP: packet too short: %d < %d", inlen, EAP_HEADERLEN); + ppp_error(("EAP: packet too short: %d < %d", inlen, EAP_HEADERLEN)); return; } GETCHAR(code, inp); GETCHAR(id, inp); GETSHORT(len, inp); if (len < EAP_HEADERLEN || len > inlen) { - ppp_error("EAP: packet has illegal length field %d (%d..%d)", len, - EAP_HEADERLEN, inlen); + ppp_error(("EAP: packet has illegal length field %d (%d..%d)", len, + EAP_HEADERLEN, inlen)); return; } len -= EAP_HEADERLEN; @@ -2111,7 +2111,7 @@ static void eap_input(ppp_pcb *pcb, u_char *inp, int inlen) { default: /* XXX Need code reject */ /* Note: it's not legal to send EAP Nak here. */ - ppp_warn("EAP: unknown code %d received", code); + ppp_warn(("EAP: unknown code %d received", code)); break; } } diff --git a/src/netif/ppp/fsm.c b/src/netif/ppp/fsm.c index b1f08aff..d299f860 100644 --- a/src/netif/ppp/fsm.c +++ b/src/netif/ppp/fsm.c @@ -290,7 +290,7 @@ static void fsm_timeout(void *arg) { case PPP_FSM_ACKRCVD: case PPP_FSM_ACKSENT: if (f->retransmits <= 0) { - ppp_warn("%s: timeout sending Config-Requests", PROTO_NAME(f)); + ppp_warn(("%s: timeout sending Config-Requests", PROTO_NAME(f))); f->state = PPP_FSM_STOPPED; if( (f->flags & OPT_PASSIVE) == 0 && f->callbacks->finished ) (*f->callbacks->finished)(f); @@ -464,7 +464,7 @@ static void fsm_rconfack(fsm *f, int id, u_char *inp, int len) { if( !(f->callbacks->ackci? (*f->callbacks->ackci)(f, inp, len): (len == 0)) ){ /* Ack is bad - ignore it */ - ppp_error("Received bad configure-ack: %P", inp, len); + ppp_error(("Received bad configure-ack: %P", inp, len)); return; } f->seen_ack = 1; @@ -524,14 +524,14 @@ static void fsm_rconfnakrej(fsm *f, int code, int id, u_char *inp, int len) { treat_as_reject = (f->rnakloops >= f->maxnakloops); if (f->callbacks->nakci == NULL || !(ret = f->callbacks->nakci(f, inp, len, treat_as_reject))) { - ppp_error("Received bad configure-nak: %P", inp, len); + ppp_error(("Received bad configure-nak: %P", inp, len)); return; } } else { f->rnakloops = 0; if (f->callbacks->rejci == NULL || !(ret = f->callbacks->rejci(f, inp, len))) { - ppp_error("Received bad configure-rej: %P", inp, len); + ppp_error(("Received bad configure-rej: %P", inp, len)); return; } } @@ -588,9 +588,9 @@ static void fsm_rtermreq(fsm *f, int id, u_char *p, int len) { case PPP_FSM_OPENED: 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 - ppp_info("%s terminated by peer", PROTO_NAME(f)); + ppp_info(("%s terminated by peer", PROTO_NAME(f))); f->retransmits = 0; f->state = PPP_FSM_STOPPING; if (f->callbacks->down) @@ -651,7 +651,7 @@ static void fsm_rcoderej(fsm *f, u_char *inp, int len) { } GETCHAR(code, 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)); if( f->state == PPP_FSM_ACKRCVD ) f->state = PPP_FSM_REQSENT; diff --git a/src/netif/ppp/ipcp.c b/src/netif/ppp/ipcp.c index b7c766eb..eaa3787f 100644 --- a/src/netif/ppp/ipcp.c +++ b/src/netif/ppp/ipcp.c @@ -1869,9 +1869,9 @@ ip_demand_conf(u) proxy_arp_set[u] = 1; #endif /* UNUSED - PROXY ARP */ - ppp_notice("local IP address %I", wo->ouraddr); + ppp_notice(("local IP address %I", wo->ouraddr)); if (wo->hisaddr) - ppp_notice("remote IP address %I", wo->hisaddr); + ppp_notice(("remote IP address %I", wo->hisaddr)); return 1; } @@ -1899,19 +1899,19 @@ static void ipcp_up(fsm *f) { if (!(go->neg_addr || go->old_addrs) && (wo->neg_addr || wo->old_addrs) && wo->ouraddr != 0) { - ppp_error("Peer refused to agree to our IP address"); + ppp_error(("Peer refused to agree to our IP address")); ipcp_close(f->pcb, "Refused our IP address"); return; } if (go->ouraddr == 0) { - ppp_error("Could not determine local IP address"); + ppp_error(("Could not determine local IP address")); ipcp_close(f->pcb, "Could not determine local IP address"); return; } if (ho->hisaddr == 0 && !pcb->settings.noremoteip) { ho->hisaddr = lwip_htonl(0x0a404040); - ppp_warn("Could not determine remote IP address: defaulting to %I", - ho->hisaddr); + ppp_warn(("Could not determine remote IP address: defaulting to %I", + ho->hisaddr)); } #if 0 /* UNUSED */ script_setenv("IPLOCAL", ip_ntoa(go->ouraddr), 0); @@ -1955,7 +1955,7 @@ static void ipcp_up(fsm *f) { || (pcb->settings.auth_required && wo->hisaddr != ho->hisaddr) #endif /* PPP_SERVER && PPP_AUTH_SUPPORT */ ) { - ppp_error("Peer is not authorized to use remote address %I", ho->hisaddr); + ppp_error(("Peer is not authorized to use remote address %I", ho->hisaddr)); ipcp_close(pcb, "Unauthorized remote IP address"); return; } @@ -1963,7 +1963,7 @@ static void ipcp_up(fsm *f) { #if 0 /* Unused */ /* Upstream checking code */ if (ho->hisaddr != 0 && !auth_ip_addr(f->unit, ho->hisaddr)) { - ppp_error("Peer is not authorized to use remote address %I", ho->hisaddr); + ppp_error(("Peer is not authorized to use remote address %I", ho->hisaddr)); ipcp_close(f->unit, "Unauthorized remote IP address"); return; } @@ -1985,13 +1985,13 @@ static void ipcp_up(fsm *f) { ipcp_clear_addrs(f->unit, wo->ouraddr, wo->hisaddr, wo->replace_default_route); if (go->ouraddr != wo->ouraddr) { - ppp_warn("Local IP address changed to %I", go->ouraddr); + ppp_warn(("Local IP address changed to %I", go->ouraddr)); script_setenv("OLDIPLOCAL", ip_ntoa(wo->ouraddr), 0); wo->ouraddr = go->ouraddr; } else script_unsetenv("OLDIPLOCAL"); if (ho->hisaddr != wo->hisaddr && wo->hisaddr != 0) { - ppp_warn("Remote IP address changed to %I", ho->hisaddr); + ppp_warn(("Remote IP address changed to %I", ho->hisaddr)); script_setenv("OLDIPREMOTE", ip_ntoa(wo->hisaddr), 0); wo->hisaddr = ho->hisaddr; } else @@ -2001,7 +2001,7 @@ static void ipcp_up(fsm *f) { mask = get_mask(go->ouraddr); if (!sifaddr(pcb, go->ouraddr, ho->hisaddr, mask)) { #if PPP_DEBUG - ppp_warn("Interface configuration failed"); + ppp_warn(("Interface configuration failed")); #endif /* PPP_DEBUG */ ipcp_close(f->unit, "Interface configuration failed"); return; @@ -2035,7 +2035,7 @@ static void ipcp_up(fsm *f) { #if !(defined(SVR4) && (defined(SNI) || defined(__USLC__))) if (!sifaddr(pcb, go->ouraddr, ho->hisaddr, mask)) { #if PPP_DEBUG - ppp_warn("Interface configuration failed"); + ppp_warn(("Interface configuration failed")); #endif /* PPP_DEBUG */ ipcp_close(f->pcb, "Interface configuration failed"); return; @@ -2045,7 +2045,7 @@ static void ipcp_up(fsm *f) { /* bring the interface up for IP */ if (!sifup(pcb)) { #if PPP_DEBUG - ppp_warn("Interface failed to come up"); + ppp_warn(("Interface failed to come up")); #endif /* PPP_DEBUG */ ipcp_close(f->pcb, "Interface configuration failed"); return; @@ -2054,7 +2054,7 @@ static void ipcp_up(fsm *f) { #if (defined(SVR4) && (defined(SNI) || defined(__USLC__))) if (!sifaddr(pcb, go->ouraddr, ho->hisaddr, mask)) { #if PPP_DEBUG - ppp_warn("Interface configuration failed"); + ppp_warn(("Interface configuration failed")); #endif /* PPP_DEBUG */ ipcp_close(f->unit, "Interface configuration failed"); return; @@ -2081,14 +2081,14 @@ static void ipcp_up(fsm *f) { wo->ouraddr = go->ouraddr; - ppp_notice("local IP address %I", go->ouraddr); + ppp_notice(("local IP address %I", go->ouraddr)); if (ho->hisaddr != 0) - ppp_notice("remote IP address %I", ho->hisaddr); + ppp_notice(("remote IP address %I", ho->hisaddr)); #if LWIP_DNS 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]) - ppp_notice("secondary DNS address %I", go->dnsaddr[1]); + ppp_notice(("secondary DNS address %I", go->dnsaddr[1])); #endif /* LWIP_DNS */ } diff --git a/src/netif/ppp/ipv6cp.c b/src/netif/ppp/ipv6cp.c index 11c18df7..fabf4ed8 100644 --- a/src/netif/ppp/ipv6cp.c +++ b/src/netif/ppp/ipv6cp.c @@ -1134,9 +1134,9 @@ static int ipv6_demand_conf(int u) { if (!sifnpmode(u, PPP_IPV6, NPMODE_QUEUE)) return 0; - ppp_notice("ipv6_demand_conf"); - ppp_notice("local LL address %s", llv6_ntoa(wo->ourid)); - ppp_notice("remote LL address %s", llv6_ntoa(wo->hisid)); + ppp_notice(("ipv6_demand_conf")); + ppp_notice(("local LL address %s", llv6_ntoa(wo->ourid))); + ppp_notice(("remote LL address %s", llv6_ntoa(wo->hisid))); return 1; } @@ -1166,17 +1166,17 @@ static void ipv6cp_up(fsm *f) { if(!no_ifaceid_neg) { #endif /* UNUSED */ if (eui64_iszero(ho->hisid)) { - ppp_error("Could not determine remote LL address"); + ppp_error(("Could not determine remote LL address")); ipv6cp_close(f->pcb, "Could not determine remote LL address"); return; } if (eui64_iszero(go->ourid)) { - ppp_error("Could not determine local LL address"); + ppp_error(("Could not determine local LL address")); ipv6cp_close(f->pcb, "Could not determine local LL address"); return; } if (eui64_equals(go->ourid, ho->hisid)) { - ppp_error("local and remote LL addresses are equal"); + ppp_error(("local and remote LL addresses are equal")); ipv6cp_close(f->pcb, "local and remote LL addresses are equal"); return; } @@ -1244,8 +1244,8 @@ static void ipv6cp_up(fsm *f) { sifnpmode(f->pcb, PPP_IPV6, NPMODE_PASS); #endif /* DEMAND_SUPPORT */ - ppp_notice("local LL address %s", llv6_ntoa(go->ourid)); - ppp_notice("remote LL address %s", llv6_ntoa(ho->hisid)); + ppp_notice(("local LL address %s", llv6_ntoa(go->ourid))); + ppp_notice(("remote LL address %s", llv6_ntoa(ho->hisid))); } np_up(f->pcb, PPP_IPV6); diff --git a/src/netif/ppp/lcp.c b/src/netif/ppp/lcp.c index 90ed183b..ae978caa 100644 --- a/src/netif/ppp/lcp.c +++ b/src/netif/ppp/lcp.c @@ -594,22 +594,22 @@ static void lcp_rprotrej(fsm *f, u_char *inp, int len) { if (protp->protocol == prot) { #if PPP_PROTOCOLNAME if (pname != NULL) - ppp_dbglog("Protocol-Reject for '%s' (0x%x) received", pname, - prot); + ppp_dbglog(("Protocol-Reject for '%s' (0x%x) received", pname, + prot)); else #endif /* PPP_PROTOCOLNAME */ - ppp_dbglog("Protocol-Reject for 0x%x received", prot); + ppp_dbglog(("Protocol-Reject for 0x%x received", prot)); (*protp->protrej)(f->pcb); return; } #if PPP_PROTOCOLNAME if (pname != NULL) - ppp_warn("Protocol-Reject for unsupported protocol '%s' (0x%x)", pname, - prot); + ppp_warn(("Protocol-Reject for unsupported protocol '%s' (0x%x)", pname, + prot)); else #endif /* #if PPP_PROTOCOLNAME */ - ppp_warn("Protocol-Reject for unsupported protocol 0x%x", prot); + ppp_warn(("Protocol-Reject for unsupported protocol 0x%x", prot)); } @@ -621,7 +621,7 @@ static void lcp_protrej(ppp_pcb *pcb) { /* * Can't reject LCP! */ - ppp_error("Received Protocol-Reject for LCP!"); + ppp_error(("Received Protocol-Reject for LCP!")); fsm_protreject(&pcb->lcp_fsm); } @@ -931,7 +931,7 @@ static void lcp_addci(fsm *f, u_char *ucp, int *lenp) { if (ucp - start_ucp != *lenp) { /* this should never happen, because peer_mtu should be 1500 */ - ppp_error("Bug in lcp_addci: wrong length"); + ppp_error(("Bug in lcp_addci: wrong length")); } } @@ -1363,7 +1363,7 @@ static int lcp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) { * well, that's just strange. Nobody should do that. */ if (cishort == PPP_EAP && cilen == CILEN_SHORT && go->neg_eap) - ppp_dbglog("Unexpected Conf-Nak for EAP"); + ppp_dbglog(("Unexpected Conf-Nak for EAP")); /* * We don't recognize what they're suggesting. @@ -1560,7 +1560,7 @@ 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) { - ppp_notice("Serial line is looped back."); + ppp_notice(("Serial line is looped back.")); pcb->err_code = PPPERR_LOOPBACK; lcp_close(f->pcb, "Loopback detected"); } @@ -1935,7 +1935,7 @@ static int lcp_reqci(fsm *f, u_char *inp, int *lenp, int reject_if_disagree) { /* * Reject the option if we're not willing to authenticate. */ - ppp_dbglog("No auth is possible"); + ppp_dbglog(("No auth is possible")); orc = CONFREJ; break; } @@ -2639,8 +2639,8 @@ static int lcp_printpkt(const u_char *p, int plen, static void LcpLinkFailure(fsm *f) { ppp_pcb *pcb = f->pcb; if (f->state == PPP_FSM_OPENED) { - ppp_info("No response to %d echo-requests", pcb->lcp_echos_pending); - ppp_notice("Serial link appears to be disconnected."); + ppp_info(("No response to %d echo-requests", pcb->lcp_echos_pending)); + ppp_notice(("Serial link appears to be disconnected.")); pcb->err_code = PPPERR_PEERDEAD; lcp_close(pcb, "Peer not responding"); } @@ -2661,7 +2661,7 @@ static void LcpEchoCheck(fsm *f) { * Start the timer for the next interval. */ 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); pcb->lcp_echo_timer_running = 1; } @@ -2691,13 +2691,13 @@ static void lcp_received_echo_reply(fsm *f, int id, u_char *inp, int len) { /* Check the magic number - don't count replies from ourselves. */ if (len < 4) { - ppp_dbglog("lcp: received short Echo-Reply, length %d", len); + ppp_dbglog(("lcp: received short Echo-Reply, length %d", len)); return; } GETLONG(magic_val, inp); if (go->neg_magicnumber && magic_val == go->magicnumber) { - ppp_warn("appear to have received our own echo-reply!"); + ppp_warn(("appear to have received our own echo-reply!")); return; } diff --git a/src/netif/ppp/ppp.c b/src/netif/ppp/ppp.c index a9c18e30..b847609c 100644 --- a/src/netif/ppp/ppp.c +++ b/src/netif/ppp/ppp.c @@ -798,7 +798,7 @@ void ppp_input(ppp_pcb *pcb, struct pbuf *pb) { * Toss all non-LCP packets unless LCP is OPEN. */ if (protocol != PPP_LCP && pcb->lcp_fsm.state != PPP_FSM_OPENED) { - ppp_dbglog("Discarded non-LCP packet when LCP not open"); + ppp_dbglog(("Discarded non-LCP packet when LCP not open")); goto drop; } @@ -821,7 +821,7 @@ void ppp_input(ppp_pcb *pcb, struct pbuf *pb) { || protocol == PPP_EAP #endif /* EAP_SUPPORT */ )) { - ppp_dbglog("discarding proto 0x%x in phase %d", protocol, pcb->phase); + ppp_dbglog(("discarding proto 0x%x in phase %d", protocol, pcb->phase)); goto drop; } @@ -956,10 +956,10 @@ void ppp_input(ppp_pcb *pcb, struct pbuf *pb) { #if PPP_PROTOCOLNAME pname = protocol_name(protocol); if (pname != NULL) { - ppp_warn("Unsupported protocol '%s' (0x%x) received", pname, protocol); + ppp_warn(("Unsupported protocol '%s' (0x%x) received", pname, protocol)); } else #endif /* PPP_PROTOCOLNAME */ - ppp_warn("Unsupported protocol 0x%x received", protocol); + ppp_warn(("Unsupported protocol 0x%x received", protocol)); #endif /* PPP_DEBUG */ if (pbuf_add_header(pb, sizeof(protocol))) { PPPDEBUG(LOG_WARNING, ("ppp_input[%d]: Dropping (pbuf_add_header failed)\n", pcb->netif->num)); diff --git a/src/netif/ppp/upap.c b/src/netif/ppp/upap.c index 3b2399dc..1a1340a6 100644 --- a/src/netif/ppp/upap.c +++ b/src/netif/ppp/upap.c @@ -206,7 +206,7 @@ static void upap_timeout(void *arg) { if (pcb->upap.us_transmits >= pcb->settings.pap_max_transmits) { /* give up in disgust */ - ppp_error("No response to PAP authenticate-requests"); + ppp_error(("No response to PAP authenticate-requests")); pcb->upap.us_clientstate = UPAPCS_BADAUTH; auth_withpeer_fail(pcb, PPP_PAP); return; @@ -286,12 +286,12 @@ static void upap_lowerdown(ppp_pcb *pcb) { static void upap_protrej(ppp_pcb *pcb) { if (pcb->upap.us_clientstate == UPAPCS_AUTHREQ) { - ppp_error("PAP authentication failed due to protocol-reject"); + ppp_error(("PAP authentication failed due to protocol-reject")); auth_withpeer_fail(pcb, PPP_PAP); } #if PPP_SERVER if (pcb->upap.us_serverstate == UPAPSS_LISTEN) { - ppp_error("PAP authentication of peer failed (protocol-reject)"); + ppp_error(("PAP authentication of peer failed (protocol-reject)")); auth_peer_fail(pcb, PPP_PAP); } #endif /* PPP_SERVER */ @@ -439,11 +439,11 @@ static void upap_rauthreq(ppp_pcb *pcb, u_char *inp, int id, int len) { if (retcode == UPAP_AUTHACK) { pcb->upap.us_serverstate = UPAPSS_OPEN; - ppp_notice("PAP peer authentication succeeded for %q", rhostname); + ppp_notice(("PAP peer authentication succeeded for %q", rhostname)); auth_peer_success(pcb, PPP_PAP, 0, ruser, ruserlen); } else { pcb->upap.us_serverstate = UPAPSS_BADAUTH; - ppp_warn("PAP peer authentication failed for %q", rhostname); + ppp_warn(("PAP peer authentication failed for %q", rhostname)); auth_peer_fail(pcb, PPP_PAP); } @@ -518,7 +518,7 @@ static void upap_rauthnak(ppp_pcb *pcb, u_char *inp, int id, int len) { pcb->upap.us_clientstate = UPAPCS_BADAUTH; - ppp_error("PAP authentication failed"); + ppp_error(("PAP authentication failed")); auth_withpeer_fail(pcb, PPP_PAP); } diff --git a/src/netif/ppp/utils.c b/src/netif/ppp/utils.c index f1366dae..99a5fb1d 100644 --- a/src/netif/ppp/utils.c +++ b/src/netif/ppp/utils.c @@ -629,7 +629,7 @@ static void ppp_log_write(int level, char *buf) { /* * ppp_fatal - log an error message and die horribly. */ -void ppp_fatal(const char *fmt, ...) { +void ppp_fatal_impl(const char *fmt, ...) { va_list pvar; va_start(pvar, fmt); @@ -642,7 +642,7 @@ void ppp_fatal(const char *fmt, ...) { /* * ppp_error - log an error message. */ -void ppp_error(const char *fmt, ...) { +void ppp_error_impl(const char *fmt, ...) { va_list pvar; va_start(pvar, fmt); @@ -656,7 +656,7 @@ void ppp_error(const char *fmt, ...) { /* * ppp_warn - log a warning message. */ -void ppp_warn(const char *fmt, ...) { +void ppp_warn_impl(const char *fmt, ...) { va_list pvar; va_start(pvar, fmt); @@ -667,7 +667,7 @@ void ppp_warn(const char *fmt, ...) { /* * ppp_notice - log a notice-level message. */ -void ppp_notice(const char *fmt, ...) { +void ppp_notice_impl(const char *fmt, ...) { va_list pvar; va_start(pvar, fmt); @@ -678,7 +678,7 @@ void ppp_notice(const char *fmt, ...) { /* * ppp_info - log an informational message. */ -void ppp_info(const char *fmt, ...) { +void ppp_info_impl(const char *fmt, ...) { va_list pvar; va_start(pvar, fmt); @@ -689,7 +689,7 @@ void ppp_info(const char *fmt, ...) { /* * ppp_dbglog - log a debug message. */ -void ppp_dbglog(const char *fmt, ...) { +void ppp_dbglog_impl(const char *fmt, ...) { va_list pvar; va_start(pvar, fmt); @@ -724,7 +724,7 @@ void ppp_dump_packet(ppp_pcb *pcb, const char *tag, unsigned char *p, int len) { return; } - ppp_dbglog("%s %P", tag, p, len); + ppp_dbglog(("%s %P", tag, p, len)); } #endif /* PRINTPKT_SUPPORT */ @@ -788,9 +788,9 @@ lock(dev) } if (result > 0) - ppp_notice("Device %s is locked by pid %d", dev, result); + ppp_notice(("Device %s is locked by pid %d", dev, result)); else - ppp_error("Can't create lock file %s", lock_file); + ppp_error(("Can't create lock file %s", lock_file)); return -1; #else /* LOCKLIB */ @@ -802,11 +802,11 @@ lock(dev) struct stat sbuf; if (stat(dev, &sbuf) < 0) { - ppp_error("Can't get device number for %s: %m", dev); + ppp_error(("Can't get device number for %s: %m", dev)); return -1; } if ((sbuf.st_mode & S_IFMT) != S_IFCHR) { - ppp_error("Can't lock %s: not a character device", dev); + ppp_error(("Can't lock %s: not a character device", dev)); return -1; } ppp_slprintf(lock_file, sizeof(lock_file), "%s/LK.%03d.%03d.%03d", @@ -833,7 +833,7 @@ lock(dev) while ((fd = open(lock_file, O_EXCL | O_CREAT | O_RDWR, 0644)) < 0) { if (errno != EEXIST) { - ppp_error("Can't create lock file %s: %m", lock_file); + ppp_error(("Can't create lock file %s: %m", lock_file)); break; } @@ -842,7 +842,7 @@ lock(dev) if (fd < 0) { if (errno == ENOENT) /* This is just a timing problem. */ continue; - ppp_error("Can't open existing lock file %s: %m", lock_file); + ppp_error(("Can't open existing lock file %s: %m", lock_file)); break; } #ifndef LOCK_BINARY @@ -853,7 +853,7 @@ lock(dev) close(fd); fd = -1; if (n <= 0) { - ppp_error("Can't read pid from lock file %s", lock_file); + ppp_error(("Can't read pid from lock file %s", lock_file)); break; } @@ -867,12 +867,12 @@ lock(dev) if (pid == 0 || (kill(pid, 0) == -1 && errno == ESRCH)) { if (unlink (lock_file) == 0) { - ppp_notice("Removed stale lock on %s (pid %d)", dev, pid); + ppp_notice(("Removed stale lock on %s (pid %d)", dev, pid)); continue; } - ppp_warn("Couldn't remove stale lock on %s", dev); + ppp_warn(("Couldn't remove stale lock on %s", dev)); } else - ppp_notice("Device %s is locked by pid %d", dev, pid); + ppp_notice(("Device %s is locked by pid %d", dev, pid)); break; } @@ -919,7 +919,7 @@ relock(pid) return -1; fd = open(lock_file, O_WRONLY, 0); if (fd < 0) { - ppp_error("Couldn't reopen lock file %s: %m", lock_file); + ppp_error(("Couldn't reopen lock file %s: %m", lock_file)); lock_file[0] = 0; return -1; } -- 2.11.0.windows.1