From owner-freebsd-hackers Mon Feb 27 23:39:26 1995 Return-Path: hackers-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.9/8.6.6) id XAA09071 for hackers-outgoing; Mon, 27 Feb 1995 23:39:26 -0800 Received: from vmbb.cts.com (vmbb.cts.com [192.188.72.18]) by freefall.cdrom.com (8.6.9/8.6.6) with SMTP id XAA09063 for ; Mon, 27 Feb 1995 23:39:22 -0800 Received: from io.cts.com by vmbb.cts.com with smtp (Smail3.1.28.1 #9) id m0rjMVo-0000V5C; Mon, 27 Feb 95 23:38 PST Received: (from root@localhost) by io.cts.com (8.6.9/8.6.9) id XAA05665; Mon, 27 Feb 1995 23:27:33 -0800 From: Morgan Davis Message-Id: <199502280727.XAA05665@io.cts.com> Subject: Re: pppd inactivity timeout? To: julian@tfs.com (Julian Elischer) Date: Mon, 27 Feb 1995 23:27:32 -0800 (PST) Cc: tom@haven.uniserve.com, hackers@FreeBSD.org In-Reply-To: from "Julian Elischer" at Feb 27, 95 00:30:58 am X-Mailer: ELM [version 2.4 PL23] Content-Type: text Content-Length: 863 Sender: hackers-owner@FreeBSD.org Precedence: bulk Julian Elischer writes: > > >This will use a lot of cputime.. a better way would be to call > timeout every 10 seconds or minute while the line is up, and > have it decrement a counter.. if it reaches 0, you hang up. > if not you just schedule another timeout.. > whenever you receive or send a packet, you just set the counter > back to initial condition (maximum count).. > that way you're doing a single write, not a whole function call(x2) > for each packet. How do netstat and pppstat get their information? Isn't there a counter somewhere in the kernel that keeps track of how many bytes were sent and received? If so, the task is even easier. Set an alarm to call a function once every so often (user-defined) and see if the sent/received counts match. If so, poof -- blow the connection off. If they're different, do nothing and reset the alarm.