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


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

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


# 3026fd06 06-Sep-2006 Brian Somers <brian@FreeBSD.org>

If the peer REJects our MRU request and that request is for a value
less than the current MTU, set our mtu to the value requested.


# eb1ecbb2 10-Jan-2005 Brian Somers <brian@FreeBSD.org>

Integrate some OpenBSD alignment fixes. This hopefully also fixes PR 38058...

Obtained from: Brad <brad@comstyle.com>


# 125eb366 12-Dec-2004 Brian Somers <brian@FreeBSD.org>

Implement an ``enable/disable echo'' option, defaults to off.
This allows LCP ECHOs to be enabled independently of LQR reports.

Note: This introduces a change in the default behaviour (search for lqr and
echo in the man page). I'll update UPDATING to reflect this.

PR: 74821


# 1814213e 05-Sep-2004 Marcel Moolenaar <marcel@FreeBSD.org>

Fix the build on 64-bit platforms.


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

Make ppp WARNS=5 clean


# 6eafd353 27-Aug-2002 Brian Somers <brian@FreeBSD.org>

Include the correct file (stdarg.h) and use va_list rather than _BSD_VA_LIST_

Suggested by: mike


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


# 69f6ed25 01-May-2002 Brian Somers <brian@FreeBSD.org>

Allow the peer to modify the LQR interval


# ff360cc9 16-Apr-2002 Brian Somers <brian@FreeBSD.org>

Make the way FSM options are processed easier to read by using structures
instead of u_char *.

The changes are cosmetic except:

RecvConfigAck() now displays the options that are being ACK'd
Huge (bogus) options sent from the peer won't cause an infinite loop
SendIdent and ReceiveIdent are displayed consistenlty with other FSM data
LCP AUTHPROTO options that aren't understood are NAK'd, not REJ'd


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


# 542a7fe0 18-Oct-2001 Brian Somers <brian@FreeBSD.org>

Fix AUTH callback negotiations.

MFC after: 1 week


# 2a772845 18-Oct-2001 Brian Somers <brian@FreeBSD.org>

When the peer fails to specify an MRU and a 1500 byte MRU is not
allowed either because of the transport or configuration, send a
MRU NAK only once, then allow the negotiations to proceed.

rfc1661 says that 1500 should always be allowed and rfc2516 says
that 1492 is the maximum for PPPoE. This changes ppp so that it
only weakly suggests 1492, then goes with the default (leaving
the problem in the hands of the peer WRT how they set their MTU).

MFC after: 1 week


# ed1e8460 13-Sep-2001 Brian Somers <brian@FreeBSD.org>

sigpause() -> sigsuspend()
sigblock() -> sigprocmask()


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


# 5a082731 30-Jul-2001 Brian Somers <brian@FreeBSD.org>

If the peer REJects our MRU REQ, stop REQing it -- *EVEN* if we're
doing PPPoE and the default MRU is therefore too big.

When negotiating with win2k, we ask for MRU 1492 and the win2k box
NAKs us saying ``MRU 1492''. This doesn't make sense to me. When
we continue to request MRU 1492, the win2k box eventually REJs our
MRU. This fix allows negotiations to continue at that point,
bringing the link up and potentially allowing the win2k box to send
us frames that are too large. AFAICT this is better than failing
to bring the link up.... probably !

I have no idea how to do the equivalent of ``route get'' or
``ifconfig -a'' under win2k, so I can't tell what MTU it actually
ends up using.

