]> git.ozlabs.org Git - ppp.git/commitdiff
Mods to Linux code from Al Longyear: use ppp_idle instead of
authorPaul Mackerras <paulus@samba.org>
Fri, 30 Jun 1995 01:47:17 +0000 (01:47 +0000)
committerPaul Mackerras <paulus@samba.org>
Fri, 30 Jun 1995 01:47:17 +0000 (01:47 +0000)
ppp_ddinfo, etc.

pppd/Makefile.linux
pppd/lcp.c
pppd/sys-linux.c

index 2d550094632f45ca41ffef28464d98622e83fcb1..507f89c6d7efde95795152077ac421cb62a70eea 100644 (file)
@@ -1,9 +1,9 @@
 #
 # pppd makefile for Linux
 #
 # pppd makefile for Linux
-# $Id: Makefile.linux,v 1.7 1995/06/12 11:37:02 paulus Exp $
+# $Id: Makefile.linux,v 1.8 1995/06/30 01:47:13 paulus Exp $
 #
 
 #
 
-BINDIR = /usr/etc
+BINDIR = /usr/lib/ppp
 MANDIR = /usr/man
 
 PPPDSRCS = main.c magic.c fsm.c lcp.c ipcp.c upap.c chap.c md5.c ccp.c \
 MANDIR = /usr/man
 
 PPPDSRCS = main.c magic.c fsm.c lcp.c ipcp.c upap.c chap.c md5.c ccp.c \
@@ -34,6 +34,7 @@ CFLAGS = $(COPTS) $(DEBUG_FLAGS) $(COMPILE_FLAGS)
 SOURCE= RELNOTES Makefile.linux $(PPPDSRCS) $(HEADERS) $(MANPAGES)
 
 install: pppd
 SOURCE= RELNOTES Makefile.linux $(PPPDSRCS) $(HEADERS) $(MANPAGES)
 
 install: pppd
+       mkdir -p $(BINDIR)
        install -c -m 4555 -o root pppd $(BINDIR)/pppd
        install -c -m 555 -o root pppd.8 $(MANDIR)/man8
 
        install -c -m 4555 -o root pppd $(BINDIR)/pppd
        install -c -m 555 -o root pppd.8 $(MANDIR)/man8
 
index af48e9c58a628961042928da73df28f70aef9694..74a3235cc0c552fff070981152cc2fcfced3f68f 100644 (file)
@@ -18,7 +18,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char rcsid[] = "$Id: lcp.c,v 1.19 1995/05/19 03:25:16 paulus Exp $";
+static char rcsid[] = "$Id: lcp.c,v 1.20 1995/06/30 01:47:15 paulus Exp $";
 #endif
 
 /*
 #endif
 
 /*
@@ -232,32 +232,25 @@ RestartIdleTimer (f)
     fsm *f;
 {
     u_long             delta;
     fsm *f;
 {
     u_long             delta;
-    struct ppp_ddinfo  ddinfo;
-    u_long             latest;
+    struct ppp_idle    ddinfo;
 /*
  * Read the time since the last packet was received.
  */
 /*
  * Read the time since the last packet was received.
  */
-    if (ioctl (fd, PPPIOCGTIME, &ddinfo) < 0) {
-        syslog (LOG_ERR, "ioctl(PPPIOCGTIME): %m");
+    if (ioctl (fd, PPPIOCGIDLE, &ddinfo) < 0) {
+        syslog (LOG_ERR, "ioctl(PPPIOCGIDLE): %m");
         die (1);
     }
         die (1);
     }
-/*
- * Choose the most recient IP activity. It may be a read or write frame
- */
-    latest = ddinfo.ip_sjiffies < ddinfo.ip_rjiffies ? ddinfo.ip_sjiffies
-                                                     : ddinfo.ip_rjiffies;
 /*
  * Compute the time since the last packet was received. If the timer
 /*
  * Compute the time since the last packet was received. If the timer
- *  has expired then send the echo request and reset the timer to maximum.
+ *  has expired then disconnect the line.
  */
  */
