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


# fdb6437f 24-Jun-2011 Kevin Lo <kevlo@FreeBSD.org>

Remove duplicated header files


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


# 8e41399c 19-Jul-2009 Brian Somers <brian@FreeBSD.org>

Don't get stuck in an infinite loop comparing (short++ <= maxshort)

PR: 136893
Submitted by: Aragon Gouveia - aragon at phat dot za dot net (mostly)
Approved by: re (kib)
MFC after: 3 weeks


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

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


# a5625ae7 12-Mar-2008 Paolo Pisati <piso@FreeBSD.org>

Update to the "new" libalias API (and thus fix world breakage).


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

Add a bunch of malloc() return checks

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


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

Make ppp WARNS=5 clean


# b07fbc17 23-Sep-2003 Joe Marcus Clarke <marcus@FreeBSD.org>

Add Cisco Skinny Station protocol support to libalias, natd, and ppp.
Skinny is the protocol used by Cisco IP phones to talk to Cisco Call
Managers. With this code, one can use a Cisco IP phone behind a FreeBSD
NAT gateway.

Currently, having the Call Manager behind the NAT gateway is not supported.
More information on enabling Skinny support in libalias, natd, and ppp
can be found in those applications' manpages.

PR: 55843
Reviewed by: ru
Approved by: ru
MFC after: 30 days


# 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


# d3974088 22-Apr-2002 Dag-Erling Smørgrav <des@FreeBSD.org>

Usage style sweep: spell "usage" with a small 'u'.
Also change one case of blatant __progname abuse (several more remain)
This commit does not touch anything in src/{contrib,crypto,gnu}/.


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

cmott@scientech.com -> cm@linktel.net

Requested by: Charless Mott <cmott@scientech.com>


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


# 686e8c8b 02-Aug-2001 Brian Somers <brian@FreeBSD.org>

Add a ``nat punch_fw'' command for punching FTP and IRC DCC holes through
the firewall.


# 88298994 08-Jul-2001 Brian Somers <brian@FreeBSD.org>

Add a ``nat proto'' command -- similar to natd(8)'s -redirect_proto switch.

MFC after: 3 weeks


# 057fee78 04-Jun-2001 Brian Somers <brian@FreeBSD.org>

Add BSD style copyrights (with permission from Charles Mott where appropriate)
Deprecate -alias further (after a repo-copy)


# 49ed07a3 10-Feb-2001 Brian Somers <brian@FreeBSD.org>

A better fix for the PacketAliasProxyRule() call.

Submitted by: Ian Dowse <iedowse@maths.tcd.ie>


# 021996f1 28-Jan-2001 Brian Somers <brian@FreeBSD.org>

Don't pass PacketAliasProxyRule() a buffer with leading whitespace as it
can't handle it.


# cf881f54 30-Oct-2000 Brian Somers <brian@FreeBSD.org>

Drop PKT_ALIAS_IGNORED packets if ``nat deny_incoming yes'' is in effect.

Approved by: rwatson, ru


# 0a4b6c5c 11-Jul-2000 Brian Somers <brian@FreeBSD.org>

Allow a ``timeout secs'' filter option to let specific packet types
effect the idle timer in different ways.

Submitted by: Stefan Esser <se@freebsd.org>

With adjustments by me to document the option in the man page and to
give the same semantics for outgoing traffic as incoming.

I made the style more consistent in ip.c - this should really have
been done as a separate commit.


# 98251667 07-Jul-2000 Brian Somers <brian@FreeBSD.org>

o Log the (payload/size) of all packet types, not just TCP packets

o If the new ``filter-decapsulation'' is enabled, delve into UDP packets
that contain 0xff 0x03 as the first two bytes, and if we recognise it
as PROTO_IP, decapsulate it for the purpose of filter checking.

If we recognise it as PROTO_<anything else> mention this for logging
purposes only.

This change is aimed at people running PPPoUDP where the UDP traffic is
being sent over another PPP link. It's desireable to have the top level
link connected all the time, but to have the bottom level link capable
of decapsulating the traffic and comparing the payload against the filters,
thus allowing ``set filter dial ...'' to work in tunnelled environments.

The caveat here is that the top ppp cannot employ any compression layers
without making the data unreadable for the bottom ppp. ``disable deflate
pred1 vj'' and ``deny deflate pred1 vj'' is suggested.


# 86c5e1ea 19-Jun-2000 Brian Somers <brian@FreeBSD.org>

Remove ``nat pptp'' as this is now done transparently by libalias.


# eb598e08 23-May-2000 Brian Somers <brian@FreeBSD.org>

Always pass packets through libalias when NAT is enabled.

Submitted by: luoqi
Forgotten by: me


# 7d7b90c7 11-May-2000 Brian Somers <brian@FreeBSD.org>

Fix a typo


# 44d127bc 11-May-2000 Brian Somers <brian@FreeBSD.org>

Mention that the default is to let external traffic route to
the internal network when NAT is enabled.

