Subject: Strange pty behaviour
To: None <email@example.com>
From: Paulo Alexandre Pinto Pires <firstname.lastname@example.org>
Date: 01/31/2005 10:51:43
Running -current as of 2005/01/26, I noticed strange pty behaviour
while trying to set up a L2TP tunnel with rp-l2tp 0.4 (pkgsrc's 0.3
didn't work: it fails to dlopen() object files for the handlers).
l2tpd listens for requests from a LAC client and, when a request ar-
rives, allocates a pty and runs pppd on it.
The problem I saw was that data written to the master pty descriptor
never arrives to the slave end, to be read.
I traced the problem with many different tools. I enabled pppd's
"debug" and "kdebug 7", and noticed that only outgoing PPP packets
were logged by the kernel, yet "incoming" packets were injected by
l2tpd in the pty master end (as ktruss/ktrace showed). I even chan-
ged pppd, to make it run cat instead, hoping that not changing line
discipline would at least allow data to come, but cat also couldn't
get a single byte of the data sent by l2tpd.
Data written to the slave end appeared on the master end, but the
traces were really strange, because ktrace showed pppd writing 24 or
25 bytes, but the reads on the master end returned 44 to 47 bytes.
Also, data bytes written were considerably different from those that
were shown on the return from read() on the master end.
On the other hand, if pty is really crazy, how do my network logins
and programs like xterm and login work?
At this point, I am not even sure that the problem that pty is the
only problem. I am affraid that ktrace/ktruss may be somewhat "crazy"
as well, for showing significantly different data that should be the
Has anyone else seen anything related? Any hint? I have the trace
dumps, if anyone might be interested.
... Qui habet aurem audiat quid Spiritus dicat ecclesiis.