Commit graph

330 commits

Author SHA1 Message Date
Brian Somers 1038894eb0 Support link identification from rfc1570
Two new commands are available; ``ident'' and ``sendident''.
2000-07-19 02:10:35 +00:00
Brian Somers 9825166754 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.
2000-07-07 14:22:08 +00:00
Brian Somers 86c5e1ea4d Remove ``nat pptp'' as this is now done transparently by libalias. 2000-06-20 12:18:40 +00:00
Brian Somers 6c1d673108 Add ``set ifqueue'' to control the size of the outgoing packet
queue.  Doing ``set ifqueue 0'' and ``set urgent none'' will allow
full use of luigi's WF2Q code.

Requested by: luigi
2000-06-11 02:30:51 +00:00
Brian Somers 4c24043766 Allow ``set urgent none'' to disable all urgent ports and IPTOS_LOWDELAY
prioritisation.

Requested by: luigi
2000-06-08 20:07:48 +00:00
Brian Somers e9d0dd0a1b Allow authname to be changed at any phase, just emit a warning
if it's not DEAD or ESTABLISH
2000-03-31 21:08:43 +00:00
Brian Somers b7d8533c16 Add the ``nat target'' command. 2000-03-31 14:26:23 +00:00
Brian Somers 2a30e2ac0b Understand environment variables in commands
Submitted by: Mark Knight <markk@knigma.org>
2000-03-14 01:47:31 +00:00
Brian Somers d568d6c405 Add the ``resolv'' command for telling ppp how to deal with resolv.conf.
You can now ``resolv restore'' in ppp.linkdown !
Add DNS0 and DNS1 macros.
2000-03-14 01:47:27 +00:00
Brian Somers 10e629b937 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.
2000-03-14 01:47:02 +00:00
Brian Somers 52c9ca1968 Add ``set log dns'' to log DNS QUERY packets.
This is invaluable for dial-on-demand connections...
In ppp.linkup:

  set log -dns -tcp/ip

and in ppp.linkdown

  set log +dns +tcp/ip

giving a much better account of why the link came up.
2000-03-14 01:46:49 +00:00
Brian Somers a19a5c023d Correct usages of getuid() and geteuid()
Pointed out by: billf
1999-12-30 03:36:11 +00:00
Brian Somers 5b78bdf8aa 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
1999-12-27 11:43:31 +00:00
Brian Somers abab7303b5 Don't munge ``set dial|login|logout|hangup'' arguments before
ExpandString() has a chance to do its own substitutions.
1999-12-22 21:48:12 +00:00
Brian Somers ef0a48491b Add missing linefeed. 1999-12-20 20:30:35 +00:00
Brian Somers c39aa54ec8 Notice and warn about unterminated quoted strings in commands.
The entire command is ignored if the syntax is invalid...
1999-12-20 20:30:02 +00:00
Brian Somers cbee975442 Change the way we transfer links (again). The previous
method avoided all race conditions, but suffered from
sometimes running out of buffer space if enough clients
were piled up at the same time.

Now, the client pushes the link descriptor, one end of a
socketpair() and the ppp version via sendmsg() at the
server.  The server replies with a pid.  The client then
transfers any link lock with uu_lock_txfr() and writev()s
the actual link contents.  The socketpair is now the only
place we need to have large socket buffers and the bind()ed
socket can keep the default 4k buffer while still handling
around 90 racing clients.
1999-11-30 23:52:37 +00:00
Brian Somers fdc29d54a4 Change ``set cd'' so that its default value is device specific. The
default is still 1 second for ttys, but is now 6 seconds for i4b (ISDN)
devices and 5 seconds for ethernet (PPPoE) devices.
1999-11-26 22:44:33 +00:00
Brian Somers 2cb305af77 Rewrite the link descriptor transfer code in MP mode.
Previously, ppp attempted to bind() to a local domain tcp socket
based on the peer authname & enddisc.  If it succeeded, it listen()ed
and became MP server.  If it failed, it connect()ed and became MP
client.  The server then select()ed on the descriptor, accept()ed
it and wrote its pid to it then read the link data & link file descriptor,
and finally sent an ack (``!'').  The client would read() the server
pid, transfer the link lock to that pid, send the link data & descriptor
and read the ack.  It would then close the descriptor and clean up.

