]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lwip.git/commitdiff
Added debug output and missing casts
authorgoldsimon <goldsimon>
Mon, 22 Feb 2010 17:49:49 +0000 (17:49 +0000)
committergoldsimon <goldsimon>
Mon, 22 Feb 2010 17:49:49 +0000 (17:49 +0000)
src/netif/ppp/auth.c
src/netif/ppp/chap.c
src/netif/ppp/ipcp.c
src/netif/ppp/lcp.c
src/netif/ppp/pap.c

index 0d722bf2c57fe945b06e8882ffde7692ef6fd956..b751a60bd39de18f7110b7608f9c7f99e6f00f15 100644 (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);
index 0003c0cc2cc8af9a5fbdb3fa3f9a77bed26d915d..8a12ba6977040a3823f6c5bc2aa488e699de8416 100644 (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);
index d49fe90d15b42345e016212c534185047ec629a9..bf7039692831a5599867f237386035815efa1f11 100644 (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);
index 04f0ab56d1ff0aa41cf8be210fc8c5c0b2ca924b..4e50ee7d2b9185a16bc36e1c3e346b3dddd9a308 100644 (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;
   }
index c0620cb3597c283627e1e4161e28b08a18cd9dcc..197af71360d5120bfec5f47055178b758e9bb56b 100644 (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) {