diff --git a/src/include/netif/ppp/ppp_impl.h b/src/include/netif/ppp/ppp_impl.h index 8c69aa6d..61ed84c1 100644 --- a/src/include/netif/ppp/ppp_impl.h +++ b/src/include/netif/ppp/ppp_impl.h @@ -491,7 +491,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) { 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. @@ -556,19 +556,19 @@ int str_to_epdisc (struct epdisc *, char *); /* endpt disc. from str */ #endif /* Procedures exported from utils.c. */ -void print_string(char *p, int len, void (*printer) (void *, char *, ...), void *arg); /* Format a string for output */ -int slprintf(char *buf, int buflen, char *fmt, ...); /* sprintf++ */ -int vslprintf(char *buf, int buflen, char *fmt, va_list args); /* vsprintf++ */ -size_t strlcpy(char *dest, const char *src, size_t len); /* safe strcpy */ -size_t strlcat(char *dest, const char *src, size_t len); /* safe strncpy */ -void dbglog(char *fmt, ...); /* log a debug message */ -void info(char *fmt, ...); /* log an informational message */ -void notice(char *fmt, ...); /* log a notice-level message */ -void warn(char *fmt, ...); /* log a warning message */ -void error(char *fmt, ...); /* log an error message */ -void fatal(char *fmt, ...); /* log an error message and die(1) */ +void ppp_print_string(char *p, int len, void (*printer) (void *, char *, ...), void *arg); /* Format a string for output */ +int ppp_slprintf(char *buf, int buflen, char *fmt, ...); /* sprintf++ */ +int ppp_vslprintf(char *buf, int buflen, 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(char *fmt, ...); /* log a debug message */ +void ppp_info(char *fmt, ...); /* log an informational message */ +void ppp_notice(char *fmt, ...); /* log a notice-level message */ +void ppp_warn(char *fmt, ...); /* log a warning message */ +void ppp_error(char *fmt, ...); /* log an error message */ +void ppp_fatal(char *fmt, ...); /* log an error message and die(1) */ #if PRINTPKT_SUPPORT -void dump_packet(const char *tag, unsigned char *p, int len); +void ppp_dump_packet(const char *tag, unsigned char *p, int len); /* dump packet to debug log if interesting */ #endif /* PRINTPKT_SUPPORT */ diff --git a/src/netif/ppp/auth.c b/src/netif/ppp/auth.c index e150ff6b..ec41bd99 100644 --- a/src/netif/ppp/auth.c +++ b/src/netif/ppp/auth.c @@ -590,9 +590,9 @@ void start_link(unit) * incoming events (reply, timeout, etc.). */ if (ifunit >= 0) - notice("Connect: %s <--> %s", ifname, ppp_devnam); + ppp_notice("Connect: %s <--> %s", ifname, ppp_devnam); else - notice("Starting negotiation on %s", ppp_devnam); + ppp_notice("Starting negotiation on %s", ppp_devnam); add_fd(fd_ppp); new_phase(pcb, PHASE_ESTABLISH); @@ -629,12 +629,12 @@ void link_terminated(ppp_pcb *pcb) { #endif /* UNUSED */ if (!doing_multilink) { - notice("Connection terminated."); + ppp_notice("Connection terminated."); #if PPP_STATS_SUPPORT print_link_stats(); #endif /* PPP_STATS_SUPPORT */ } else - notice("Link terminated."); + ppp_notice("Link terminated."); lcp_lowerdown(pcb); @@ -780,7 +780,7 @@ void link_established(ppp_pcb *pcb) { } else #endif /* PPP_ALLOWED_ADDRS */ if (!wo->neg_upap || uselogin || !null_login(unit)) { - warn("peer refused to authenticate: terminating link"); + ppp_warn("peer refused to authenticate: terminating link"); status = EXIT_PEER_AUTH_FAILED; lcp_close(pcb, "peer refused to authenticate"); return; @@ -854,7 +854,7 @@ static void network_phase(ppp_pcb *pcb) { #if 0 /* UNUSED */ /* Log calling number. */ if (*remote_number) - notice("peer from calling number %q authorized", remote_number); + ppp_notice("peer from calling number %q authorized", remote_number); #endif /* UNUSED */ #if PPP_NOTIFY @@ -1040,7 +1040,7 @@ void auth_peer_success(ppp_pcb *pcb, int protocol, int prot_flavor, char *name, break; #endif /* EAP_SUPPORT */ default: - warn("auth_peer_success: unknown protocol %x", protocol); + ppp_warn("auth_peer_success: unknown protocol %x", protocol); return; } @@ -1127,12 +1127,12 @@ void auth_withpeer_success(ppp_pcb *pcb, int protocol, int prot_flavor) { break; #endif /* EAP_SUPPORT */ default: - warn("auth_withpeer_success: unknown protocol %x", protocol); + ppp_warn("auth_withpeer_success: unknown protocol %x", protocol); bit = 0; /* no break */ } - notice("%s authentication succeeded", prot); + ppp_notice("%s authentication succeeded", prot); /* Save the authentication method for later. */ pcb->auth_done |= bit; @@ -1251,7 +1251,7 @@ check_maxoctets(arg) break; } if (used > maxoctets) { - 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 */ @@ -1290,7 +1290,7 @@ static void check_idle(void *arg) { if (tlim <= 0) { int errcode = PPPERR_IDLETIMEOUT; /* link is idle: shut it down. */ - notice("Terminating connection due to lack of activity."); + ppp_notice("Terminating connection due to lack of activity."); ppp_ioctl(pcb, PPPCTLS_ERRCODE, &errcode); lcp_close(pcb, "Link inactive"); #if 0 /* UNUSED */ @@ -1309,7 +1309,7 @@ static void check_idle(void *arg) { static void connect_time_expired(void *arg) { int errcode = PPPERR_CONNECTTIME; ppp_pcb *pcb = (ppp_pcb*)arg; - info("Connect time expired"); + ppp_info("Connect time expired"); ppp_ioctl(pcb, PPPCTLS_ERRCODE, &errcode); lcp_close(pcb, "Connect time expired"); /* Close connection */ } @@ -1448,7 +1448,7 @@ auth_check_options() * Early check for remote number authorization. */ if (!auth_number()) { - warn("calling number %q is not authorized", remote_number); + ppp_warn("calling number %q is not authorized", remote_number); exit(EXIT_CNID_AUTH_FAILED); } } @@ -1633,12 +1633,12 @@ check_passwd(unit, auser, userlen, apasswd, passwdlen, msg) ret = UPAP_AUTHNAK; f = fopen(filename, "r"); if (f == NULL) { - 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) { - 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 @@ -1653,7 +1653,7 @@ check_passwd(unit, auser, userlen, apasswd, passwdlen, msg) } } else if (session_mgmt) { if (session_check(ppp_settings.user, NULL, devnam, NULL) == 0) { - warn("Peer %q failed PAP Session verification", user); + ppp_warn("Peer %q failed PAP Session verification", user); ret = UPAP_AUTHNAK; } } @@ -1677,7 +1677,7 @@ check_passwd(unit, auser, userlen, apasswd, passwdlen, msg) * On 10'th, drop the connection. */ if (attempts++ >= 10) { - 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) @@ -1936,7 +1936,7 @@ int get_secret(ppp_pcb *pcb, char *client, char *server, char *secret, int *secr len = (int)strlen(pcb->settings.passwd); if (len > MAXSECRETLEN) { - 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; } @@ -1968,7 +1968,7 @@ int get_secret(ppp_pcb *pcb, char *client, char *server, char *secret, int *secr strlcpy(secbuf, ppp_settings.passwd, sizeof(secbuf)); } else if (!am_server && chap_passwd_hook) { if ( (*chap_passwd_hook)(client, secbuf) < 0) { - error("Unable to obtain CHAP password for %s on %s from plugin", + ppp_error("Unable to obtain CHAP password for %s on %s from plugin", client, server); return 0; } @@ -1979,7 +1979,7 @@ int get_secret(ppp_pcb *pcb, char *client, char *server, char *secret, int *secr f = fopen(filename, "r"); if (f == NULL) { - 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); @@ -1999,7 +1999,7 @@ int get_secret(ppp_pcb *pcb, char *client, char *server, char *secret, int *secr len = strlen(secbuf); if (len > MAXSECRETLEN) { - 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); @@ -2038,7 +2038,7 @@ get_srp_secret(unit, client, server, secret, am_server) fp = fopen(filename, "r"); if (fp == NULL) { - 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); @@ -2132,7 +2132,7 @@ set_allowed_addrs(unit, addrs, opts) bit_count = (int) strtol (ptr_mask+1, &endp, 10); if (bit_count <= 0 || bit_count > 32) { - warn("invalid address length %v in auth. address list", + ppp_warn("invalid address length %v in auth. address list", ptr_mask+1); continue; } @@ -2142,7 +2142,7 @@ set_allowed_addrs(unit, addrs, opts) ++endp; } if (*endp != 0) { - warn("invalid address length syntax: %v", ptr_mask+1); + ppp_warn("invalid address length syntax: %v", ptr_mask+1); continue; } *ptr_mask = '\0'; @@ -2175,12 +2175,12 @@ set_allowed_addrs(unit, addrs, opts) *ptr_mask = '/'; if (a == (u32_t)-1L) { - 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) { - warn("interface unit %d too large for subnet %v", + ppp_warn("interface unit %d too large for subnet %v", ifunit, ptr_word); continue; } @@ -2329,9 +2329,9 @@ check_access(f, filename) struct stat sbuf; if (fstat(fileno(f), &sbuf) < 0) { - 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) { - warn("Warning - secret file %s has world and/or group access", + ppp_warn("Warning - secret file %s has world and/or group access", filename); } } @@ -2442,12 +2442,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) { - 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)) { - 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/chap-new.c b/src/netif/ppp/chap-new.c index 242c9163..d462d856 100644 --- a/src/netif/ppp/chap-new.c +++ b/src/netif/ppp/chap-new.c @@ -172,14 +172,14 @@ void chap_auth_peer(ppp_pcb *pcb, char *our_name, int digest_code) { struct chap_digest_type *dp; if (pcb->chap_server.flags & AUTH_STARTED) { - error("CHAP: peer authentication already started!"); + ppp_error("CHAP: peer authentication already started!"); return; } for (dp = chap_digests; dp != NULL; dp = dp->next) if (dp->code == digest_code) break; if (dp == NULL) - fatal("CHAP digest 0x%x requested but not available", + ppp_fatal("CHAP digest 0x%x requested but not available", digest_code); pcb->chap_server.digest = dp; @@ -203,14 +203,14 @@ void chap_auth_with_peer(ppp_pcb *pcb, char *our_name, int digest_code) { return; if (pcb->chap_client.flags & AUTH_STARTED) { - error("CHAP: authentication with peer already started!"); + ppp_error("CHAP: authentication with peer already started!"); return; } for (dp = chap_digests; dp != NULL; dp = dp->next) if (dp->code == digest_code) break; if (dp == NULL) - fatal("CHAP digest 0x%x requested but not available", + ppp_fatal("CHAP digest 0x%x requested but not available", digest_code); pcb->chap_client.digest = dp; @@ -310,7 +310,7 @@ static void chap_handle_response(ppp_pcb *pcb, int id, name = remote_name; } else { /* Null terminate and clean remote name. */ - slprintf(rname, sizeof(rname), "%.*v", len, name); + ppp_slprintf(rname, sizeof(rname), "%.*v", len, name); name = rname; } @@ -326,7 +326,7 @@ static void chap_handle_response(ppp_pcb *pcb, int id, #endif /* UNUSED */ if (!ok) { pcb->chap_server.flags |= AUTH_FAILED; - 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; @@ -366,7 +366,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; - warn("Peer %q failed CHAP Session verification", name); + ppp_warn("Peer %q failed CHAP Session verification", name); } #endif /* UNUSED */ @@ -403,7 +403,7 @@ static int chap_verify_response(char *name, char *ourname, int id, /* Get the secret that the peer is supposed to know */ if (!get_secret(pcb, name, ourname, (char *)secret, &secret_len, 1)) { - error("No CHAP secret found for authenticating %q", name); + ppp_error("No CHAP secret found for authenticating %q", name); return 0; } @@ -439,7 +439,7 @@ static void chap_respond(ppp_pcb *pcb, int id, nlen = len - (clen + 1); /* Null terminate and clean remote name. */ - slprintf(rname, sizeof(rname), "%.*v", nlen, pkt + clen + 1); + ppp_slprintf(rname, sizeof(rname), "%.*v", nlen, pkt + clen + 1); #if PPP_REMOTENAME /* Microsoft doesn't send their name back in the PPP packet */ @@ -450,7 +450,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 */ - warn("No CHAP secret found for authenticating us to %q", rname); + ppp_warn("No CHAP secret found for authenticating us to %q", rname); } outp = p->payload; @@ -500,15 +500,15 @@ static void chap_handle_status(ppp_pcb *pcb, int code, int id, } if (msg) { if (len > 0) - info("%s: %.*v", msg, len, pkt); + ppp_info("%s: %.*v", msg, len, pkt); else - 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; - error("CHAP authentication failed"); + ppp_error("CHAP authentication failed"); auth_withpeer_fail(pcb, PPP_CHAP); } } @@ -556,7 +556,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; - error("CHAP authentication failed due to protocol-reject"); + ppp_error("CHAP authentication failed due to protocol-reject"); auth_withpeer_fail(pcb, PPP_CHAP); } } @@ -605,12 +605,12 @@ static int chap_print_pkt(unsigned char *p, int plen, printer(arg, "%.2x", x); } printer(arg, ">, name = "); - print_string((char *)p, nlen, printer, arg); + ppp_print_string((char *)p, nlen, printer, arg); break; case CHAP_FAILURE: case CHAP_SUCCESS: printer(arg, " "); - print_string((char *)p, len, printer, arg); + ppp_print_string((char *)p, len, printer, arg); break; default: for (clen = len; clen > 0; --clen) { diff --git a/src/netif/ppp/chap_ms.c b/src/netif/ppp/chap_ms.c index be5331c1..cbbcf53c 100644 --- a/src/netif/ppp/chap_ms.c +++ b/src/netif/ppp/chap_ms.c @@ -350,7 +350,7 @@ static int chapms2_check_success(unsigned char *msg, int len, unsigned char *pri if ((len < MS_AUTH_RESPONSE_LENGTH + 2) || strncmp((char *)msg, "S=", 2) != 0) { /* Packet does not start with "S=" */ - error("MS-CHAPv2 Success packet is badly formed."); + ppp_error("MS-CHAPv2 Success packet is badly formed."); return 0; } msg += 2; @@ -358,7 +358,7 @@ static int chapms2_check_success(unsigned char *msg, int len, unsigned char *pri if (len < MS_AUTH_RESPONSE_LENGTH || memcmp(msg, private, MS_AUTH_RESPONSE_LENGTH)) { /* Authenticator Response did not match expected. */ - error("MS-CHAPv2 mutual authentication failed."); + ppp_error("MS-CHAPv2 mutual authentication failed."); return 0; } /* Authenticator Response matches. */ @@ -368,7 +368,7 @@ static int chapms2_check_success(unsigned char *msg, int len, unsigned char *pri msg += 3; /* Eat the delimiter */ } else if (len) { /* Packet has extra text which does not begin " M=" */ - error("MS-CHAPv2 Success packet is badly formed."); + ppp_error("MS-CHAPv2 Success packet is badly formed."); return 0; } return 1; @@ -427,14 +427,14 @@ static void chapms_handle_failure(unsigned char *inp, int len) { break; default: - error("Unknown MS-CHAP authentication failure: %.*v", + ppp_error("Unknown MS-CHAP authentication failure: %.*v", len, inp); return; } } print_msg: if (p != NULL) - error("MS-CHAP authentication failed: %v", p); + ppp_error("MS-CHAP authentication failed: %v", p); } static void ChallengeResponse(u_char *challenge, diff --git a/src/netif/ppp/eap.c b/src/netif/ppp/eap.c index f213d778..3b32a1e4 100644 --- a/src/netif/ppp/eap.c +++ b/src/netif/ppp/eap.c @@ -222,7 +222,7 @@ static void eap_client_timeout(void *arg) { if (!eap_client_active(pcb)) return; - 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; } @@ -486,7 +486,7 @@ 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)) { - dbglog("no DES here; cannot decode " + ppp_dbglog("no DES here; cannot decode " "pseudonym"); return; } @@ -517,11 +517,11 @@ int status; } pcb->eap.es_server.ea_peer[ pcb->eap.es_server.ea_peerlen] = '\0'; - dbglog("decoded pseudonym to \"%.*q\"", + ppp_dbglog("decoded pseudonym to \"%.*q\"", pcb->eap.es_server.ea_peerlen, pcb->eap.es_server.ea_peer); } else { - dbglog("failed to decode real name"); + ppp_dbglog("failed to decode real name"); /* Stay in eapIdentfy state; requery */ break; } @@ -689,9 +689,9 @@ eap_state *esp; if (pcb->eap.es_server.ea_maxrequests > 0 && pcb->eap.es_server.ea_requests >= pcb->eap.es_server.ea_maxrequests) { if (pcb->eap.es_server.ea_responses > 0) - error("EAP: too many Requests sent"); + ppp_error("EAP: too many Requests sent"); else - error("EAP: no response to Requests"); + ppp_error("EAP: no response to Requests"); eap_send_failure(esp); return; } @@ -800,7 +800,7 @@ eap_state *esp; 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)) { - dbglog("no DES here; not generating pseudonym"); + ppp_dbglog("no DES here; not generating pseudonym"); break; } BZERO(&b64, sizeof (b64)); @@ -1038,12 +1038,12 @@ static void eap_lowerdown(ppp_pcb *pcb) { static void eap_protrej(ppp_pcb *pcb) { if (eap_client_active(pcb)) { - 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(esp)) { - 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 */ @@ -1234,7 +1234,7 @@ name_of_pn_file() return (NULL); (void) slprintf(path, pl, "%s/%s", user, file); if (!pnlogged) { - dbglog("pseudonym file: %s", path); + ppp_dbglog("pseudonym file: %s", path); pnlogged = 1; } return (path); @@ -1305,22 +1305,22 @@ int len, id; /* Now check that the result is sane */ if (olen <= 0 || *inp + 1 > olen) { - 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) { - 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) { - dbglog("EAP: saved pseudonym"); + ppp_dbglog("EAP: saved pseudonym"); pcb->eap.es_usedpseudo = 0; } else { - dbglog("EAP: failed to save pseudonym"); + ppp_dbglog("EAP: failed to save pseudonym"); remove_pn_file(); } } @@ -1355,7 +1355,7 @@ static void eap_request(ppp_pcb *pcb, u_char *inp, int id, int len) { pcb->eap.es_client.ea_requests++; if (pcb->eap.es_client.ea_maxrequests != 0 && pcb->eap.es_client.ea_requests > pcb->eap.es_client.ea_maxrequests) { - info("EAP: received too many Request messages"); + ppp_info("EAP: received too many Request messages"); if (pcb->eap.es_client.ea_timeout > 0) { UNTIMEOUT(eap_client_timeout, pcb); } @@ -1364,7 +1364,7 @@ static void eap_request(ppp_pcb *pcb, u_char *inp, int id, int len) { } if (len <= 0) { - error("EAP: empty Request message discarded"); + ppp_error("EAP: empty Request message discarded"); return; } @@ -1374,7 +1374,7 @@ static void eap_request(ppp_pcb *pcb, u_char *inp, int id, int len) { switch (typenum) { case EAPT_IDENTITY: if (len > 0) - 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 || @@ -1408,7 +1408,7 @@ static void eap_request(ppp_pcb *pcb, u_char *inp, int id, int len) { case EAPT_NOTIFICATION: if (len > 0) - info("EAP: Notification \"%.*q\"", len, inp); + ppp_info("EAP: Notification \"%.*q\"", len, inp); eap_send_response(pcb, id, typenum, NULL, 0); break; @@ -1417,20 +1417,20 @@ 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. */ - 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) { - 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) { - error("EAP: MD5-Challenge with bad length %d (8..%d)", + ppp_error("EAP: MD5-Challenge with bad length %d (8..%d)", vallen, len); /* Try something better. */ eap_send_nak(pcb, id, EAPT_SRP); @@ -1439,7 +1439,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)) { - 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 { @@ -1460,7 +1460,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)) { - 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; } @@ -1478,7 +1478,7 @@ static void eap_request(ppp_pcb *pcb, u_char *inp, int id, int len) { #ifdef USE_SRP case EAPT_SRP: if (len < 1) { - error("EAP: received empty SRP Request"); + ppp_error("EAP: received empty SRP Request"); /* Bogus request; wait for something real. */ return; } @@ -1509,7 +1509,7 @@ static void eap_request(ppp_pcb *pcb, u_char *inp, int id, int len) { GETCHAR(vallen, inp); len--; if (vallen >= len) { - error("EAP: badly-formed SRP Challenge" + ppp_error("EAP: badly-formed SRP Challenge" " (name)"); /* Ignore badly-formed messages */ return; @@ -1537,7 +1537,7 @@ static void eap_request(ppp_pcb *pcb, u_char *inp, int id, int len) { GETCHAR(vallen, inp); len--; if (vallen >= len) { - error("EAP: badly-formed SRP Challenge" + ppp_error("EAP: badly-formed SRP Challenge" " (s)"); /* Ignore badly-formed messages */ return; @@ -1550,7 +1550,7 @@ static void eap_request(ppp_pcb *pcb, u_char *inp, int id, int len) { GETCHAR(vallen, inp); len--; if (vallen > len) { - error("EAP: badly-formed SRP Challenge" + ppp_error("EAP: badly-formed SRP Challenge" " (g)"); /* Ignore badly-formed messages */ return; @@ -1598,7 +1598,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) { - 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; } @@ -1608,7 +1608,7 @@ 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) { - 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); } @@ -1632,7 +1632,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 */ - error("EAP: SRP server is rogue"); + ppp_error("EAP: SRP server is rogue"); goto client_failure; } } @@ -1643,7 +1643,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) { - 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; } @@ -1654,7 +1654,7 @@ 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) { - 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); } @@ -1662,7 +1662,7 @@ static void eap_request(ppp_pcb *pcb, u_char *inp, int id, int len) { len -= sizeof (u32_t) + SHA_DIGESTSIZE; if (len < 0 || t_clientverify(tc, inp + sizeof (u32_t)) != 0) { - error("EAP: SRP server verification " + ppp_error("EAP: SRP server verification " "failed"); goto client_failure; } @@ -1683,7 +1683,7 @@ static void eap_request(ppp_pcb *pcb, u_char *inp, int id, int len) { case EAPSRP_LWRECHALLENGE: if (len < 4) { - warn("EAP: malformed Lightweight rechallenge"); + ppp_warn("EAP: malformed Lightweight rechallenge"); return; } SHA1Init(&ctxt); @@ -1700,7 +1700,7 @@ static void eap_request(ppp_pcb *pcb, u_char *inp, int id, int len) { break; default: - error("EAP: unknown SRP Subtype %d", vallen); + ppp_error("EAP: unknown SRP Subtype %d", vallen); eap_send_nak(pcb, id, EAPT_MD5CHAP); break; } @@ -1708,7 +1708,7 @@ static void eap_request(ppp_pcb *pcb, u_char *inp, int id, int len) { #endif /* USE_SRP */ default: - 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; } @@ -1753,7 +1753,7 @@ 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) { - dbglog("EAP: discarding Response %d; expected ID %d", id, + ppp_dbglog("EAP: discarding Response %d; expected ID %d", id, pcb->eap.es_server.ea_id); return; } @@ -1761,7 +1761,7 @@ static void eap_response(ppp_pcb *pcb, u_char *inp, int id, int len) { pcb->eap.es_server.ea_responses++; if (len <= 0) { - error("EAP: empty Response message discarded"); + ppp_error("EAP: empty Response message discarded"); return; } @@ -1771,11 +1771,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) { - dbglog("EAP discarding unwanted Identify \"%.q\"", len, + ppp_dbglog("EAP discarding unwanted Identify \"%.q\"", len, inp); break; } - info("EAP: unauthenticated peer name \"%.*q\"", len, inp); + ppp_info("EAP: unauthenticated peer name \"%.*q\"", len, inp); if (pcb->eap.es_server.ea_peer != NULL && pcb->eap.es_server.ea_peer != remote_name) free(pcb->eap.es_server.ea_peer); @@ -1792,12 +1792,12 @@ static void eap_response(ppp_pcb *pcb, u_char *inp, int id, int len) { break; case EAPT_NOTIFICATION: - dbglog("EAP unexpected Notification; response discarded"); + ppp_dbglog("EAP unexpected Notification; response discarded"); break; case EAPT_NAK: if (len < 1) { - info("EAP: Nak Response with no suggested protocol"); + ppp_info("EAP: Nak Response with no suggested protocol"); eap_figure_next_state(esp, 1); break; } @@ -1823,7 +1823,7 @@ static void eap_response(ppp_pcb *pcb, u_char *inp, int id, int len) { break; default: - 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: @@ -1844,26 +1844,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) { - error("EAP: unexpected MD5-Response"); + ppp_error("EAP: unexpected MD5-Response"); eap_figure_next_state(esp, 1); break; } if (len < 1) { - error("EAP: received MD5-Response with no data"); + ppp_error("EAP: received MD5-Response with no data"); eap_figure_next_state(esp, 1); break; } GETCHAR(vallen, inp); len--; if (vallen != 16 || vallen > len) { - error("EAP: MD5-Response with bad length %d", vallen); + ppp_error("EAP: MD5-Response with bad length %d", vallen); eap_figure_next_state(esp, 1); break; } /* Not so likely to happen. */ if (vallen >= len + sizeof (rhostname)) { - 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 { @@ -1882,7 +1882,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)) { - dbglog("EAP: no MD5 secret for auth of %q", rhostname); + ppp_dbglog("EAP: no MD5 secret for auth of %q", rhostname); eap_send_failure(esp); break; } @@ -1906,7 +1906,7 @@ static void eap_response(ppp_pcb *pcb, u_char *inp, int id, int len) { #ifdef USE_SRP case EAPT_SRP: if (len < 1) { - error("EAP: empty SRP Response"); + ppp_error("EAP: empty SRP Response"); eap_figure_next_state(esp, 1); break; } @@ -1915,7 +1915,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) { - error("EAP: unexpected SRP Subtype 1 Response"); + ppp_error("EAP: unexpected SRP Subtype 1 Response"); eap_figure_next_state(esp, 1); break; } @@ -1926,7 +1926,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 */ - error("EAP: bogus A value from client"); + ppp_error("EAP: bogus A value from client"); eap_send_failure(esp); } else { eap_figure_next_state(esp, 0); @@ -1935,12 +1935,12 @@ 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) { - error("EAP: unexpected SRP Subtype 2 Response"); + ppp_error("EAP: unexpected SRP Subtype 2 Response"); eap_figure_next_state(esp, 1); break; } if (len < sizeof (u32_t) + SHA_DIGESTSIZE) { - error("EAP: M1 length %d < %d", len, + ppp_error("EAP: M1 length %d < %d", len, sizeof (u32_t) + SHA_DIGESTSIZE); eap_figure_next_state(esp, 1); break; @@ -1949,7 +1949,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)) { - info("EAP: unable to validate client identity"); + ppp_info("EAP: unable to validate client identity"); eap_send_failure(esp); break; } @@ -1958,7 +1958,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) { - error("EAP: unexpected SRP Subtype 3 Response"); + ppp_error("EAP: unexpected SRP Subtype 3 Response"); eap_send_failure(esp); break; } @@ -1975,11 +1975,11 @@ 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) { - info("EAP: unexpected SRP Subtype 4 Response"); + ppp_info("EAP: unexpected SRP Subtype 4 Response"); return; } if (len != SHA_DIGESTSIZE) { - error("EAP: bad Lightweight rechallenge " + ppp_error("EAP: bad Lightweight rechallenge " "response"); return; } @@ -1993,7 +1993,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) { - error("EAP: failed Lightweight rechallenge"); + ppp_error("EAP: failed Lightweight rechallenge"); eap_send_failure(esp); break; } @@ -2008,7 +2008,7 @@ static void eap_response(ppp_pcb *pcb, u_char *inp, int id, int len) { default: /* This can't happen. */ - error("EAP: unknown Response type %d; ignored", typenum); + ppp_error("EAP: unknown Response type %d; ignored", typenum); return; } @@ -2029,7 +2029,7 @@ static void eap_response(ppp_pcb *pcb, u_char *inp, int id, int len) { */ static void eap_success(ppp_pcb *pcb, u_char *inp, int id, int len) { if (pcb->eap.es_client.ea_state != eapOpen && !eap_client_active(pcb)) { - 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); return; @@ -2053,7 +2053,7 @@ static void eap_success(ppp_pcb *pcb, u_char *inp, int id, int len) { */ static void eap_failure(ppp_pcb *pcb, u_char *inp, int id, int len) { if (!eap_client_active(pcb)) { - 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); } @@ -2069,7 +2069,7 @@ static void eap_failure(ppp_pcb *pcb, u_char *inp, int id, int len) { pcb->eap.es_client.ea_state = eapBadAuth; - error("EAP: peer reports authentication failure"); + ppp_error("EAP: peer reports authentication failure"); auth_withpeer_fail(pcb, PPP_EAP); } @@ -2085,14 +2085,14 @@ static void eap_input(ppp_pcb *pcb, u_char *inp, int inlen) { * drop it. */ if (inlen < EAP_HEADERLEN) { - 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) { - error("EAP: packet has illegal length field %d (%d..%d)", len, + ppp_error("EAP: packet has illegal length field %d (%d..%d)", len, EAP_HEADERLEN, inlen); return; } @@ -2120,7 +2120,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. */ - warn("EAP: unknown code %d received", code); + ppp_warn("EAP: unknown code %d received", code); break; } } @@ -2179,7 +2179,7 @@ static int eap_printpkt(u_char *inp, int inlen, void (*printer) (void *, char *, case EAPT_NOTIFICATION: if (len > 0) { printer(arg, " "); INCPTR(len, inp); len = 0; @@ -2200,7 +2200,7 @@ static int eap_printpkt(u_char *inp, int inlen, void (*printer) (void *, char *, len -= vallen; if (len > 0) { printer(arg, " "); INCPTR(len, inp); len = 0; @@ -2223,7 +2223,7 @@ static int eap_printpkt(u_char *inp, int inlen, void (*printer) (void *, char *, goto truncated; if (vallen > 0) { printer(arg, " "); } else { @@ -2313,7 +2313,7 @@ static int eap_printpkt(u_char *inp, int inlen, void (*printer) (void *, char *, case EAPT_IDENTITY: if (len > 0) { printer(arg, " "); INCPTR(len, inp); len = 0; @@ -2348,7 +2348,7 @@ static int eap_printpkt(u_char *inp, int inlen, void (*printer) (void *, char *, len -= vallen; if (len > 0) { printer(arg, " "); INCPTR(len, inp); len = 0; diff --git a/src/netif/ppp/fsm.c b/src/netif/ppp/fsm.c index 4c3cf53a..89638d61 100644 --- a/src/netif/ppp/fsm.c +++ b/src/netif/ppp/fsm.c @@ -285,7 +285,7 @@ static void fsm_timeout(void *arg) { case PPP_FSM_ACKRCVD: case PPP_FSM_ACKSENT: if (f->retransmits <= 0) { - warn("%s: timeout sending Config-Requests\n", PROTO_NAME(f)); + ppp_warn("%s: timeout sending Config-Requests\n", PROTO_NAME(f)); f->state = PPP_FSM_STOPPED; if( (f->flags & OPT_PASSIVE) == 0 && f->callbacks->finished ) (*f->callbacks->finished)(f); @@ -455,7 +455,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 */ - error("Received bad configure-ack: %P", inp, len); + ppp_error("Received bad configure-ack: %P", inp, len); return; } f->seen_ack = 1; @@ -513,14 +513,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))) { - 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))) { - error("Received bad configure-rej: %P", inp, len); + ppp_error("Received bad configure-rej: %P", inp, len); return; } } @@ -573,9 +573,9 @@ static void fsm_rtermreq(fsm *f, int id, u_char *p, int len) { case PPP_FSM_OPENED: if (len > 0) { - 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 - 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) @@ -632,7 +632,7 @@ static void fsm_rcoderej(fsm *f, u_char *inp, int len) { } GETCHAR(code, inp); GETCHAR(id, inp); - 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 b7300f3c..ede4af8f 100644 --- a/src/netif/ppp/ipcp.c +++ b/src/netif/ppp/ipcp.c @@ -1750,9 +1750,9 @@ ip_demand_conf(u) if (sifproxyarp(pcb, wo->hisaddr)) proxy_arp_set[u] = 1; - notice("local IP address %I", wo->ouraddr); + ppp_notice("local IP address %I", wo->ouraddr); if (wo->hisaddr) - notice("remote IP address %I", wo->hisaddr); + ppp_notice("remote IP address %I", wo->hisaddr); return 1; } @@ -1780,18 +1780,18 @@ static void ipcp_up(fsm *f) { if (!(go->neg_addr || go->old_addrs) && (wo->neg_addr || wo->old_addrs) && wo->ouraddr != 0) { - 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) { - 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 = htonl(0x0a404040); - warn("Could not determine remote IP address: defaulting to %I", + ppp_warn("Could not determine remote IP address: defaulting to %I", ho->hisaddr); } #if 0 /* UNUSED */ @@ -1824,7 +1824,7 @@ static void ipcp_up(fsm *f) { * Check that the peer is allowed to use the IP address it wants. */ if (ho->hisaddr != 0 && !auth_ip_addr(f->unit, ho->hisaddr)) { - 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; } @@ -1844,13 +1844,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) { - 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) { - 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 @@ -1860,7 +1860,7 @@ static void ipcp_up(fsm *f) { mask = get_mask(go->ouraddr); if (!sifaddr(pcb, go->ouraddr, ho->hisaddr, mask)) { #if PPP_DEBUG - warn("Interface configuration failed"); + ppp_warn("Interface configuration failed"); #endif /* PPP_DEBUG */ ipcp_close(f->unit, "Interface configuration failed"); return; @@ -1892,7 +1892,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 - warn("Interface configuration failed"); + ppp_warn("Interface configuration failed"); #endif /* PPP_DEBUG */ ipcp_close(f->pcb, "Interface configuration failed"); return; @@ -1902,7 +1902,7 @@ static void ipcp_up(fsm *f) { /* bring the interface up for IP */ if (!sifup(pcb)) { #if PPP_DEBUG - warn("Interface failed to come up"); + ppp_warn("Interface failed to come up"); #endif /* PPP_DEBUG */ ipcp_close(f->pcb, "Interface configuration failed"); return; @@ -1911,7 +1911,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 - warn("Interface configuration failed"); + ppp_warn("Interface configuration failed"); #endif /* PPP_DEBUG */ ipcp_close(f->unit, "Interface configuration failed"); return; @@ -1934,13 +1934,13 @@ static void ipcp_up(fsm *f) { wo->ouraddr = go->ouraddr; - notice("local IP address %I", go->ouraddr); + ppp_notice("local IP address %I", go->ouraddr); if (ho->hisaddr != 0) - notice("remote IP address %I", ho->hisaddr); + ppp_notice("remote IP address %I", ho->hisaddr); if (go->dnsaddr[0]) - notice("primary DNS address %I", go->dnsaddr[0]); + ppp_notice("primary DNS address %I", go->dnsaddr[0]); if (go->dnsaddr[1]) - notice("secondary DNS address %I", go->dnsaddr[1]); + ppp_notice("secondary DNS address %I", go->dnsaddr[1]); } #if PPP_STATS_SUPPORT @@ -2176,7 +2176,7 @@ static int ipcp_printpkt(u_char *p, int plen, case TERMREQ: if (len > 0 && *p >= ' ' && *p < 0x7f) { printer(arg, " "); - print_string((char *)p, len, printer, arg); + ppp_print_string((char *)p, len, printer, arg); p += len; len = 0; } diff --git a/src/netif/ppp/ipv6cp.c b/src/netif/ppp/ipv6cp.c index 14b83f90..5318e2ba 100644 --- a/src/netif/ppp/ipv6cp.c +++ b/src/netif/ppp/ipv6cp.c @@ -1120,9 +1120,9 @@ static int ipv6_demand_conf(int u) { if (!sifnpmode(u, PPP_IPV6, NPMODE_QUEUE)) return 0; - notice("ipv6_demand_conf"); - notice("local LL address %s", llv6_ntoa(wo->ourid)); - 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; } @@ -1152,17 +1152,17 @@ static void ipv6cp_up(fsm *f) { if(!no_ifaceid_neg) { #endif /* UNUSED */ if (eui64_iszero(ho->hisid)) { - 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)) { - 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)) { - 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; } @@ -1228,8 +1228,8 @@ static void ipv6cp_up(fsm *f) { } sifnpmode(f->pcb, PPP_IPV6, NPMODE_PASS); - notice("local LL address %s", llv6_ntoa(go->ourid)); - 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); @@ -1447,7 +1447,7 @@ static int ipv6cp_printpkt(u_char *p, int plen, case TERMREQ: if (len > 0 && *p >= ' ' && *p < 0x7f) { printer(arg, " "); - print_string((char *)p, len, printer, arg); + ppp_print_string((char *)p, len, printer, arg); p += len; len = 0; } diff --git a/src/netif/ppp/lcp.c b/src/netif/ppp/lcp.c index 01a889d0..f1445519 100644 --- a/src/netif/ppp/lcp.c +++ b/src/netif/ppp/lcp.c @@ -625,22 +625,22 @@ static void lcp_rprotrej(fsm *f, u_char *inp, int len) { if (protp->protocol == prot && protp->enabled_flag) { #if PPP_PROTOCOLNAME if (pname != NULL) - dbglog("Protocol-Reject for '%s' (0x%x) received", pname, + ppp_dbglog("Protocol-Reject for '%s' (0x%x) received", pname, prot); else #endif /* PPP_PROTOCOLNAME */ - 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) - warn("Protocol-Reject for unsupported protocol '%s' (0x%x)", pname, + ppp_warn("Protocol-Reject for unsupported protocol '%s' (0x%x)", pname, prot); else #endif /* #if PPP_PROTOCOLNAME */ - warn("Protocol-Reject for unsupported protocol 0x%x", prot); + ppp_warn("Protocol-Reject for unsupported protocol 0x%x", prot); } @@ -652,7 +652,7 @@ static void lcp_protrej(ppp_pcb *pcb) { /* * Can't reject LCP! */ - error("Received Protocol-Reject for LCP!"); + ppp_error("Received Protocol-Reject for LCP!"); fsm_protreject(&pcb->lcp_fsm); } @@ -871,7 +871,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 */ - error("Bug in lcp_addci: wrong length"); + ppp_error("Bug in lcp_addci: wrong length"); } } @@ -1303,7 +1303,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) - dbglog("Unexpected Conf-Nak for EAP"); + ppp_dbglog("Unexpected Conf-Nak for EAP"); /* * We don't recognize what they're suggesting. @@ -1496,7 +1496,7 @@ static int lcp_nakci(fsm *f, u_char *p, int len, int treat_as_reject) { if (looped_back) { if (++try.numloops >= pcb->settings.lcp_loopbackfail) { int errcode = PPPERR_LOOPBACK; - notice("Serial line is looped back."); + ppp_notice("Serial line is looped back."); ppp_ioctl(pcb, PPPCTLS_ERRCODE, &errcode); lcp_close(f->pcb, "Loopback detected"); } @@ -1866,7 +1866,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. */ - dbglog("No auth is possible"); + ppp_dbglog("No auth is possible"); orc = CONFREJ; break; } @@ -2502,7 +2502,7 @@ static int lcp_printpkt(u_char *p, int plen, case TERMREQ: if (len > 0 && *p >= ' ' && *p < 0x7f) { printer(arg, " "); - print_string((char *)p, len, printer, arg); + ppp_print_string((char *)p, len, printer, arg); p += len; len = 0; } @@ -2534,7 +2534,7 @@ static int lcp_printpkt(u_char *p, int plen, } if (len > 0) { printer(arg, " "); - print_string((char *)p, len, printer, arg); + ppp_print_string((char *)p, len, printer, arg); p += len; len = 0; } @@ -2563,8 +2563,8 @@ static void LcpLinkFailure(fsm *f) { ppp_pcb *pcb = f->pcb; if (f->state == PPP_FSM_OPENED) { int errcode = PPPERR_PEERDEAD; - info("No response to %d echo-requests", pcb->lcp_echos_pending); - 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."); ppp_ioctl(pcb, PPPCTLS_ERRCODE, &errcode); lcp_close(pcb, "Peer not responding"); } @@ -2585,7 +2585,7 @@ static void LcpEchoCheck(fsm *f) { * Start the timer for the next interval. */ if (pcb->lcp_echo_timer_running) - 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; } @@ -2614,13 +2614,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) { - dbglog("lcp: received short Echo-Reply, length %d", len); + ppp_dbglog("lcp: received short Echo-Reply, length %d", len); return; } GETLONG(magic, inp); if (go->neg_magicnumber && magic == go->magicnumber) { - 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 c7725658..9a6bbd10 100644 --- a/src/netif/ppp/ppp.c +++ b/src/netif/ppp/ppp.c @@ -692,7 +692,7 @@ void ppp_input(ppp_pcb *pcb, struct pbuf *pb) { protocol = (((u8_t *)pb->payload)[0] << 8) | ((u8_t*)pb->payload)[1]; #if PRINTPKT_SUPPORT - dump_packet("rcvd", pb->payload, pb->len); + ppp_dump_packet("rcvd", pb->payload, pb->len); #endif /* PRINTPKT_SUPPORT */ if(pbuf_header(pb, -(s16_t)sizeof(protocol))) { @@ -708,7 +708,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) { - dbglog("Discarded non-LCP packet when LCP not open"); + ppp_dbglog("Discarded non-LCP packet when LCP not open"); goto drop; } @@ -731,7 +731,7 @@ void ppp_input(ppp_pcb *pcb, struct pbuf *pb) { || protocol == PPP_EAP #endif /* EAP_SUPPORT */ )) { - dbglog("discarding proto 0x%x in phase %d", + ppp_dbglog("discarding proto 0x%x in phase %d", protocol, pcb->phase); goto drop; } @@ -816,10 +816,10 @@ void ppp_input(ppp_pcb *pcb, struct pbuf *pb) { #if PPP_PROTOCOLNAME const char *pname = protocol_name(protocol); if (pname != NULL) - warn("Unsupported protocol '%s' (0x%x) received", pname, protocol); + ppp_warn("Unsupported protocol '%s' (0x%x) received", pname, protocol); else #endif /* PPP_PROTOCOLNAME */ - warn("Unsupported protocol 0x%x received", protocol); + ppp_warn("Unsupported protocol 0x%x received", protocol); #endif /* PPP_DEBUG */ if (pbuf_header(pb, (s16_t)sizeof(protocol))) { LWIP_ASSERT("pbuf_header failed\n", 0); @@ -1454,7 +1454,7 @@ int ppp_write(ppp_pcb *pcb, struct pbuf *p) { #endif /* PPPOS_SUPPORT */ #if PRINTPKT_SUPPORT - dump_packet("sent", (unsigned char *)p->payload+2, p->len-2); + ppp_dump_packet("sent", (unsigned char *)p->payload+2, p->len-2); #endif /* PRINTPKT_SUPPORT */ #if PPPOE_SUPPORT diff --git a/src/netif/ppp/upap.c b/src/netif/ppp/upap.c index 8f3a44c9..0de5a57d 100644 --- a/src/netif/ppp/upap.c +++ b/src/netif/ppp/upap.c @@ -210,7 +210,7 @@ static void upap_timeout(void *arg) { if (pcb->upap.us_transmits >= pcb->upap.us_maxtransmits) { /* give up in disgust */ - 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; @@ -290,12 +290,12 @@ static void upap_lowerdown(ppp_pcb *pcb) { static void upap_protrej(ppp_pcb *pcb) { if (pcb->upap.us_clientstate == UPAPCS_AUTHREQ) { - 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) { - 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 */ @@ -515,7 +515,7 @@ static void upap_rauthnak(ppp_pcb *pcb, u_char *inp, int id, int len) { pcb->upap.us_clientstate = UPAPCS_BADAUTH; - error("PAP authentication failed"); + ppp_error("PAP authentication failed"); auth_withpeer_fail(pcb, PPP_PAP); } @@ -624,13 +624,13 @@ static int upap_printpkt(u_char *p, int plen, void (*printer) (void *, char *, . p += ulen + wlen + 2; len -= ulen + wlen + 2; printer(arg, " user="); - print_string(user, ulen, printer, arg); + ppp_print_string(user, ulen, printer, arg); printer(arg, " password="); /* FIXME: require ppp_pcb struct as printpkt() argument */ #if 0 if (!pcb->settings.hide_password) #endif - print_string(pwd, wlen, printer, arg); + ppp_print_string(pwd, wlen, printer, arg); #if 0 else printer(arg, ""); @@ -647,7 +647,7 @@ static int upap_printpkt(u_char *p, int plen, void (*printer) (void *, char *, . p += mlen + 1; len -= mlen + 1; printer(arg, " "); - print_string(msg, mlen, printer, arg); + ppp_print_string(msg, mlen, printer, arg); break; } diff --git a/src/netif/ppp/utils.c b/src/netif/ppp/utils.c index 833a5a76..f918ba07 100644 --- a/src/netif/ppp/utils.c +++ b/src/netif/ppp/utils.c @@ -69,11 +69,11 @@ extern char *strerror(); #endif -static void logit(int level, char *fmt, va_list args); -static void log_write(int level, char *buf); +static void ppp_logit(int level, char *fmt, va_list args); +static void ppp_log_write(int level, char *buf); #if PRINTPKT_SUPPORT -static void vslp_printer(void *arg, char *fmt, ...); -static void format_packet(u_char *p, int len, +static void ppp_vslp_printer(void *arg, char *fmt, ...); +static void ppp_format_packet(u_char *p, int len, void (*printer) (void *, char *, ...), void *arg); struct buffer_info { @@ -83,10 +83,10 @@ struct buffer_info { #endif /* PRINTPKT_SUPPORT */ /* - * strlcpy - like strcpy/strncpy, doesn't overflow destination buffer, + * ppp_strlcpy - like strcpy/strncpy, doesn't overflow destination buffer, * always leaves destination null-terminated (for len > 0). */ -size_t strlcpy(char *dest, const char *src, size_t len) { +size_t ppp_strlcpy(char *dest, const char *src, size_t len) { size_t ret = strlen(src); if (len != 0) { @@ -101,40 +101,40 @@ size_t strlcpy(char *dest, const char *src, size_t len) { } /* - * strlcat - like strcat/strncat, doesn't overflow destination buffer, + * ppp_strlcat - like strcat/strncat, doesn't overflow destination buffer, * always leaves destination null-terminated (for len > 0). */ -size_t strlcat(char *dest, const char *src, size_t len) { +size_t ppp_strlcat(char *dest, const char *src, size_t len) { size_t dlen = strlen(dest); - return dlen + strlcpy(dest + dlen, src, (len > dlen? len - dlen: 0)); + return dlen + ppp_strlcpy(dest + dlen, src, (len > dlen? len - dlen: 0)); } /* - * slprintf - format a message into a buffer. Like sprintf except we + * ppp_slprintf - format a message into a buffer. Like sprintf except we * also specify the length of the output buffer, and we handle * %m (error message), %v (visible string), * %q (quoted string), %t (current time) and %I (IP address) formats. * Doesn't do floating-point formats. * Returns the number of chars put into buf. */ -int slprintf(char *buf, int buflen, char *fmt, ...) { +int ppp_slprintf(char *buf, int buflen, char *fmt, ...) { va_list args; int n; va_start(args, fmt); - n = vslprintf(buf, buflen, fmt, args); + n = ppp_vslprintf(buf, buflen, fmt, args); va_end(args); return n; } /* - * vslprintf - like slprintf, takes a va_list instead of a list of args. + * ppp_vslprintf - like ppp_slprintf, takes a va_list instead of a list of args. */ #define OUTCHAR(c) (buflen > 0? (--buflen, *buf++ = (c)): 0) -int vslprintf(char *buf, int buflen, char *fmt, va_list args) { +int ppp_vslprintf(char *buf, int buflen, char *fmt, va_list args) { int c, i, n; int width, prec, fillch; int base, len, neg, quoted; @@ -267,7 +267,7 @@ int vslprintf(char *buf, int buflen, char *fmt, va_list args) { case 'I': ip = va_arg(args, u32_t); ip = ntohl(ip); - slprintf(num, sizeof(num), "%d.%d.%d.%d", (ip >> 24) & 0xff, + ppp_slprintf(num, sizeof(num), "%d.%d.%d.%d", (ip >> 24) & 0xff, (ip >> 16) & 0xff, (ip >> 8) & 0xff, ip & 0xff); str = num; break; @@ -275,10 +275,10 @@ int vslprintf(char *buf, int buflen, char *fmt, va_list args) { case 'r': f = va_arg(args, char *); #ifndef __powerpc__ - n = vslprintf(buf, buflen + 1, f, va_arg(args, va_list)); + n = ppp_vslprintf(buf, buflen + 1, f, va_arg(args, va_list)); #else /* On the powerpc, a va_list is an array of 1 structure */ - n = vslprintf(buf, buflen + 1, f, va_arg(args, void *)); + n = ppp_vslprintf(buf, buflen + 1, f, va_arg(args, void *)); #endif buf += n; buflen -= n; @@ -344,7 +344,7 @@ int vslprintf(char *buf, int buflen, char *fmt, va_list args) { bufinfo.len = buflen + 1; p = va_arg(args, unsigned char *); n = va_arg(args, int); - format_packet(p, n, vslp_printer, &bufinfo); + ppp_format_packet(p, n, ppp_vslp_printer, &bufinfo); buf = bufinfo.ptr; buflen = bufinfo.len - 1; continue; @@ -413,14 +413,14 @@ int vslprintf(char *buf, int buflen, char *fmt, va_list args) { /* * vslp_printer - used in processing a %P format */ -static void vslp_printer(void *arg, char *fmt, ...) { +static void ppp_vslp_printer(void *arg, char *fmt, ...) { int n; va_list pvar; struct buffer_info *bi; va_start(pvar, fmt); bi = (struct buffer_info *) arg; - n = vslprintf(bi->ptr, bi->len, fmt, pvar); + n = ppp_vslprintf(bi->ptr, bi->len, fmt, pvar); va_end(pvar); bi->ptr += n; @@ -441,17 +441,17 @@ log_packet(p, len, prefix, level) int level; { init_pr_log(prefix, level); - format_packet(p, len, pr_log, &level); + ppp_format_packet(p, len, pr_log, &level); end_pr_log(); } #endif /* UNUSED */ #if PRINTPKT_SUPPORT /* - * format_packet - make a readable representation of a packet, + * ppp_format_packet - make a readable representation of a packet, * calling `printer(arg, format, ...)' to output it. */ -static void format_packet(u_char *p, int len, +static void ppp_format_packet(u_char *p, int len, void (*printer) (void *, char *, ...), void *arg) { int i, n; u_short proto; @@ -508,7 +508,7 @@ init_pr_log(prefix, level) { linep = line; if (prefix != NULL) { - strlcpy(line, prefix, sizeof(line)); + ppp_strlcpy(line, prefix, sizeof(line)); linep = line + strlen(line); } llevel = level; @@ -519,7 +519,7 @@ end_pr_log() { if (linep != line) { *linep = 0; - log_write(llevel, line); + ppp_log_write(llevel, line); } } @@ -535,7 +535,7 @@ pr_log (void *arg, char *fmt, ...) char buf[256]; va_start(pvar, fmt); - n = vslprintf(buf, sizeof(buf), fmt, pvar); + n = ppp_vslprintf(buf, sizeof(buf), fmt, pvar); va_end(pvar); p = buf; @@ -553,13 +553,13 @@ pr_log (void *arg, char *fmt, ...) eol = strchr(p, '\n'); } *linep = 0; - log_write(llevel, line); + ppp_log_write(llevel, line); linep = line; } while (eol != NULL) { *eol = 0; - log_write(llevel, p); + ppp_log_write(llevel, p); p = eol + 1; eol = strchr(p, '\n'); } @@ -574,10 +574,10 @@ pr_log (void *arg, char *fmt, ...) #endif /* UNUSED */ /* - * print_string - print a readable representation of a string using + * ppp_print_string - print a readable representation of a string using * printer. */ -void print_string(char *p, int len, void (*printer) (void *, char *, ...), void *arg) { +void ppp_print_string(char *p, int len, void (*printer) (void *, char *, ...), void *arg) { int c; printer(arg, "\""); @@ -608,16 +608,16 @@ void print_string(char *p, int len, void (*printer) (void *, char *, ...), void } /* - * logit - does the hard work for fatal et al. + * ppp_logit - does the hard work for fatal et al. */ -static void logit(int level, char *fmt, va_list args) { +static void ppp_logit(int level, char *fmt, va_list args) { char buf[1024]; - vslprintf(buf, sizeof(buf), fmt, args); - log_write(level, buf); + ppp_vslprintf(buf, sizeof(buf), fmt, args); + ppp_log_write(level, buf); } -static void log_write(int level, char *buf) { +static void ppp_log_write(int level, char *buf) { PPPDEBUG(level, ("%s\n", buf) ); #if 0 if (log_to_fd >= 0 && (level != LOG_DEBUG || debug)) { @@ -633,13 +633,13 @@ static void log_write(int level, char *buf) { } /* - * fatal - log an error message and die horribly. + * ppp_fatal - log an error message and die horribly. */ -void fatal(char *fmt, ...) { +void ppp_fatal(char *fmt, ...) { va_list pvar; va_start(pvar, fmt); - logit(LOG_ERR, fmt, pvar); + ppp_logit(LOG_ERR, fmt, pvar); va_end(pvar); /* FIXME: find a way to die */ @@ -649,13 +649,13 @@ void fatal(char *fmt, ...) { } /* - * error - log an error message. + * ppp_error - log an error message. */ -void error(char *fmt, ...) { +void ppp_error(char *fmt, ...) { va_list pvar; va_start(pvar, fmt); - logit(LOG_ERR, fmt, pvar); + ppp_logit(LOG_ERR, fmt, pvar); va_end(pvar); #if 0 /* UNUSED */ ++error_count; @@ -663,55 +663,55 @@ void error(char *fmt, ...) { } /* - * warn - log a warning message. + * ppp_warn - log a warning message. */ -void warn(char *fmt, ...) { +void ppp_warn(char *fmt, ...) { va_list pvar; va_start(pvar, fmt); - logit(LOG_WARNING, fmt, pvar); + ppp_logit(LOG_WARNING, fmt, pvar); va_end(pvar); } /* - * notice - log a notice-level message. + * ppp_notice - log a notice-level message. */ -void notice(char *fmt, ...) { +void ppp_notice(char *fmt, ...) { va_list pvar; va_start(pvar, fmt); - logit(LOG_NOTICE, fmt, pvar); + ppp_logit(LOG_NOTICE, fmt, pvar); va_end(pvar); } /* - * info - log an informational message. + * ppp_info - log an informational message. */ -void info(char *fmt, ...) { +void ppp_info(char *fmt, ...) { va_list pvar; va_start(pvar, fmt); - logit(LOG_INFO, fmt, pvar); + ppp_logit(LOG_INFO, fmt, pvar); va_end(pvar); } /* - * dbglog - log a debug message. + * ppp_dbglog - log a debug message. */ -void dbglog(char *fmt, ...) { +void ppp_dbglog(char *fmt, ...) { va_list pvar; va_start(pvar, fmt); - logit(LOG_DEBUG, fmt, pvar); + ppp_logit(LOG_DEBUG, fmt, pvar); va_end(pvar); } #if PRINTPKT_SUPPORT /* - * dump_packet - print out a packet in readable form if it is interesting. + * ppp_dump_packet - print out a packet in readable form if it is interesting. * Assumes len >= PPP_HDRLEN. */ -void dump_packet(const char *tag, unsigned char *p, int len) { +void ppp_dump_packet(const char *tag, unsigned char *p, int len) { int proto; /* @@ -737,7 +737,7 @@ void dump_packet(const char *tag, unsigned char *p, int len) { return; } - dbglog("%s %P", tag, p, len); + ppp_dbglog("%s %P", tag, p, len); } #endif /* PRINTPKT_SUPPORT */ @@ -796,14 +796,14 @@ lock(dev) result = mklock (dev, (void *) 0); if (result == 0) { - strlcpy(lock_file, dev, sizeof(lock_file)); + ppp_strlcpy(lock_file, dev, sizeof(lock_file)); return 0; } if (result > 0) - notice("Device %s is locked by pid %d", dev, result); + ppp_notice("Device %s is locked by pid %d", dev, result); else - error("Can't create lock file %s", lock_file); + ppp_error("Can't create lock file %s", lock_file); return -1; #else /* LOCKLIB */ @@ -815,14 +815,14 @@ lock(dev) struct stat sbuf; if (stat(dev, &sbuf) < 0) { - 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) { - error("Can't lock %s: not a character device", dev); + ppp_error("Can't lock %s: not a character device", dev); return -1; } - slprintf(lock_file, sizeof(lock_file), "%s/LK.%03d.%03d.%03d", + ppp_slprintf(lock_file, sizeof(lock_file), "%s/LK.%03d.%03d.%03d", LOCK_DIR, major(sbuf.st_dev), major(sbuf.st_rdev), minor(sbuf.st_rdev)); #else @@ -841,12 +841,12 @@ lock(dev) if ((p = strrchr(dev, '/')) != NULL) dev = p + 1; - slprintf(lock_file, sizeof(lock_file), "%s/LCK..%s", LOCK_DIR, dev); + ppp_slprintf(lock_file, sizeof(lock_file), "%s/LCK..%s", LOCK_DIR, dev); #endif while ((fd = open(lock_file, O_EXCL | O_CREAT | O_RDWR, 0644)) < 0) { if (errno != EEXIST) { - error("Can't create lock file %s: %m", lock_file); + ppp_error("Can't create lock file %s: %m", lock_file); break; } @@ -855,7 +855,7 @@ lock(dev) if (fd < 0) { if (errno == ENOENT) /* This is just a timing problem. */ continue; - 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 @@ -866,7 +866,7 @@ lock(dev) close(fd); fd = -1; if (n <= 0) { - error("Can't read pid from lock file %s", lock_file); + ppp_error("Can't read pid from lock file %s", lock_file); break; } @@ -880,12 +880,12 @@ lock(dev) if (pid == 0 || (kill(pid, 0) == -1 && errno == ESRCH)) { if (unlink (lock_file) == 0) { - notice("Removed stale lock on %s (pid %d)", dev, pid); + ppp_notice("Removed stale lock on %s (pid %d)", dev, pid); continue; } - warn("Couldn't remove stale lock on %s", dev); + ppp_warn("Couldn't remove stale lock on %s", dev); } else - notice("Device %s is locked by pid %d", dev, pid); + ppp_notice("Device %s is locked by pid %d", dev, pid); break; } @@ -896,7 +896,7 @@ lock(dev) pid = getpid(); #ifndef LOCK_BINARY - slprintf(lock_buffer, sizeof(lock_buffer), "%10d\n", pid); + ppp_slprintf(lock_buffer, sizeof(lock_buffer), "%10d\n", pid); write (fd, lock_buffer, 11); #else write(fd, &pid, sizeof (pid)); @@ -932,13 +932,13 @@ relock(pid) return -1; fd = open(lock_file, O_WRONLY, 0); if (fd < 0) { - 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; } #ifndef LOCK_BINARY - slprintf(lock_buffer, sizeof(lock_buffer), "%10d\n", pid); + ppp_slprintf(lock_buffer, sizeof(lock_buffer), "%10d\n", pid); write (fd, lock_buffer, 11); #else write(fd, &pid, sizeof(pid));