From seva@sevasoft.alex-ua.com Mon Aug  9 13:02:28 1999
Return-Path: <seva@sevasoft.alex-ua.com>
Received: from sevasoft.alex-ua.com (sevasoft.alex-ua.com [195.123.18.144])
	by hub.freebsd.org (Postfix) with ESMTP id 13432153A5
	for <FreeBSD-gnats-submit@freebsd.org>; Mon,  9 Aug 1999 13:01:55 -0700 (PDT)
	(envelope-from seva@sevasoft.alex-ua.com)
Received: (from seva@localhost)
	by sevasoft.alex-ua.com (8.9.3/8.9.3) id WAA22147;
	Mon, 9 Aug 1999 22:58:51 +0300 (EEST)
	(envelope-from seva)
Message-Id: <199908091958.WAA22147@sevasoft.alex-ua.com>
Date: Mon, 9 Aug 1999 22:58:51 +0300 (EEST)
From: Vsevolod Lobko <seva@sevasoft.alex-ua.com>
Reply-To: seva@sevasoft.alex-ua.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: [PATCH] ppp don't close session on modem hangup
X-Send-Pr-Version: 3.2

>Number:         13046
>Category:       bin
>Synopsis:       [PATCH] ppp don't close session on modem hangup
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    brian
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Aug  9 13:00:03 PDT 1999
>Closed-Date:    Sat Oct 16 03:14:08 PDT 1999
>Last-Modified:  Sun Oct 17 01:50:00 PDT 1999
>Originator:     Vsevolod Lobko
>Release:        FreeBSD 4.0-CURRENT i386
>Organization:
None
>Environment:

uname -a:
FreeBSD sevasoft.alex-ua.com 4.0-CURRENT FreeBSD 4.0-CURRENT #32: Sat Aug  7 10:10:23 EEST 1999     root@sevasoft.alex-ua.com:/usr/src/sys/compile/SEVASOFT  i386

dialup link using userlevel ppp

>Description:

when modem hangs up, ppp does not get hangup signal
This happens because of setting CLOCAL & HUPCL flags for modem tty 
simultaneously

>How-To-Repeat:

hungup modem while online

>Fix:
	

Index: tty.c
===================================================================
RCS file: /home/free_rep/src/usr.sbin/ppp/tty.c,v
retrieving revision 1.10
diff -u -r1.10 tty.c
--- tty.c	1999/08/06 20:04:07	1.10
+++ tty.c	1999/08/09 19:44:06
@@ -204,8 +204,10 @@
     else
       ios.c_cflag |= CLOCAL;
 
-    if (p->type != PHYS_DEDICATED)
+    if (p->type != PHYS_DEDICATED) {
       ios.c_cflag |= HUPCL;
+      ios.c_cflag &= ~CLOCAL;
+    }
 
     tcsetattr(p->fd, TCSANOW, &ios);
   }
@@ -410,8 +412,10 @@
     ios.c_iflag |= IXOFF;
   }
   ios.c_iflag |= IXON;