I believe the bug is in win2k (it's certainly mis-negotiating).
I'll MFC given the release engineers permission as code freeze
begins on August 1.

PR: 29277
MFC after: 3 days


# 525b58c9 26-Jul-2001 Brian Somers <brian@FreeBSD.org>

Handle peer REQ/NAKs of >1500 byte MRUs when we have no preference.

MFC after: 3 days


# 17462195 16-Jul-2001 Brian Somers <brian@FreeBSD.org>

Ignore (with a warning message) mtu/mru configurations that are greater
than the maximum physical values.

MFC after: 1 week


# 4bb6aac0 03-Jul-2001 Brian Somers <brian@FreeBSD.org>

Don't accept chap80lm by default - it doesn't work.

MFC after: 1 week


# 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


# 65309e5c 13-Jun-2001 Brian Somers <brian@FreeBSD.org>

Convert IIJ copyrights to BSD copyrights.

Approved by: Toshiharu OHNO <tohno@sirius.ocn.ne.jp>


# c63c8e76 29-Nov-2000 Brian Somers <brian@FreeBSD.org>

Call MSCHAP CHAP80 in ``show lcp'' so that it's consistent with CHAP81.


# 385167a6 19-Nov-2000 Brian Somers <brian@FreeBSD.org>

Accept MSCHAPv2 by default.
Enable and accept MPPE by default.


# 9b996792 29-Oct-2000 Brian Somers <brian@FreeBSD.org>

Various whitespace changes.
Make some functions static.


# a8d604ab 29-Oct-2000 Brian Somers <brian@FreeBSD.org>

Add MPPE and MSChap v2 support (denied and disabled by default)

Submitted by: Ustimenko Semen <semen@iclub.nsu.ru>


# 1038894e 18-Jul-2000 Brian Somers <brian@FreeBSD.org>

Support link identification from rfc1570
Two new commands are available; ``ident'' and ``sendident''.


# ec37734a 24-Jun-2000 Brian Somers <brian@FreeBSD.org>

Don't assign an MTU based on the peers first-link MRU in MP mode.
Use the peers MRRU as we're supposed to.


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

When ppp can't identify the relevant name, don't use "???", use
<nnn> or <0xxxx> instead.


# 182c898a 27-Dec-1999 Brian Somers <brian@FreeBSD.org>

Add a bunch of `const's and fix a typo.

Submitted by: Rich Neswold <rneswold@MCS.Net>


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

Cosmetic: Make struct mbuf more like kernel mbufs.


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

$Id$ -> $FreeBSD$


# b18a6818 08-Aug-1999 Brian Somers <brian@FreeBSD.org>

Silence a warning about uninitialized variables.


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

Initialise `mp'.


# 7063995c 09-Jun-1999 Brian Somers <brian@FreeBSD.org>

Allow our endpoint discriminator to be enabled, disabled, accepted
and denied. This is necessary for some MP implementations that
get confused if you accept their endpoint discriminator but reject
their MRRU.


# 411675ba 02-Jun-1999 Brian Somers <brian@FreeBSD.org>

o Alter the mbuf type as it's processed by different layers.
o Show more information about missing MP fragments in ``show mp''.
o Do away with mbuf_Log(). It was showing mbuf stats twice on
receipt of LCP/CCP/IPCP packets.... ???!!?
o Pre-allocate a bit extra when creating LQR packets to avoid having
to allocate another mbuf in mbuf_Prepend().


# 3377c28c 09-May-1999 Brian Somers <brian@FreeBSD.org>

Deal with the fact that as we now mbuf_Read the fsm
header in fsm_Input() we often end up with a NULL mbuf.

Deal with a possible NULL mbuf being passed into
mbuf_Prepend().

Adjust some spacing to make things more consistent.


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


# 4ae29eb7 11-Apr-1999 Brian Somers <brian@FreeBSD.org>

Revert the ACCMAP changes where we OR the peers accmap
with our own if there are differing bits (last two revisions
of lcp.c). This change broke at least one negotiation
session.
Instead, we just use an OR of the two accmap values when
we're doing the ASYNC framing.


# a2bc4c59 29-Mar-1999 Brian Somers <brian@FreeBSD.org>

If we adjust our required ACCMAP due to a more restrictive
ACCMAP being REQuested by the peer, also increment our FSM
id so that we don't end up sending out a new REQ with the
same ID and different data (the changed ACCMAP).


# 536d5b33 01-Mar-1999 Brian Somers <brian@FreeBSD.org>

When negotiating ACCMAPs, sync our ACCMAP with the
peers by ORing the two together and NAKing or REQing
the result rather than allowing seperate local/peer
values.
If the peer REJs our ACCMAP and our ACCMAP isn't 0,
warn about it and ignore the rejection.


# 479508cf 26-Feb-1999 Brian Somers <brian@FreeBSD.org>

Allow control over the number of ConfigREQ & TermREQ attempts
that are made in each of the FSMs (LCP, CCP & IPCP) and the
number of REQs/Challenges for PAP/CHAP by accepting more arguments
in the ``set {c,ip,l}cpretry'' and ``set {ch,p}apretry'' commands.

Change the non-convergence thresholds to 3 times the number of configured
REQ tries (rather than the previous fixed ``10''). We now notice
repeated NAKs and REJs rather than just REQs.

Don't suggest that CHAP 0x05 isn't supported when it's not configured.

Fix some bugs that expose themselves with smaller numbers of retries:
o Handle instantaneous disconnects (set device /dev/null) correctly
by stopping all fsm timers in fsm2initial.
o Don't forget to uu_unlock() devices that are files but are not
ttys (set device /dev/zero).

Fix a *HORRENDOUS* bug in RFC1661 (already fixed for an Open event in state
``Closed''):
According to the state transition table, a RCR+ or RCR- received in
the ``Stopped'' state are supposed to InitRestartCounter, SendConfigReq
and SendConfig{Ack,Nak}. However, in ``Stopped'', we haven't yet
done a TLS (or the last thing we did is a TLF). We must therefore
do the TLS at this point !

This was never noticed before because LCP and CCP used not use
LayerStart() for anything interesting, and IPCP tends to go into
Stopped then get a Down because of an LCP RTR rather than getting a
RCR again.


# 5e315498 17-Feb-1999 Brian Somers <brian@FreeBSD.org>

Fully support both NT and LANMan CHAP type 0x80 as both
authenticator and authenticatee.


# 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


# 5165af6f 12-Jan-1999 Brian Somers <brian@FreeBSD.org>

If we've configured CBCP *and* another not-so-important
CALLBACK protocol and end up agreeing CBCP, DTRT and go
into CBCP phase rather than mistakenly terminating as
if CBCP wasn't agreed.
Problem reported by: Alexander Dubinin <alex@nstl.nnov.ru>


# e377bbf8 16-Oct-1998 Brian Somers <brian@FreeBSD.org>

Warn that the specific chap protocol isn't supported when
rejecting CHAP because of byte 5.
Suggested by: Daniel O'Callaghan <danny@hilink.com.au>


# 7ac9884a 08-Sep-1998 Brian Somers <brian@FreeBSD.org>

Initialise lcp::his_mru to the ``set mtu'' value if it's less
than DEF_MRU, allowing our interface mtu to be decreased
despite negotiation with the peer.


# 9e8ec64b 04-Sep-1998 Brian Somers <brian@FreeBSD.org>

Don't cast potentially unaligned addresses to pointers to
non-char types on non-i386 architectures.
On Alpha and Sparc we get a bus error if we do.


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


# 3a2e4f62 27-Jun-1998 Brian Somers <brian@FreeBSD.org>

o Fix remaining sizeof problems for 64 bit machines.
o Allow ``set ....'' when we have multiple links but aren't in
multilink mode.
o Do a TLS when we receive a ``Open'' event in ``Closed'' state,
despite the rfc state transition table. This is clearly an
error in the RFC as TLS cannot have yet been called (without
TLF) in the ``Closed'' state.
I've posted a message to comp.protocols.ppp for confirmation.


# 897f9429 25-Jun-1998 Brian Somers <brian@FreeBSD.org>

Add ``ipcp'' as an optional argument to ``open'', and make
open capable of re-negotiatiating the various layers.

It is now possible to change various link options and then
re-open the relevant layer, making the changes effective -
for example, switching off VJ compression or starting ECHO
LQRs on-the-fly.


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

Fix a rather nasty use of `static'. This caused a SEGV
when running ``link * load label'' as we ended up recursing
back into command_Interpret after nuking our command arg list.


# 05dbe14b 29-May-1998 Brian Somers <brian@FreeBSD.org>

Some documentation corrections & typo fixes....


# dd0645c5 15-May-1998 Brian Somers <brian@FreeBSD.org>

o Add the `set mode' command for change a links current mode. It
is not possible to switch to or from dedicated or direct mode,
but all other combinations are ok (eg. -auto -> -ddial).
o Cope with the fact that commands with optional context may not
be able to obtain a link with command_ChooseLink() (if all links
have been deleted for example).
o Allow `clone'ing in non-multilink mode. We may for example want
to configure two links in unilink mode and dial them both, using
the one that comes up first. It's also possible to rename
``deflink'' by cloning it, deleting the original, then setting
the mode of the new link.


# b4b280ab 06-May-1998 Brian Somers <brian@FreeBSD.org>

o Behave correctly when short sequence numbers are denied.
o Determine if one seq is less than the other correctly,
given the point at which they wrap (again).


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

Cosmetic: Make our external function names consistent.


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


# e43ebac1 25-Apr-1998 Brian Somers <brian@FreeBSD.org>

Make gcc-2.8.1 build ppp cleanly.
Support OpenBSD again.


# 50abd4c8 24-Apr-1998 Brian Somers <brian@FreeBSD.org>

Make ``show ipcp'' prettier and remove a few redundant includes.


# 643f4904 24-Apr-1998 Brian Somers <brian@FreeBSD.org>

o Defer setting up pap/chap based IP numbers & labels until after
we've determined if we're going to join another ppp invocation.
o Make ``show link'' show all link details, and ``show links''
just give a list of links and their current status.
o Show our current label in ``show bundle''.
o Allow link cloning and removal as soon as our MRRU is set.
o Make ``show lcp'' require context as nothing will ever change
in our MP LCP (it's auto-configured as per rfc1990).
o Initialise our LQM owner in hdlc_Init().
o Store our endpoint discriminator and authentication name at both
the datalink and multilink level and compare them when we've
finished AUTHENTICATE phase and before entering NETWORK phase.
If they don't match, close the link again.
Display the information in the appropriate ``show'' command.
o Initialise datalink::phone and datalink::fsmp.object properly
when we're cloning the link.
o Show which link we're passing LQRs on in our diagnostics.
o Reject endpoint discriminator REQs at the logical multilink
level.
o Remove the rest of our CARRIER and LINK logging setup.


# d47dceb8 24-Apr-1998 Brian Somers <brian@FreeBSD.org>

o Remove LINK level logging.
o change the default link name to ``deflink'' rather
than ``default''.
o Prepend the link name to CCP and LCP FSM diagnostics.
o Protect against 0 length options in CCP and IPCP REQ
interpreters (already done for LCP).
o Allow optional context for the `show' command.
o Use MPs link when interpreting commands if the multilink
mrru is configured rather than when multilink is active.
This means that once we've ``set mrru xxx'', we then need
to ``link deflink show ccp'' etc if we want to do link-level
stuff (based on the command requiring optional or manditory
context).
o Use the ifconfig'd interface address in `set enddisc {ip,mac}'
if it's there, otherwise the configuration file value.


# dbf60d74 23-Apr-1998 Brian Somers <brian@FreeBSD.org>

o Don't go multilink if the peer hasn't asked for it
o Don't go multilink if the peer hasn't agreed
o When negotiating multilink, don't try to push the peers
MRU up according to our `set mtu' setting. Instead, accept
whatever MRU they want and push their MRRU up instead.
o When *not* negotiating multilink, REJ short sequence number
REQs.


# 49052c95 22-Apr-1998 Brian Somers <brian@FreeBSD.org>

Negotiate MRRU, SHORTSEQ and ENDDISC. ENDDISC doesn't imply
multilink ('cos I've seen my ISP REQ it without multilink).

Setting MRRU is ifdef'd out until it's debugged and we can
merge -direct links with other running programs.

Fix MTU setting.


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

o Use __attribute__ (#ifdef __GNUC__) to type-check
LogPrintf() and prompt_Printf(), and fix the bits
identified as being wrong as a result.


# 1342caed 15-Apr-1998 Brian Somers <brian@FreeBSD.org>

o Move the accept/deny/disable/enable globals either to the
bundle (non-negotiated vars) or to their respective IPCP,
LCP or CCP.
o Enable rolling throughput statistics by default.
o Remove the `display' command. These values now appear in
`show bundle', `show ipcp', `show ccp' and `show lcp'.
o Initialise auth name & key at bundle create time (oops).
o Rename pppd-deflate (the id-24 hack) to deflate24.
o Don't send both a REJ and a NAK to an IPCP or LCP REQ.
Favour the REJ (already done at the CCP level).
o Recurse in datalink_UpdateSet() when we change state, otherwise
we end up setting no descriptors and getting jammed in the
imminent select() instead of doing the dial/login/hangup.
o Display our CHAP encryption method despite being built with DES.
o Display VJ as not negotiated in ``show ipcp'' when necessary.


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


# a3e27496 05-Apr-1998 Brian Somers <brian@FreeBSD.org>

`int var : 1' -> `unsigned var : 1'.
This made things look silly and made us mis-negotiate the
number of VJ slots.


# 833882f7 03-Apr-1998 Brian Somers <brian@FreeBSD.org>

o Move VarMSChap into struct chap, and remove `set encrypt'
option. We never ask a client for MSChap when we've got
chap `enabled', and we dynamically answer using MSChap
if the peer demands it.
o Remove all of the bundle2*() series of functions except
bundle2datalink() as they're too expensive. The only
calls to bundle2datalink() are made from command.c when
determining context.
o Write to the correct modem in term mode, and check the
return value, dropping back to command mode if the write
fails.

Cosmetic:
Make the PPP COMMAND LIST section of the man page
prettier, better and more consistent. Alphabeticalise
all command lists and document missing commands.


# 97ce322d 03-Apr-1998 Brian Somers <brian@FreeBSD.org>

Initialise multilink LCPs according to rfc1990.


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

Deglobalise `struct prompt':
o Our diagnostic socket has its password set in the `set socket'
line only (not in ppp.secret).
o Passwords are per server socket (*VarAuthKey are gone)
o Authority is per prompt (VarLocalAuth is gone).
o Local logging is per prompt.
o Add a `show who' command to see who's connected. No identd
routine - just a `where the connection came from' display.
o SIGUSR1 is disabled for now - we have no way of choosing a
password for the socket created :-(

Prompts are attached as a list of `struct descriptor's in
struct bundle, and serviced under the bundles descriptor
service routines. Ultimately, everything should be done
like this.

Cosmetic:
o alphabeticalise SRCS in Makefile.
o Add a few comments in command.h

TODO: Start checking that we don't overflow the descriptor sets
in select() now that we can have any number of descriptors.


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

o Move default MRU, MTU, ACCMAP and OPENMODE config values into
struct lcp and display them in `show lcp'.
o Remove `show mru' and `show mtu' and make the data part of
`show lcp'. Also merge `set m[tr]u' and `set openmode'
implementations into the SetVariable function.
o `set timeout' only accepts the idle timer value as an argument.
o Move our lqr period into struct lcp, and create a `set lqrperiod'
command. Display it in `show lcp'.
o Remove VarRetryTimeout, and implement it at the LCP, PAP, CHAP,
CCP and IPCP levels, creating individual `set XXXretry' commands
for each. They must be separate because they have different
context requirements in multilink mode.
o Display default config values in `show ccp'.
o Tart the man page up a bit (wrt PPP/TCP, compression and LQR) and
explain the new commands.


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


# 1e991daa 24-Mar-1998 Brian Somers <brian@FreeBSD.org>

Remove some more globals:
o int modem was unused.
o StateNames[] is now accessed via State2Nam()
o ipKeepAlive is no more. As a result, we must call FilterCheck()
twice if we're doing TCP/IP logging (once when we queue and log
the packet and once when we transmit it and need to know if the
idle timer should be reset), but this won't be the case
in normal life.


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


# 2267893f 20-Mar-1998 Brian Somers <brian@FreeBSD.org>

o Check the LCP Identifier field for correctness and drop
dodgy packets by default.
The old behaviour is still available with ``disable idcheck''.
o Make all FSM diagnostics consistent and tidy up the way
we build our LCP/CCP/IPCP requests.
o Don't assume sizeof(u_long) == 4.


# eaa4df37 16-Mar-1998 Brian Somers <brian@FreeBSD.org>

Move VJ compression state and stats into struct ipcp.


# 5ca5389a 16-Mar-1998 Brian Somers <brian@FreeBSD.org>

Move filter sets into struct bundle.


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

Remove more globals


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

o Don't immediately reply to the first LQR thinking
it's a duplicate ('cos it compares with our initial
values).
o Move the LCP into struct datalink.


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


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

Move the idle timer into struct bundle. There's no
link-level idle timer for the moment.


# d2fd8d77 02-Mar-1998 Brian Somers <brian@FreeBSD.org>

Force IPCP back to initial in bundle_Close().
Add a few un-necessary includes to make us build under
2.2.5. These'll go when the code is cleaned up at the
end.


# e2ebb036 28-Feb-1998 Brian Somers <brian@FreeBSD.org>

Do authentication at the datalink level, not the bundle level.
The bundle doesn't get a LayerUp 'till we're authenticated.

Introduce DATALINK_LCP and DATALINK_AUTH phases.


# 5454ccd9 27-Feb-1998 Brian Somers <brian@FreeBSD.org>

Reset fsm.maxconfig in the *_Setup() routines.


# 6d666775 26-Feb-1998 Brian Somers <brian@FreeBSD.org>

Create struct fsm_parent. FSMs are created with one of these,
and the FSM passes subsequent events to them.

The datalink now hides its CCP from the bundle layer.


# 6eddf53e 23-Feb-1998 Brian Somers <brian@FreeBSD.org>

Move our Layer*() FSM callbacks into their own structure.


# 503a7782 20-Feb-1998 Brian Somers <brian@FreeBSD.org>

Shuffle around our FSMs a bit. This'll make it
easier to remove the CcpInfo, LcpInfo and IpcpInfo
globals.


# 7e80369b 19-Feb-1998 Brian Somers <brian@FreeBSD.org>

Move some FSM initialisation into FsmInit().


# 63258dcc 18-Feb-1998 Brian Somers <brian@FreeBSD.org>

o Create `struct hdlc' - a part of struct physical.
o Move our LCP report timer into struct hdlc - it's really
a hdlc timer (fcs errors etc).
o Make `show hdlc' require context and make the output more
friendly.
o Remove all non-const globals from hdlc.c
o Output peer-rejected protocols by name - not just ones
that we reject.


# 81b6b898 17-Feb-1998 Brian Somers <brian@FreeBSD.org>

Merge LcpOpen functionality into datalink_LoginDone


# 3006ec67 15-Feb-1998 Brian Somers <brian@FreeBSD.org>

Create struct datalink.

This is a type of physical link that can chat and talk
LCP & CCP. A bundle contains a list of these (only one
in the list for the moment).

The datalink is a type of descriptor, and dials, enters
LCP (& does CCP), kicks the bundle when its FSMs do
something interesting and does the hangup chat script
on the way down. It also handles redials and reconnects.

There are lots of loose ends, and probably lots of bugs,
but the data structures are getting there !


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


# aad81d1e 08-Feb-1998 Brian Somers <brian@FreeBSD.org>

Rename ccpstate to ccp, ipcpstate to ipcp and lcpstate to lcp.


# 455aabc3 07-Feb-1998 Brian Somers <brian@FreeBSD.org>

o Hook the FSMs into our bundle.
o The FSM layering is now more sane.
o Move a lot of the NCP stuff into our ipcpstate rather than having it
in the bundle, including control of the configured IP addresses. We
don't need hacks like the global `linkup' variable any more as the
FSM decides when our ppp.link* files get run. This is going to eventually
be configurable based on FSM events anyway.
o Fix a few inconsistencies when both sides require authentication.
o We now have "Ppp..." and "PPp" prompts, reflecting authentication
and network phase. We don't print loads of spurious prompts as we
change phases any more.
o Our phase is part of the bundle now.
o Fix a bug where the FSM wasn't calling LayerFinish.
o Close the FSM down correctly with a signal rather than slamming it
down as if the line was dropped (the undocumented ``down'' command
is still available though).
o Remove the forgotten `tunno' variable and fix references to it.


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

Isolate fsm callback functions
Derive {lcp,ipcp,ccp}state structures from struct fsm
where convenient.
Create bundle_Down() and remove LcpDown()


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

Shuffle names and args in modem.h


# b3796ed6 03-Feb-1998 Brian Somers <brian@FreeBSD.org>

Merge from MP branch:
Correct magic number format string


# 52f21f26 03-Feb-1998 Brian Somers <brian@FreeBSD.org>

Correct magic number format string
Spotted by: Bruce M. Walter <walter@fortean.com>


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


# 7a6f8720 02-Feb-1998 Brian Somers <brian@FreeBSD.org>

Create `struct bundle' - the top level control structure.
This structure will eventually contain a list of NCPs (currently
only IPCP is supported) and a list of physical `struct link's.
It will also derive from a struct link itself.
Make ModemTimeout() static - it's way to dangerous to be called
from outside !
Bump version to 1.9. Our first MP release should be 2.0.


# 7308ec68 30-Jan-1998 Brian Somers <brian@FreeBSD.org>

Move the global FSMs into their relevent structures.
IPCP, CCP and LCP are now just derived FSMs.
Comment each of the FSM implementations so that we can
tell what's going on.
Revise the state transitions so that CCP and IPCP actually
send terminate REQs when appropriate.

The OS & IPCP layers are still like spagetti (next job).


# 8c07a7b2 30-Jan-1998 Brian Somers <brian@FreeBSD.org>

Create `struct link' - the logical link from which
`struct physical' (and the future `struct logical')
are derived.


# c8ee0d78 29-Jan-1998 Brian Somers <brian@FreeBSD.org>

o Bring global/static data into LcpInfo.
o Parameterise LcpReportTime().
o Don't obscure the hard-coded use of LcpInfo.
o Comment on the data elements of LcpInfo.


# 29e275ce 29-Jan-1998 Brian Somers <brian@FreeBSD.org>

o Move global/static IPCP data into IpcpInfo.
o Use INADDR_ANY and INADDR_BROADCAST instead of 0 and 0xffffffff
for IP addresses & masks.
o Move struct compreq into ipcp.c (it's none of anyone elses
business).
o Rename MAX_STATES to MAX_VJ_STATES.


# 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


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

Allow an optional delay when specifying "set openmode active".
The delay defaults to 1 sec (as it always has) unless we've done
a ~p in interactive mode or we've actually detected a HDLC frame.
This is now cleanly implemented (via async timers) so that it is
possible for LCP to come up despite the delay if an LCP REQ is
received.

This will hopefully solve situations with slow servers or slirp
scenarios (where ECHO is left on the port for a second or so before
the peer enters packet mode).

Also, ~p in interactive mode no longer changes the value of the default
openmode delay and -dedicated mode enters packet mode in the right state
according to the value of openmode.


# cc924f9e 11-Jan-1998 Brian Somers <brian@FreeBSD.org>

Lose <net/if_var.h> !
This'll require a `make installworld'.


# 3a70c9f7 11-Jan-1998 Brian Somers <brian@FreeBSD.org>

Make things work when sizeof(long) != 32 (hopefully)


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


# b0624e7f 07-Dec-1997 Brian Somers <brian@FreeBSD.org>

Fix PAP, CHAP & LQR req (I broke the byte ordering when
I did the deflate re-org).
Make PAP & CHAP negotiation prettier in the log file.
If both PAP & CHAP are `enabled' and the peer NAKs CHAP
suggesting PAP, be friendly and REQ PAP the next time.
This is in line with the rfc.


# 0053cc58 03-Dec-1997 Brian Somers <brian@FreeBSD.org>

Abstract the CCP layer a level.
Add DEFLATE support.


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


# 9a0b991f 18-Nov-1997 Brian Somers <brian@FreeBSD.org>

Add throughput logging (disabled by default).
Use "enable throughput" to see modem & IPCP throughput.
Removed an extraneous prompt()


# 6a6b4bbb 16-Nov-1997 Brian Somers <brian@FreeBSD.org>

Abstract data read from and written to the tun device,
allowing for a possible header on the front of all packets.
In OpenBSD, there's a structure containing the address
family here.
If we're building under OpenBSD, set up the ``flags'' part
of struct tuninfo (not there under FreeBSD) so that we config
the interface as POINTOPOINT.
Prefix prototypes with ``extern'' in os.c for consistency.

These changes are cosmetic under FreeBSD, but allow ppp to
build & work under OpenBSD (bar the srandomdev() stuff,
the inclusing of <net/if_var.h> and some Makefile symantecs).


# 9e836af5 14-Nov-1997 Brian Somers <brian@FreeBSD.org>

Update the cftypes arrays according to rfc1700.
Log IPCP reqests as IPCP.


# 3d8ad715 11-Nov-1997 Brian Somers <brian@FreeBSD.org>

Fix typo that causes CHAP RESPONSEs to *always*
be damned M$ responses if you've got DES.


# 9780ef31 07-Nov-1997 Brian Somers <brian@FreeBSD.org>

Don't pass global vars as args.
Remove local/global conflicts.


# 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


# 6eaa6ac5 25-Oct-1997 Brian Somers <brian@FreeBSD.org>

Cosmetic:
Move prototypes into the correct headers.


# 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


# 30bbbd3e 14-Oct-1997 Brian Somers <brian@FreeBSD.org>

Initialise LCP, IPCP and CCP as soon as LCP is down.
Without this, in -auto mode, we stay in ST_STOPPING
and never check our dial filters to see if it's time
to bring the line up again.

This may make "set stopped" redundant.


# e70c96ab 05-Oct-1997 Brian Somers <brian@FreeBSD.org>

Change things around a bit when bringing down the layers.

o LcpLayerDown() no longer does a NewPhase(PHASE_TERMINATE).
Instead, it's done in LcpLayerFinish(). LayerFinish() gets
called by the FSM after the LCP FSM goes through the Stopping
and Stopped states.

o -direct and -background mode exit at PHASE_TERMINATE, not
PHASE_DEAD.

The result is that LCP, CCP & IPCP are brought down cleanly on both
sides of the link (not just our side). Killing ppp rather than just
closing it still makes it get out after the LCP SendTerminateReq().
I'll have a look at that soon. We're probably not actually sending
the REQ :-(


# 8bfa2d0e 29-Sep-1997 Brian Somers <brian@FreeBSD.org>

If "set mtu" is used, *and* the mtu is less than the
value requested by the peer, NAK using this value
rather than silently just changing the interface
mtu.


# fde958c3 27-Sep-1997 Brian Somers <brian@FreeBSD.org>

Don't depend on time.h including sys/types.h


# 7351f9d8 24-Sep-1997 Brian Somers <brian@FreeBSD.org>

Allow Microsoft CHAP authentication.
This is a combination of MD4 & DES.
Submitted by: Gabor Kincses <gabor@acm.org>


# 3f112519 23-Sep-1997 Brian Somers <brian@FreeBSD.org>

Undo botched commit (local changes got in)


# 301127fb 22-Sep-1997 Brian Somers <brian@FreeBSD.org>

Don't allow accept/deny when it's not appropriate.
Log PAP/CHAP users in utmp & wtmp, allowing it to
be avoided with "disable utmp"


# 586526be 21-Sep-1997 Brian Somers <brian@FreeBSD.org>

Don't pause for one second before starting LCP
negotiation. Instead, incrementally pause after
receiving LCPs with the same magic. We can now
suffer a server that waits more than 1 second before
responding. Pauses greater than a second get
hopelessly confusing as when the server eventually
starts, it sees a flood of Config Requests followed
by config NAKs and changes of magic. This causes the
server to change its magic over and over.....


# 94cad8bc 21-Sep-1997 Brian Somers <brian@FreeBSD.org>

Sleep for a second before sending the first LCP
config request. This stops us from squirting stuff
down a line that still has ECHO turned on because the
peer hasn't had a chance to start yet.
Lead to the cause by: Greg Lehey <grog@lemis.com>


# 5b4c5b00 02-Sep-1997 Brian Somers <brian@FreeBSD.org>

Bring CCP and IPCP layers down properly when LCP
comes down. Give a count of bytes sent/received
in IPCP log.


# b6d7b1e0 02-Sep-1997 Brian Somers <brian@FreeBSD.org>

Allow the transition from an idle timeout value
of zero (no timeout) while IPCP is up.
Move some prototypes into .h files and re-order
some includes.


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


# cb611434 20-Aug-1997 Brian Somers <brian@FreeBSD.org>

Expand the "set stopped" command so that it can
idependently time out any of the FSMs.

Split LCP logging into LCP, IPCP and CCP logging,
and make room in "struct fsm" for the log level
that the state machine should use.


# bfbee262 31-Jul-1997 Brian Somers <brian@FreeBSD.org>

Remove extraneous prototypes.


# 687ee69a 13-Jun-1997 Andrey A. Chernov <ache@FreeBSD.org>

Remove srandomdev fallback code


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


# 1f3dee4c 31-May-1997 Brian Somers <brian@FreeBSD.org>

Remove initial startup printf's in -direct mode.
Make "same magic" error send a NAK (as per rfc).


# 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


# 25aa96ac 24-May-1997 Brian Somers <brian@FreeBSD.org>

Fix the reconnect option, and add an explanation to vars.h


# 6efd9292 18-May-1997 Brian Somers <brian@FreeBSD.org>

Mega update to sort out bad implementations
of reconnect & -background.

o Fix reconnect anomolies.
o Make reconnect apply to failed LQR hangups (& mention in man page).
o Make reconnect effective in -background mode.
o Listen on socket in -background mode.
o Try all phone numbers in -background mode.
o Insist on system arg in -background mode.
o Make a control-connection close command exit in -background mode.
o Output status message to stdout on exit of parent in -background mode.
o Don't notify parent of success too soon.
o Describe termination EX_* code.
o Miscelaneous diagnostic corrections.
o Remove redundant connect_time from modem.c.
o Don't repeatedly DownConnection().


# 06d8e8d3 10-May-1997 Andrey A. Chernov <ache@FreeBSD.org>

Cosmetique


# b1c4e614 10-May-1997 Andrey A. Chernov <ache@FreeBSD.org>

Print out reject masks on "show lcp"


# 87063741 10-May-1997 Andrey A. Chernov <ache@FreeBSD.org>

Use random() for GenerateMagic()


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

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

Submitted by: eivind


# 2cd0474b 05-May-1997 Brian Somers <brian@FreeBSD.org>

Make ppp exit on loss of carrier in -background mode.

Submitted by: Jim Carroll <jim@carroll.com>


# 6e4959f0 13-Mar-1997 Brian Somers <brian@FreeBSD.org>

Closes pr 2711
Fix -background option. Parent returns after the line is established
(or not established).
Definitely a candidate for 2.2


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

Revert $FreeBSD$ to $Id$


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


# b0cdb3ce 12-Oct-1996 Jordan K. Hubbard <jkh@FreeBSD.org>

1. Room to calculate MD5 for CHAP negotiation is shorter than
required. a core is not dumped at first connecting time and
dumped at second or third time. (patch I)
2. A routine for "show route" refers out of allocated space.
Values pointed by "lp" should be read as CHAR, I think.
there is also no free() for disallocation. (patch II)

Here is also a patch for an improvement: In current imprementation,
even if PPP connection is disconnected by time out, prompt of
interactive mode does not change from "PPP>" to "ppp>" to
indicate the disconnection on a terminal.
So I modified the code to do that. (patch III)

Submitted-By: NAKAMURA Motonori <motonori@econ.kyoto-u.ac.jp>


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


# 76bd0c0a 30-Jan-1996 Doug Rabson <dfr@FreeBSD.org>

Some patches to ppp which improve stability. I have been running a
ppp based on these patches for about 3 weeks with no downtime.

The original submitters comments:

Two features iijppp has over kernel ppp that I like are predictor1
compression and demand dialing. Here are a few bug fixes.

I expanded the priority queueing scheme and discovered it was broken
due to the assignment at ip.c line 300. All packets were being
queued at the same priority.

Fixing priority queueing broke predictor1 compression. Packets
were compressed before being queued and predictor1 worked as long
as the packets were popped off the queue in the same order they
were pushed onto the queue.

There were a few byte order problems in IP header tests also.

There is a recursion problem in SendLqrReport(). LcpClose() is
called when "Too many echo packets are lost" which winds up in
SendLqrReport() again. I believe the original intention was to
just stop the LQR timer with the call to StopLqr() but the side
effects hurt.

Submitted by: John Capo <jc@irbs.com>


# ed6a16c1 11-Jan-1996 Poul-Henning Kamp <phk@FreeBSD.org>

Final cleanup for now. -Wall is now silent. A couple of bogons found.


# f1884650 17-Sep-1995 Atsushi Murai <amurai@FreeBSD.org>

1. All fragments (except the first one) of a fragmented packet were
dropped - devet@adv.IAEhv.nl (Arjan de Vet)
2. Will not read data from telnet connection - John Capo <jc@irbs.com>
3. Using LQM option could be drop the link due to LcpLayerDown() doesn't
stop LQR timer. - Brian <brian@awfulhak.demon.co.uk>
4. Allow to describe a syntax of filters that is not only port number
but also by name in /etc/service. - Rich Murphey <rich@lamprey.utmb.edu>

Reviewed by: Atsushi Murai <amurai@spec.co.jp>
Submitted by: devet@adv.IAEhv.nl, jc@irbs.com, brian@awfulhak.demon.co.uk,
rich@lamprey.utmb.edu


# 28303f27 07-Jul-1995 Atsushi Murai <amurai@FreeBSD.org>

>Number: 591
>Category: bin
>Synopsis: SPAP request REJexted in stead of NAKed
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs (FreeBSD bugs mailing list)
>State: open
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Wed Jul 5 01:40:01 1995
>Originator: Dick van den Burg
>Organization:
>Release: FreeBSD 2.0.5-RELEASE i386
>Environment:
>Description:

When trying to connect with ppp to a Shiva Lanrover (version 3.2) the
authentication fails because the SPAP (Shiva Secure PAP) configuration
request the is sent by Shive is REJected by ppp in stead of NAKed.

Reviewed by: amurai@spec.c.jp and friends
Submitted by: burg@is.ge.com


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