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


# 672eba24 24-Apr-2023 John Baldwin <jhb@FreeBSD.org>

ppp: Use valid prototypes for function declarations with no arguments.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D39730


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


# fe24bdd4 05-Jul-2013 Robert Millan <rmh@FreeBSD.org>

Remove ancient code for FreeBSD 2.x compatibility.

Reviewed by: brian, freebsd-net


# 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


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


# 5476d2e5 14-Apr-2002 Brian Somers <brian@FreeBSD.org>

When it's necessary to kldload tun(4), don't forget to re-try to open
tun0.

Submitted by: qhwt@myrealbox.com


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


# dc656426 12-Mar-2002 Brian Somers <brian@FreeBSD.org>

Handle B460800 and B921600 being defined in <termios.h>


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


# 797c04a7 15-Jun-2001 Brian Somers <brian@FreeBSD.org>

Correct the arg count after parsing a line with an unescaped # that isn't
preceeded with whitespace.

MFC after: 3 weeks


# 2661ef38 28-Oct-2000 Brian Somers <brian@FreeBSD.org>

Ignore ``#'' properly when told to


# 8a52f3ec 09-Oct-2000 Brian Somers <brian@FreeBSD.org>

Create fd_sets big enough to handle getdtablesize() descriptors.


# 57c94dd3 01-Sep-2000 Brian Somers <brian@FreeBSD.org>

libutil.h is no longer required for setproctitle()


# 8507c35e 30-Aug-2000 Brian Somers <brian@FreeBSD.org>

Use arc4random() instead of random()


# 4c066cf9 30-Aug-2000 Brian Somers <brian@FreeBSD.org>

Don't treat two or more whitespace followed by a comment as
an empty argument

PR: 20937 (maybe)
PR: 20938


# 75fbd185 29-Aug-2000 Brian Somers <brian@FreeBSD.org>

Use srandom() under OpenBSD

Submitted by: Matt Behrens <matt@megaweapon.zigg.com>


# ebe96675 16-Aug-2000 Brian Somers <brian@FreeBSD.org>

setproctitle() doesn't need to be called with root privs, so move
it from id.c into defs.c


# b42135de 07-Apr-2000 Brian Somers <brian@FreeBSD.org>

When running ppp -background, show comfort messages showing
when we're redialing/reconnecting.

While we're here, log redial, reconnect and phone number
announcements to LogCHAT, and reduce some other logging to
LogDEBUG.


# f3a0d054 28-Mar-2000 Brian Somers <brian@FreeBSD.org>

don't treat # specially if PARSE_NOHASH is passed


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


# d81cf7d0 26-Jan-2000 Brian Somers <brian@FreeBSD.org>

Actually ignore comments at the end of lines - broken with the commit
that made ppp *not* treat #s in quoted arguments as comments.


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

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

set something "xxx yyy # zzz" aaa

shouldn't be interpreted as

set something "xxx yyy" aaa


# 1bbd8362 23-Dec-1999 Brian Somers <brian@FreeBSD.org>

Understand double-quotes anywhere on a command line in the same
way that a shell does. The previous way ppp did it just didn't
make any sense.


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

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


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

Handle comments at the end of lines.


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

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


# f6a4e748 28-Nov-1999 Brian Somers <brian@FreeBSD.org>