-  if (p->type != PHYS_DEDICATED)
+  if (p->type != PHYS_DEDICATED) {
     ios.c_cflag |= HUPCL;
+    ios.c_cflag &= ~CLOCAL;
+  }
 
   if (p->type != PHYS_DIRECT) {
       /* Change tty speed when we're not in -direct mode */

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->brian 
Responsible-Changed-By: brian 
Responsible-Changed-When: Mon Aug 9 16:50:06 PDT 1999 
Responsible-Changed-Why:  
Ppp's mine. 

From: Brian Somers <brian@Awfulhak.org>
To: Vsevolod Lobko <seva@alex-ua.com>
Cc: brian@FreeBSD.ORG, freebsd-gnats-submit@FreeBSD.ORG
Subject: Re: bin/13046: [PATCH] ppp don't close session on modem hangup (fwd) 
Date: Tue, 10 Aug 1999 01:00:29 +0100

 > ---------- Forwarded message ----------
 > Date: Mon, 9 Aug 1999 13:00:03 -0700 (PDT)
 > From: gnats-admin@FreeBSD.org
 > To: seva@sevasoft.alex-ua.com
 > Subject: Re: bin/13046: [PATCH] ppp don't close session on modem hangup
 > 
 > Thank you very much for your problem report.
 > It has the internal identification `bin/13046'.
 > The individual assigned to look at your
 > report is: freebsd-bugs. 
 > 
 > >Category:       bin
 > >Responsible:    freebsd-bugs
 > >Synopsis:       [PATCH] ppp don't close session on modem hangup
 > >Arrival-Date:   Mon Aug  9 13:00:03 PDT 1999
 
 I think there's a problem here.  We don't want to end up blocking 
 waiting for carrier on this line.  Ppp turns CLOCAL on so that it can 
 control non-modem ttys and then does frequent TIOCMGETs.
 
 Does this really make things work in your environment ?  Have you 
 tried enabling debug logging to see what ppp thinks is happening with 
 carrier ?
 
 Cheers.
 -- 
 Brian <brian@Awfulhak.org>                        <brian@FreeBSD.org>
       <http://www.Awfulhak.org>                   <brian@OpenBSD.org>
 Don't _EVER_ lose your sense of humour !          <brian@FreeBSD.org.uk>
 
 
 

From: Vsevolod Lobko <seva@alex-ua.com>
To: Brian Somers <brian@Awfulhak.org>
Cc: brian@FreeBSD.ORG, freebsd-gnats-submit@FreeBSD.ORG
Subject: Re: bin/13046: [PATCH] ppp don't close session on modem hangup (fwd)
Date: Tue, 10 Aug 1999 09:54:33 +0300 (EEST)

 On Tue, 10 Aug 1999, Brian Somers wrote:
 
 > > ---------- Forwarded message ----------
 > > Date: Mon, 9 Aug 1999 13:00:03 -0700 (PDT)
 > > From: gnats-admin@FreeBSD.org
 > > To: seva@sevasoft.alex-ua.com
 > > Subject: Re: bin/13046: [PATCH] ppp don't close session on modem hangup
 > > 
 > > Thank you very much for your problem report.
 > > It has the internal identification `bin/13046'.
 > > The individual assigned to look at your
 > > report is: freebsd-bugs. 
 > > 
 > > >Category:       bin
 > > >Responsible:    freebsd-bugs
 > > >Synopsis:       [PATCH] ppp don't close session on modem hangup
 > > >Arrival-Date:   Mon Aug  9 13:00:03 PDT 1999
 > 
 > I think there's a problem here.  We don't want to end up blocking 
 > waiting for carrier on this line.  Ppp turns CLOCAL on so that it can 
 > control non-modem ttys and then does frequent TIOCMGETs.
 
 Sorry, forgot to mention. I have a semi-callback connection, so ppp
 working in -direct mode, and tty_Timeout doesn't gets called at all.
 
 > Does this really make things work in your environment ?  Have you 
 > tried enabling debug logging to see what ppp thinks is happening with 
 > carrier ?
 
 There are nothing about carrier in logs. Instrumented tty_Timeout (with
 log_Printf on start) does not called. 
 
 With my patch it works. Possibly patch need to be changed for explicit
 PHYS_DIRECT case and not for !PHYS_DEDICATED
 
 

From: Brian Somers <brian@Awfulhak.org>
To: Vsevolod Lobko <seva@alex-ua.com>
Cc: Brian Somers <brian@Awfulhak.org>, brian@FreeBSD.ORG,
	freebsd-gnats-submit@FreeBSD.ORG, brian@hak.lan.Awfulhak.org
Subject: Re: bin/13046: [PATCH] ppp don't close session on modem hangup (fwd) 
Date: Sat, 16 Oct 1999 10:23:51 +0100

 Hi,
 
 This should now be fixed in the latest ppp archive on my web site.  
 Would you care to verify ?
 
 Thanks.
 
 > On Tue, 10 Aug 1999, Brian Somers wrote:
 > 
 > > > ---------- Forwarded message ----------
 > > > Date: Mon, 9 Aug 1999 13:00:03 -0700 (PDT)
 > > > From: gnats-admin@FreeBSD.org
 > > > To: seva@sevasoft.alex-ua.com
 > > > Subject: Re: bin/13046: [PATCH] ppp don't close session on modem hangup
 > > > 
 > > > Thank you very much for your problem report.
 > > > It has the internal identification `bin/13046'.
 > > > The individual assigned to look at your
 > > > report is: freebsd-bugs. 
 > > > 
 > > > >Category:       bin
 > > > >Responsible:    freebsd-bugs
 > > > >Synopsis:       [PATCH] ppp don't close session on modem hangup
 > > > >Arrival-Date:   Mon Aug  9 13:00:03 PDT 1999
 > > 
 > > I think there's a problem here.  We don't want to end up blocking 
 > > waiting for carrier on this line.  Ppp turns CLOCAL on so that it can 
 > > control non-modem ttys and then does frequent TIOCMGETs.
 > 
 > Sorry, forgot to mention. I have a semi-callback connection, so ppp
 > working in -direct mode, and tty_Timeout doesn't gets called at all.
 > 
 > > Does this really make things work in your environment ?  Have you 
 > > tried enabling debug logging to see what ppp thinks is happening with 
 > > carrier ?
 > 
 > There are nothing about carrier in logs. Instrumented tty_Timeout (with
 > log_Printf on start) does not called. 
 > 
 > With my patch it works. Possibly patch need to be changed for explicit
 > PHYS_DIRECT case and not for !PHYS_DEDICATED
 > 
 > 
 
 -- 
 Brian <brian@Awfulhak.org>                        <brian@FreeBSD.org>
       <http://www.Awfulhak.org>                   <brian@OpenBSD.org>
 Don't _EVER_ lose your sense of humour !          <brian@FreeBSD.org.uk>
 
 
 
State-Changed-From-To: open->closed 
State-Changed-By: brian 
State-Changed-When: Sat Oct 16 03:14:08 PDT 1999 
State-Changed-Why:  
Fixed in -current.  Will MFC soon. 

From: Vsevolod Lobko <seva@alex-ua.com>
To: Brian Somers <brian@Awfulhak.org>
Cc: brian@FreeBSD.ORG, freebsd-gnats-submit@FreeBSD.ORG,
	brian@hak.lan.Awfulhak.org
Subject: Re: bin/13046: [PATCH] ppp don't close session on modem hangup (fwd)
Date: Sun, 17 Oct 1999 11:45:10 +0300 (EEST)

 On Sat, 16 Oct 1999, Brian Somers wrote:
 
 > Hi,
 > 
 > This should now be fixed in the latest ppp archive on my web site.  
 > Would you care to verify ?
 
 It works now, thanks.
 
 
 
>Unformatted:
