Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Jan 2000 03:43:06 -0800 (PST)
From:      pherman@piro.net
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   kern/16023: Add an idletime counter for sppp, just like ppp has
Message-ID:  <20000110114306.50CEF14C48@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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", (send<recv)? send : recv);
 }

 const char *
 phase_name(enum ppp_phase phase)
--- src/sys/net/if_sppp.h       Mon Jan 10 11:57:57 2000
+++ src/sys/net/if_sppp.h.new   Mon Jan 10 12:11:16 2000
@@ -88,8 +88,10 @@
        u_short pp_alivecnt;    /* keepalive packets counter */
        u_short pp_loopcnt;     /* loopback detection counter */
        u_long  pp_seq;         /* local sequence number */
        u_long  pp_rseq;        /* remote sequence number */
+       time_t  pp_last_sent;   /* time() when the last packet was sent */
+       time_t  pp_last_recv;   /* time() when the last packet was received */
        enum ppp_phase pp_phase;        /* phase we're currently in */
        int     state[IDX_COUNT];       /* state machine */
        u_char  confid[IDX_COUNT];      /* id of last configuration request */
        int     rst_counter[IDX_COUNT]; /* restart counter */
--- src/sys/net/if_spppsubr.c   Mon Jan 10 11:58:08 2000
+++ src/sys/net/if_spppsubr.c.new       Mon Jan 10 12:16:38 2000
@@ -619,8 +619,9 @@
                                SPP_ARGS(ifp));
                goto drop;
        }
        IF_ENQUEUE(inq, m);
+       sp->pp_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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000110114306.50CEF14C48>