From owner-freebsd-bugs Mon Jan 10 3:51:11 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 4F11F14F0B for ; Mon, 10 Jan 2000 03:50:02 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id DAA94749; Mon, 10 Jan 2000 03:50:02 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: by hub.freebsd.org (Postfix, from userid 32767) id 50CEF14C48; Mon, 10 Jan 2000 03:43:06 -0800 (PST) Message-Id: <20000110114306.50CEF14C48@hub.freebsd.org> Date: Mon, 10 Jan 2000 03:43:06 -0800 (PST) From: pherman@piro.net To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: kern/16023: Add an idletime counter for sppp, just like ppp has Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 16023 >Category: kern >Synopsis: Add an idletime counter for sppp, just like ppp has >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Mon Jan 10 03:50:01 PST 2000 >Closed-Date: >Last-Modified: >Originator: Paul Herman >Release: 4.0 current >Organization: >Environment: n/a >Description: Hi, I'd like an idle time counter in sppp, just like ppp has. The reason for this is that i4b incorectly counts LCP control packets (like LCP Echo-Request, and LCP Echo-Response) incorectly as "active" packets. This can result in an idle PPP connection (no TCP/IP packets) which stays indefinately open. This is, of course, and i4b problem; However, to properly impliment a fix for this, an idletime mechanism is required in the sppp stack. I stole the idea from ppp, and should be completely harmless -- I tested them on 3.3-stable with no problems. I'd be happy if the powers that be could commit the patches below against 4.0-current. :) Thanks! -Paul >How-To-Repeat: The i4b problem can be repeated by just connecting (via ISDN) to a PPP Server which decides to send contiunous LCP Packets in the background, ...but again this is not an sppp problem, but i4b that should (will) be fixed later with the help of this patch. >Fix: Patches (patched against 4.0-current): ******** CUT HERE *********** --- src/sbin/spppcontrol/spppcontrol.c Mon Jan 10 11:59:25 2000 +++ src/sbin/spppcontrol/spppcontrol.c.new Mon Jan 10 12:06:13 2000 @@ -188,8 +188,10 @@ void print_vals(const char *ifname, struct spppreq *sp) { + time_t send, recv; + printf("%s:\tphase=%s\n", ifname, phase_name(sp->defs.pp_phase)); if (sp->defs.myauth.proto) { printf("\tmyauthproto=%s myauthname=\"%.*s\"\n", proto_name(sp->defs.myauth.proto), @@ -200,8 +202,11 @@ proto_name(sp->defs.hisauth.proto), AUTHNAMELEN, sp->defs.hisauth.name, authflags(sp->defs.hisauth.flags)); } + send = time(NULL) - sp->defs.pp_last_sent; + recv = time(NULL) - sp->defs.pp_last_recv; + printf("\tidle_time=%ld\n", (sendpp_last_recv = time_second; splx(s); } /* @@ -805,8 +806,9 @@ * The packet length includes header, FCS and 1 flag, * according to RFC 1333. */ ifp->if_obytes += m->m_pkthdr.len + 3; + sp->pp_last_sent = time_second; splx (s); return (0); } @@ -838,8 +840,9 @@ sp->pp_rseq = 0; sp->pp_phase = PHASE_DEAD; sp->pp_up = lcp.Up; sp->pp_down = lcp.Down; + sp->pp_last_recv = sp->pp_last_sent = time_second; sppp_lcp_init(sp); sppp_ipcp_init(sp); sppp_pap_init(sp); >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message