From: Paul Mackerras Date: Fri, 30 Jun 1995 01:47:17 +0000 (+0000) Subject: Mods to Linux code from Al Longyear: use ppp_idle instead of X-Git-Tag: RELEASE_2_3_6~654 X-Git-Url: http://git.ozlabs.org/?p=ppp.git;a=commitdiff_plain;h=d999c23548f44ff477c29d66eda18e1c787ecbe9 Mods to Linux code from Al Longyear: use ppp_idle instead of ppp_ddinfo, etc. --- diff --git a/pppd/Makefile.linux b/pppd/Makefile.linux index 2d55009..507f89c 100644 --- a/pppd/Makefile.linux +++ b/pppd/Makefile.linux @@ -1,9 +1,9 @@ # # 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 \ @@ -34,6 +34,7 @@ CFLAGS = $(COPTS) $(DEBUG_FLAGS) $(COMPILE_FLAGS) 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 diff --git a/pppd/lcp.c b/pppd/lcp.c index af48e9c..74a3235 100644 --- a/pppd/lcp.c +++ b/pppd/lcp.c @@ -18,7 +18,7 @@ */ #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 /* @@ -232,32 +232,25 @@ RestartIdleTimer (f) 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. */ - 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); } -/* - * 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 - * 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 { - 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); @@ -1671,43 +1664,36 @@ static void LcpEchoCheck (f) fsm *f; { - u_int32_t delta; + long int delta; #ifdef __linux__ - struct ppp_ddinfo ddinfo; - u_int32_t latest; + struct ppp_idle ddinfo; /* * 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); } -/* - * 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. */ - 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); - delta = lcp_echo_interval * HZ; + delta = (int) lcp_echo_interval; } - delta /= HZ; #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); - TIMEOUT (LcpEchoTimeout, (caddr_t) f, delta); + TIMEOUT (LcpEchoTimeout, (caddr_t) f, (u_int32_t) delta); lcp_echo_timer_running = 1; } diff --git a/pppd/sys-linux.c b/pppd/sys-linux.c index 455d74a..335f8a1 100644 --- a/pppd/sys-linux.c +++ b/pppd/sys-linux.c @@ -43,7 +43,7 @@ #include #include #include -#include +#include #include #include