History log of /freebsd-current/usr.sbin/ppp/chat.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.


# 2df95816 14-Feb-2014 Christian Brueffer <brueffer@FreeBSD.org>

In chat_UpdateSet(), initialize the input buffer to prevent stale data
from previous timed out commands.

PR: 186530
Submitted by: Alexander Zagrebin <alexz at visp.ru>
Reviewed by: brian
MFC after: 1 week


# 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.


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

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


# 5d604c11 11-Oct-2004 Brian Somers <brian@FreeBSD.org>

Add a bunch of malloc() return checks

PR: 71592
Submitted by: Dan Lukes <dan@obluda.cz> with further changes


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

Make ppp WARNS=5 clean


# 10be78d3 15-Jun-2002 Brian Somers <brian@FreeBSD.org>

Remove whitespace at the end of lines.


# 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>


# 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.


# 46df5aa7 03-Nov-2001 Brian Somers <brian@FreeBSD.org>

Add a ``log'' command for logging specific information.
Add an ``UPTIME'' variable to indicate the bundle uptime.

It's now possible to put something like this in ppp.linkdown
for a server setup:

MYADDR:
log Session closing: User USER, address HISADDR, up UPTIME

Fixed some memory leakage with commands that expand words.
Made some functions static.
Fixed a diagnostic bug (iface add .... SIOCDIFADDR)


# 30949fd4 14-Aug-2001 Brian Somers <brian@FreeBSD.org>