There was a race between the bind() and listen() where someone could
attempt to connect() and fail.

This change removes the race.  Now ppp makes the RCVBUF big enough on a
socket descriptor and attempts to bind() to a local domain *udp* socket
(same name as before).  If it succeeds, it becomes MP server.  If it
fails, it sets the SNDBUF and connect()s, becoming MP client.  The server
select()s on the descriptor and recvmsg()s the message, insisting on at
least two descriptors (plus the link data).  It uses the second descriptor
to write() its pid then read()s an ack (``!'').  The client creates a
socketpair() and sendmsg()s the link data, link descriptor and one of
the socketpair descriptors.  It then read()s the server pid from the
other socketpair descriptor, transfers any locks and write()s an ack.

Now, there can be no race, and a connect() failure indicates a stale
socket file.

This also fixes MP ppp over ethernet, where the struct msghdr was being
misconstructed when transferring the control socket descriptor.

Also, if we fail to send the link, don't hang around in a ``session
owner'' state, just do the setsid() and fork() if it's required to
disown a tty.

UDP idea suggested by: Chris Bennet from Mindspring at FreeBSDCon
1999-11-25 02:47:04 +00:00
Brian Somers cf0a39401d Fix ``set proctitle'' by using setproctitle(). 1999-11-17 21:12:35 +00:00
Brian Somers e6ee5b3933 Don't insist on 4 digit umasks in ``set server''.
Pointed out by: joerg
1999-11-13 16:18:40 +00:00
Brian Somers 87c3786e7f Support PPPoE
Help (lots) from: julian, archie
Facilities from: ahebert@pubnix.net
1999-11-06 22:50:59 +00:00
Brian Somers c116e0c0aa Introduce ``set logout''; another chat script. This is in preparation
for the abstraction of ``set dial'' and ``set hangup''.
1999-10-25 13:49:44 +00:00
Brian Somers ccd587f00f Support ``set cd off'' to tell ppp not to even look for carrier on the
device.
1999-09-26 23:02:18 +00:00
Brian Somers b9391689ee 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>
1999-09-21 19:37:00 +00:00
Brian Somers 7e795ebe38 NetBSD has moved ``extern int errno;'' to signal.h :-/
Submitted by:	Kazuyoshi Kato <kazk@yyy.or.jp>
1999-09-20 07:36:46 +00:00
Brian Somers f02c2029cf Cosmetic:
alias_cmd -> nat_cmd after a repo-copy
1999-09-08 07:34:52 +00:00
Brian Somers da47788649 Introduce a forth IP packet queue. Urgent packets with
ip_tos == IPTOS_LOWDELAY now get precidence over urgent
packets with ip_tos != IPTOS_LOWDELAY and non-urgent packets
with ip_tos == IPTOS_LOWDELAY.

Enhance the ``set urgent'' syntax to allow for urgent UDP
packets as well as urgent TCP packets.
1999-09-07 07:51:11 +00:00
Brian Somers f914f3c09c $FreeBSD$ -> __DATE__
This is probably more appropriate that $Date$ anyway
1999-09-06 18:11:50 +00:00
Peter Wemm 2735dafdfc $Date$ -> $FreeBSD$ 1999-09-06 07:36:44 +00:00
Brian Somers 442f849547 o Split the two IPCP queues into three - one for FSM data
(LCP/CCP/IPCP), one for urgent IP traffic and one for
  everything else.
o Add the ``set urgent'' command for adjusting the list of
  urgent port numbers.  The default urgent ports are 21, 22,
  23, 513, 514, 543 and 544 (Ports 80 and 81 have been
  removed from the default priority list).
o Increase the buffered packet threshold from 20 to 30.
o Report the number of packets in the IP output queue and the
  list of urgent ports under ``show ipcp''.
