History log of /freebsd-current/usr.sbin/ppp/tty.c
Revision Date Author Comments
# b3e76948 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: two-line .h pattern

Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/


# 4d846d26 10-May-2023 Warner Losh <imp@FreeBSD.org>

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix


# 1de7b4b8 27-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

various: general adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

No functional change intended.


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# ff550a99 27-Aug-2009 Brian Somers <brian@FreeBSD.org>

MFC: When realloc()ing device memory for transfer to another ppp process,
don't continue to use the realloc()d pointer - it might have changed!

Remove some stray diagnostics while I'm here.

Approved by: re (kib)


# c5e246d4 24-Aug-2009 Brian Somers <brian@FreeBSD.org>

When realloc()ing device memory for transfer to another ppp process,
don't continue to use the realloc()d pointer - it might have changed!

Remove some stray diagnostics while I'm here.

MFC after: 3 days


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 1ffcdfc9 13-Sep-2004 Ruslan Ermilov <ru@FreeBSD.org>

Fixed the NONETGRAPH build.

Reported by: wsk@gddsn.org.cn


# 057f1760 04-Sep-2004 Brian Somers <brian@FreeBSD.org>

Make ppp WARNS=5 clean


# 89624a34 15-Nov-2003 Hartmut Brandt <harti@FreeBSD.org>

Replace all uses of the old netgraph constants NG_*LEN by the new
constants NG_*SIZ that include the trailing NUL byte. This change
is mostly mechanical except for the replacement of a couple of snprintf()
and sprintf() calls with strlcpy.


# de59e178 13-May-2002 Brian Somers <brian@FreeBSD.org>

o Clean up some #includes
o Bump version number to 3.0.4
o When talking to a RADIUS server, provide a NAS-Port-Type.

When the NAS-Port-Type is Ethernet, provide a NAS-Port value equal
to the SESSIONID from the environment in direct mode or the
NGM_PPPOE_SESSIONID message in other modes. If no SESSIONID is found,
default to the interface index in client mode or zero in server mode.

When the NAS-Port-Type is ISDN, set the NAS-Port to the minor number
of the physical device (ie, the N in /dev/i4brbchN).

This makes it easier for the RADIUS server to identify the client
WRT accounting data etc.

Prompted by: lsz8425 <lsz8425@mail.cd.hn.cn>


# 768dc550 20-Apr-2002 Brian Somers <brian@FreeBSD.org>

Don't load the netgraph line discipline. When it's in use, TIOCMGET
fails and on loss of carrier, the device doesn't become selectable with
0 bytes to read.

Problem reported by: ache


# 97486b09 30-Mar-2002 Brian Somers <brian@FreeBSD.org>

Add a missing ``#ifndef NONETGRAPH''


# fb11a9c2 29-Mar-2002 Brian Somers <brian@FreeBSD.org>

Merge the NETGRAPH branch into HEAD. tty devices now use netgraph's line
discipline to do the async escaping, but no other benefits are available yet.

Change ``ifdef HAVE_DES'' to ``ifndef NODES'' for consistency.

Make the Makefile a little more sane WRT RELEASE_CRUNCH.


# c8b9fb53 18-Jun-2001 Brian Somers <brian@FreeBSD.org>

Handle hardware-imposed MTU/MRU limitations. PPPoE will no longer
allow MRU/MTU negotiations to exceed 1492.

Add an optional ``max'' specifier to ``set m[rt]u'', ie.

set mtu max 1480

Bump the ppp version number.

Sponsored by: Monzoon Networks AG and FreeBSD Services Limited


# fca09861 31-Oct-2000 Brian Somers <brian@FreeBSD.org>

Don't ignore the return from tcsetattr() - moan about it instead.

Suggested by: Andre Albsmeier <andre@akademie3000.de>


# 8e7bd08e 13-Mar-2000 Brian Somers <brian@FreeBSD.org>

Correct some typos introduced in the descriptor -> fdescriptor change.


# f013f33e 13-Mar-2000 Brian Somers <brian@FreeBSD.org>

To avoid namespace polution in NetBSD:

``struct descriptor'' -> ``struct fdescriptor''


# 9acc8460 13-Dec-1999 Brian Somers <brian@FreeBSD.org>