o Add ipv6 support, abstracting most NCP addresses into opaque
structures (well, they're treated as opaque).

It's now possible to manage IPv6 interface addresses and routing
table entries and to filter IPV6 traffic whether encapsulated or
not.

IPV6CP support is crude for now, and hasn't been tested against
any other implementations.

RADIUS and IPv6 are independent of eachother for now.

ppp.linkup/ppp.linkdown aren't currently used by IPV6CP

o Understand all protocols(5) in filter rules rather than only a select
few.

o Allow a mask specification for the ``delete'' command. It's now
possible to specifically delete one of two conflicting routes.

o When creating and deleting proxy arp entries, do it for all IPv4
interface addresses rather than doing it just for the ``current''
peer address.

o When iface-alias isn't in effect, don't blow away manually (via ``iface
add'') added interface addresses.

o When listening on a tcp server (diagnostic) socket, bind so that a
tcp46 socket is created -- allowing both IPv4 and IPv6 connections.

o When displaying ICMP traffic, don't display the icmp type twice.
When display traffic, display at least some information about unrecognised
traffic.

o Bump version

Inspired after filtering work by: Makoto MATSUSHITA <matusita@jp.FreeBSD.org>


# 68602c3e 17-Aug-2000 Brian Somers <brian@FreeBSD.org>

Make -DNOSUID (or -DPPP_NOSUID) possible to build ppp without SUID
capabilities.


# a2240f35 09-Aug-2000 Brian Somers <brian@FreeBSD.org>

Allow leading ``!'' characters in authkeys and chat scripts to
be doubled up to mean a single literaly ``!''.


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

To avoid namespace polution in NetBSD:

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


# e7d008b4 29-Dec-1999 Brian Somers <brian@FreeBSD.org>

Add a few missing #includes


# a19a5c02 29-Dec-1999 Brian Somers <brian@FreeBSD.org>

Correct usages of getuid() and geteuid()

Pointed out by: billf


# 5b78bdf8 27-Dec-1999 Brian Somers <brian@FreeBSD.org>

Don't allowt '#' as a comment when it's embedded in quotes:

set something "xxx yyy # zzz" aaa

shouldn't be interpreted as

set something "xxx yyy" aaa


# abab7303 22-Dec-1999 Brian Somers <brian@FreeBSD.org>

Don't munge ``set dial|login|logout|hangup'' arguments before
ExpandString() has a chance to do its own substitutions.


# c39aa54e 20-Dec-1999 Brian Somers <brian@FreeBSD.org>

Notice and warn about unterminated quoted strings in commands.
The entire command is ignored if the syntax is invalid...


# ffcfaec7 02-Dec-1999 Brian Somers <brian@FreeBSD.org>

Be careful not to re-initialise `struct stat' while it still has
a running timer. This fixes a problem where a dial is manually
aborted, the hangup script kicks in and the chat timer ends up
on the timer queue twice (tick tick tick tick *boom*)


# c116e0c0 25-Oct-1999 Brian Somers <brian@FreeBSD.org>

Introduce ``set logout''; another chat script. This is in preparation
for the abstraction of ``set dial'' and ``set hangup''.


# 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$


# 44e73c12 17-Aug-1999 Brian Somers <brian@FreeBSD.org>

Set the close-on-exec flag for all unused descriptors when
exec()ing other programs.


# ddd68080 25-Jun-1999 Brian Somers <brian@FreeBSD.org>

Don't bother read()ing if we ``expect'' nothing in our chat script.


# 6a32b414 25-Jun-1999 Brian Somers <brian@FreeBSD.org>

If we run out of chat script immediately after a successfully executed
expect-send-expect sequence, finish gracefully, don't core dump.
This bug has been there for over a year - I could never reproduce it !

Straw provided by: Andre Albsmeier <andre.albsmeier@mchp.siemens.de>


# 8fb106c6 09-Jun-1999 Brian Somers <brian@FreeBSD.org>

Use the correct pid when substituting PROCESSID.
Problem reported by: Amedeo Beck Peccoz <gea@gressoney.it>


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

Add some comments, optimise out a few strlen()s and
remove a few extraneous assignments.


# 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''.


# a8103305 11-Feb-1999 Brian Somers <brian@FreeBSD.org>

When executing a command as part of a dial/login/hangup
script, expand words in the same way as !bg does.


# 972a1bcf 27-Jan-1999 Brian Somers <brian@FreeBSD.org>

Initial RADIUS support (using libradius). See the man page for
details. Compiling with -DNORADIUS (the default for `release')
removes support.

TODO: The functionality in libradius::rad_send_request() needs
to be supplied as a set of routines so that ppp doesn't
have to wait indefinitely for the radius server(s). Instead,
we need to get a descriptor back, select() on the descriptor,
and ask libradius to service it when necessary.
For now, ppp blocks SIGALRM while in rad_send_request(), so
it misses PAP/CHAP retries & timeouts if they occur.

Only PAP is functional. When CHAP is attempted, libradius
complains that no User-Password has been specified... rfc2138
says that it *mustn't* be used for CHAP :-(

Sponsored by: Internet Business Solutions Ltd., Switzerland


# ca618bcf 27-Oct-1998 Brian Somers <brian@FreeBSD.org>

Untimeout the chat expect timer as soon as we get a
match - otherwise, with a delayed (\\d) ``send'', the
timeout may happen during the send and cause a failure.
Problem reported by: David L. Vondrasek <dallas.tx@airmail.net>


# 92b09558 07-Aug-1998 Brian Somers <brian@FreeBSD.org>

o Support callback types NONE, E.164, AUTH and CBCP.
(see the new ``set callback'' and ``set cbcp'' commands)
o Add a ``cbcp'' log level and mbuf type.
o Don't dump core when \T is given in ``set login'' or
``set hangup''.
o Allow ``*'' and blanks as placeholders in ppp.secret and
allow a fifth field for specifying auth/cbcp dialback
parameters.
o Remove a few extraneous #includes
o Define the default number of REQs (restart counter) in defs.h
rather than hardcoding ``5'' all over the place.
o Fix a few man page inconsistencies.


# 10a9be1e 27-Jun-1998 Brian Somers <brian@FreeBSD.org>

Remove redundant includes


# 1af29a6e 24-Jun-1998 Brian Somers <brian@FreeBSD.org>

o If we come out of select() with only write descriptors that
end up writing zero bytes, sleep for 1/10 of a second so that
we don't end up using up too much cpu.
This should only ever happen on systems that wrongly report a
descriptor as writable despite the tty buffer being full.
Discussed with: Jeff Evarts

o Do an initial run-time check to see if select() alters the passed
timeval. This knowledge isn't yet used, but will be soon.


# d93d3a9c 15-Jun-1998 Brian Somers <brian@FreeBSD.org>

o De-staticise things that don't need to be static.
o Bring the static ``ttystate'' into struct prompt so that
the tilde context is per prompt and not global.
o Comment the remaining static variables so that it's
clear why they're static.
o Add some XXX comments suggesting that our interface list
and our hostname should be re-generated after a signal
(say SIGUSR1) so that a machine with PCCARDs has a chance.


# 1384bd27 28-May-1998 Brian Somers <brian@FreeBSD.org>

o #define the name "tun" in defs.h against the future possibility
of supporting architectures with different device names.
o Close /dev/tunX when destroying the bundle.
o Don't forget to close the parent end of the pipe in the child
process when exec'ing a program from a chat script.
o If we close our controlling terminal, ditch the current session
with it, allowing getty(8) (or whatever) to regain control.
o After transferring our controlling terminal descriptor to another
ppp instance, we now fork a new ppp to continue where we left off,
transferring ownership of all uucp locks and the /var/run/tunX.pid
file. Meanwhile the parent closes all file descriptors, defaults
all signals and does a pause() to wait for a HUP after the
transferred descriptor is finally closed.
We don't run /bin/cat any more (again!).

Suggested by: bde

TODO: It seems clocal devices need their pause()d session leader
to be given a manual HUP, as closing the last open descriptor
doesn't do the job.


# 0f2f3eb3 23-May-1998 Brian Somers <brian@FreeBSD.org>

o Move our prompt descriptor list outside of the bundle.
It's now dealt with by the `server' object. This simplifies
things as we only have one list of prompt descriptors and
the log_ routines check prompt::logactive to determine
whether it should be used for output.
o Include the MP socket UpdateSet() result in bundle::UpdateSet().
o Don't select on the tun device unless we're in NETWORK
phase or AUTO mode.
o Stop the idle timer when we go to DEAD phase. We may
have transferred a link and not had a chance to kill
it.
o Don't fail when trying to unlink our transferred datalink
from our descriptor lists just before the transfer.
o Add our link descriptor to the write set if we got a short
write the last time (physical::out is set).
o Log the connection source address when a connection is closed.
o Remove descriptor::next field. Descriptor lists are not required
any more.


# dd7e2610 01-May-1998 Brian Somers <brian@FreeBSD.org>

Cosmetic: Make our external function names consistent.


# b762af4f 01-May-1998 Brian Somers <brian@FreeBSD.org>

o Explicitly set the close-on-exec flag of descriptor 3 before
exec()ing. Tidy up file dups in general prior to exec().
This prevents our tun device (fd 3) from staying open (and
configured) despite handing off all it's links and exiting
(because ``cat'' holds it open).
o Don't bother SIG_DFL'ing signals before exec() as they're
already trapped with specific handlers and will be handled
correctly by the exec.
o Use values from paths.h for "/dev/" and "/dev/tty".
o Don't assert() in physical.c.


# 6f384573 30-Apr-1998 Brian Somers <brian@FreeBSD.org>

o Create a new ``timer'' log level. This lets us ``set
log debug'' without filling our filesystem/screen with
junk that we don't really want to see.
o change PHYS_STDIN to PHYS_DIRECT - we can handle incoming
connections that aren't on STDIN_FILENO now.
o Allow return values from our FSM LayerUp functions. If
LayerUp() fails, the FSM does an immediate FsmDown() without
calling the fsm_parent's Layer{Up,Down} functions.
o Clear the close-on-exec flag of file descriptor 3 when executing
chat programs so that our documented ability to communicate with
/dev/tty via that descriptor works. Also document it as
descriptor 3, not 4 :-O
o Allow a ``rm'' command as an alias for ``remove''.
o Fix the bind()/connect()/accept() calls made by the MP server.
o Create bundle_SendDatalink() and bundle_ReceiveDatalink().
This allows `struct datalink's to flatten themselves, pass
through a pipe (read: the eye of a needle !) and come alive
at the other end. The donator then fork()s & exec()s pppmpipe,
``passing'' the connection to another ppp instance.

*** PPP NOW TALKS MULTILINK :-))) ***

Our link utilization is hideous, and lots of code needs
tidying still. It's also probably riddled with bugs !
It's been tested against itself only, and has hung once,
so confidence isn't high....


# 1fa665f5 27-Apr-1998 Brian Somers <brian@FreeBSD.org>

o Add the link name to modem diagnostics.
o Create struct mpserver as part of struct mp.
mpserver creates a unix-domain socket based on the
peers auth name and endpoint discriminator. If it
already exists, ppp will ``pass the link'' over to
the owner of the socket, joining it into the bundle
of another ppp invocation, otherwise ppp waits for
other invocations to pass it links through this
socket.
The final piece of code will be the code that flattens
our datalink info and passes it down this channel
(not yet implemented).


# e3c70ce9 19-Apr-1998 Brian Somers <brian@FreeBSD.org>

Tidy up the use of struct pppTimer.


# 39d94652 18-Apr-1998 Brian Somers <brian@FreeBSD.org>

Destroy struct chat when it's finished in struct datalink.
Initialise chat timers correctly as they're malloc()ed as
part of struct datalink, and initially contain garbage.


# cdbbb6b5 17-Apr-1998 Brian Somers <brian@FreeBSD.org>

Cosmetic: Clean up warnings.


# 99294c8b 10-Apr-1998 Brian Somers <brian@FreeBSD.org>

o Fix chats expect-send-expect - it shouldn't be
expect-send-send !
o Say `disabled' rather than 0s in `show timeout'.
o Set all arguments in ``set device'' rather than just
the first (read: quotes aren't necessary).
o Set the device speed correctly (broken in last commit).


# 2764b86a 06-Apr-1998 Brian Somers <brian@FreeBSD.org>

o Move alias function pointers into loadalias.c
o Move Var*Version into command.c
o Remove struct pppVars (and there was much rejoicing) !
o Forward-decl some structs in .h files to avoid include
ordering requirements and remove a few more redundant
#includes.


# d24f017b 06-Apr-1998 Brian Somers <brian@FreeBSD.org>

Remove unused includes.


# 92f4ff1c 03-Apr-1998 Brian Somers <brian@FreeBSD.org>

Move authname and authkey into struct bundle and only allow
their alteration in PHASE_DEAD.
Remove redundant pppConfs array element.


# 3b0f8d2e 03-Apr-1998 Brian Somers <brian@FreeBSD.org>

o Move struct lcp and struct ccp into struct link.
o Remove bundle2lcp(), bundle2ccp() and bundle2link().
They're too resource-hungry and we have `owner pointers'
to do their job.
o Make our FSM understand LCPs that are always ST_OPENED
(with a minimum code that != 1).
o Send FSM code rejects for invalid codes.
o Make our bundle fsm_parent deal with multiple links.
o Make timer diagnostics pretty and allow access via ~t
in `term' mode (not just when logging debug) and
`show timers'. Only show timers every second in debug
mode, otherwise we get too many diagnostics to be useful
(we probably still do). Also, don't restrict ~m in term
mode to depend on debug logging.
o Rationalise our bundles' phases.
o Create struct mp (multilink protocol). This is both an
NCP and a type of struct link. It feeds off other NCPs
for output, passing fragmented packets into the queues
of available datalinks. It also gets PROTO_MP input,
reassembles the fragments into ppp frames, and passes
them back to the HDLC layer that the fragments were passed
from.
** It's not yet possible to enter multilink mode :-( **
o Add `set weight' (requires context) for deciding on a links
weighting in multilink mode. Weighting is simplistic (and
probably badly implemented) for now.
o Remove the function pointers in struct link. They ended up
only applying to physical links.
o Configure our tun device with an MTU equal to the MRU from
struct mp's LCP and a speed equal to the sum of our link
speeds.
o `show {lcp,ccp,proto}' and `set deflate' now have optional
context and use ChooseLink() to decide on which `struct link'
to use. This allows behaviour as before when in non-multilink
mode, and allows access to the MP logical link in multilink
mode.
o Ignore reconnect and redial values when in -direct mode and
when cleaning up. Always redial when in -ddial or -dedicated
mode (unless cleaning up).
o Tell our links to `staydown' when we close them due to a signal.
o Remove remaining `#ifdef SIGALRM's (ppp doesn't function without
alarms).
o Don't bother strdup()ing our physical link name.
o Various other cosmetic changes.


# 2f786681 20-Mar-1998 Brian Somers <brian@FreeBSD.org>

Make struct bundle into a sort of `struct descriptor'.
It does the fdsets/reads/writes for each of it's
datalinks.


# 30c2f2ff 13-Mar-1998 Brian Somers <brian@FreeBSD.org>

Remove more globals


# 879ed6fa 12-Mar-1998 Brian Somers <brian@FreeBSD.org>

De-staticise LQR information
Increment OutPackets for any packet - not just LQRs

MFC:
o Fix a few comment typos.
o Fix ``set timeout'' usage message and documentation.
o Change ifOutPackets, ifOutOctets and ifOutLQRs to `u_int32_t's
so that they wrap correctly.
o Put the LQR in network byte order using the correct struct size
(sizeof u_int32_t, not sizeof u_long).
o Wrap LQR ECHO counters correctly.
o Don't increment OutLQR count if the last LQR hasn't been replied
to.
o Initialise last received LQR in StartLqm.
o Don't start the LQR timer if we're `disabled' and `accepted'.
o Generate LQR responses when both sides are using a timer and
we're not going to send our next LQR before the peers max timeout.


# d5015272 09-Mar-1998 Brian Somers <brian@FreeBSD.org>

o Allow "*" in the password field in ppp.secret (forcing a
getpwnam() lookup).
o Don't use chat_ExpandString on the password field in ppp.secret.
It's still possible to quote the string for embedded spaces.
o Don't allow multiple entries with the same name in ppp.secret.


# f9545805 09-Mar-1998 Brian Somers <brian@FreeBSD.org>

Move phone numbers into struct datalink.
Make "show modem" look a bit prettier.


# 486f40c9 26-Feb-1998 Brian Somers <brian@FreeBSD.org>

Implement ABORT strings.


# f4768038 22-Feb-1998 Brian Somers <brian@FreeBSD.org>

o Remove the global CcpInfo. It's now part of the datalink.
Struct bundle will have its own struct ccp in the future
too.
o The ``set stopped'' command now requires context and doesn't
work on the IPCP FSM.
o Check if it's time to break out of our top level loop before
doing a select - otherwise, we'll select forever :-(
o Remove `struct link'::ccp (a temporary hack). It turns out
that IpStartOutput() calls link_Output() and link_Output()
incorrectly calls StartOutput() (really modem_StartOutput)
requiring the ccp knowledge so that it can call
IpStartOutput()... The end result is that the whole IP
output queue gets dumped into the modem output queue
and a pile of physical writes are done prematurely. This
makes the (original) code in main() actually work in that
it would not bother selecting() on the tun descriptor when
our modem queue length was 20 or greater. Instead, we now
make that decision based on the overall queue length.

This will need improvement later.


# 56c9cf9d 17-Feb-1998 Brian Somers <brian@FreeBSD.org>

Fix empty string skipping when chatting.


# 5b8b8060 16-Feb-1998 Brian Somers <brian@FreeBSD.org>

Move the dial, login and hangup scripts into struct datalink.
Don't set these scripts in -direct mode.
Always set reconnect_tries to zero for -direct mode.


# c78db105 12-Feb-1998 Brian Somers <brian@FreeBSD.org>

Remove some unused variables.


# b6dec9f0 12-Feb-1998 Brian Somers <brian@FreeBSD.org>

Update to version 2.0-beta
Allow for NULL fd_sets in descriptor_UpdateSet()
Reimplement the entire chat module, creating
`struct chat' - a `type' of struct descriptor.
Remove CARRIER logging.
CONNECT logging now only logs "CONNECT" lines. CHAT logging
masks it with an entire log of the conversation.

Modem dialing is now asynchronous, including pauses
and timeouts :-)

The hooks in DoLoop() in main.c are *very* messy ! I'll have
to rewrite DoLoop fairly soon, so I don't care too much for the
moment. This code is pretty raw.


# 85b542cf 09-Feb-1998 Brian Somers <brian@FreeBSD.org>

Move the terminal/diagnostic socket stuff out of main.c
and into the new `prompt.c'. struct prompt is (of course)
a `sort' of descriptor.


# 42d4d396 09-Feb-1998 Brian Somers <brian@FreeBSD.org>

o Introduce struct descriptor.
This will ultimately be a member of a list of descriptors and
their handler functions on which we need to select() in the
main loop.
o Make struct physical into a `sort' of struct descriptor.


# 2289f246 05-Feb-1998 Brian Somers <brian@FreeBSD.org>

Move pppVars.physical into the bundle (for the moment).


# ecd5172a 05-Feb-1998 Brian Somers <brian@FreeBSD.org>

Shuffle names and args in modem.h


# 6140ba11 02-Feb-1998 Brian Somers <brian@FreeBSD.org>

Create `struct async' and make it part of `struct physical'.
This structure contains the asynchronous state of the physical
link.
Unfortunately, just about every .h file is included in every .c
file now. Fixing this can be one of the last jobs.


# 63b73463 28-Jan-1998 Brian Somers <brian@FreeBSD.org>

Create a new MP branch for `multilink protocol'.

Do lots of initial shuffling and grouping.
Submitted by: Eivind Eklund <perhaps@yes.no>


# 1ae349f5 28-Jan-1998 cvs2svn <cvs2svn@FreeBSD.org>

This commit was manufactured by cvs2svn to create branch 'MP'.


# aa8e0519 20-Jan-1998 Brian Somers <brian@FreeBSD.org>

Remove unused #includes.
Make various bits static.
Remove unused variables.
Submitted by: eivind


# 313572f3 27-Dec-1997 Brian Somers <brian@FreeBSD.org>

Allow (and document) execution of commands from within
our chat script.
You can now even run chat(8) - see ppp.conf.sample.


# 70ee81ff 24-Dec-1997 Brian Somers <brian@FreeBSD.org>

Cosmetic (style):
sizeof(var) -> sizeof var
sizeof type -> sizeof(type)

Suggested by: J Wunsch <j@uriah.heep.sax.de>


# 6fefd436 23-Dec-1997 Brian Somers <brian@FreeBSD.org>

strncpy(x,y,sizeof(x)) --> strncpy(x,y,sizeof(x)-1)

Suggested by: Philippe Charnier <charnier@lirmm.fr>
Theo de Raadt <deraadt@cvs.openbsd.org>


# 16f81f68 17-Dec-1997 Brian Somers <brian@FreeBSD.org>

Replace

strcpy(a, b); /* a and b are the same size */

with

strncpy(a, b, sizeof(a));
a[sizeof(a)-1] = '\0';

Making the code `correct at a glance'.

Suggested by: Theo de Raadt <deraadt@cvs.openbsd.org>


# b6e82f33 21-Nov-1997 Brian Somers <brian@FreeBSD.org>

Fix prototypes.
Remove extraneous decls.
Add ``const'' to several places.
Allow ``make NOALIAS=1'' to remove IP aliasing.
Merge with OpenBSD - only the Makefiles vary.

We can now survive a compile with
-Wall -Wbad-function-cast -Wcast-align -Wcast-qual
-Winline -Wmissing-declarations -Wmissing-prototypes
-Wnested-externs -Wpointer-arith -Wredundant-decls
-Wshadow -Wstrict-prototypes -Wwrite-strings -Wchar-subscripts
(although the Makefile just contains -Wall).


# 86e02934 09-Nov-1997 Brian Somers <brian@FreeBSD.org>

Increase chat script sizes to 512
Requested by: Michael Reifenberger <root@totum.plaut.de>


# 5106c671 08-Nov-1997 Brian Somers <brian@FreeBSD.org>

Introduce ID0 logging.
Stay as the invoking uid as much as possible.
Execution as a normal user is still forbidden for now,
so these changes are pretty ineffective.
The next commit will implement the modifications suggested
on -hackers a number of days ago.


# 0fe7ca31 28-Oct-1997 Brian Somers <brian@FreeBSD.org>

o Bump version to 1.3 to reflect major changes
o Report modem connect time properly
o Report bytes in/out over physical media
o Fix phases (TERMINATE is *higher than* DEAD)
o Do a LayerFinish from LcpDown
o Bring down IPCP & CCP when we enter PHASE_TERMINATE
o Give a new prompt when we go to PHASE_DEAD
o Stop the modem timer properly when idle
o Treat sig 15 like an exiting carrier loss
o Log (DEBUG) offline & online transitions


# 75240ed1 25-Oct-1997 Brian Somers <brian@FreeBSD.org>

Cosmetic (no functional changes):
o Add missing $Id$s
o Move extern decls from .c -> .h files
o Staticize
o Remove #includes from .h files
o style(9)ify includes
o bcopy -> memcpy
bzero -> memset
bcmp -> memcmp
index -> strchr
rindex -> strrchr
o Move timeout.h -> timer.h (making it consistent w/ timer.c)
o Add -Wmissing-prototypes


# 9a571ec7 24-Oct-1997 Brian Somers <brian@FreeBSD.org>

sleep => nointr_sleep
usleep => nointr_usleep
(not just a #define)
Already done by: ache


# afc7fa2c 31-Aug-1997 Brian Somers <brian@FreeBSD.org>

Cosmetic: Make LogPrintf() calls consistent.


# 944f7098 24-Aug-1997 Brian Somers <brian@FreeBSD.org>

Make the code format more in line with style(9).
Update loadalias to use the new libalias api.
Update to version 1.1.


# eb53eaa3 17-Aug-1997 Brian Somers <brian@FreeBSD.org>

Fix possible buffer overrun while "expect"ing
something that's "nearly" what it wants.


# 5b9b0419 17-Aug-1997 Brian Somers <brian@FreeBSD.org>

Allow specification of fallback phone numbers to
be used only if the dial script fails.
PR: 4262


# c09be724 13-Jul-1997 Brian Somers <brian@FreeBSD.org>

Allow a "hangup" capability.
You can now "ATZ" your modem when it's closed.

Submitted by: peter@citylink.dinoex.sub.org (Peter Much)


# 873725cc 01-Jul-1997 Brian Somers <brian@FreeBSD.org>

Make HUP cause an exit (as it used to), and make
INT cause a hangup - not exiting for -ddial & -auto.

HUP must exit because init sends this at system shutdown
time (why, I don't know), and we don't want to end up
redialing after the HUP (due to another dfilter packet).

Pointed out by and discussed with: ache


# 368aee2b 23-Jun-1997 Brian Somers <brian@FreeBSD.org>

o Fix uptime for direct connections.
o Style police
o Make hangup abort the current connection, not
necessarily exiting (-auto/-ddial).
o Trap HUP and INT during DoChat and abort the
connection attempt. This means you can now
type "dial" and change your mind with ^C, or
HUP the process to stop it dialing.

Slapped into doing it by: Chuck Robey <chuckr@glue.umd.edu>


# 927145be 08-Jun-1997 Brian Somers <brian@FreeBSD.org>

Overhaul ppp:
o Use syslog
o Remove references to stdout/stderr (incl perror())
o Introduce VarTerm - the interactive terminal or zero
o Allow "set timeout" to affect current session
o Change "set debug" to "set log"
o Allow "set log [+|-]flag"
o Make MSEXT and PASSWDAUTH stuff the default
o Move all #ifdef DEBUG stuff into the code - this
shouldn't be too much overhead. It's now controlled
with "set log +debug"
o Add "set log command, debug, tun, warn, error, alert"
o Remove cdefs.h, and assume an ansi compiler.
o Improve all diagnostic output
o Don't trap SIGSEGV
o SIGHUP now terminates again (log files are controlled
by syslog)
o Call CloseModem() when changing devices
o Fix parsing of third arg of "delete"

I think this fixes the "magic is same" problems that some
people have been experiencing.
The man page is being rewritten. It'll follow soon.


# 6ed9fb2f 25-May-1997 Brian Somers <brian@FreeBSD.org>

De-couple ppp from libalias. If libalias isn't there, the
alias commands simply won't work. Only root may specify the
location of the alias lib (otherwise, it's hard-coded).

Make logprintf silently fail if LogOpen hasn't been called.

Suggested by: eivind


# 274e766c 09-May-1997 Brian Somers <brian@FreeBSD.org>

Tidy up the code - bounds checking, return
value checking etc.

Submitted by: eivind


# e68d210e 07-May-1997 Brian Somers <brian@FreeBSD.org>

Allow up to 40 args in the chat script (was 20).
Ignore subsequent args rather than scribbling.

PR: 1952
Submitted by: Mikael Hybsch <micke@free.dynas.se>


# f5ff0f7c 12-Mar-1997 Brian Somers <brian@FreeBSD.org>

Reviewed by: ache@freebsd.org
These changes should fix the signal "problems" in ppp.
The signal changes should really be put into 2.2 too !
The following patches should do it. There were some other
changes made by Andrey recently that havn't been brought
into 2.2, it may be worth doing them now.


# 8ea7f057 09-Mar-1997 Andrey A. Chernov <ache@FreeBSD.org>

cdefs cleanup


# bbea88d0 09-Mar-1997 Andrey A. Chernov <ache@FreeBSD.org>

I remove pending signals completely, they are not useless, they are
dangerous! Signal handlers themself must be fixed to not call malloc,
but no pended handlers, it will be correct fix. In finite case each signal
handler can set some variable which will be analized later, but calling
handler functions manually is too dangerous (f.e. signals not blocked while
the handler or handlers switch executed in this case). Of course this
code can be fixed instead of removing, but it not worth fixing in any case.

Should go into 2.2

In addition sig.c code shows following dangerous fragments (there can be more,
but I stop after two):

This fragment

if (fn == SIG_DFL || fn == SIG_IGN) {
handler[sig-1] = (sig_type)0;
<------------- here
signal(sig,fn);
} else {

cause NULL pointer reference when signal comes
"here", but more worse fragment is below:

void handle_signals() {
int sig;

if (caused)
for (sig=0; sig<__MAXSIG; sig++, caused>>=1)
if (caused&1)
(*handler[sig])(sig+1);
}

caused is bitmask which set corresponding bit on each signal coming.
And now imagine, what happens when some signal comes (bit sets) while loop
is executed (see caused>>=1 !!!)

In this light carrier drop situation was (as gdb shows)
1. SIGSEGV in handle_signals because some junk called as *handler reference.
2. Since SIGSEGV was pended too (== never happens),
it can cause various range of disasters.


# 0b6828d1 07-Mar-1997 Andrey A. Chernov <ache@FreeBSD.org>

Unpend all signals before execv, it not makes any sense to pend them here

Should go into 2.2


# 06257ca4 08-Mar-1997 Andrey A. Chernov <ache@FreeBSD.org>

Unpend all killing signals to shut down this thing immediately,
or it is impossible to kill it in some situations.
Unpend yet one SIGARLM (see timer.c commit)

Should go into 2.2


# c3b6ad66 25-Feb-1997 Brian Somers <brian@FreeBSD.org>

osreldate.h stuff suggested by: Eivind Eklund

Remove #include's from sig.h and get dependant modules to include them
themselves. Make inclusion of if_var.h depend on __FreeBSD_version so
that the -current version of ppp can be used with 2.1.*

2.2 Candidate ?


# 476602a9 22-Feb-1997 Peter Wemm <peter@FreeBSD.org>

Revert $FreeBSD$ to $Id$


# 52cc0880 18-Feb-1997 Brian Somers <brian@FreeBSD.org>

Tidy up signal handling.
All signal() calls have been changed to pending_signal() calls.
pending_signal() is defined in the new sig.c file. It remembers
the handler and traps the signal with a function that will remember
the signal.

main.c now calls handle_signals() to actually call the required
handlers (if the above handler was called).

If this doesn't close PR2662 (was PR2347), I'll cry.

Joerg, I think this should go into 2.2, but I havn't done anything
about it because I'm bound to botch it with the new sig.[ch] files.

I've just "cvs add"'d sig.[ch] so far.... can you update to 2.2 and
tell me what you did ? Thanks.


# 1130b656 14-Jan-1997 Jordan K. Hubbard <jkh@FreeBSD.org>

Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.


# 99c02d39 10-Jan-1997 Warner Losh <imp@FreeBSD.org>

Fix many buffer overruns in the code. Specifically, disallow ExpandString
to be used to expand things beyond the size of the buffer passed in. Also
do a general cleanup of sprintf -> snprintf as well as strcpy and strncat
safety. Also expand some buffers to allow for the largest possible data
that might be used.

This is a 2.2 candidate. However, it needs to be vetted on -current
since little testing has been done on this due to my lack of PPP on
this machine.

Reviewed by: Jordan Hubbard, Peter Wemm, Guido van Rooij


# 053edb3c 15-Dec-1996 Paul Traina <pst@FreeBSD.org>

Avoid some buffer overrun problems.


# 113dea91 09-Jun-1996 Andrey A. Chernov <ache@FreeBSD.org>

Prepare for exec properly and check return values
Submitted by: Arjan de Vet <devet@IAEhv.nl>


# 9c749ffb 11-May-1996 Poul-Henning Kamp <phk@FreeBSD.org>

Here is a diff of /usr/src/usr.sbin/ppp against current. The diffs
add some logging functionality which I find very useful.
'set debug link' will record just link up/down and address assignments.
'set debug connect' will record the entire chat dialog
'set debug carrier' will record just chat lines including 'CARRIER'
(so that I can be sure I'm getting a 28.8 line).

There was a global change required to permit LogPrintf to take a bit
mask instead of a bit position value (to permit logging some events
on either of two flags, so that no change in 'set debug lcp' would
result from the code supporting 'link'. Thus the diffs are rather
long for such a small change. The man page is also touched.

Oh, and there was a slight syntax problem in route.c

Reviewed by: phk
Submitted by: Tony Kimball <alk@Think.COM>


# 81cc95f2 05-Apr-1996 Andrey A. Chernov <ache@FreeBSD.org>

Here is a patch for a little bug in the WaitForString routine. The problem
is when the matched string spans the end of the inbuff. This fix allocates
twice the IBSIZE so that it can keep the last and the current text to search
in the inbuff so that the match won't fail if it gets truncated by the read.

It also warns if the search string is to long and truncates it.

Submitted by: Dough Ambrisco <ambrisco@ambrisco.roble.com>


# a81c9c68 08-Mar-1996 Andrey A. Chernov <ache@FreeBSD.org>

Prevent dial cycling on the last phone from the list, make phone list copy


# cb7fddc6 07-Mar-1996 Andrey A. Chernov <ache@FreeBSD.org>

Log phone as LOG_PHASE, it is valuable enough for multi-phone environment.
Add missing return when terminal mode can't be re-established due
to modem not opened.


# 1dff3fc5 08-Mar-1996 Andrey A. Chernov <ache@FreeBSD.org>

1) Add multi-phone dialing/redialing, several phones separated by ':'
2) Improve on-line help subsystem
3) Make 'term' mode works even carrier dropped (old code
close line forever here)
4) Make 'term' mode 8bit clean.
5) Improve manual page
6) #ifdef DEBUG diagnostic about missing optional files.
7) Don't put interactive dialing info to logfile