1999-09-04 00:00:21 +00:00
Peter Wemm 97d92980a9 $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
Brian Somers d40a462ae2 Allow authkey to be changed independently of the current phase. 1999-08-22 01:29:53 +00:00
Brian Somers 67b072f732 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''.
1999-08-19 18:15:52 +00:00
Brian Somers dade2407e6 Implement a minimum idle time value as an optional second argument
to ``set timeout''.
This is useful for situations where your minimum call charge is (say)
5 minutes (like mine is)
1999-08-17 17:22:46 +00:00
Brian Somers 44e73c1254 Set the close-on-exec flag for all unused descriptors when
exec()ing other programs.
1999-08-17 14:59:05 +00:00
Brian Somers ab2de065b2 o Obsolete the undocumented ``set weight'' command.
o If we're using RADIUS and the RADIUS mtu is less than our
  peers mru/mrru, reduce our mtu to this value for NetBSD too.
o Make struct throughput's sample period dynamic and tweak the ppp
  version number to reflect the extra stuff being passed through
  the local domain socket as a result (MP mode).
o Measure the current throughput based on the number of samples actually
  taken rather than on the full sample period.
o Keep the throughput statisics persistent while being passed to
  another ppp invocation through the local domain socket.
o When showing throughput statistics after the timer has stopped, use
  the stopped time for overall calculations, not the current time.
  Also show the stopped time and how long the current throughput has
  been sampled for.
o Use time() consistently in throughput.c
o Tighten up the ``show bundle'' output.
o Introduce the ``set bandwidth'' command.
o Rewrite the ``set autoload'' command.  It now takes three arguments
  and works based on a rolling bundle throughput average compared against
  the theoretical bundle bandwidth over a given period (read: it's now
  functional).
1999-08-05 10:32:16 +00:00
Brian Somers badaf18d92 Mention that ospf is a possible filter protocol. 1999-08-02 21:45:36 +00:00
Brian Somers 1f9e5fe5fa Support `igmp' filters.
Mostly submitted by: Timo Geusch <freebsd@sleepycat.ukpeople.net>
1999-06-23 16:48:24 +00:00
Brian Somers 5dfb9210ae Allow reserved substitution strings to be escaped by preceeding them
with a backslash.
1999-06-10 09:34:57 +00:00
Brian Somers 7063995c94 Allow our endpoint discriminator to be enabled, disabled, accepted
and denied.  This is necessary for some MP implementations that
get confused if you accept their endpoint discriminator but reject
their MRRU.
1999-06-09 16:54:04 +00:00
Brian Somers 8fb106c674 Use the correct pid when substituting PROCESSID.
Problem reported by: Amedeo Beck Peccoz <gea@gressoney.it>
1999-06-09 08:47:36 +00:00
Brian Somers 68645f3954 Don't use static variables if we don't have to. 1999-06-08 20:12:06 +00:00
Brian Somers f5a99677a3 Correct the way ppp transfers links on the server side in MP
mode by padding out the ``struct device'' to the maximum
device size.
Bump the ppp version number to indicate the transfer format
change.

This should make MP over tty and udp devices functional again.
1999-06-05 21:36:00 +00:00
Brian Somers 0d4fe7a80f Mention physical and sync logging in the ``set log''
usage message.
1999-06-02 21:28:02 +00:00
Brian Somers ac685e314f Introduce the ``keep-session'' option. Refer to the man
page for details.  This allows MP over non-tty devices where
the original ppp process must not exit (such as sshd-spawned
ppp sessions).
1999-06-02 00:46:55 +00:00
Brian Somers 1d1fc0171e Remember if MYADDR or HISADDR is used in a filter add tweak all
filters any time either value changes.
1999-05-31 23:57:40 +00:00
Brian Somers 4faec43070 Add ``show layers'' to see the protocol layering for a link. 1999-05-15 02:24:18 +00:00
Brian Somers 6815097bf7 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().
1999-05-12 09:49:12 +00:00
Brian Somers 5d9e610366 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''.
1999-05-08 11:07:56 +00:00