Allow ``set target MYADDR'' to stop packets at the gateway.


# 804e0a12 31-Mar-2000 Brian Somers <brian@FreeBSD.org>

Use INADDR_NONE with PacketAliasSetTarget() if no args are given to
``nat target'', and suggest the use of ``nat target default'' as an
interesting possibility.


# b7d8533c 31-Mar-2000 Brian Somers <brian@FreeBSD.org>

Add the ``nat target'' command.


# b565321a 29-Mar-2000 Brian Somers <brian@FreeBSD.org>

Log information about packets being dropped (probably due to
``nat deny_incoming yes'') by libalias.


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

Mention the value of the unexpected return code in nat_LayerPull()


# a1f961d3 18-Mar-2000 Brian Somers <brian@FreeBSD.org>

Add some diagnostics to prove that incoming IP fragments are
being dealt with correctly.


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

Refresh the NAT IP pointer after a potential mbuf reallocation. This
caused frequent lock-ups for individual sessions over a NAT'd ppp link
when MTU sizes ended up more or less exactly wrong.


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

Fix some printf-style argument bugs


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

Introduce LOCALNAT and LOCALRAD defines so that the sources can stay
exactly the same in FreeBSD & OpenBSD despite libalias and libradius
being local to the ppp sources under OpenBSD.


# 323b15a1 03-Jan-2000 Brian Somers <brian@FreeBSD.org>

Ensure that there's a bit of extra space in our buffer when it's
passed to libalias. If there's not enough space, things like ftp
PORT commands start failing....

Reported by: Gianmarco Giovannelli <gmarco@giovannelli.it>


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

Cosmetic: Make struct mbuf more like kernel mbufs.


# f02c2029 08-Sep-1999 Brian Somers <brian@FreeBSD.org>

Cosmetic:
alias_cmd -> nat_cmd after a repo-copy


# 19c56680 06-Sep-1999 Brian Somers <brian@FreeBSD.org>

Make the ``Problem with IP header length'' error a bit more verbose


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

$Id$ -> $FreeBSD$


# 67b072f7 19-Aug-1999 Brian Somers <brian@FreeBSD.org>

o Add the -foreground switch. This switch behaves like -background except
that ppp stays in the foreground.
o Add the -quiet switch to quieten ppps startup
o Add the -nat flag and discourage the use of the -alias flag. Both do
the same thing.
o Correct some nat usage strings.
o Change the internal ``alias'' command to ``nat''.


# 7722ec20 28-Jul-1999 Brian Somers <brian@FreeBSD.org>

Don't return a garbage mbuf pointer after storing it
as an unresolved fragment.


# ef8fcfa7 23-Jul-1999 Brian Somers <brian@FreeBSD.org>

When we fetch previously retrieved IP fragments from the alias
tables, copy them correctly back into our mbuf rather giving a
bzero'd count to memcpy() and ending up with a 0 byte fragment.

The old code resulted in a 0 byte write to the tun device which
tickled a bug that resulted in a panic :-(


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

Allow a remote IP and port range specification in the
``alias port'' command.


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


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

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

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

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

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

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

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

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

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

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

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


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

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

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

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

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


# 7884358f 26-Apr-1999 Brian Somers <brian@FreeBSD.org>

Add support for NetBSD


# fe3094cd 25-Mar-1999 Brian Somers <brian@FreeBSD.org>

Allow port ranges in ``alias port''.


# 50a63ab9 07-Mar-1999 Brian Somers <brian@FreeBSD.org>

Support PPTP via libalias (``alias pptp addr'').


# d318fe8e 07-Mar-1999 Brian Somers <brian@FreeBSD.org>

Support proxying & transparent proxying curtesy of libalias(3).
Order the alias command descriptions.
Order the SEE ALSO entries.


# 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


# 1595bacd 16-Sep-1998 Brian Somers <brian@FreeBSD.org>

Sync with OpenBSD ifdefs


# 5a72b6ed 26-Aug-1998 Brian Somers <brian@FreeBSD.org>

Put the IP buffer queues into struct ipcp.
Forgotten by: me


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

Remove redundant includes


# 615ad4f9 27-Jun-1998 Brian Somers <brian@FreeBSD.org>

Don't dlopen()/dlsym() libalias, use it in the same way
as the rest of the world uses libraries.


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


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

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


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

Correct copyright.

Requested by: Eivind Eklund <perhaps@yes.no>


# abbdf4e9 21-Dec-1997 Brian Somers <brian@FreeBSD.org>

Charles Mott created these (and told me via email that
they were BSD copyright). Use his name, not mine.


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

Add (BSD) copyright headers.


# 8511968c 15-Dec-1997 Brian Somers <brian@FreeBSD.org>

Correct return values from alias routines.


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


# 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


# 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


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

Include <alias.h>, not "alias.h"


# f82fd828 22-May-1997 Brian Somers <brian@FreeBSD.org>

Finish updating for the latest alias code.

Submitted by: Charles Mott <cmott@srv.net>