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


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

Make ppp WARNS=5 clean


# a57095e7 29-Jun-2004 Brian Somers <brian@FreeBSD.org>

Re-implement LQM, this time according to the rfc.

PR: 11293
MFC after: 4 weeks


# 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


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


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

Convert IIJ copyrights to BSD copyrights.

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


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


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

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

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

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

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

For i4b devices we always insist on carrier.

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


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


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


# e3044845 03-Apr-1999 Brian Somers <brian@FreeBSD.org>

Handle the detection of frames even if we read them
with more than one read(). When we detect one, don't
forget to pass it to async_Input() and drop our
terminal back into command mode.

Don't output an extraneous \r if we're passed \r\n
to prompt_vprintf in raw mode.


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

Ensure that the thing we're casting to struct ip
is aligned for non-i386 architectures.


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

When resending chap challenges, resend the same challenge
each time rather than making up a new one.

Increase the authname/authkey max sizes to 100 characters.

Allow ``authkey'' specifications beginning with ``!''.
When a challenge is received, the text following the
``!'' is executed as a program (expanding stuff in the same
way that ``sh'' and ``!bg'' do). The program is passed the
peer name, peer challenge and local ``authname'' on standard
input and is expected to output the name/key combination that
should be used to build the CHAP response.

This provides support for Secure ID cards (guess what I was
given at work recently!) using CHAP.

Examples will follow.


# f0cdd9c0 05-Feb-1999 Brian Somers <brian@FreeBSD.org>

Decouple pap & chap output routines from the corresponding
input routines and take advantage of the new init/continue
interface in libradius. This allows a timely response on
other links in an MP setup while RADIUS requests are in
progress as well as the ability to handle other data from
the peer in parallel. It should also make the future addition
of PAM support trivial.

While I'm in there, validate pap & chap header IDs if
``idcheck'' is enabled (the default) for other FSM packet
types.

NOTE: This involved integrating the generation of chap
challenges and the validation of chap responses
(and commenting what's going on in those routines).
I currently have no way of testing ppps ability
to respond to M$Chap CHALLENGEs correctly, so if
someone could do the honours, it'd be much
appreciated (it *looks* ok!).

Sponsored by: Internet Business Solutions Ltd., Switzerland


# 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


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


# cff2b1c9 31-Jul-1998 Brian Somers <brian@FreeBSD.org>

Cosmetic: Diagnostic wording (Unknown -> Unexpected)


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


# a33b2ef7 16-Jun-1998 Brian Somers <brian@FreeBSD.org>

Change some log levels. ALERTs are only logged when
something that can't happen happens or when everyone
needs to know. ERRORs are only logged when something
unexpected happens.


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


# 641684cd 20-May-1998 Brian Somers <brian@FreeBSD.org>

Don't accept IPCP packets before NETWORK phase.
Pointed out by: Ralf Rutherford <ralf@philips.oz.au>


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

o Activate link-level CCPs in multilink mode, by bringing them
into the ST_STOPPED state.
o Allow an optional ccp|lcp argument to `down'. The default is
still lcp (as before). You can now call down with no context
in multilink mode, in which case it'll down the multilink ccp
or the entire bundle (*very* rude).
o Allow an optional `!' after `close ccp' (close ccp!) to tell
ccp to stay in the CLOSED state after the terminate ACK. The
default is now to re-enter STOPPED so that the peer can bring
the layer back up if desired.
o Always handle proto-compressed packets, even if we've agreed
(in LCP) that the peer will not send us 1 byte protocols.
If the peer violates the LCP agreement, log it to the HDLC
log.
o Fix some comments.


# 66f634b6 11-May-1998 Brian Somers <brian@FreeBSD.org>

o Do an mp_Down() when aborting ppp.
o Re-assign the link name when strdup()ing the datalink name.
o Add the link name to some more hdlc log messages.


# b7c5748e 07-May-1998 Brian Somers <brian@FreeBSD.org>

o Rename datalinks as soon as the name has been received so that
LQM and HDLC timer diagnostics come out with the correct name.
o Don't send an LQR immediately upon reviving a datalink. Leave
it 'till the next timeout.
o Add the link name to some more LQR diagnostics.
o Break out of the main loop when a descriptor exception is seen
in select().
o Remove the evil nointr_[u]sleep() functions. Timers should be
(and are) used instead.
o Treat a read() of 0 bytes as an error that's fatal to the link
on which the read() is done. We should never read() 0 after
select() says there's something there - not unless the link
has been closed by the other side.
o Write the data seen before a HDLC header to the terminal in
`term' mode, *not* back to the modem :-/
o Initialise our transmitted file descriptor before starting any
timers.
o Only send data links that have *no* pending output data. This
means that our final ACK will be written rather than being
nuked with the datalink transmission.


# 147613ea 03-May-1998 Brian Somers <brian@FreeBSD.org>

o Increment expected MP fragment numbers correctly,
according to SHORTSEQ negotiation.
o Don't forget to attach incoming fragments with a
number greater than everything else in the queue
(rather than leaking memory).
o Output the link name with the ``other'' hdlc
diagnostic message.
o Correct a VJ diagnostic (`COMPPROTO', not `proto').


# 6e7cdde1 03-May-1998 Brian Somers <brian@FreeBSD.org>

