Name Date Size #Lines LOC

..08-May-2022-

libradius/H08-May-2022-2,0141,570

MakefileH A D08-May-20221.9 KiB9878

README.changesH A D08-May-20227.4 KiB142135

README.develH A D08-May-20222.5 KiB5142

README.natH A D08-May-202215 KiB380285

acf.cH A D08-May-20223.6 KiB11973

acf.hH A D08-May-20221.6 KiB353

arp.cH A D08-May-20228.3 KiB318225

arp.hH A D08-May-20221.8 KiB385

async.cH A D08-May-20225.4 KiB217158

async.hH A D08-May-20222 KiB5520

auth.cH A D08-May-202211 KiB441351

auth.hH A D08-May-20222.8 KiB7035

bundle.cH A D08-May-202256 KiB2,0111,545

bundle.hH A D08-May-20227.5 KiB209148

cbcp.cH A D08-May-202222.2 KiB760589

cbcp.hH A D08-May-20222.6 KiB6731

ccp.cH A D08-May-202223.2 KiB823654

ccp.hH A D08-May-20225.6 KiB167116

chap.cH A D08-May-202227 KiB968787

chap.hH A D08-May-20222.7 KiB7640

chap_ms.cH A D08-May-202212.2 KiB409291

chap_ms.hH A D08-May-20222.6 KiB5417

chat.cH A D08-May-202220.3 KiB798631

chat.hH A D08-May-20223 KiB8441

command.cH A D08-May-202296.4 KiB3,1882,829

command.hH A D08-May-20223.1 KiB7739

datalink.cH A D08-May-202242.5 KiB1,4701,245

datalink.hH A D08-May-20226.3 KiB159109

deflate.cH A D08-May-202216 KiB603446

deflate.hH A D08-May-20221.6 KiB322

defs.cH A D08-May-20228.8 KiB449375

defs.hH A D08-May-20225.4 KiB14294

descriptor.hH A D08-May-20222.3 KiB5521

ether.cH A D08-May-202220.6 KiB732543

ether.hH A D08-May-20221.8 KiB397

exec.cH A D08-May-20227 KiB236185

exec.hH A D08-May-20221.8 KiB376

filter.cH A D08-May-202215.7 KiB605499

filter.hH A D08-May-20223.9 KiB10350

fsm.cH A D08-May-202231 KiB1,2151,021

fsm.hH A D08-May-20227.1 KiB203132

hdlc.cH A D08-May-202215 KiB435353

hdlc.hH A D08-May-20223.8 KiB11361

id.cH A D08-May-20226.1 KiB293227

id.hH A D08-May-20223 KiB8050

iface.cH A D08-May-202219.3 KiB722586

iface.hH A D08-May-20222.9 KiB6730

ip.cH A D08-May-202229.2 KiB967799

ip.hH A D08-May-20222.2 KiB4613

ipcp.cH A D08-May-202242.5 KiB1,4691,174

ipcp.hH A D08-May-20225.2 KiB13480

iplist.cH A D08-May-20225.7 KiB228174

iplist.hH A D08-May-20222.1 KiB5320

ipv6cp.cH A D08-May-202220.5 KiB750569

ipv6cp.hH A D08-May-20223.4 KiB8541

layer.hH A D08-May-20222.1 KiB5421

lcp.cH A D08-May-202238.9 KiB1,2961,113

lcp.hH A D08-May-20226.3 KiB14496

link.cH A D08-May-20229.4 KiB388292

link.hH A D08-May-20223.4 KiB8240

log.cH A D08-May-202211 KiB523431

log.hH A D08-May-20224 KiB10065

lqr.cH A D08-May-202214.2 KiB450320

lqr.hH A D08-May-20223 KiB7331

main.cH A D08-May-202217.8 KiB677517

main.hH A D08-May-20221.6 KiB332

mbuf.cH A D08-May-20229.9 KiB435336

mbuf.hH A D08-May-20223.9 KiB11978

mp.cH A D08-May-202233.7 KiB1,210945

mp.hH A D08-May-20225 KiB148100

mppe.cH A D08-May-202220.3 KiB819585

mppe.hH A D08-May-20221.7 KiB355

nat_cmd.cH A D08-May-202214.9 KiB572457

nat_cmd.hH A D08-May-20221.9 KiB4310

ncp.cH A D08-May-202212.6 KiB530404