-    delta = (idle_time_limit * HZ) - latest;
-    if (((int) delta < HZ || (int) latest < 0L) && f->state == OPENED) {
-        syslog (LOG_NOTICE, "No IP frames exchanged within idle time limit");
+    delta = idle_time_limit - (u_long) ddinfo.recv_idle;
+    if (((int) delta <= 0L) && (f->state == OPENED)) {
+        syslog (LOG_NOTICE, "No IP frames received within idle time limit");
        lcp_close(f->unit);             /* Reset connection */
        phase = PHASE_TERMINATE;        /* Mark it down */
     } else {
        lcp_close(f->unit);             /* Reset connection */
        phase = PHASE_TERMINATE;        /* Mark it down */
     } else {
-        delta = (delta + HZ - 1) / HZ;
-        if (delta == 0)
+        if ((int) delta <= 0L)
            delta = (u_long) idle_time_limit;
         assert (idle_timer_running==0);
         TIMEOUT (IdleTimeCheck, (caddr_t) f, delta);
            delta = (u_long) idle_time_limit;
         assert (idle_timer_running==0);
         TIMEOUT (IdleTimeCheck, (caddr_t) f, delta);
@@ -1671,43 +1664,36 @@ static void
 LcpEchoCheck (f)
     fsm *f;
 {
 LcpEchoCheck (f)
     fsm *f;
 {
-    u_int32_t delta;
+    long int delta;
 #ifdef __linux__
 #ifdef __linux__
-    struct ppp_ddinfo ddinfo;
-    u_int32_t latest;
+    struct ppp_idle    ddinfo;
 /*
  * Read the time since the last packet was received.
  */
 /*
  * Read the time since the last packet was received.
  */
-    if (ioctl (fd, PPPIOCGTIME, &ddinfo) < 0) {
-        syslog (LOG_ERR, "ioctl(PPPIOCGTIME): %m");
+    if (ioctl (fd, PPPIOCGIDLE, &ddinfo) < 0) {
+        syslog (LOG_ERR, "ioctl(PPPIOCGIDLE): %m");
         die (1);
     }
         die (1);
     }
-/*
- * Choose the most recient frame received. It may be an IP or NON-IP frame.
- */
-    latest = ddinfo.nip_rjiffies < ddinfo.ip_rjiffies ? ddinfo.nip_rjiffies
-                                                      : ddinfo.ip_rjiffies;
 /*
  * Compute the time since the last packet was received. If the timer
  *  has expired then send the echo request and reset the timer to maximum.
  */
 /*
  * Compute the time since the last packet was received. If the timer
  *  has expired then send the echo request and reset the timer to maximum.
  */
-    delta = (lcp_echo_interval * HZ) - latest;
-    if (delta < HZ || latest < 0L) {
+    delta = (long int) lcp_echo_interval - (long int) ddinfo.recv_idle;
+    if (delta < 0L) {
         LcpSendEchoRequest (f);
         LcpSendEchoRequest (f);
-        delta = lcp_echo_interval * HZ;
+        delta = (int) lcp_echo_interval;
     }
     }
-    delta /= HZ;
 
 #else /* Other implementations do not have ability to find delta */
     LcpSendEchoRequest (f);
 
 #else /* Other implementations do not have ability to find delta */
     LcpSendEchoRequest (f);
-    delta = lcp_echo_interval;
+    delta = (int) lcp_echo_interval;
 #endif
 
 /*
  * Start the timer for the next interval.
  */
     assert (lcp_echo_timer_running==0);
 #endif
 
 /*
  * Start the timer for the next interval.
  */
     assert (lcp_echo_timer_running==0);
-    TIMEOUT (LcpEchoTimeout, (caddr_t) f, delta);
+    TIMEOUT (LcpEchoTimeout, (caddr_t) f, (u_int32_t) delta);
     lcp_echo_timer_running = 1;
 }
 
     lcp_echo_timer_running = 1;
 }
 
index 455d74a7e764eeadf17f007b0a892b4ec2b6b693..335f8a15325fd260b4c624a6e054baa64724db78 100644 (file)
@@ -43,7 +43,7 @@
 #include <net/ppp_defs.h>
 #include <net/if_arp.h>
 #include <net/if_ppp.h>
 #include <net/ppp_defs.h>
 #include <net/if_arp.h>
 #include <net/if_ppp.h>
-#include <net/if_route.h>
+#include <net/route.h>
 #include <linux/if_ether.h>
 #include <netinet/in.h>
 
 #include <linux/if_ether.h>
 #include <netinet/in.h>