+#ifdef _linux_
+static void IdleTimeCheck __P((caddr_t));
+
+/*
+ * Timer expired for the LCP echo requests from this process.
+ */
+
+static void
+RestartIdleTimer (f)
+ fsm *f;
+{
+ u_long delta;
+ struct ppp_ddinfo ddinfo;
+ u_long latest;
+/*
+ * Read the time since the last packet was received.
+ */
+ if (ioctl (fd, PPPIOCGTIME, &ddinfo) < 0) {
+ syslog (LOG_ERR, "ioctl(PPPIOCGTIME): %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.
+ */
+ 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");
+ lcp_close(f->unit); /* Reset connection */
+ phase = PHASE_TERMINATE; /* Mark it down */
+ } else {
+ delta = (delta + HZ - 1) / HZ;
+ if (delta == 0)
+ delta = (u_long) idle_time_limit;
+ assert (idle_timer_running==0);
+ TIMEOUT (IdleTimeCheck, (caddr_t) f, delta);
+ idle_timer_running = 1;
+ }
+}
+
+/*
+ * IdleTimeCheck - Timer expired on the IDLE detection for IP frames
+ */
+
+static void
+IdleTimeCheck (arg)
+ caddr_t arg;
+{
+ if (idle_timer_running != 0) {
+ idle_timer_running = 0;
+ RestartIdleTimer ((fsm *) arg);
+ }
+}
+#endif