Bug 16023

Summary: Add an idletime counter for sppp, just like ppp has
Product: Base System Reporter: pherman <pherman>
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff
none
file.diff none

Description pherman 2000-01-10 11:50:01 UTC
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

Fix: Patches (patched against 4.0-current):

******** CUT HERE ***********
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)
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.
Comment 1 Joerg Wunsch freebsd_committer freebsd_triage 2002-08-26 22:02:39 UTC
State Changed
From-To: open->feedback

This is supposed to be fixed in -current and -stable's sppp, 
although a bit differently than your suggestion (mostly taken 
from the i4b line of fixes). 

Please verify that the problem you were describing is solved now, 
so we could close the PR.  Thanks!
Comment 2 Joerg Wunsch freebsd_committer freebsd_triage 2002-08-26 22:20:21 UTC
State Changed
From-To: feedback->closed

Mail to originator bounces, so just assume the existing fix 
was appropriate anyway.