Make -foreground a proper option (allowing ``allow mode foreground'',
``set mode foreground'' etc.


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

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

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


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

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

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


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

$Id$ -> $FreeBSD$


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

Handle unterminated quoted strings without dup'ing the last character
with an out-by-one-memcpy.


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


# 119386a3 26-Apr-1999 Brian Somers <brian@FreeBSD.org>

#include <errno.h>, not <sys/errno.h>


# 26baedc5 25-Feb-1999 Brian Somers <brian@FreeBSD.org>

Parse IP addresses more securely - specifically, don't allow
a bum name to return as 0.0.0.0... we don't want ``delete xxx''
to delete the default route when xxx doesn't resolve.

Support IP number specifications as the host when specifying
a tcp-style device (rather than *just* hostnames).


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

Remove redundant includes


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

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


# 81358fa3 29-May-1998 Brian Somers <brian@FreeBSD.org>

o Make modes consistent throughout ppp. The same strings are used
in `set mode', `allow modes', on the command line and when
outputting mode names. The strings are matched so that only
enough characters to uniquely identify the string are required,
so you can now

ppp -a mylabel (for auto mode)
ppp -b mylabel (for background mode)
ppp -dd mylabel (for direct dial mode)

etc.
o Make -ddial dial when specified on the command line (oops).
Pointed out by: Alex <garbanzo@hooked.net>


# 1662ac24 28-May-1998 Brian Somers <brian@FreeBSD.org>

srandomdev() isn't available in all 2.* versions. Only
use it for version 3 (-current) & up.


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


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

o Make sure we don't dereference NULL when we've lost all our links.
o Use srandomdev() for __FreeBSD__ >= 2, not just >2.
o Use srandom((time(NULL)^getpid())+random()), random() when we
haven't got srandomdev().


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


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


# 565e35e5 10-Apr-1998 Brian Somers <brian@FreeBSD.org>

o Remove the `mode' global - it's now per physical device.
o Shuffle things that live at the datalink level into
``show link'' rather than ``show modem''.
o Make both ``show'' commands prettier and more consistent,
and display carrier status, link type and our name in
``show modem''.
o Show redial and reconnect information in ``show link''
and remove ``show redial'' and ``show reconnect''.
o Down the correct link in bundle_LinkLost().
o Remove stale -direct and -background links at the end
of our main loop, not when we know they're going. This
prevents unexpected pointer-invalidations...
o If we ``set server'' with the same values twice, notice
and don't moan about failure.
o Record dial script despite our link mode. The mode may
be changed later (next mod) :-) We never run scripts
in -direct and -dedicated modes.
o Make ``set server none'' functional again.
o Correct datalink state array so that we don't report an
``unknown'' state.
o Pass struct ipcp to IpcpCleanInterface, not struct fsm.
o Create TUN_PREFIX define rather than hard-coding in main.c
o prompt_TtyInit now handles a NULL prompt for -direct mode
rather than having to create one then destroy it uncleanly.
o Mention our mode in the "PPP Started" LogPHASE message.
o Bring all auto links up when we have something to send.
o Remove some redundant Physical_*() functions.
o Show which connection is running a command when logging
commands.
o Initialise throughput uptime correctly.


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


# 5cf4388b 25-Mar-1998 Brian Somers <brian@FreeBSD.org>

Tidy up the parent notification stuff for -background mode.
Remove extraneous extern decls of tun_{in,out} and netfd.


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


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

Correct #ifdef for __FreeBSD__ < 3


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


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


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

o Move in_algorithm and out_algorithm into CcpInfo.
o Take note of the return value of the compression layers
init routine, and if it fails, bring the whole layer
cleanly back down again.
o Only use srandomdev() if ``__FreeBSD__ > 2'' - this makes
these sources buildable on 2.2 (where I'm testing).


# 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


# 05d83ad6 30-Dec-1997 Brian Somers <brian@FreeBSD.org>

Typo in error message.


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

Show who closes the diagnostic connection.
Show the IP range (if specified) in "show ipcp".
Close unused descriptors 0 and 2 in interactive mode.
Pass (size_t *) rather than (int *) to sysctl().


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

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

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


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

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

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


# c39934ea 20-Dec-1997 Brian Somers <brian@FreeBSD.org>

Add (BSD) copyright headers.


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


# 3b7eb4fb 17-Nov-1997 Brian Somers <brian@FreeBSD.org>

Add and use a DropClient() function for closing the diagnostic port.
Call DropClient() from Cleanup() too.


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

Add id strings to tun.[ch].
Don't try to open ppp.secret if we're never going to use it.


# 12ef29a8 11-Nov-1997 Brian Somers <brian@FreeBSD.org>

Finish the security improvements:
o Add "allow" command:
"allow users a b c" gives access to users a, b and c.
"allow modes auto" gives those users access to auto mode only.
"allow users *" and "allow modes *" are accepted.
No users and all modes are allowed by default.
UID 0 can do anything.
o Set the current label with the "load" and "dial" commands
so that the call to ppp.linkdown makes sense.
o Up the verison number.
o Don't OR MODE_AUTO for -background and -ddial.
o Don't OR MODE_INTER when we get a diagnostic connection.
o Allow up to 40 args per line (was 20).
o "set ifaddr" only changes the interface in AUTO mode (with other
modes, it happens after IPCP negotiation).
o Sort command descriptions in the man page.
o Support -dedicated mode where we just talk ppp forever (no login etc).


# 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