Handle PPPoPTY correctly.


# fdc29d54 26-Nov-1999 Brian Somers <brian@FreeBSD.org>

Change ``set cd'' so that its default value is device specific. The
default is still 1 second for ttys, but is now 6 seconds for i4b (ISDN)
devices and 5 seconds for ethernet (PPPoE) devices.


# 2cb305af 24-Nov-1999 Brian Somers <brian@FreeBSD.org>

Rewrite the link descriptor transfer code in MP mode.

Previously, ppp attempted to bind() to a local domain tcp socket
based on the peer authname & enddisc. If it succeeded, it listen()ed
and became MP server. If it failed, it connect()ed and became MP
client. The server then select()ed on the descriptor, accept()ed
it and wrote its pid to it then read the link data & link file descriptor,
and finally sent an ack (``!''). The client would read() the server
pid, transfer the link lock to that pid, send the link data & descriptor
and read the ack. It would then close the descriptor and clean up.

There was a race between the bind() and listen() where someone could
attempt to connect() and fail.

This change removes the race. Now ppp makes the RCVBUF big enough on a
socket descriptor and attempts to bind() to a local domain *udp* socket
(same name as before). If it succeeds, it becomes MP server. If it
fails, it sets the SNDBUF and connect()s, becoming MP client. The server
select()s on the descriptor and recvmsg()s the message, insisting on at
least two descriptors (plus the link data). It uses the second descriptor
to write() its pid then read()s an ack (``!''). The client creates a
socketpair() and sendmsg()s the link data, link descriptor and one of
the socketpair descriptors. It then read()s the server pid from the
other socketpair descriptor, transfers any locks and write()s an ack.

Now, there can be no race, and a connect() failure indicates a stale
socket file.

This also fixes MP ppp over ethernet, where the struct msghdr was being
misconstructed when transferring the control socket descriptor.

Also, if we fail to send the link, don't hang around in a ``session
owner'' state, just do the setsid() and fork() if it's required to
disown a tty.

UDP idea suggested by: Chris Bennet from Mindspring at FreeBSDCon


# 87c3786e 06-Nov-1999 Brian Somers <brian@FreeBSD.org>

Support PPPoE

Help (lots) from: julian, archie
Facilities from: ahebert@pubnix.net


# 1d3a2f02 15-Oct-1999 Brian Somers <brian@FreeBSD.org>

Redefine CRTS_IFLOW and CCTS_OFLOW on the mac.

Submitted by: Kazuyoshi Kato <kazk@yyy.or.jp>


# ccd587f0 26-Sep-1999 Brian Somers <brian@FreeBSD.org>

Support ``set cd off'' to tell ppp not to even look for carrier on the
device.


# b9391689 21-Sep-1999 Brian Somers <brian@FreeBSD.org>

Back out the bogus #ifdef __NetBSD__ #include <signal.h> lines.
The original report was due to a mis-installation of the NetBS
header files :-/

Submitted by: Kazuyoshi Kato <kazk@yyy.or.jp>


# 7e795ebe 20-Sep-1999 Brian Somers <brian@FreeBSD.org>

NetBSD has moved ``extern int errno;'' to signal.h :-/

Submitted by: Kazuyoshi Kato <kazk@yyy.or.jp>


# 97d92980 27-Aug-1999 Peter Wemm <peter@FreeBSD.org>

$Id$ -> $FreeBSD$


# cde8638b 09-Aug-1999 Brian Somers <brian@FreeBSD.org>

Back out the last patch. I'm too tired to apply patches.


# 02b485a4 09-Aug-1999 Brian Somers <brian@FreeBSD.org>

Remove CLOCAL when we're not in -dedicated mode.

PR: 13046
Submitted by: Vsevolod Lobko <seva@alex-ua.com>


# eb6e5e05 06-Aug-1999 Brian Somers <brian@FreeBSD.org>

Add ISDN support via isdnd & i4b. This requires version
0.81.1 of the i4b code - namely support of the I4B_VR_REQ
ioctl via the i4brbchX device.

Ppp controls the phone number, but idle timers and
SYNC/RAW decisions are still made by isdnd (in isdnd.rc).

