Added debug output and missing casts

This commit is contained in:
goldsimon 2010-02-22 17:49:49 +00:00
parent 402597c2cb
commit ea78d69c6d
5 changed files with 16 additions and 12 deletions

View File

@ -605,7 +605,7 @@ auth_peer_success(int unit, u16_t protocol, char *name, int namelen)
/*
* Save the authenticated name of the peer for later.
*/
if (namelen > sizeof(peer_authname) - 1) {
if (namelen > (int)sizeof(peer_authname) - 1) {
namelen = sizeof(peer_authname) - 1;
}
BCOPY(name, peer_authname, namelen);

View File

@ -452,7 +452,7 @@ ChapReceiveChallenge(chap_state *cstate, u_char *inp, u_char id, int len)
rchallenge = inp;
INCPTR(rchallenge_len, inp);
if (len >= sizeof(rhostname)) {
if (len >= (int)sizeof(rhostname)) {
len = sizeof(rhostname) - 1;
}
BCOPY(inp, rhostname, len);
@ -571,7 +571,7 @@ ChapReceiveResponse(chap_state *cstate, u_char *inp, int id, int len)
UNTIMEOUT(ChapChallengeTimeout, cstate);
if (len >= sizeof(rhostname)) {
if (len >= (int)sizeof(rhostname)) {
len = sizeof(rhostname) - 1;
}
BCOPY(inp, rhostname, len);

View File

@ -76,8 +76,9 @@ ipcp_options ipcp_allowoptions[NUM_PPP]; /* Options we allow peer to request */
ipcp_options ipcp_hisoptions[NUM_PPP]; /* Options that we ack'd */
/* local vars */
static int cis_received[NUM_PPP]; /* # Conf-Reqs received */
static int default_route_set[NUM_PPP]; /* Have set up a default route */
static int cis_received[NUM_PPP]; /* # Conf-Reqs received */
/*
* Callbacks for fsm code. (CI = Configuration Information)
@ -525,7 +526,7 @@ ipcp_ackci(fsm *f, u_char *p, int len)
goto bad;
}
return (1);
bad:
IPCPDEBUG((LOG_INFO, "ipcp_ackci: received bad Ack!\n"));
return (0);

View File

@ -242,7 +242,7 @@ lcp_init(int unit)
fsm *f = &lcp_fsm[unit];
lcp_options *wo = &lcp_wantoptions[unit];
lcp_options *ao = &lcp_allowoptions[unit];
f->unit = unit;
f->protocol = PPP_LCP;
f->callbacks = &lcp_callbacks;
@ -449,7 +449,7 @@ lcp_rprotrej(fsm *f, u_char *inp, int len)
struct protent *protp;
u_short prot;
if (len < sizeof (u_short)) {
if (len < (int)sizeof (u_short)) {
LCPDEBUG((LOG_INFO, "lcp_rprotrej: Rcvd short Protocol-Reject packet!\n"));
return;
}

View File

@ -218,6 +218,7 @@ upap_timeout(void *arg)
u->us_unit, u->us_timeouttime, u->us_clientstate));
if (u->us_clientstate != UPAPCS_AUTHREQ) {
UPAPDEBUG((LOG_INFO, "upap_timeout: not in AUTHREQ state!\n"));
return;
}
@ -342,14 +343,14 @@ upap_input(int unit, u_char *inpacket, int l)
* If packet too short, drop it.
*/
inp = inpacket;
if (l < UPAP_HEADERLEN) {
if (l < (int)UPAP_HEADERLEN) {
UPAPDEBUG((LOG_INFO, "pap_input: rcvd short header.\n"));
return;
}
GETCHAR(code, inp);
GETCHAR(id, inp);
GETSHORT(len, inp);
if (len < UPAP_HEADERLEN) {
if (len < (int)UPAP_HEADERLEN) {
UPAPDEBUG((LOG_INFO, "pap_input: rcvd illegal length.\n"));
return;
}
@ -376,6 +377,7 @@ upap_input(int unit, u_char *inpacket, int l)
break;
default: /* XXX Need code reject */
UPAPDEBUG((LOG_INFO, "pap_input: UNHANDLED default: code: %d, id: %d, len: %d.\n", code, id, len));
break;
}
}
@ -415,7 +417,7 @@ upap_rauthreq(upap_state *u, u_char *inp, u_char id, int len)
/*
* Parse user/passwd.
*/
if (len < sizeof (u_char)) {
if (len < (int)sizeof (u_char)) {
UPAPDEBUG((LOG_INFO, "pap_rauth: rcvd short packet.\n"));
return;
}
@ -471,13 +473,14 @@ upap_rauthack(upap_state *u, u_char *inp, int id, int len)
UPAPDEBUG((LOG_INFO, "pap_rauthack: Rcvd id %d s=%d\n", id, u->us_clientstate));
if (u->us_clientstate != UPAPCS_AUTHREQ) { /* XXX */
UPAPDEBUG((LOG_INFO, "pap_rauthack: us_clientstate != UPAPCS_AUTHREQ\n"));
return;
}
/*
* Parse message.
*/
if (len < sizeof (u_char)) {
if (len < (int)sizeof (u_char)) {
UPAPDEBUG((LOG_INFO, "pap_rauthack: ignoring missing msg-length.\n"));
} else {
GETCHAR(msglen, inp);
@ -519,7 +522,7 @@ upap_rauthnak(upap_state *u, u_char *inp, int id, int len)
* Parse message.
*/
if (len < sizeof (u_char)) {
UPAPDEBUG((LOG_INFO, "pap_rauthnak: rcvd short packet.\n"));
UPAPDEBUG((LOG_INFO, "pap_rauthnak: ignoring missing msg-length.\n"));
} else {
GETCHAR(msglen, inp);
if(msglen > 0) {