diff options
author | phk <phk@FreeBSD.org> | 2000-11-26 19:34:06 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2000-11-26 19:34:06 +0000 |
commit | 7c4763bbdd4cb046f92027fbbfb033f3e9987580 (patch) | |
tree | 19ddfab61312f39f9931025607e68b3c7c27ac2c /sys | |
parent | 2ad308fd87c069be6ea9eb90bfc1b811438fdb46 (diff) | |
download | FreeBSD-src-7c4763bbdd4cb046f92027fbbfb033f3e9987580.zip FreeBSD-src-7c4763bbdd4cb046f92027fbbfb033f3e9987580.tar.gz |
Make log(-1, ...) do what addlog(...) did.
Replace all uses of addlog(...) with log(-1, ...)
Remove bogus "register" keywords in subr_prf.c
Make log() return void.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/i4b/driver/i4b_ispppsubr.c | 194 | ||||
-rw-r--r-- | sys/kern/subr_prf.c | 53 | ||||
-rw-r--r-- | sys/net/if_spppsubr.c | 178 | ||||
-rw-r--r-- | sys/sys/systm.h | 3 |
4 files changed, 202 insertions, 226 deletions
diff --git a/sys/i4b/driver/i4b_ispppsubr.c b/sys/i4b/driver/i4b_ispppsubr.c index cbe45b6..fa68171 100644 --- a/sys/i4b/driver/i4b_ispppsubr.c +++ b/sys/i4b/driver/i4b_ispppsubr.c @@ -1212,7 +1212,7 @@ sppp_cisco_input(struct sppp *sp, struct mbuf *m) switch (ntohl (h->type)) { default: if (debug) - addlog(SPP_FMT "cisco unknown packet type: 0x%lx\n", + log(-1, SPP_FMT "cisco unknown packet type: 0x%lx\n", SPP_ARGS(ifp), (u_long)ntohl (h->type)); break; case CISCO_ADDR_REPLY: @@ -1355,7 +1355,7 @@ sppp_cp_send(struct sppp *sp, u_short proto, u_char type, sppp_cp_type_name (lh->type), lh->ident, ntohs (lh->len)); sppp_print_bytes ((u_char*) (lh+1), len); - addlog(">\n"); + log(-1, ">\n"); } if (! IF_HANDOFF_ADJ(&sp->pp_cpq, m, ifp, 3)) ++ifp->if_oerrors; @@ -1388,7 +1388,7 @@ sppp_cp_input(const struct cp *cp, struct sppp *sp, struct mbuf *m) sppp_state_name(sp->state[cp->protoidx]), sppp_cp_type_name (h->type), h->ident, ntohs (h->len)); sppp_print_bytes ((u_char*) (h+1), len-4); - addlog(">\n"); + log(-1, ">\n"); } if (len > ntohs (h->len)) len = ntohs (h->len); @@ -1397,7 +1397,7 @@ sppp_cp_input(const struct cp *cp, struct sppp *sp, struct mbuf *m) case CONF_REQ: if (len < 4) { if (debug) - addlog(SPP_FMT "%s invalid conf-req length %d\n", + log(-1, SPP_FMT "%s invalid conf-req length %d\n", SPP_ARGS(ifp), cp->name, len); ++ifp->if_ierrors; @@ -1452,7 +1452,7 @@ sppp_cp_input(const struct cp *cp, struct sppp *sp, struct mbuf *m) case CONF_ACK: if (h->ident != sp->confid[cp->protoidx]) { if (debug) - addlog(SPP_FMT "%s id mismatch 0x%x != 0x%x\n", + log(-1, SPP_FMT "%s id mismatch 0x%x != 0x%x\n", SPP_ARGS(ifp), cp->name, h->ident, sp->confid[cp->protoidx]); ++ifp->if_ierrors; @@ -1497,7 +1497,7 @@ sppp_cp_input(const struct cp *cp, struct sppp *sp, struct mbuf *m) case CONF_REJ: if (h->ident != sp->confid[cp->protoidx]) { if (debug) - addlog(SPP_FMT "%s id mismatch 0x%x != 0x%x\n", + log(-1, SPP_FMT "%s id mismatch 0x%x != 0x%x\n", SPP_ARGS(ifp), cp->name, h->ident, sp->confid[cp->protoidx]); ++ifp->if_ierrors; @@ -1638,14 +1638,14 @@ sppp_cp_input(const struct cp *cp, struct sppp *sp, struct mbuf *m) goto illegal; if (sp->state[cp->protoidx] != STATE_OPENED) { if (debug) - addlog(SPP_FMT "lcp echo req but lcp closed\n", + log(-1, SPP_FMT "lcp echo req but lcp closed\n", SPP_ARGS(ifp)); ++ifp->if_ierrors; break; } if (len < 8) { if (debug) - addlog(SPP_FMT "invalid lcp echo request " + log(-1, SPP_FMT "invalid lcp echo request " "packet length: %d bytes\n", SPP_ARGS(ifp), len); break; @@ -1667,7 +1667,7 @@ sppp_cp_input(const struct cp *cp, struct sppp *sp, struct mbuf *m) } *(long*)(h+1) = htonl (sp->lcp.magic); if (debug) - addlog(SPP_FMT "got lcp echo req, sending echo rep\n", + log(-1, SPP_FMT "got lcp echo req, sending echo rep\n", SPP_ARGS(ifp)); sppp_cp_send (sp, PPP_LCP, ECHO_REPLY, h->ident, len-4, h+1); break; @@ -1680,13 +1680,13 @@ sppp_cp_input(const struct cp *cp, struct sppp *sp, struct mbuf *m) } if (len < 8) { if (debug) - addlog(SPP_FMT "lcp invalid echo reply " + log(-1, SPP_FMT "lcp invalid echo reply " "packet length: %d bytes\n", SPP_ARGS(ifp), len); break; } if (debug) - addlog(SPP_FMT "lcp got echo rep\n", + log(-1, SPP_FMT "lcp got echo rep\n", SPP_ARGS(ifp)); if (!(sp->lcp.opts & (1 << LCP_OPT_MAGIC)) || @@ -1697,7 +1697,7 @@ sppp_cp_input(const struct cp *cp, struct sppp *sp, struct mbuf *m) /* Unknown packet type -- send Code-Reject packet. */ illegal: if (debug) - addlog(SPP_FMT "%s send code-rej for 0x%x\n", + log(-1, SPP_FMT "%s send code-rej for 0x%x\n", SPP_ARGS(ifp), cp->name, h->type); sppp_cp_send(sp, cp->proto, CODE_REJ, ++sp->pp_seq, m->m_pkthdr.len, h); @@ -1976,11 +1976,11 @@ sppp_lcp_up(struct sppp *sp) ifp->if_flags |= IFF_RUNNING; if (sp->state[IDX_LCP] == STATE_INITIAL) { if (debug) - addlog("(incoming call)\n"); + log(-1, "(incoming call)\n"); sp->pp_flags |= PP_CALLIN; lcp.Open(sp); } else if (debug) - addlog("\n"); + log(-1, "\n"); } sppp_up_event(&lcp, sp); @@ -2072,7 +2072,7 @@ sppp_lcp_RCR(struct sppp *sp, struct lcp_header *h, int len) p = (void*) (h+1); for (rlen=0; len>1 && p[1]; len-=p[1], p+=p[1]) { if (debug) - addlog(" %s ", sppp_lcp_opt_name(*p)); + log(-1, " %s ", sppp_lcp_opt_name(*p)); switch (*p) { case LCP_OPT_MAGIC: /* Magic number. */ @@ -2082,31 +2082,31 @@ sppp_lcp_RCR(struct sppp *sp, struct lcp_header *h, int len) if (len >= 6 || p[1] == 6) continue; if (debug) - addlog("[invalid] "); + log(-1, "[invalid] "); break; case LCP_OPT_MRU: /* Maximum receive unit. */ if (len >= 4 && p[1] == 4) continue; if (debug) - addlog("[invalid] "); + log(-1, "[invalid] "); break; case LCP_OPT_AUTH_PROTO: if (len < 4) { if (debug) - addlog("[invalid] "); + log(-1, "[invalid] "); break; } authproto = (p[2] << 8) + p[3]; if (authproto == PPP_CHAP && p[1] != 5) { if (debug) - addlog("[invalid chap len] "); + log(-1, "[invalid chap len] "); break; } if (sp->myauth.proto == 0) { /* we are not configured to do auth */ if (debug) - addlog("[not configured] "); + log(-1, "[not configured] "); break; } /* @@ -2119,7 +2119,7 @@ sppp_lcp_RCR(struct sppp *sp, struct lcp_header *h, int len) default: /* Others not supported. */ if (debug) - addlog("[rej] "); + log(-1, "[rej] "); break; } /* Add the option to rejected list. */ @@ -2129,11 +2129,11 @@ sppp_lcp_RCR(struct sppp *sp, struct lcp_header *h, int len) } if (rlen) { if (debug) - addlog(" send conf-rej\n"); + log(-1, " send conf-rej\n"); sppp_cp_send (sp, PPP_LCP, CONF_REJ, h->ident, rlen, buf); return 0; } else if (debug) - addlog("\n"); + log(-1, "\n"); /* * pass 2: check for option values that are unacceptable and @@ -2147,7 +2147,7 @@ sppp_lcp_RCR(struct sppp *sp, struct lcp_header *h, int len) len = origlen; for (rlen=0; len>1 && p[1]; len-=p[1], p+=p[1]) { if (debug) - addlog(" %s ", sppp_lcp_opt_name(*p)); + log(-1, " %s ", sppp_lcp_opt_name(*p)); switch (*p) { case LCP_OPT_MAGIC: /* Magic number -- extract. */ @@ -2155,7 +2155,7 @@ sppp_lcp_RCR(struct sppp *sp, struct lcp_header *h, int len) (u_long)p[3] << 16 | p[4] << 8 | p[5]; if (nmagic != sp->lcp.magic) { if (debug) - addlog("0x%lx ", nmagic); + log(-1, "0x%lx ", nmagic); continue; } /* @@ -2173,7 +2173,7 @@ sppp_lcp_RCR(struct sppp *sp, struct lcp_header *h, int len) lcp.Up(sp); } } else if (debug) - addlog("[glitch] "); + log(-1, "[glitch] "); ++sp->pp_loopcnt; /* * We negate our magic here, and NAK it. If @@ -2193,11 +2193,11 @@ sppp_lcp_RCR(struct sppp *sp, struct lcp_header *h, int len) /* Async control character map -- check to be zero. */ if (! p[2] && ! p[3] && ! p[4] && ! p[5]) { if (debug) - addlog("[empty] "); + log(-1, "[empty] "); continue; } if (debug) - addlog("[non-empty] "); + log(-1, "[non-empty] "); from Armin Gruner: Anyway, if I remove the "p[2] = p[3] = p[4] = p[5] = 0;", @@ -2218,7 +2218,7 @@ sppp_lcp_RCR(struct sppp *sp, struct lcp_header *h, int len) */ sp->lcp.their_mru = p[2] * 256 + p[3]; if (debug) - addlog("%lu ", sp->lcp.their_mru); + log(-1, "%lu ", sp->lcp.their_mru); continue; case LCP_OPT_AUTH_PROTO: @@ -2226,7 +2226,7 @@ sppp_lcp_RCR(struct sppp *sp, struct lcp_header *h, int len) if (sp->myauth.proto != authproto) { /* not agreed, nak */ if (debug) - addlog("[mine %s != his %s] ", + log(-1, "[mine %s != his %s] ", sppp_proto_name(sp->hisauth.proto), sppp_proto_name(authproto)); p[2] = sp->myauth.proto >> 8; @@ -2235,7 +2235,7 @@ sppp_lcp_RCR(struct sppp *sp, struct lcp_header *h, int len) } if (authproto == PPP_CHAP && p[4] != CHAP_MD5) { if (debug) - addlog("[chap not MD5] "); + log(-1, "[chap not MD5] "); p[4] = CHAP_MD5; break; } @@ -2249,19 +2249,19 @@ sppp_lcp_RCR(struct sppp *sp, struct lcp_header *h, int len) if (rlen) { if (++sp->fail_counter[IDX_LCP] >= sp->lcp.max_failure) { if (debug) - addlog(" max_failure (%d) exceeded, " + log(-1, " max_failure (%d) exceeded, " "send conf-rej\n", sp->lcp.max_failure); sppp_cp_send(sp, PPP_LCP, CONF_REJ, h->ident, rlen, buf); } else { if (debug) - addlog(" send conf-nak\n"); + log(-1, " send conf-nak\n"); sppp_cp_send (sp, PPP_LCP, CONF_NAK, h->ident, rlen, buf); } return 0; } else { if (debug) - addlog(" send conf-ack\n"); + log(-1, " send conf-ack\n"); sp->fail_counter[IDX_LCP] = 0; sp->pp_loopcnt = 0; sppp_cp_send (sp, PPP_LCP, CONF_ACK, @@ -2294,7 +2294,7 @@ sppp_lcp_RCN_rej(struct sppp *sp, struct lcp_header *h, int len) p = (void*) (h+1); for (; len > 1 && p[1]; len -= p[1], p += p[1]) { if (debug) - addlog(" %s ", sppp_lcp_opt_name(*p)); + log(-1, " %s ", sppp_lcp_opt_name(*p)); switch (*p) { case LCP_OPT_MAGIC: /* Magic number -- can't use it, use 0 */ @@ -2318,19 +2318,19 @@ sppp_lcp_RCN_rej(struct sppp *sp, struct lcp_header *h, int len) if ((sp->pp_flags & PP_CALLIN) == 0 && (sp->hisauth.flags & AUTHFLAG_NOCALLOUT) != 0) { if (debug) - addlog("[don't insist on auth " + log(-1, "[don't insist on auth " "for callout]"); sp->lcp.opts &= ~(1 << LCP_OPT_AUTH_PROTO); break; } if (debug) - addlog("[access denied]\n"); + log(-1, "[access denied]\n"); lcp.Close(sp); break; } } if (debug) - addlog("\n"); + log(-1, "\n"); free (buf, M_TEMP); return; } @@ -2358,7 +2358,7 @@ sppp_lcp_RCN_nak(struct sppp *sp, struct lcp_header *h, int len) p = (void*) (h+1); for (; len > 1 && p[1]; len -= p[1], p += p[1]) { if (debug) - addlog(" %s ", sppp_lcp_opt_name(*p)); + log(-1, " %s ", sppp_lcp_opt_name(*p)); switch (*p) { case LCP_OPT_MAGIC: /* Magic number -- renegotiate */ @@ -2373,7 +2373,7 @@ sppp_lcp_RCN_nak(struct sppp *sp, struct lcp_header *h, int len) */ if (magic == ~sp->lcp.magic) { if (debug) - addlog("magic glitch "); + log(-1, "magic glitch "); #if defined(__NetBSD__) || (defined(__FreeBSD__) && __FreeBSD__ >= 3) sp->lcp.magic = random(); #else @@ -2382,7 +2382,7 @@ sppp_lcp_RCN_nak(struct sppp *sp, struct lcp_header *h, int len) } else { sp->lcp.magic = magic; if (debug) - addlog("%lu ", magic); + log(-1, "%lu ", magic); } } break; @@ -2395,7 +2395,7 @@ sppp_lcp_RCN_nak(struct sppp *sp, struct lcp_header *h, int len) if (len >= 4 && p[1] == 4) { u_int mru = p[2] * 256 + p[3]; if (debug) - addlog("%d ", mru); + log(-1, "%d ", mru); if (mru < PP_MTU || mru > PP_MAX_MRU) mru = PP_MTU; sp->lcp.mru = mru; @@ -2408,13 +2408,13 @@ sppp_lcp_RCN_nak(struct sppp *sp, struct lcp_header *h, int len) * deny. */ if (debug) - addlog("[access denied]\n"); + log(-1, "[access denied]\n"); lcp.Close(sp); break; } } if (debug) - addlog("\n"); + log(-1, "\n"); free (buf, M_TEMP); return; } @@ -2756,7 +2756,7 @@ sppp_ipcp_RCR(struct sppp *sp, struct lcp_header *h, int len) p = (void*) (h+1); for (rlen=0; len>1 && p[1]; len-=p[1], p+=p[1]) { if (debug) - addlog(" %s ", sppp_ipcp_opt_name(*p)); + log(-1, " %s ", sppp_ipcp_opt_name(*p)); switch (*p) { #ifdef SPPP_VJ @@ -2768,7 +2768,7 @@ sppp_ipcp_RCR(struct sppp *sp, struct lcp_header *h, int len) continue; } if (debug) - addlog("[invalid] "); + log(-1, "[invalid] "); } break; #endif @@ -2779,12 +2779,12 @@ sppp_ipcp_RCR(struct sppp *sp, struct lcp_header *h, int len) continue; } if (debug) - addlog("[invalid] "); + log(-1, "[invalid] "); break; default: /* Others not supported. */ if (debug) - addlog("[rej] "); + log(-1, "[rej] "); break; } /* Add the option to rejected list. */ @@ -2794,11 +2794,11 @@ sppp_ipcp_RCR(struct sppp *sp, struct lcp_header *h, int len) } if (rlen) { if (debug) - addlog(" send conf-rej\n"); + log(-1, " send conf-rej\n"); sppp_cp_send (sp, PPP_IPCP, CONF_REJ, h->ident, rlen, buf); return 0; } else if (debug) - addlog("\n"); + log(-1, "\n"); /* pass 2: parse option values */ sppp_get_ip_addrs(sp, 0, &hisaddr, 0); @@ -2809,7 +2809,7 @@ sppp_ipcp_RCR(struct sppp *sp, struct lcp_header *h, int len) len = origlen; for (rlen=0; len>1 && p[1]; len-=p[1], p+=p[1]) { if (debug) - addlog(" %s ", sppp_ipcp_opt_name(*p)); + log(-1, " %s ", sppp_ipcp_opt_name(*p)); switch (*p) { #ifdef SPPP_VJ @@ -2822,7 +2822,7 @@ sppp_ipcp_RCR(struct sppp *sp, struct lcp_header *h, int len) if(sp->enable_vj) { if (debug) - addlog("VJ [ack] "); + log(-1, "VJ [ack] "); sp->ipcp.flags |= IPCP_VJ; #ifdef __FreeBSD__ sl_compress_init(&sp->pp_comp, p[4]); @@ -2836,14 +2836,14 @@ sppp_ipcp_RCR(struct sppp *sp, struct lcp_header *h, int len) else { if (debug) - addlog("%#04x [VJ disabled] ", desiredcomp); + log(-1, "%#04x [VJ disabled] ", desiredcomp); p[2] = IPCP_COMP_VJ >> 8; p[3] = IPCP_COMP_VJ; break; } } if (debug) - addlog("%#04x [not supported] ", desiredcomp); + log(-1, "%#04x [not supported] ", desiredcomp); p[2] = IPCP_COMP_VJ >> 8; p[3] = IPCP_COMP_VJ; break; @@ -2864,7 +2864,7 @@ sppp_ipcp_RCR(struct sppp *sp, struct lcp_header *h, int len) * it. */ if (debug) - addlog("%s [ack] ", + log(-1, "%s [ack] ", sppp_dotted_quad(hisaddr)); /* record that we've seen it already */ sp->ipcp.flags |= IPCP_HISADDR_SEEN; @@ -2880,9 +2880,9 @@ sppp_ipcp_RCR(struct sppp *sp, struct lcp_header *h, int len) */ if (debug) { if (desiredaddr == 0) - addlog("[addr requested] "); + log(-1, "[addr requested] "); else - addlog("%s [not agreed] ", + log(-1, "%s [not agreed] ", sppp_dotted_quad(desiredaddr)); } p[2] = hisaddr >> 24; @@ -2917,16 +2917,16 @@ sppp_ipcp_RCR(struct sppp *sp, struct lcp_header *h, int len) buf[5] = hisaddr; rlen = 6; if (debug) - addlog("still need hisaddr "); + log(-1, "still need hisaddr "); } if (rlen) { if (debug) - addlog(" send conf-nak\n"); + log(-1, " send conf-nak\n"); sppp_cp_send (sp, PPP_IPCP, CONF_NAK, h->ident, rlen, buf); } else { if (debug) - addlog(" send conf-ack\n"); + log(-1, " send conf-ack\n"); sppp_cp_send (sp, PPP_IPCP, CONF_ACK, h->ident, origlen, h+1); } @@ -2958,7 +2958,7 @@ sppp_ipcp_RCN_rej(struct sppp *sp, struct lcp_header *h, int len) p = (void*) (h+1); for (; len > 1 && p[1]; len -= p[1], p += p[1]) { if (debug) - addlog(" %s ", sppp_ipcp_opt_name(*p)); + log(-1, " %s ", sppp_ipcp_opt_name(*p)); switch (*p) { #ifdef SPPP_VJ case IPCP_OPT_COMPRESSION: @@ -2982,7 +2982,7 @@ sppp_ipcp_RCN_rej(struct sppp *sp, struct lcp_header *h, int len) } } if (debug) - addlog("\n"); + log(-1, "\n"); free (buf, M_TEMP); return; } @@ -3014,14 +3014,14 @@ sppp_ipcp_RCN_nak(struct sppp *sp, struct lcp_header *h, int len) p = (void*) (h+1); for (; len > 1 && p[1]; len -= p[1], p += p[1]) { if (debug) - addlog(" %s ", sppp_ipcp_opt_name(*p)); + log(-1, " %s ", sppp_ipcp_opt_name(*p)); switch (*p) { #ifdef SPPP_VJ case IPCP_OPT_COMPRESSION: if (len >= 6 && p[1] == 6) { desiredcomp = p[2] << 8 | p[3]; if (debug) - addlog("[wantcomp %#04x] ", + log(-1, "[wantcomp %#04x] ", desiredcomp); if (desiredcomp == IPCP_COMP_VJ && sp->enable_vj) { #ifdef __FreeBSD__ @@ -3031,7 +3031,7 @@ sppp_ipcp_RCN_nak(struct sppp *sp, struct lcp_header *h, int len) #endif sp->ipcp.max_state = p[4]; sp->ipcp.compress_cid = p[5]; - addlog("[agree] "); + log(-1, "[agree] "); } else sp->ipcp.opts &= ~(1 << IPCP_OPT_COMPRESSION); @@ -3049,7 +3049,7 @@ sppp_ipcp_RCN_nak(struct sppp *sp, struct lcp_header *h, int len) p[4] << 8 | p[5]; sp->ipcp.opts |= (1 << IPCP_OPT_ADDRESS); if (debug) - addlog("[wantaddr %s] ", + log(-1, "[wantaddr %s] ", sppp_dotted_quad(wantaddr)); /* * When doing dynamic address assignment, @@ -3062,7 +3062,7 @@ sppp_ipcp_RCN_nak(struct sppp *sp, struct lcp_header *h, int len) if (sp->ipcp.flags & IPCP_MYADDR_DYN) { sppp_set_ip_addr(sp, wantaddr); if (debug) - addlog("[agree] "); + log(-1, "[agree] "); sp->ipcp.flags |= IPCP_MYADDR_SEEN; } } @@ -3077,7 +3077,7 @@ sppp_ipcp_RCN_nak(struct sppp *sp, struct lcp_header *h, int len) } } if (debug) - addlog("\n"); + log(-1, "\n"); free (buf, M_TEMP); return; } @@ -3269,7 +3269,7 @@ sppp_chap_input(struct sppp *sp, struct mbuf *m) sppp_auth_type_name(PPP_CHAP, h->type), h->ident, ntohs(h->len)); sppp_print_bytes((u_char*) (h+1), len-4); - addlog(">\n"); + log(-1, ">\n"); } break; } @@ -3281,9 +3281,9 @@ sppp_chap_input(struct sppp *sp, struct mbuf *m) sppp_auth_type_name(PPP_CHAP, h->type), h->ident, ntohs(h->len)); sppp_print_string((char*) name, name_len); - addlog(" value-size=%d value=", value_len); + log(-1, " value-size=%d value=", value_len); sppp_print_bytes(value, value_len); - addlog(">\n"); + log(-1, ">\n"); } /* Compute reply value. */ @@ -3308,10 +3308,10 @@ sppp_chap_input(struct sppp *sp, struct mbuf *m) log(LOG_DEBUG, SPP_FMT "chap success", SPP_ARGS(ifp)); if (len > 4) { - addlog(": "); + log(-1, ": "); sppp_print_string((char*)(h + 1), len - 4); } - addlog("\n"); + log(-1, "\n"); } x = splimp(); sp->pp_flags &= ~PP_NEEDAUTH; @@ -3335,10 +3335,10 @@ sppp_chap_input(struct sppp *sp, struct mbuf *m) log(LOG_INFO, SPP_FMT "chap failure", SPP_ARGS(ifp)); if (len > 4) { - addlog(": "); + log(-1, ": "); sppp_print_string((char*)(h + 1), len - 4); } - addlog("\n"); + log(-1, "\n"); } else log(LOG_INFO, SPP_FMT "chap failure\n", SPP_ARGS(ifp)); @@ -3360,7 +3360,7 @@ sppp_chap_input(struct sppp *sp, struct mbuf *m) sppp_auth_type_name(PPP_CHAP, h->type), h->ident, ntohs(h->len)); sppp_print_bytes((u_char*)(h+1), len-4); - addlog(">\n"); + log(-1, ">\n"); } break; } @@ -3378,10 +3378,10 @@ sppp_chap_input(struct sppp *sp, struct mbuf *m) log(LOG_INFO, SPP_FMT "chap response, his name ", SPP_ARGS(ifp)); sppp_print_string(name, name_len); - addlog(" != expected "); + log(-1, " != expected "); sppp_print_string(sp->hisauth.name, sppp_strnlen(sp->hisauth.name, AUTHNAMELEN)); - addlog("\n"); + log(-1, "\n"); } if (debug) { log(LOG_DEBUG, SPP_FMT "chap input(%s) " @@ -3391,9 +3391,9 @@ sppp_chap_input(struct sppp *sp, struct mbuf *m) sppp_auth_type_name(PPP_CHAP, h->type), h->ident, ntohs (h->len)); sppp_print_string((char*)name, name_len); - addlog(" value-size=%d value=", value_len); + log(-1, " value-size=%d value=", value_len); sppp_print_bytes(value, value_len); - addlog(">\n"); + log(-1, ">\n"); } if (value_len != AUTHKEYLEN) { if (debug) @@ -3445,7 +3445,7 @@ sppp_chap_input(struct sppp *sp, struct mbuf *m) sppp_state_name(sp->state[IDX_CHAP]), h->type, h->ident, ntohs(h->len)); sppp_print_bytes((u_char*)(h+1), len-4); - addlog(">\n"); + log(-1, ">\n"); } break; @@ -3552,9 +3552,9 @@ sppp_chap_tlu(struct sppp *sp) SPP_ARGS(ifp), sp->pp_phase == PHASE_NETWORK? "reconfirmed": "tlu"); if ((sp->hisauth.flags & AUTHFLAG_NORECHALLENGE) == 0) - addlog("next re-challenge in %d seconds\n", i); + log(-1, "next re-challenge in %d seconds\n", i); else - addlog("re-challenging supressed\n"); + log(-1, "re-challenging supressed\n"); } x = splimp(); @@ -3682,7 +3682,7 @@ sppp_pap_input(struct sppp *sp, struct mbuf *m) sppp_auth_type_name(PPP_PAP, h->type), h->ident, ntohs(h->len)); sppp_print_bytes((u_char*)(h+1), len-4); - addlog(">\n"); + log(-1, ">\n"); } break; } @@ -3694,9 +3694,9 @@ sppp_pap_input(struct sppp *sp, struct mbuf *m) sppp_auth_type_name(PPP_PAP, h->type), h->ident, ntohs(h->len)); sppp_print_string((char*)name, name_len); - addlog(" passwd="); + log(-1, " passwd="); sppp_print_string((char*)passwd, passwd_len); - addlog(">\n"); + log(-1, ">\n"); } if (name_len > AUTHNAMELEN || passwd_len > AUTHKEYLEN || @@ -3734,10 +3734,10 @@ sppp_pap_input(struct sppp *sp, struct mbuf *m) SPP_ARGS(ifp)); name_len = *((char *)h); if (len > 5 && name_len) { - addlog(": "); + log(-1, ": "); sppp_print_string((char*)(h+1), name_len); } - addlog("\n"); + log(-1, "\n"); } x = splimp(); sp->pp_flags &= ~PP_NEEDAUTH; @@ -3763,10 +3763,10 @@ sppp_pap_input(struct sppp *sp, struct mbuf *m) SPP_ARGS(ifp)); name_len = *((char *)h); if (len > 5 && name_len) { - addlog(": "); + log(-1, ": "); sppp_print_string((char*)(h+1), name_len); } - addlog("\n"); + log(-1, "\n"); } else log(LOG_INFO, SPP_FMT "pap failure\n", SPP_ARGS(ifp)); @@ -3781,7 +3781,7 @@ sppp_pap_input(struct sppp *sp, struct mbuf *m) SPP_ARGS(ifp), h->type, h->ident, ntohs(h->len)); sppp_print_bytes((u_char*)(h+1), len-4); - addlog(">\n"); + log(-1, ">\n"); } break; @@ -4010,7 +4010,7 @@ sppp_auth_send(const struct cp *cp, struct sppp *sp, sppp_auth_type_name(cp->proto, lh->type), lh->ident, ntohs(lh->len)); sppp_print_bytes((u_char*) (lh+1), len); - addlog(">\n"); + log(-1, ">\n"); } if (! IF_HANDOFF_ADJ(&sp->pp_cpq, m, NULL, 3)) ++ifp->if_oerrors; @@ -4515,14 +4515,14 @@ sppp_print_bytes(const u_char *p, u_short len) { #if defined(__FreeBSD_version) && (__FreeBSD_version > 300005) if (len) - addlog(" %*D", len, p, "-"); + log(-1, " %*D", len, p, "-"); #else if (!len) return; - addlog("%x", *p++); + log(-1, "%x", *p++); while (--len) - addlog("-%x", *p++); + log(-1, "-%x", *p++); #endif } @@ -4537,9 +4537,9 @@ sppp_print_string(const char *p, u_short len) * Print only ASCII chars directly. RFC 1994 recommends * using only them, but we don't rely on it. */ if (c < ' ' || c > '~') - addlog("\\x%x", c); + log(-1, "\\x%x", c); else - addlog("%c", c); + log(-1, "%c", c); } } diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c index ad71e51..13a4ade 100644 --- a/sys/kern/subr_prf.c +++ b/sys/kern/subr_prf.c @@ -123,7 +123,7 @@ uprintf(const char *fmt, ...) tpr_t tprintf_open(p) - register struct proc *p; + struct proc *p; { if (p->p_flag & P_CONTROLT && p->p_session->s_ttyvp) { @@ -149,7 +149,7 @@ tprintf_close(sess) int tprintf(tpr_t tpr, const char *fmt, ...) { - register struct session *sess = (struct session *)tpr; + struct session *sess = (struct session *)tpr; struct tty *tp = NULL; int flags = TOLOG; va_list ap; @@ -197,15 +197,16 @@ extern int log_open; * called by interrupt routines). If there is no process reading the * log yet, it writes to the console also. */ -int +void log(int level, const char *fmt, ...) { - register int s; + int s; va_list ap; int retval; s = splhigh(); - logpri(level); + if (level != -1) + logpri(level); va_start(ap, fmt); retval = kvprintf(fmt, msglogchar, NULL, 10, ap); @@ -229,7 +230,7 @@ logpri(level) int level; { char nbuf[MAXNBUF]; - register char *p; + char *p; msglogchar('<', NULL); for (p = ksprintn(nbuf, (u_long)level, 10, NULL); *p;) @@ -238,34 +239,10 @@ logpri(level) } int -addlog(const char *fmt, ...) -{ - register int s; - va_list ap; - int retval; - - s = splhigh(); - va_start(ap, fmt); - retval = kvprintf(fmt, msglogchar, NULL, 10, ap); - splx(s); - va_end(ap); - if (!log_open) { - struct putchar_arg pca; - va_start(ap, fmt); - pca.tty = NULL; - pca.flags = TOCONS; - retval += kvprintf(fmt, putchar, &pca, 10, ap); - va_end(ap); - } - logwakeup(); - return (retval); -} - -int printf(const char *fmt, ...) { va_list ap; - register int savintr; + int savintr; struct putchar_arg pca; int retval; @@ -285,7 +262,7 @@ printf(const char *fmt, ...) int vprintf(const char *fmt, va_list ap) { - register int savintr; + int savintr; struct putchar_arg pca; int retval; @@ -407,10 +384,10 @@ snprintf_func(int ch, void *arg) static char * ksprintn(nbuf, ul, base, lenp) char *nbuf; - register u_long ul; - register int base, *lenp; + u_long ul; + int base, *lenp; { - register char *p; + char *p; p = nbuf; *p = '\0'; @@ -425,10 +402,10 @@ ksprintn(nbuf, ul, base, lenp) static char * ksprintqn(nbuf, uq, base, lenp) char *nbuf; - register u_quad_t uq; - register int base, *lenp; + u_quad_t uq; + int base, *lenp; { - register char *p; + char *p; p = nbuf; *p = '\0'; diff --git a/sys/net/if_spppsubr.c b/sys/net/if_spppsubr.c index 052274a..83382f9 100644 --- a/sys/net/if_spppsubr.c +++ b/sys/net/if_spppsubr.c @@ -1050,7 +1050,7 @@ sppp_cisco_input(struct sppp *sp, struct mbuf *m) switch (ntohl (h->type)) { default: if (debug) - addlog(SPP_FMT "cisco unknown packet type: 0x%lx\n", + log(-1, SPP_FMT "cisco unknown packet type: 0x%lx\n", SPP_ARGS(ifp), (u_long)ntohl (h->type)); break; case CISCO_ADDR_REPLY: @@ -1194,7 +1194,7 @@ sppp_cp_send(struct sppp *sp, u_short proto, u_char type, sppp_cp_type_name (lh->type), lh->ident, ntohs (lh->len)); sppp_print_bytes ((u_char*) (lh+1), len); - addlog(">\n"); + log(-1, ">\n"); } if (! IF_HANDOFF_ADJ(&sp->pp_cpq, m, ifp, 3)) ifp->if_oerrors++; @@ -1227,7 +1227,7 @@ sppp_cp_input(const struct cp *cp, struct sppp *sp, struct mbuf *m) sppp_state_name(sp->state[cp->protoidx]), sppp_cp_type_name (h->type), h->ident, ntohs (h->len)); sppp_print_bytes ((u_char*) (h+1), len-4); - addlog(">\n"); + log(-1, ">\n"); } if (len > ntohs (h->len)) len = ntohs (h->len); @@ -1236,7 +1236,7 @@ sppp_cp_input(const struct cp *cp, struct sppp *sp, struct mbuf *m) case CONF_REQ: if (len < 4) { if (debug) - addlog(SPP_FMT "%s invalid conf-req length %d\n", + log(-1, SPP_FMT "%s invalid conf-req length %d\n", SPP_ARGS(ifp), cp->name, len); ++ifp->if_ierrors; @@ -1291,7 +1291,7 @@ sppp_cp_input(const struct cp *cp, struct sppp *sp, struct mbuf *m) case CONF_ACK: if (h->ident != sp->confid[cp->protoidx]) { if (debug) - addlog(SPP_FMT "%s id mismatch 0x%x != 0x%x\n", + log(-1, SPP_FMT "%s id mismatch 0x%x != 0x%x\n", SPP_ARGS(ifp), cp->name, h->ident, sp->confid[cp->protoidx]); ++ifp->if_ierrors; @@ -1336,7 +1336,7 @@ sppp_cp_input(const struct cp *cp, struct sppp *sp, struct mbuf *m) case CONF_REJ: if (h->ident != sp->confid[cp->protoidx]) { if (debug) - addlog(SPP_FMT "%s id mismatch 0x%x != 0x%x\n", + log(-1, SPP_FMT "%s id mismatch 0x%x != 0x%x\n", SPP_ARGS(ifp), cp->name, h->ident, sp->confid[cp->protoidx]); ++ifp->if_ierrors; @@ -1477,14 +1477,14 @@ sppp_cp_input(const struct cp *cp, struct sppp *sp, struct mbuf *m) goto illegal; if (sp->state[cp->protoidx] != STATE_OPENED) { if (debug) - addlog(SPP_FMT "lcp echo req but lcp closed\n", + log(-1, SPP_FMT "lcp echo req but lcp closed\n", SPP_ARGS(ifp)); ++ifp->if_ierrors; break; } if (len < 8) { if (debug) - addlog(SPP_FMT "invalid lcp echo request " + log(-1, SPP_FMT "invalid lcp echo request " "packet length: %d bytes\n", SPP_ARGS(ifp), len); break; @@ -1504,7 +1504,7 @@ sppp_cp_input(const struct cp *cp, struct sppp *sp, struct mbuf *m) } *(long*)(h+1) = htonl (sp->lcp.magic); if (debug) - addlog(SPP_FMT "got lcp echo req, sending echo rep\n", + log(-1, SPP_FMT "got lcp echo req, sending echo rep\n", SPP_ARGS(ifp)); sppp_cp_send (sp, PPP_LCP, ECHO_REPLY, h->ident, len-4, h+1); break; @@ -1517,13 +1517,13 @@ sppp_cp_input(const struct cp *cp, struct sppp *sp, struct mbuf *m) } if (len < 8) { if (debug) - addlog(SPP_FMT "lcp invalid echo reply " + log(-1, SPP_FMT "lcp invalid echo reply " "packet length: %d bytes\n", SPP_ARGS(ifp), len); break; } if (debug) - addlog(SPP_FMT "lcp got echo rep\n", + log(-1, SPP_FMT "lcp got echo rep\n", SPP_ARGS(ifp)); if (!(sp->lcp.opts & (1 << LCP_OPT_MAGIC)) || ntohl (*(long*)(h+1)) != sp->lcp.magic) @@ -1533,7 +1533,7 @@ sppp_cp_input(const struct cp *cp, struct sppp *sp, struct mbuf *m) /* Unknown packet type -- send Code-Reject packet. */ illegal: if (debug) - addlog(SPP_FMT "%s send code-rej for 0x%x\n", + log(-1, SPP_FMT "%s send code-rej for 0x%x\n", SPP_ARGS(ifp), cp->name, h->type); sppp_cp_send(sp, cp->proto, CODE_REJ, ++sp->pp_seq, m->m_pkthdr.len, h); @@ -1811,11 +1811,11 @@ sppp_lcp_up(struct sppp *sp) ifp->if_flags |= IFF_RUNNING; if (sp->state[IDX_LCP] == STATE_INITIAL) { if (debug) - addlog("(incoming call)\n"); + log(-1, "(incoming call)\n"); sp->pp_flags |= PP_CALLIN; lcp.Open(sp); } else if (debug) - addlog("\n"); + log(-1, "\n"); } sppp_up_event(&lcp, sp); @@ -1907,7 +1907,7 @@ sppp_lcp_RCR(struct sppp *sp, struct lcp_header *h, int len) p = (void*) (h+1); for (rlen=0; len>1 && p[1]; len-=p[1], p+=p[1]) { if (debug) - addlog(" %s ", sppp_lcp_opt_name(*p)); + log(-1, " %s ", sppp_lcp_opt_name(*p)); switch (*p) { case LCP_OPT_MAGIC: /* Magic number. */ @@ -1917,31 +1917,31 @@ sppp_lcp_RCR(struct sppp *sp, struct lcp_header *h, int len) if (len >= 6 || p[1] == 6) continue; if (debug) - addlog("[invalid] "); + log(-1, "[invalid] "); break; case LCP_OPT_MRU: /* Maximum receive unit. */ if (len >= 4 && p[1] == 4) continue; if (debug) - addlog("[invalid] "); + log(-1, "[invalid] "); break; case LCP_OPT_AUTH_PROTO: if (len < 4) { if (debug) - addlog("[invalid] "); + log(-1, "[invalid] "); break; } authproto = (p[2] << 8) + p[3]; if (authproto == PPP_CHAP && p[1] != 5) { if (debug) - addlog("[invalid chap len] "); + log(-1, "[invalid chap len] "); break; } if (sp->myauth.proto == 0) { /* we are not configured to do auth */ if (debug) - addlog("[not configured] "); + log(-1, "[not configured] "); break; } /* @@ -1954,7 +1954,7 @@ sppp_lcp_RCR(struct sppp *sp, struct lcp_header *h, int len) default: /* Others not supported. */ if (debug) - addlog("[rej] "); + log(-1, "[rej] "); break; } /* Add the option to rejected list. */ @@ -1964,11 +1964,11 @@ sppp_lcp_RCR(struct sppp *sp, struct lcp_header *h, int len) } if (rlen) { if (debug) - addlog(" send conf-rej\n"); + log(-1, " send conf-rej\n"); sppp_cp_send (sp, PPP_LCP, CONF_REJ, h->ident, rlen, buf); return 0; } else if (debug) - addlog("\n"); + log(-1, "\n"); /* * pass 2: check for option values that are unacceptable and @@ -1982,7 +1982,7 @@ sppp_lcp_RCR(struct sppp *sp, struct lcp_header *h, int len) len = origlen; for (rlen=0; len>1 && p[1]; len-=p[1], p+=p[1]) { if (debug) - addlog(" %s ", sppp_lcp_opt_name(*p)); + log(-1, " %s ", sppp_lcp_opt_name(*p)); switch (*p) { case LCP_OPT_MAGIC: /* Magic number -- extract. */ @@ -1990,7 +1990,7 @@ sppp_lcp_RCR(struct sppp *sp, struct lcp_header *h, int len) (u_long)p[3] << 16 | p[4] << 8 | p[5]; if (nmagic != sp->lcp.magic) { if (debug) - addlog("0x%lx ", nmagic); + log(-1, "0x%lx ", nmagic); continue; } /* @@ -2008,7 +2008,7 @@ sppp_lcp_RCR(struct sppp *sp, struct lcp_header *h, int len) lcp.Up(sp); } } else if (debug) - addlog("[glitch] "); + log(-1, "[glitch] "); ++sp->pp_loopcnt; /* * We negate our magic here, and NAK it. If @@ -2027,11 +2027,11 @@ sppp_lcp_RCR(struct sppp *sp, struct lcp_header *h, int len) /* Async control character map -- check to be zero. */ if (! p[2] && ! p[3] && ! p[4] && ! p[5]) { if (debug) - addlog("[empty] "); + log(-1, "[empty] "); continue; } if (debug) - addlog("[non-empty] "); + log(-1, "[non-empty] "); /* suggest a zero one */ p[2] = p[3] = p[4] = p[5] = 0; break; @@ -2043,7 +2043,7 @@ sppp_lcp_RCR(struct sppp *sp, struct lcp_header *h, int len) */ sp->lcp.their_mru = p[2] * 256 + p[3]; if (debug) - addlog("%lu ", sp->lcp.their_mru); + log(-1, "%lu ", sp->lcp.their_mru); continue; case LCP_OPT_AUTH_PROTO: @@ -2051,7 +2051,7 @@ sppp_lcp_RCR(struct sppp *sp, struct lcp_header *h, int len) if (sp->myauth.proto != authproto) { /* not agreed, nak */ if (debug) - addlog("[mine %s != his %s] ", + log(-1, "[mine %s != his %s] ", sppp_proto_name(sp->hisauth.proto), sppp_proto_name(authproto)); p[2] = sp->myauth.proto >> 8; @@ -2060,7 +2060,7 @@ sppp_lcp_RCR(struct sppp *sp, struct lcp_header *h, int len) } if (authproto == PPP_CHAP && p[4] != CHAP_MD5) { if (debug) - addlog("[chap not MD5] "); + log(-1, "[chap not MD5] "); p[4] = CHAP_MD5; break; } @@ -2074,19 +2074,19 @@ sppp_lcp_RCR(struct sppp *sp, struct lcp_header *h, int len) if (rlen) { if (++sp->fail_counter[IDX_LCP] >= sp->lcp.max_failure) { if (debug) - addlog(" max_failure (%d) exceeded, " + log(-1, " max_failure (%d) exceeded, " "send conf-rej\n", sp->lcp.max_failure); sppp_cp_send(sp, PPP_LCP, CONF_REJ, h->ident, rlen, buf); } else { if (debug) - addlog(" send conf-nak\n"); + log(-1, " send conf-nak\n"); sppp_cp_send (sp, PPP_LCP, CONF_NAK, h->ident, rlen, buf); } return 0; } else { if (debug) - addlog(" send conf-ack\n"); + log(-1, " send conf-ack\n"); sp->fail_counter[IDX_LCP] = 0; sp->pp_loopcnt = 0; sppp_cp_send (sp, PPP_LCP, CONF_ACK, @@ -2119,7 +2119,7 @@ sppp_lcp_RCN_rej(struct sppp *sp, struct lcp_header *h, int len) p = (void*) (h+1); for (; len > 1 && p[1]; len -= p[1], p += p[1]) { if (debug) - addlog(" %s ", sppp_lcp_opt_name(*p)); + log(-1, " %s ", sppp_lcp_opt_name(*p)); switch (*p) { case LCP_OPT_MAGIC: /* Magic number -- can't use it, use 0 */ @@ -2143,19 +2143,19 @@ sppp_lcp_RCN_rej(struct sppp *sp, struct lcp_header *h, int len) if ((sp->pp_flags & PP_CALLIN) == 0 && (sp->hisauth.flags & AUTHFLAG_NOCALLOUT) != 0) { if (debug) - addlog("[don't insist on auth " + log(-1, "[don't insist on auth " "for callout]"); sp->lcp.opts &= ~(1 << LCP_OPT_AUTH_PROTO); break; } if (debug) - addlog("[access denied]\n"); + log(-1, "[access denied]\n"); lcp.Close(sp); break; } } if (debug) - addlog("\n"); + log(-1, "\n"); free (buf, M_TEMP); return; } @@ -2183,7 +2183,7 @@ sppp_lcp_RCN_nak(struct sppp *sp, struct lcp_header *h, int len) p = (void*) (h+1); for (; len > 1 && p[1]; len -= p[1], p += p[1]) { if (debug) - addlog(" %s ", sppp_lcp_opt_name(*p)); + log(-1, " %s ", sppp_lcp_opt_name(*p)); switch (*p) { case LCP_OPT_MAGIC: /* Magic number -- renegotiate */ @@ -2198,7 +2198,7 @@ sppp_lcp_RCN_nak(struct sppp *sp, struct lcp_header *h, int len) */ if (magic == ~sp->lcp.magic) { if (debug) - addlog("magic glitch "); + log(-1, "magic glitch "); #if defined(__FreeBSD__) && __FreeBSD__ >= 3 sp->lcp.magic = random(); #else @@ -2207,7 +2207,7 @@ sppp_lcp_RCN_nak(struct sppp *sp, struct lcp_header *h, int len) } else { sp->lcp.magic = magic; if (debug) - addlog("%lu ", magic); + log(-1, "%lu ", magic); } } break; @@ -2220,7 +2220,7 @@ sppp_lcp_RCN_nak(struct sppp *sp, struct lcp_header *h, int len) if (len >= 4 && p[1] == 4) { u_int mru = p[2] * 256 + p[3]; if (debug) - addlog("%d ", mru); + log(-1, "%d ", mru); if (mru < PP_MTU || mru > PP_MAX_MRU) mru = PP_MTU; sp->lcp.mru = mru; @@ -2233,13 +2233,13 @@ sppp_lcp_RCN_nak(struct sppp *sp, struct lcp_header *h, int len) * deny. */ if (debug) - addlog("[access denied]\n"); + log(-1, "[access denied]\n"); lcp.Close(sp); break; } } if (debug) - addlog("\n"); + log(-1, "\n"); free (buf, M_TEMP); return; } @@ -2556,7 +2556,7 @@ sppp_ipcp_RCR(struct sppp *sp, struct lcp_header *h, int len) p = (void*) (h+1); for (rlen=0; len>1 && p[1]; len-=p[1], p+=p[1]) { if (debug) - addlog(" %s ", sppp_ipcp_opt_name(*p)); + log(-1, " %s ", sppp_ipcp_opt_name(*p)); switch (*p) { case IPCP_OPT_ADDRESS: if (len >= 6 && p[1] == 6) { @@ -2564,12 +2564,12 @@ sppp_ipcp_RCR(struct sppp *sp, struct lcp_header *h, int len) continue; } if (debug) - addlog("[invalid] "); + log(-1, "[invalid] "); break; default: /* Others not supported. */ if (debug) - addlog("[rej] "); + log(-1, "[rej] "); break; } /* Add the option to rejected list. */ @@ -2579,11 +2579,11 @@ sppp_ipcp_RCR(struct sppp *sp, struct lcp_header *h, int len) } if (rlen) { if (debug) - addlog(" send conf-rej\n"); + log(-1, " send conf-rej\n"); sppp_cp_send (sp, PPP_IPCP, CONF_REJ, h->ident, rlen, buf); return 0; } else if (debug) - addlog("\n"); + log(-1, "\n"); /* pass 2: parse option values */ sppp_get_ip_addrs(sp, 0, &hisaddr, 0); @@ -2594,7 +2594,7 @@ sppp_ipcp_RCR(struct sppp *sp, struct lcp_header *h, int len) len = origlen; for (rlen=0; len>1 && p[1]; len-=p[1], p+=p[1]) { if (debug) - addlog(" %s ", sppp_ipcp_opt_name(*p)); + log(-1, " %s ", sppp_ipcp_opt_name(*p)); switch (*p) { case IPCP_OPT_ADDRESS: /* This is the address he wants in his end */ @@ -2610,7 +2610,7 @@ sppp_ipcp_RCR(struct sppp *sp, struct lcp_header *h, int len) * it. */ if (debug) - addlog("%s [ack] ", + log(-1, "%s [ack] ", sppp_dotted_quad(hisaddr)); /* record that we've seen it already */ sp->ipcp.flags |= IPCP_HISADDR_SEEN; @@ -2626,9 +2626,9 @@ sppp_ipcp_RCR(struct sppp *sp, struct lcp_header *h, int len) */ if (debug) { if (desiredaddr == 0) - addlog("[addr requested] "); + log(-1, "[addr requested] "); else - addlog("%s [not agreed] ", + log(-1, "%s [not agreed] ", sppp_dotted_quad(desiredaddr)); } @@ -2663,16 +2663,16 @@ sppp_ipcp_RCR(struct sppp *sp, struct lcp_header *h, int len) buf[5] = hisaddr; rlen = 6; if (debug) - addlog("still need hisaddr "); + log(-1, "still need hisaddr "); } if (rlen) { if (debug) - addlog(" send conf-nak\n"); + log(-1, " send conf-nak\n"); sppp_cp_send (sp, PPP_IPCP, CONF_NAK, h->ident, rlen, buf); } else { if (debug) - addlog(" send conf-ack\n"); + log(-1, " send conf-ack\n"); sppp_cp_send (sp, PPP_IPCP, CONF_ACK, h->ident, origlen, h+1); } @@ -2704,7 +2704,7 @@ sppp_ipcp_RCN_rej(struct sppp *sp, struct lcp_header *h, int len) p = (void*) (h+1); for (; len > 1 && p[1]; len -= p[1], p += p[1]) { if (debug) - addlog(" %s ", sppp_ipcp_opt_name(*p)); + log(-1, " %s ", sppp_ipcp_opt_name(*p)); switch (*p) { case IPCP_OPT_ADDRESS: /* @@ -2717,7 +2717,7 @@ sppp_ipcp_RCN_rej(struct sppp *sp, struct lcp_header *h, int len) } } if (debug) - addlog("\n"); + log(-1, "\n"); free (buf, M_TEMP); return; } @@ -2746,7 +2746,7 @@ sppp_ipcp_RCN_nak(struct sppp *sp, struct lcp_header *h, int len) p = (void*) (h+1); for (; len > 1 && p[1]; len -= p[1], p += p[1]) { if (debug) - addlog(" %s ", sppp_ipcp_opt_name(*p)); + log(-1, " %s ", sppp_ipcp_opt_name(*p)); switch (*p) { case IPCP_OPT_ADDRESS: /* @@ -2759,7 +2759,7 @@ sppp_ipcp_RCN_nak(struct sppp *sp, struct lcp_header *h, int len) p[4] << 8 | p[5]; sp->ipcp.opts |= (1 << IPCP_OPT_ADDRESS); if (debug) - addlog("[wantaddr %s] ", + log(-1, "[wantaddr %s] ", sppp_dotted_quad(wantaddr)); /* * When doing dynamic address assignment, @@ -2772,7 +2772,7 @@ sppp_ipcp_RCN_nak(struct sppp *sp, struct lcp_header *h, int len) if (sp->ipcp.flags & IPCP_MYADDR_DYN) { sppp_set_ip_addr(sp, wantaddr); if (debug) - addlog("[agree] "); + log(-1, "[agree] "); sp->ipcp.flags |= IPCP_MYADDR_SEEN; } } @@ -2780,7 +2780,7 @@ sppp_ipcp_RCN_nak(struct sppp *sp, struct lcp_header *h, int len) } } if (debug) - addlog("\n"); + log(-1, "\n"); free (buf, M_TEMP); return; } @@ -2961,7 +2961,7 @@ sppp_chap_input(struct sppp *sp, struct mbuf *m) sppp_auth_type_name(PPP_CHAP, h->type), h->ident, ntohs(h->len)); sppp_print_bytes((u_char*) (h+1), len-4); - addlog(">\n"); + log(-1, ">\n"); } break; } @@ -2973,9 +2973,9 @@ sppp_chap_input(struct sppp *sp, struct mbuf *m) sppp_auth_type_name(PPP_CHAP, h->type), h->ident, ntohs(h->len)); sppp_print_string((char*) name, name_len); - addlog(" value-size=%d value=", value_len); + log(-1, " value-size=%d value=", value_len); sppp_print_bytes(value, value_len); - addlog(">\n"); + log(-1, ">\n"); } /* Compute reply value. */ @@ -3000,10 +3000,10 @@ sppp_chap_input(struct sppp *sp, struct mbuf *m) log(LOG_DEBUG, SPP_FMT "chap success", SPP_ARGS(ifp)); if (len > 4) { - addlog(": "); + log(-1, ": "); sppp_print_string((char*)(h + 1), len - 4); } - addlog("\n"); + log(-1, "\n"); } x = splimp(); sp->pp_flags &= ~PP_NEEDAUTH; @@ -3027,10 +3027,10 @@ sppp_chap_input(struct sppp *sp, struct mbuf *m) log(LOG_INFO, SPP_FMT "chap failure", SPP_ARGS(ifp)); if (len > 4) { - addlog(": "); + log(-1, ": "); sppp_print_string((char*)(h + 1), len - 4); } - addlog("\n"); + log(-1, "\n"); } else log(LOG_INFO, SPP_FMT "chap failure\n", SPP_ARGS(ifp)); @@ -3052,7 +3052,7 @@ sppp_chap_input(struct sppp *sp, struct mbuf *m) sppp_auth_type_name(PPP_CHAP, h->type), h->ident, ntohs(h->len)); sppp_print_bytes((u_char*)(h+1), len-4); - addlog(">\n"); + log(-1, ">\n"); } break; } @@ -3070,10 +3070,10 @@ sppp_chap_input(struct sppp *sp, struct mbuf *m) log(LOG_INFO, SPP_FMT "chap response, his name ", SPP_ARGS(ifp)); sppp_print_string(name, name_len); - addlog(" != expected "); + log(-1, " != expected "); sppp_print_string(sp->hisauth.name, sppp_strnlen(sp->hisauth.name, AUTHNAMELEN)); - addlog("\n"); + log(-1, "\n"); } if (debug) { log(LOG_DEBUG, SPP_FMT "chap input(%s) " @@ -3083,9 +3083,9 @@ sppp_chap_input(struct sppp *sp, struct mbuf *m) sppp_auth_type_name(PPP_CHAP, h->type), h->ident, ntohs (h->len)); sppp_print_string((char*)name, name_len); - addlog(" value-size=%d value=", value_len); + log(-1, " value-size=%d value=", value_len); sppp_print_bytes(value, value_len); - addlog(">\n"); + log(-1, ">\n"); } if (value_len != AUTHKEYLEN) { if (debug) @@ -3137,7 +3137,7 @@ sppp_chap_input(struct sppp *sp, struct mbuf *m) sppp_state_name(sp->state[IDX_CHAP]), h->type, h->ident, ntohs(h->len)); sppp_print_bytes((u_char*)(h+1), len-4); - addlog(">\n"); + log(-1, ">\n"); } break; @@ -3244,9 +3244,9 @@ sppp_chap_tlu(struct sppp *sp) SPP_ARGS(ifp), sp->pp_phase == PHASE_NETWORK? "reconfirmed": "tlu"); if ((sp->hisauth.flags & AUTHFLAG_NORECHALLENGE) == 0) - addlog("next re-challenge in %d seconds\n", i); + log(-1, "next re-challenge in %d seconds\n", i); else - addlog("re-challenging supressed\n"); + log(-1, "re-challenging supressed\n"); } x = splimp(); @@ -3368,7 +3368,7 @@ sppp_pap_input(struct sppp *sp, struct mbuf *m) sppp_auth_type_name(PPP_PAP, h->type), h->ident, ntohs(h->len)); sppp_print_bytes((u_char*)(h+1), len-4); - addlog(">\n"); + log(-1, ">\n"); } break; } @@ -3380,9 +3380,9 @@ sppp_pap_input(struct sppp *sp, struct mbuf *m) sppp_auth_type_name(PPP_PAP, h->type), h->ident, ntohs(h->len)); sppp_print_string((char*)name, name_len); - addlog(" passwd="); + log(-1, " passwd="); sppp_print_string((char*)passwd, passwd_len); - addlog(">\n"); + log(-1, ">\n"); } if (name_len > AUTHNAMELEN || passwd_len > AUTHKEYLEN || @@ -3420,10 +3420,10 @@ sppp_pap_input(struct sppp *sp, struct mbuf *m) SPP_ARGS(ifp)); name_len = *((char *)h); if (len > 5 && name_len) { - addlog(": "); + log(-1, ": "); sppp_print_string((char*)(h+1), name_len); } - addlog("\n"); + log(-1, "\n"); } x = splimp(); sp->pp_flags &= ~PP_NEEDAUTH; @@ -3449,10 +3449,10 @@ sppp_pap_input(struct sppp *sp, struct mbuf *m) SPP_ARGS(ifp)); name_len = *((char *)h); if (len > 5 && name_len) { - addlog(": "); + log(-1, ": "); sppp_print_string((char*)(h+1), name_len); } - addlog("\n"); + log(-1, "\n"); } else log(LOG_INFO, SPP_FMT "pap failure\n", SPP_ARGS(ifp)); @@ -3467,7 +3467,7 @@ sppp_pap_input(struct sppp *sp, struct mbuf *m) SPP_ARGS(ifp), h->type, h->ident, ntohs(h->len)); sppp_print_bytes((u_char*)(h+1), len-4); - addlog(">\n"); + log(-1, ">\n"); } break; @@ -3696,7 +3696,7 @@ sppp_auth_send(const struct cp *cp, struct sppp *sp, sppp_auth_type_name(cp->proto, lh->type), lh->ident, ntohs(lh->len)); sppp_print_bytes((u_char*) (lh+1), len); - addlog(">\n"); + log(-1, ">\n"); } if (! IF_HANDOFF_ADJ(&sp->pp_cpq, m, ifp, 3)) ifp->if_oerrors++; @@ -4149,7 +4149,7 @@ static void sppp_print_bytes(const u_char *p, u_short len) { if (len) - addlog(" %*D", len, p, "-"); + log(-1, " %*D", len, p, "-"); } static void @@ -4163,9 +4163,9 @@ sppp_print_string(const char *p, u_short len) * Print only ASCII chars directly. RFC 1994 recommends * using only them, but we don't rely on it. */ if (c < ' ' || c > '~') - addlog("\\x%x", c); + log(-1, "\\x%x", c); else - addlog("%c", c); + log(-1, "%c", c); } } diff --git a/sys/sys/systm.h b/sys/sys/systm.h index 55b2a22..de83697 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -104,10 +104,9 @@ void *phashinit __P((int count, struct malloc_type *type, u_long *nentries)); void cpu_boot __P((int)); void cpu_rootconf __P((void)); void tablefull __P((const char *)); -int addlog __P((const char *, ...)) __printflike(1, 2); int kvprintf __P((char const *, void (*)(int, void*), void *, int, _BSD_VA_LIST_)) __printflike(1, 0); -int log __P((int, const char *, ...)) __printflike(2, 3); +void log __P((int, const char *, ...)) __printflike(2, 3); void logwakeup __P((void)); int printf __P((const char *, ...)) __printflike(1, 2); int snprintf __P((char *, size_t, const char *, ...)) __printflike(3, 4); |