]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/main.c
pppoe plugin stuff - Michal Ostrowski's version, lightly hacked
[ppp.git] / pppd / main.c
index a6f4e06d6274ff721d2b3b4517167f5ba1385db6..a09590e9509341cb33cc6955f1163b8c8a5b6e50 100644 (file)
@@ -17,7 +17,7 @@
  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
-#define RCSID  "$Id: main.c,v 1.104 2001/03/09 00:55:14 paulus Exp $"
+#define RCSID  "$Id: main.c,v 1.107 2001/05/23 03:39:13 paulus Exp $"
 
 #include <stdio.h>
 #include <ctype.h>
@@ -453,7 +453,7 @@ main(argc, argv)
 
        /* set up the serial device as a ppp interface */
        tdb_writelock(pppdb);
-       fd_ppp = establish_ppp(devfd);
+       fd_ppp = the_channel->establish_ppp(devfd);
        if (fd_ppp < 0) {
            tdb_writeunlock(pppdb);
            status = EXIT_FATAL_ERROR;
@@ -468,7 +468,10 @@ main(argc, argv)
         * Start opening the connection and wait for
         * incoming events (reply, timeout, etc.).
         */
-       notice("Connect: %s <--> %s", ifname, ppp_devnam);
+       if (ifunit >= 0)
+               notice("Connect: %s <--> %s", ifname, ppp_devnam);
+       else
+               notice("Starting negotiation on %s", ppp_devnam);
        gettimeofday(&start_time, NULL);
        link_stats_valid = 0;
        script_unsetenv("CONNECT_TIME");
@@ -499,7 +502,7 @@ main(argc, argv)
        if (link_stats_valid) {
            int t = (link_connect_time + 5) / 6;    /* 1/10ths of minutes */
            info("Connect time %d.%d minutes.", t/10, t%10);
-           info("Sent %d bytes, received %d bytes.",
+           info("Sent %u bytes, received %u bytes.",
                 link_stats.bytes_out, link_stats.bytes_in);
        }
 
@@ -522,9 +525,7 @@ main(argc, argv)
         */
        remove_fd(fd_ppp);
        clean_check();
-       if (demand)
-           restore_loop();
-       disestablish_ppp(devfd);        /* XXX */
+       the_channel->disestablish_ppp(devfd);
        fd_ppp = -1;
        if (!hungup)
            lcp_lowerdown(0);
@@ -944,14 +945,13 @@ get_input()
        return;
     }
 
-    if (debug /*&& (debugflags & DBG_INPACKET)*/)
-       dbglog("rcvd %P", p, len);
-
     if (len < PPP_HDRLEN) {
-       MAINDEBUG(("io(): Received short packet."));
+       dbglog("received short packet:%.*B", len, p);
        return;
     }
 
+    dump_packet("rcvd", p, len);
+
     p += 2;                            /* Skip address and control */
     GETSHORT(protocol, p);
     len -= PPP_HDRLEN;
@@ -1037,7 +1037,7 @@ cleanup()
     sys_cleanup();
 
     if (fd_ppp >= 0)
-       disestablish_ppp(devfd);
+       the_channel->disestablish_ppp(devfd);
     if (the_channel->cleanup)
        (*the_channel->cleanup)();
 
@@ -1089,9 +1089,6 @@ static struct timeval timenow;            /* Current time */
 
 /*
  * timeout - Schedule a timeout.
- *
- * Note that this timeout takes the number of milliseconds, NOT hz (as in
- * the kernel).
  */
 void
 timeout(func, arg, secs, usecs)
@@ -1100,10 +1097,10 @@ timeout(func, arg, secs, usecs)
     int secs, usecs;
 {
     struct callout *newp, *p, **pp;
-  
+
     MAINDEBUG(("Timeout %p:%p in %d.%03d seconds.", func, arg,
-              time / 1000, time % 1000));
-  
+              secs, usecs/1000));
+
     /*
      * Allocate timeout.
      */