o Mention our link name with timed HDLC error reports.
o Switch off our carrier detect timer if we don't have
CD after logging in.
o Maintain our CD timer after a link transfer.


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

Cosmetic: Make our external function names consistent.


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


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


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

o Initialise MP correctly depending on if we're the
first link in mp_Up().
o Bring MP and its CCP down when we enter phase TERMINATE,
and ditch everything in the incoming packet queue.
o Enable MRRU negotiation. Now, we can multilink
mode, but only with one physical link.
o Close the link if the peer PROTO REJs PROTO_MP.
o Prepend our protocol before passing a packet to
struct mp for fragmentation.
o Log info messages to DEBUG, not ERROR (oops).
o Align `show mp' output (again).


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

Tidy up the use of struct pppTimer.


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

Cosmetic: Clean up warnings.


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


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


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


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


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

Move the IPCP into struct bundle.


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


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

Add extraneous braces to stiffle warnings from gcc-2.8


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

"dial" now may optionally have context.
Tidy up some LcpInfo uses.


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


# f830032f 11-Mar-1998 Brian Somers <brian@FreeBSD.org>

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 HisLqrData (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.

LQR should now be fully functional.


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


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


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


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

o Fix an obscure memory leak (if the peer sends PROTO_COMPD
packets when we haven't agreed a protocol).
o Move the complication of passing incoming data to the
PROTO_COMPD input or dictionary setup routine into ccp.c


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


# 9991562d 18-Feb-1998 Brian Somers <brian@FreeBSD.org>

Make ``show escape'' require context.
De-globalize EscMap[].


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


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


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


# 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


# 98baf7c8 09-Jan-1998 Brian Somers <brian@FreeBSD.org>

Implement Reset{Req,Ack} properly, as per rfc 1962.
(I completely mis-read the rfc last time 'round!)

This means:
o Better CCP/WARN Reset diagnostics.
o After we've sent a REQ and before we've received an ACK, we drop
incoming compressed data and send another REQ.
o Before sending an ACK, re-sequence all pending PRI_NORMAL data in
the modem queue so that pending packets won't get to the peer
*after* the ResetAck.
o Send ACKs with the `identifier' from the REQ frame.
o After we've received a correct ACK, duplicate ACKs are ok (and will
reset our history).
o Incorrect ACKs (not matching the last REQ) are moaned about and dropped.

Also,

o Calculate the correct FCS after compressing a packet. DEFLATE
*may* produce an mbuf with more than a single link in the chain,
but HdlcOutput didn't know how to calculate the FCS :-(
o Make `struct fsm'::reqid a u_char, not an int.
This fix will prevent us from sending id `255' 2,000,000,000 times
before wrapping to `0' for another 2,000,000,000 sends :-/
o Bump the version number a little.

The end result: DEFLATE now works over an unreliable link layer.
I can txfr a 1.5Mb kernel over a (rather bad) null-modem
cable at an average of 21679 bytes per second using rcp.
Repeat after me: Don't test compression using a loopback ppp/tcp setup as
we never lose packets and therefore never have to reset!


# 4e9914b7 05-Jan-1998 Brian Somers <brian@FreeBSD.org>

Correct the return value of ReportProtStatus() ("show proto").
Submitted by: Dave Bodenstab <imdave@mcs.net>


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


# 774326ed 04-Dec-1997 Brian Somers <brian@FreeBSD.org>

Identify rejected protocol types according to rfc1700.


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


# 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


# f7fdd41d 10-Sep-1997 Brian Somers <brian@FreeBSD.org>

PRED1 => TY_PRED1 (oops)


# 29a6597c 10-Sep-1997 Brian Somers <brian@FreeBSD.org>

o Initialize the PRED1 input queue when we
receive the ResetAck, NOT when we send the
ResetReq (as per the rfc).
o SILENTLY ignore CCPs that arrive *before*
the network phase (as per the rfc).
o Check that we've actually negotiated PRED1
before sending PRED1 output.
This bug has been around for a *VERY* long
time ! We shouldn't need to explicitly disable
PRED1 now :-)


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


# 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


# 4ded859b 19-Apr-1997 Andrey A. Chernov <ache@FreeBSD.org>

Fix typo in previous commit


# 6b5f0ac2 19-Apr-1997 Poul-Henning Kamp <phk@FreeBSD.org>

Unceremoneously discard HDLC frames with less than two bytes in them.
XXX: real fix: this could should check the number of bytes in the packet
before accessing them.

Found by: phkmalloc


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


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


# e53374ea 30-Jan-1996 Poul-Henning Kamp <phk@FreeBSD.org>

Use libmd's MD5.
inline hdlc checksum calculation.
make big tables const.


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

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


# 7b64106a 10-Jan-1996 Poul-Henning Kamp <phk@FreeBSD.org>

A random bunch of cleanup changes.


# 4545963c 30-Jul-1995 Gary Palmer <gpalmer@FreeBSD.org>

Typo in log message : errros -> errors


# 60e218e4 08-Jul-1995 Atsushi Murai <amurai@FreeBSD.org>

1. Clean up log message.
2. Optimize ModemQlen.
3. Sending ProtoReject for Unknow protocol (i.e. IPX)
4. Avoid select looping by reading tun under the high system load.
5. Adding Local version String for maintenance.
6. Just more speak rather silent ignore if you type invalid key words.


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

Remove trailing whitespace.


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