ncp.hH A D08-May-20224.3 KiB10365

ncpaddr.cH A D08-May-202223.3 KiB1,016839

ncpaddr.hH A D08-May-20224.7 KiB11173

netgraph.cH A D08-May-202220.9 KiB751562

netgraph.hH A D08-May-20221.8 KiB397

pap.cH A D08-May-20228.8 KiB304226

pap.hH A D08-May-20221.9 KiB428

physical.cH A D08-May-202228.7 KiB1,113936

physical.hH A D08-May-20226.4 KiB173127

ppp.8.m4H A D08-May-2022143.7 KiB5,8545,850

pred.cH A D08-May-20228.9 KiB346281

pred.hH A D08-May-20221.7 KiB331

probe.cH A D08-May-20222.4 KiB8040

probe.hH A D08-May-20221.7 KiB408

prompt.cH A D08-May-202213 KiB573460

prompt.hH A D08-May-20224 KiB9861

proto.cH A D08-May-20223.3 KiB11873

proto.hH A D08-May-20222.5 KiB6625

radius.cH A D08-May-202230.6 KiB1,053833

radius.hH A D08-May-20223.9 KiB10261

route.cH A D08-May-202225.5 KiB921774

route.hH A D08-May-20223.3 KiB7539

server.cH A D08-May-202210.8 KiB416338

server.hH A D08-May-20222.4 KiB6325

sig.cH A D08-May-20223.5 KiB12155

sig.hH A D08-May-20221.7 KiB373

slcompress.cH A D08-May-202216.3 KiB591391

slcompress.hH A D08-May-20225.7 KiB15057

sync.cH A D08-May-20222.7 KiB8344

sync.hH A D08-May-20221.5 KiB311

systems.cH A D08-May-202212.2 KiB506387

systems.hH A D08-May-20222.1 KiB4512

tcp.cH A D08-May-20225.7 KiB213162

tcp.hH A D08-May-20221.7 KiB365

tcpmss.cH A D08-May-20225.2 KiB187119

tcpmss.hH A D08-May-20221.5 KiB311

throughput.cH A D08-May-20228.9 KiB305237

throughput.hH A D08-May-20223 KiB7239

timer.cH A D08-May-20227.9 KiB297209

timer.hH A D08-May-20222.4 KiB5721

tty.cH A D08-May-202220.7 KiB765602

tty.hH A D08-May-20221.8 KiB397

tun.cH A D08-May-20223.4 KiB12181

tun.hH A D08-May-20221.7 KiB419

ua.hH A D08-May-20222.5 KiB6432

udp.cH A D08-May-20228.8 KiB337259

udp.hH A D08-May-20221.8 KiB376

vjcomp.cH A D08-May-20225.8 KiB202141

vjcomp.hH A D08-May-20221.6 KiB386

README.changes

