]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/lcp.c
Added log messages for LCP Identification, Time-Remaining, and other
[ppp.git] / pppd / lcp.c
index 23f69fe5f0360a10f7c1b34a16b90da19037cf4a..e70dcec525507b9ddcfba06542941f8bcca24619 100644 (file)
@@ -40,7 +40,7 @@
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#define RCSID  "$Id: lcp.c,v 1.74 2004/11/13 02:28:15 paulus Exp $"
+#define RCSID  "$Id: lcp.c,v 1.75 2004/11/14 22:53:42 carlsonj Exp $"
 
 /*
  * TODO:
@@ -494,7 +494,6 @@ lcp_input(unit, p, len)
     fsm_input(f, p, len);
 }
 
-
 /*
  * lcp_extcode - Handle a LCP-specific code.
  */
@@ -525,6 +524,8 @@ lcp_extcode(f, code, id, inp, len)
        break;
 
     case DISCREQ:
+    case IDENTIF:
+    case TIMEREM:
        break;
 
     default:
@@ -548,6 +549,7 @@ lcp_rprotrej(f, inp, len)
     int i;
     struct protent *protp;
     u_short prot;
+    const char *pname;
 
     if (len < 2) {
        LCPDEBUG(("lcp_rprotrej: Rcvd short Protocol-Reject packet!"));
@@ -565,16 +567,27 @@ lcp_rprotrej(f, inp, len)
        return;
     }
 
+    pname = protocol_name(prot);
+
     /*
      * Upcall the proper Protocol-Reject routine.
      */
     for (i = 0; (protp = protocols[i]) != NULL; ++i)
        if (protp->protocol == prot && protp->enabled_flag) {
+           if (pname == NULL)
+               dbglog("Protocol-Reject for 0x%x received", prot);
+           else
+               dbglog("Protocol-Reject for '%s' (0x%x) received", pname,
+                      prot);
            (*protp->protrej)(f->unit);
            return;
        }
 
-    warn("Protocol-Reject for unsupported protocol 0x%x", prot);
+    if (pname == NULL)
+       warn("Protocol-Reject for unsupported protocol 0x%x", prot);
+    else
+       warn("Protocol-Reject for unsupported protocol '%s' (0x%x)", pname,
+            prot);
 }
 
 
@@ -1964,7 +1977,8 @@ lcp_finished(f)
 static char *lcp_codenames[] = {
     "ConfReq", "ConfAck", "ConfNak", "ConfRej",
     "TermReq", "TermAck", "CodeRej", "ProtRej",
-    "EchoReq", "EchoRep", "DiscReq"
+    "EchoReq", "EchoRep", "DiscReq", "Ident",
+    "TimeRem"
 };
 
 static int
@@ -2168,10 +2182,31 @@ lcp_printpkt(p, plen, printer, arg)
        if (len >= 4) {
            GETLONG(cilong, p);
            printer(arg, " magic=0x%x", cilong);
-           p += 4;
            len -= 4;
        }
        break;
+
+    case IDENTIF:
+    case TIMEREM:
+       if (len >= 4) {
+           GETLONG(cilong, p);
+           printer(arg, " magic=0x%x", cilong);
+           len -= 4;
+       }
+       if (code == TIMEREM) {
+           if (len < 4)
+               break;
+           GETLONG(cilong, p);
+           printer(arg, " seconds=%u", cilong);
+           len -= 4;
+       }
+       if (len > 0) {
+           printer(arg, " ");
+           print_string((char *)p, len, printer, arg);
+           p += len;
+           len = 0;
+       }
+       break;
     }
 
     /* print the rest of the bytes in the packet */