# c3899f8d 02-Sep-1995 Atsushi Murai <amurai@FreeBSD.org>

1. Do not log the password itself to ppp.log ( Mr. Rich Murphey )
2. Add ability to execute shell commands and suspend back into
invoking shell (Mr. J Wunsch)

Reviewed by: amurai@spec.co.jp
Submitted by: joerg_wunsch@uriah.heep.sax.de (Joerg Wunsch)
Rich Murphey <rich@lamprey.utmb.edu>


# 709e8f9a 29-May-1995 Rodney W. Grimes <rgrimes@FreeBSD.org>

Remove trailing whitespace.


# 84b8a6eb 11-Mar-1995 Atsushi Murai <amurai@FreeBSD.org>

1.Reducing cpu usage at off connection.
2.Implment Redail function as working correctly.
3.Clean up a code as I notice.
4.Now, RTT getting close to 50ms with ISDN/TA 38400bps !!

Reviewed by: amurai@spec.co.jp
Submitted by: amurai@spec.co.jp


# 53c9f6c0 25-Feb-1995 Atsushi Murai <amurai@FreeBSD.org>

New user Process PPP based on iij-ppp0.94beta2.

o Supporting SYNC SIO device (But need a device driver)
- add "set speed sync"
o Fixing bug for Predictor-1 function.
o Add new parameter that re-sent interval for set timeout commands.
o Improving RTT (Round Trip Time) and reducing processor time.
- Previous Timer service was using polling, and now using
SIGALRM ;-)
- A 0.94beta2 will not work correctly....

-- Follows are additinal feature not including 0.94beta2
o Support Proxy ARP
- add "enable/disable proxy" commands
o Marging common routine in CHAP/PAP.
o Enhancing LCP/IPCP log information.
o Support local Authfication connection on port 300x and tty.
- You can set up pair of your "hostname -s" and
password in ppp.secret. if either ppp.secret file nor
your hostname line don't exist, It will notify a message
and working as same as previous version.(Backword compatibility)
- If you did set up them, It's allow connection but nothing to do
except help and passwd command.
- add "passwd yourpasswd" commands
o Support afilter - keep Alive filter that a packet can send/receiving
according to ifilter/ofilter but doesn't count it as preventing idle
timer expires.
- Same syntax of other filters.
o Fixing bugs reported by current user for previous one. Thanks !!

Reviewed by: Atsushi Murai (amurai@spec.co.jp)


# af57ed9f 30-Jan-1995 Atsushi Murai <amurai@FreeBSD.org>