1Copyright (c) 2001 Brian Somers <brian@Awfulhak.org>
2              based on work by Eivind Eklund <perhaps@yes.no>,
3All rights reserved.
4
5Redistribution and use in source and binary forms, with or without
6modification, are permitted provided that the following conditions
7are met:
81. Redistributions of source code must retain the above copyright
9   notice, this list of conditions and the following disclaimer.
102. Redistributions in binary form must reproduce the above copyright
11   notice, this list of conditions and the following disclaimer in the
12   documentation and/or other materials provided with the distribution.
13
14THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24SUCH DAMAGE.
25
26$FreeBSD: src/usr.sbin/ppp/README.changes,v 1.16.2.6 2001/06/04 14:46:12 brian Exp $
27$DragonFly: src/usr.sbin/ppp/README.changes,v 1.2 2003/06/17 04:30:00 dillon Exp $
28
29This file summarises changes made to ppp that effect
30its configuration.
31
32It does not describe new features, rather it attempts
33to answer any `this used to work, why doesn't it now?'
34questions.
35
36o The `set debug' command was replaced with `set log'.
37o The `set log LCP' command was split into LCP, IPCP and CCP logs.
38o Syslogd is used for logging.  /etc/syslog.conf must be updated.
39o LQR is disabled by default.
40o Openmode is active by default.
41o Users must be a member of group `network' for ppp access.  Furthermore,
42  they must be `allow'ed to run ppp via the `allow' command in the
43  configuration file.
44  For a brief period, ppp could only be run as root.
45o No diagnostic socket is created by default.  The `set server' command
46  must be used.
47o The diagnostic socket password must be specified *only* on the `set
48  server' command line.
49o When `set server' is used to re-select a diagnostic port, all existing
50  diagnostic connections are dropped.
51o pppd-deflate is now called deflate24.
52o Filter IPs of 0.0.0.0 have a default width of 0, not 32.
53o Errors in `add' and `delete' are logged as warnings rather than being
54  written to the TCP/IP log.
55o Any number of diagnostic prompts are allowed, and they are allowed in
56  interactive mode.
57o The default `device' is cuaa1, then cuaa0
58o A password of "*" in ppp.secret causes a passwd database lookup in
59  pap mode.
60o The value of the CONNECT environment variable is logged in the
61  utmp host field in -direct mode.
62o Out-of-sequence FSM packets (IPCP/LCP/CCP) are dropped by default.
63o Reconnect values are used after an LQR timeout.
64o ^C works on the parent in -background mode.
65o The dial/call/open command works asynchronously.  As a result, prompts
66  do not lose control while dialing.
67o The `display' command has been removed.  All information is available
68  with the appropriate `show' command.
69o Msext does not need to be enabled/disabled.  Setting the NBNS (set nbns)
70  will auto enable it.  The DNS side may be enabled/disabled, and if
71  enabled without a `set dns' (was `set ns') will use values from
72  /etc/resolv.conf.
73o Filters are now called `allow', `dial', `in' and `out'.  `set
74  ifilter ...' becomes `set filter in ...' etc.
75o Authname and Authkey may only be `set' in phase DEAD.
76o Set encrypt is no longer necessary.  Ppp will respond to M$CHAP
77  servers correctly if it's built with DES.
78o Throughput statistics are enabled by default.
79o `Set stopped' only has two parameters.  It's no longer possible to
80  have an IPCP stopped timer.
81o `Set timeout' only has one or two parameters.  Use `set lqrperiod' and
82  `set {lcp,ccp,ipcp,chap,pap}retry' for the other timers.  These timeout
83  values can be seen using the relevant show commands.
84o `set loopback' is now `enable/disable loopback'.
85o `show auto', `show loopback' and `show mtu' are all part of `show bundle'.
86o `show mru' is part of `show lcp'
87o `show msext' and `show vj' are part of `show ipcp'
88o `show reconnect' and `show redial' are part of `show link'
89o A signal 15 (TERM) will now shut down the link gracefully.
90o A signal 2 (HUP) will drop all links immediately.
91o Signal 30 (USR1) is now ignored.
92o Add & delete commands are not necessary in ppp.linkup if they are
93  `sticky routes' (ie, contain MYADDR or HISADDR).
94o LINK and CARRIER logging are no longer available.
95o Timer based DEBUG messages are now logged in the new TIMER log.
96o Ppp can use tun devices > tun255.
97o Protocol-compressed packets are accepted even if they were denied
98  at LCP negotiation time.
99o Passwords aren't logged when logging the ``set server'' line.
100o Command line options only need enough characters to uniquely identify
101  them.  -a == -auto, -dd == -ddial etc.  -interactive is also allowed.
102o If you don't like seeing additional interface aliases when running in
103  -auto -alias mode, add ``iface clear'' to your ppp.linkdown file -
104  check the sample file.
105o Ppp waits for 1 second before checking whether the device supports
106  carrier.  This is controllable with ``set cd''.
107o Random dial timeouts are now between 1 and 30 seconds inclusive rather
108  than between 0 and 29.
109o Ppp now accepts M$CHAP (as well as normal CHAP) by default.  If this
110  is not required, you must ``deny chap05 chap80''.
111o The ``set device'' command now expects each device to be specified as an
112  argument rather than concatentating all arguments and splitting based
113  on commas and spaces.
114o The ``show modem'' command is deprecated and has been changed to
115  ``show physical''.
116o The words ``host'' and ``port'' are no longer accepted by the ``set filter''
117  command.  Removing them should yield the same results as before.
118o The ``set weight'' command has been deprecated.  The ``set bandwidth''
119  command should now be used instead.
120o The ``set autoload'' command syntax and implementation have changed as the
121  old implementation was mis-designed and dysfunctional.
122o Ppp now waits either the full ``set cd'' time or until carrier is detected
123  before running the login script (whichever comes first).
124o The -alias flag has been deprecated.  The -nat flag should be used instead.
125o Unbalanced quotes in commands are now warned about and the entire command
126  is ignored.
127o It is now only necessary to escape the `-' character in chat scripts twice.
128  See the example files for details.
129o Environment variables and ~ are expanded on in commands
130o ``nat pptp'' is no longer necessary as this is now done transparently
131o The ``!'' at the start of chat scripts and authkey can be made literal
132  (rather than meaning execute) by doubling it to ``!!''.
133o MP autoload throughput measurements are now based on the maximum of input
134  and output averages rather than on the total.
135o When only one link is open in MP mode, MP link level compression is not
136  open and the peer MRU >= the peer MRRU, ppp sends outbound traffic as
137  PROTO_IP traffic rather than PROTO_MP.
138o MSCHAPv2 is now accepted by default.  If you don't wish to negotiate
139  this, you must explicitly deny it.
140o MPPE is enabled and accepted by default (although deflate and predictor1
141  are preferred.
142

README.devel

1Copyright (c) 2001 Brian Somers <brian@Awfulhak.org>
2              based on work by Eivind Eklund <perhaps@yes.no>,
3All rights reserved.
4
5Redistribution and use in source and binary forms, with or without
6modification, are permitted provided that the following conditions
7are met:
81. Redistributions of source code must retain the above copyright
9   notice, this list of conditions and the following disclaimer.
102. Redistributions in binary form must reproduce the above copyright
11   notice, this list of conditions and the following disclaimer in the
12   documentation and/or other materials provided with the distribution.
13
14THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24SUCH DAMAGE.
25
26$FreeBSD: src/usr.sbin/ppp/README.devel,v 1.4.2.3 2002/08/26 23:24:44 brian Exp $
27$DragonFly: src/usr.sbin/ppp/README.devel,v 1.2 2003/06/17 04:30:00 dillon Exp $
28
29This file summarises changes made to ppp that effect
30This program was originally written by Toshiharu OHNO <tony-o@iij.ad.jp>,
31and was submitted to FreeBSD-2.0.5 by Atsushi Murai <amurai@spec.co.jp>.
32The original version was usually referred to as iij-ppp.
33
34Ppp is currently maintained under FreeBSD and OpenBSD by Brian Somers
35<brian@Awfulhak.org>.  The sources for both operating systems are the
36same except that the libalias code is built directly into ppp under
37OpenBSD, and the Makefiles vary per OS.
38
39The latest sources are available in FreeBSD-current and OpenBSD-current.
40An archive hacked so that it will build on just about any version of
41FreeBSD or OpenBSD is frequently generated and made available via
42http://www.Awfulhak.org/ppp.html.
43
44A FAQ is available at
45http://www.freebsd.org/doc/en_US.ISO8859-1/books/faq/ppp.html.  It
46applies equally to OpenBSD as it does to FreeBSD.  The man page is
47quite extensive, and there are lots of examples in
48/usr/share/examples/ppp/.
49
50Ppp is still under development.  There is no official TODO list.
51

README.nat

1Copyright (c) 2001 Charles Mott <cm@linktel.net>
2All rights reserved.
3
4Redistribution and use in source and binary forms, with or without
5modification, are permitted provided that the following conditions
6are met:
71. Redistributions of source code must retain the above copyright
8   notice, this list of conditions and the following disclaimer.
92. Redistributions in binary form must reproduce the above copyright
10   notice, this list of conditions and the following disclaimer in the
11   documentation and/or other materials provided with the distribution.
12
13THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23SUCH DAMAGE.
24
25$FreeBSD: src/usr.sbin/ppp/README.nat,v 1.4.4.4 2002/09/01 02:12:22 brian Exp $
26$DragonFly: src/usr.sbin/ppp/README.nat,v 1.2 2003/06/17 04:30:00 dillon Exp $
27
28User PPP NAT (Packet Aliasing)
29
30
31
320. Contents
33    1. Background
34    2. Setup
35    3. New commands in ppp
36    4. Future Work
37    5. Authors / Acknowledgements
38    6. Revision History for Aliasing Code
39
40
41
421. Background
43
44User mode ppp has embedded NAT (Network Address Translation) code.
45Enabling this, either by the "-nat" command line option or the
46"nat enable yes" command in a ppp.conf file, makes the ppp host
47automatically NAT IP packets forwarded from a local network, making
48them appear to come from the ppp host machine.  Incoming packets
49from the outside world are then appropriately de-NAT'd.
50
51The process of NAT'ing involves both the IP address and the TCP or UDP
52port numbers. ICMP echo and timestamp packets are natted by their id
53numbers.  ICMP error messages can be properly directed by examining the
54fragment of the offending packet which is contained in the body of the
55message.
56
57This software was specifically meant to support users who have
58unregistered, private address IP networks (e.g. 192.168.0.x or 10.0.0.x
59addresses).  The ppp host can act as a gateway for these networks, and
60computers on the local area net will have some degree of Internet access
61without the need for a registered IP address.  Additionally, there will
62be no need for an Internet service provider to maintain routing tables
63for the local area network.
64
65A disadvantage of NAT is that machines on the local network,
66behind the ppp host, are not visible from the outside world.  They can
67establish TCP connections and make UDP inquiries (such as domain name
68service requests) but the connections seem to come from the ppp host
69itself.  There is, in effect, a partial firewall.  Of course, if this is
70what you want, the disadvantage becomes an advantage.
71
72A second disadvantage is that "IP encoding" protocols, which send IP
73address or port information within the data stream, are not supported
74for the cases where exception code exists.  This implementation has
75workarounds for FTP and IRC DCC, the most well known of the IP encoding
76protocols.  This frees users from depending on using the ftp passive
77mode and avoiding IRC DCC sends, as is sometimes the case with other
78masquerading solutions.
79
80The implementation supports all standard, non-encoding TCP and UDP protocols.
81Examples of these protocols are http, gopher and telnet. The standard UDP
82mode of Real-Audio is not presently supported, but the TCP mode does work
83correctly.
84
85The NAT code also handles many ICMP messages.  In particular,
86ping and traceroute are supported.
87
88
89
902. Packet Aliasing Setup
91
92It is recommended that users first verify correct ppp operation without
93NAT enabled.  This will confirm that the ppp.conf file is
94properly set up and that there are no ppp problems. Then start ppp with
95the "-nat" option on the command line.  The user should verify that
96the ppp host can correctly connect to the Internet in NAT
97mode.  Finally, check that machines on the private network can access
98the Internet.
99
100The NAT software handles all packets, whether they come from
101the host or another computer on the local area network.  Thus, a correctly
102operating ppp host indicates that the software should work properly for
103other computers on the private network.
104
105If the ppp host can access the Internet, but other computers on the local
106network cannot, check that IP forwarding is enabled on the ppp host. Also,
107verify that the other computers use this machine as a gateway.  Of course,
108you should also verify that machines within the local area network
109communicate properly.  A common error is inconsistent subnet addresses
110and masks.
111
112
113
1143. New commands in ppp
115
116In order to control NAT behaviour in a simple manner (no need for
117recompilation), a new command has been added to ppp: nat.  This
118is in addition to the -nat command line option.  System managers and
119more experienced users may prefer to use the ppp command syntax
120within the ppp.conf file.  The nat command also allows NAT
121behaviour to be more precisely specified.
122
123The decision to add a command instead of extending 'set' or 'option' was
124to make obvious that these options only work when NAT is enabled.
125
126The syntax for 'nat' is
127
128    ppp>  nat option [yes|no]
129
130where option is given by one of the following templates.
131
132
133 - nat enable [yes|no]  (default no)
134
135Enable NAT functionality.  If disabled, no other NAT
136options will have any effect.  You should usually enable NAT
137before routing any packets over the link; good points are in the
138initial script or right before adding a route.  If you do not always
139want NAT, consider using the -nat option to ppp instead of this
140command.
141
142
143 - nat deny_incoming [yes|no] (default yes)
144
145Set to "yes" to disable all incoming connections.  This just drops
146connections to, for example, ftp, telnet or web servers.  The NAT
147mechanism prevents these connections. Technically, this option denies
148all incoming TCP and UDP requests, making the NAT software a
149fairly efficient one-way firewall.  The default is no, which will allow
150all incoming connections to telnetd, ftpd, etc.
151
152
153 - nat log [yes|no]
154
155Controls logging of NAT link creation to "/var/log/alias.log" - this
156is usually only useful if debugging a setup, to see if the bug is in
157the PPP NATing.  The debugging information is fairly limited, listing
158the number of NAT links open for different protocols.
159
160
161 - nat same_ports [yes|no] (default yes)
162
163When a connection is being established going through the NAT
164routines, it will normally have its port number changed to allow the
165NAT code to track it.  If same_ports is enabled, the NAT
166software attempts to keep the connection's source port unchanged.
167This will allow rsh, RPC and other specialised protocols to work
168_most of the time_, at least on the host machine.  Please, do not
169report this being unstable as a bug - it is a result of the way
170NAT has to work. TCP/IP was intended to have one IP address
171per machine.
172
173
174 - nat use_sockets [yes|no] (default yes)
175
176This is a fairly obscure option.  For the most part, the NAT
177software does not have to allocate system sockets when it chooses a
178NAT port number.  Under very specific circumstances, FTP data
179connections (which don't know the remote port number, though it is
180usually 20) and IRC DCC send (which doesn't know either the address or
181the port from which the connection will come), there can potentially be
182some interference with an open server socket having the same port number
183on the ppp host machine.  This possibility for interference only exists
184until the TCP connection has been acknowledged on both sides.  The safe
185option is yes, though fewer system resources are consumed by specifying
186no.
187
188
189 - nat unregistered_only [yes|no] (default no)
190
191NAT normally remaps all packets coming from the local area
192network to the ppp host machine address.  Set this option to only map
193addresses from the following standard ranges for private, unregistered
194addresses:
195
196                10.0.0.0     ->   10.255.255.255
197                172.16.0.0   ->   172.31.255.255
198                192.168.0.0  ->   192.168.255.255  */
199
200In the instance that there is a subnet of public addresses and another
201subnet of private addresses being routed by the ppp host, then only the
202packets on the private subnet will be NAT'd.
203
204
205- nat port <proto> <local addr>:<port>  <nat port>
206
207This command allows incoming traffic to <nat port> on the host
208machine to be redirected to a specific machine and port on the
209local area network.  One example of this would be:
210
211    nat port tcp 192.168.0.4:telnet  8066
212
213All traffic to port 8066 of the ppp host would then be sent to
214the telnet port (23) of machine 192.168.0.4.  Port numbers
215can either be designated numerically or by symbolic names
216listed in /etc/services.  Similarly, addresses can be either
217in dotted quad notation or in /etc/hosts.
218
219
220- nat addr <local addr> <public addr>
221
222This command allows traffic for a public IP address to be
223redirected to a machine on the local network.  This function
224is known as "static NAT".  An address assignment of 0 refers
225to the default address of the ppp host.  Normally static
226NAT is useful if your ISP has allocated a small block of
227IP addresses to the user, but it can even be used in the
228case of a single, dynamically allocated IP address:
229
230    nat addr 10.0.0.8 0
231
232The above command would redirect all incoming traffic to
233machine 10.0.0.8.
234
235If several address NATs specify the same public address
236as follows
237
238    nat addr 192.168.0.2  public_addr
239    nat addr 192.168.0.3  public_addr
240    nat addr 192.168.0.4  public_addr
241
242then incoming traffic will be directed to the last
243translated local address (192.168.0.4), but outgoing
244traffic to the first two addresses will still be NAT'd
245to the specified public address.
246
247
248
2494. Future Work
250
251What is called NAT here has been variously called masquerading, packet
252aliasing and transparent proxying by others.  It is an extremely useful
253function to many users, but it is also necessarily imperfect.  The
254occasional IP-encoding protocols always need workarounds (hacks).
255Users who are interested in supporting new IP-encoding protocols
256can follow the examples of alias_ftp.c and alias_irc.c.
257
258ICMP error messages are currently handled only in the incoming direction.
259A handler needs to be added to correctly NAT outgoing error messages.
260
261IRC and FTP exception handling make reasonable, though not strictly correct
262assumptions, about how IP encoded messages will appear in the control
263stream.  Programmers may wish to consider how to make this process more
264robust.
265
266The NAT engine (alias.c, alias_db.c, alias_ftp.c, alias_irc.c
267and alias_util.c) runs in user space, and is intended to be both portable
268and reusable for interfaces other than ppp.  To access the basic engine
269only requires four simple function calls (initialisation, communication of
270host address, outgoing NAT and incoming de-NATing).
271
272
273
2745. Authors / Acknowledgements
275
276Charles Mott (cm@linktel.net)  <versions 1.0 - 1.8, 2.0, 2.1>
277Eivind Eklund (perhaps@yes.no) <versions 1.8b - 1.9, new ppp commands>
278
279Listed below, in chronological order, are individuals who have provided
280valuable comments and/or debugging assistance.
281
282    Gary Roberts
283    Tom Torrance
284    Reto Burkhalter
285    Martin Renters
286    Brian Somers
287    Paul Traina
288    Ari Suutari
289    J. Fortes
290    Andrzej Bialeki
291
292
293
2946. Revision History for Aliasing Code
295
296Version 1.0: August 11, 1996 (cjm)
297
298Version 1.1:  August 20, 1996  (cjm)
299    PPP host accepts incoming connections for ports 0 to 1023.
300
301Version 1.2:  September 7, 1996 (cjm)
302    Fragment handling error in alias_db.c corrected.
303
304Version 1.3: September 15, 1996 (cjm)
305    - Generalised mechanism for handling incoming connections
306      (no more 0 to 1023 restriction).
307    - Increased ICMP support (will handle traceroute now).
308    - Improved TCP close connection logic.
309
310Version 1.4: September 16, 1996
311    Can't remember (this version only lasted a day -- cjm).
312
313Version 1.5: September 17, 1996 (cjm)
314    Corrected error in handling incoming UDP packets
315    with zero checksum.
316
317Version 1.6: September 18, 1996
318    Simplified ICMP data storage.  Will now handle
319    tracert from Win95 as well as FreeBSD traceroute.
320
321Version 1.7: January 9, 1997 (cjm)
322    - Reduced malloc() activity for ICMP echo and
323      timestamp requests.
324    - Added handling for out-of-order IP fragments.
325    - Switched to differential checksum computation
326      for IP headers (TCP, UDP and ICMP checksums
327      were already differential).
328    - Accepts FTP data connections from other than
329      port 20.  This allows one ftp connections
330      from two hosts which are both running packet
331      aliasing.
332
333Version 1.8: January 14, 1997 (cjm)
334    - Fixed data type error in function StartPoint()
335      in alias_db.c (this bug did not exist before v1.7)
336
337Version 1.8b: January 16, 1997 (Eivind Eklund <perhaps@yes.no>)
338    - Upgraded base PPP version to be the source code from
339      FreeBSD 2.1.6, with additional security patches.  This
340      version should still be possible to run on 2.1.5, though -
341      I've run it with a 2.1.5 kernel without problems.
342      (Update done with the permission of cjm)
343
344Version 1.9: February 1, 1997 (Eivind Eklund <perhaps@yes.no>)
345    - Added support for IRC DCC (ee)
346    - Changed the aliasing routines to use ANSI style throughout -
347      minor API changes for integration with other programs than PPP (ee)
348    - Changed the build process, making all options switchable
349      from the Makefile (ee)
350    - Fixed minor security hole in alias_ftp.c for other applications
351      of the aliasing software.  Hole could _not_ manifest in
352      PPP+pktAlias, but could potentially manifest in other
353      applications of the aliasing. (ee)
354    - Connections initiated from packet aliasing host machine will
355      not have their port number aliased unless it conflicts with
356      an aliasing port already being used. (There is an option to
357      disable this for debugging) (cjm)
358    - Sockets will be allocated in cases where there might be
359      port interference with the host machine.  This can be disabled
360      in cases where the ppp host will be acting purely as a
361      masquerading router and not generate any traffic of its own.
362      (cjm)
363
364Version 2.0: March, 1997 (cjm)
365    - Incoming packets which are not recognised by the packet
366      aliasing engine are now completely dropped in ip.c.
367    - Aliasing links are cleared when a host interface address
368      changes (due to re-dial and dynamic address allocation).
369    - PacketAliasPermanentLink() API added.
370    - Option for only aliasing private, unregistered IP addresses
371      added.
372    - Substantial rework to the aliasing lookup engine.
373
374Version 2.1: May, 1997 (cjm)
375    - Continuing rework to the aliasing lookup engine to support
376      multiple incoming addresses and static NAT.
377    - Now supports outgoing as well as incoming ICMP error messages/
378    - PPP commands to support address and port redirection.
379
380