This involves a new datalink state machine phase. The
``wait for carrier'' phase happens after dialing but
before logging in. The whole dial state should really
be abstracted so that each device type can deal with it
in its own way (thinking about PPPoE) - but that'll have
to wait.

The ``set cd'' symantics remain the same for tty devices,
but we now delay until we either get CD or timeout waiting
(at which time we drop the link if we require CD).

For i4b devices we always insist on carrier.

Thanks to hm@ for his help, and especially for pointing out
that I *don't* need to re-implement isdnd (that was a huge
waste of time !) :-]


# f5a99677 05-Jun-1999 Brian Somers <brian@FreeBSD.org>

Correct the way ppp transfers links on the server side in MP
mode by padding out the ``struct device'' to the maximum
device size.
Bump the ppp version number to indicate the transfer format
change.

This should make MP over tty and udp devices functional again.


# d0b3b745 27-May-1999 Brian Somers <brian@FreeBSD.org>

Call tty_Offline() from tty_Cooked() and tty_Free(), just in
case ppp is abending and hasn't called physical_Offline()
already.


# acbd1f00 24-May-1999 Brian Somers <brian@FreeBSD.org>

Correct the ``ignoring sync/async'' warnings so that they show
up with the correct device type.
Reassign the correct tcpdevice or execdevice after transfering
a link in MP server mode.


# 9950fb2a 17-May-1999 Brian Somers <brian@FreeBSD.org>

Move the tty locking stuff back out to physical.c so
that we lock the device *before* we open it.
We still open the device only once - and then ask all
our handlers if they know how to handle it.


# 4b698945 16-May-1999 Brian Somers <brian@FreeBSD.org>

Initialise ttydevice::Timer


# 27be3ac6 13-May-1999 Brian Somers <brian@FreeBSD.org>

Initialise the struct device part of struct ttydevice.


# 8dbb1e2b 13-May-1999 Brian Somers <brian@FreeBSD.org>

Fix a bum pointer dereference and make some variable
names more consistent.
Stack trace supplied by: Joe Clarke <jclarke@cisco.com>


# 6815097b 12-May-1999 Brian Somers <brian@FreeBSD.org>

Allow ``host:port/udp'' devices and support ``host:port/tcp'' as
being the same as the previous (still supported) ``host:port''
syntax for tcp socket devices.

A udp device uses synchronous ppp rather than async, and avoids
the double-retransmit overhead that comes with ppp over tcp (it's
usually a bad idea to transport IP over a reliable transport that
itself is using an unreliable transport). PPP over UDP provides
througput of ** 1.5Mb per second ** with all compression disabled,
maxing out a PPro/200 when running ppp twice, back-to-back.

This proves that PPPoE is plausable in userland....

This change adds a few more handler functions to struct device and
allows derivations of struct device (which may contain their own
data etc) to pass themselves through the unix domain socket for MP.
** At last **, struct physical has lost all the tty crud !

iov2physical() is now smart enough to restore the correct stack of
layers so that MP servers will work again.

The version number has bumped as our MP link transfer contents have
changed (they now may contain a `struct device').

Don't extract the protocol twice in MP mode (resulting in protocol
rejects for every MP packet). This was broken with my original
layering changes.

Add ``Physical'' and ``Sync'' log levels for logging the relevent
raw packets and add protocol-tracking LogDEBUG stuff in various
LayerPush & LayerPull functions.

Assign our physical device name for incoming tcp connections by
calling getpeername().

Assign our physical device name for incoming udp connections from
the address retrieved by the first recvfrom().


# 5d9e6103 08-May-1999 Brian Somers <brian@FreeBSD.org>

o Redesign the layering mechanism and make the aliasing code part of
the layering.

We now ``stack'' layers as soon as we open the device (when we figure
out what we're dealing with). A static set of `dispatch' routines are
also declared for dealing with incoming packets after they've been
`pulled' up through the stacked layers.

Physical devices are now assigned handlers based on the device type
when they're opened. For the moment there are three device types;
ttys, execs and tcps.

o Increment version number to 2.2
o Make an entry in [uw]tmp for non-tty -direct invocations (after
pap/chap authentication).
o Make throughput counters quad_t's
o Account for the absolute number of mbuf malloc()s and free()s in
``show mem''.
o ``show modem'' becomes ``show physical''.