[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Weird PPP trouble



On Thu, 18 Jan 1996, Joe Knapka wrote:

> Hi, everone.
> 
>  open("/dev/ttyS1",O_RDWR | O_NDELAY)

There is much not_commonly_known about tty drivers and modem
controls.  The above is the std way to open a tty device for
modem control when DCD is low.  Obviously the modem is on hook.

See the doc in the terimio struct for CLOCAL, which when this flag
is set, you may open a tty device (the modem control device) in
blocking mode even when DCD is low.  If you poke in kermit/minicom
etc, you'll see an old strategy of opening the device non-block,
do the ioctl(fd, ,) to set the CLOCAL flag in the termio struct.
Do another open of the same device, for a blocking fd, then close the
non-blocking fd.

My guess, is when you kill pppd, that the termio struct sometimes has
the CLOCAL flag set.  I'm not a Linux user so you'll have to do some
home work.  Most of the time; stty -a /dev/ttyS1 will accurately show
the state of CLOCAL.

My opinions on the other fellow who had the getty problem, jumping
ahead and opening the tty:

Another similar scenario (my guess).  I suspect the modem has been
programed or the factory programming asserts DCD always.  This
allows getty to succeed in opening the tty immediately, since DCD
is high.  Some login banners contain the poison string: "AT" or "at"
or some string that causes the modem to say; "OK" return.  The
worst case of this scenario causes getty/login to consume lots of
CPU exchanging sensless commands and responses with the modem.

The other possibility is that getty should be opening the proper
device that obeys modem controls.  Most Unixes have 2 tty devices,
one for modem control (will block until DCD is high) and one that ignores DCD,
so you don't have to open non-block... This may be an issue for the
problem above.

At any rate, tty devices, variants of getty/mgetty/uugetty, and specific
programming of the modem for DCD, DSR and DTR operation all are 
interelated and have been the cause of endless hours of debugging
for *every* Unix box owner / sysadmin since the invention of computers. ;-(

Good luck


Curt Smith
curts at compgen.com