Commit Graph

47 Commits

Author SHA1 Message Date
Brian Somers
10be78d3ae Remove whitespace at the end of lines. 2002-06-15 08:03:30 +00:00
Brian Somers
de59e178aa 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>
2002-05-14 12:55:39 +00:00
Brian Somers
63c6cac940 socket()s first argument should be a protocol family rather than an
address family.
2002-01-16 14:03:52 +00:00
Brian Somers
ebdcbc6744 o Enable IFF_MULTICAST when first opening the tun device (and keep the flag
when we ioctl(TUNSIFINFO) under OpenBSD)
o Don't bring the interface up immediately
o Don't complain about unrecognised interface flags in ``show iface''.
2001-08-21 11:07:58 +00:00
Brian Somers
30949fd4b5 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>
2001-08-14 16:05:52 +00:00
Brian Somers
c8b9fb53a1 Handle hardware-imposed MTU/MRU limitations. PPPoE will no longer
allow MRU/MTU negotiations to exceed 1492.

Add an optional ``max'' specifier to ``set m[rt]u'', ie.

	set mtu max 1480

Bump the ppp version number.

Sponsored by:	Monzoon Networks AG and FreeBSD Services Limited
2001-06-18 14:59:36 +00:00
Brian Somers
2a2877b836 TUNSIFINFO now requires uid 0 to change the interface MTU.
Reviewed by:	Mark Knight <markk@knigma.org>
2001-03-08 10:33:30 +00:00
Brian Somers
94d7be5294 Add ``enable/disable tcpmssfixup'', defaulting to enabled.
Suggested by:	julian
Hijacked from:	ru (ports/net/tcpmssd)
2000-11-28 13:18:35 +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
a77cab77c5 NetBSD requires net/if.h for the IFF_* defines (as well as OpenBSD) ! 1999-09-20 07:18:50 +00:00
Peter Wemm
97d92980a9 $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
Brian Somers
eb6e5e05f9 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 !) :-]
1999-08-06 20:04:08 +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
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
Brian Somers
7884358fdd Add support for NetBSD 1999-04-26 08:54:34 +00:00
Brian Somers
119386a38b #include <errno.h>, not <sys/errno.h> 1999-04-26 08:54:25 +00:00
Brian Somers
972a1bcf5d 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
1999-01-28 01:56:34 +00:00
Brian Somers
8fa6ebe47d Solve the ``first connection'' problem that occurs on
demand-dial links with dynamic IP numbers where the program
that causes the dial bind()s to an interface address that is
subsequently changed after ppp negotiation.

The problem is defeated by adding negotiated addresses to the
tun interface as additional alias addresses and providing a set
of ``iface'' commands for managing the interface.  Libalias is
also required (and what a name clash!) - it happily IP-aliases
the address so that the source is that of the primary (negotiated)
interface and un-IP-aliases it on the way back.

An ``enable iface-alias'' is done implicitly by the -alias command
line switch.  If -alias isn't given, iface-aliasing is disabled by
default and can't be enabled 'till an ``alias enable yes'' is done.
``alias enable no'' silently disables iface-alias.

So, for dynamic-IP-type-connections, running ``ppp -alias -auto blah''
will work for the first connection, although existing bindings will
not survive a disconnect/connect as the TCP peer will be trying to
send to the old IP address - the packets won't route.

It's now a lot easier to add IPXCP to ppp with minor updates to
the new iface.[ch] (if anyone ever gets 'round to it).

It's also now possible to manually add interface aliases with
something like ``iface add 1.2.3.4/24 5.6.7.8''.  This allows
multi-homed ppp links :-)
1998-10-22 02:32:50 +00:00
Brian Somers
44cae95d95 Use IFT_PPP from net/if_types.h rather than hard-coding it. 1998-08-09 16:41:01 +00:00
Brian Somers
10a9be1e88 Remove redundant includes 1998-06-27 14:18:15 +00:00
Brian Somers
d91d286164 MFMP: Make ppp multilink capable.
See the file README.changes, and re-read the man page.
1998-05-21 21:49:08 +00:00
Brian Somers
faefde08e0 Categorize the fields in struct bundle, and make the tunnel
device speed available in ``show bundle''.
1998-05-06 23:50:25 +00:00
Brian Somers
eeab6bf510 o Use a tun speed of 115200 for each network link.
o Display the link weight in `show links', and only
  show throughput for open links.
1998-05-05 03:01:32 +00:00
Brian Somers
dd7e261079 Cosmetic: Make our external function names consistent. 1998-05-01 19:26:12 +00:00
Brian Somers
1fa665f5b3 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).
1998-04-28 01:25:46 +00:00
Brian Somers
e43ebac1c2 Make gcc-2.8.1 build ppp cleanly.
Support OpenBSD again.
1998-04-25 10:49:52 +00:00
Brian Somers
2764b86afd 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.
1998-04-07 00:54:26 +00:00
Brian Somers
d24f017be8 Remove unused includes. 1998-04-06 09:12:38 +00:00
Brian Somers
cd9647a100 o Move default MRU, MTU, ACCMAP and OPENMODE config values into
struct lcp and display them in `show lcp'.
o Remove `show mru' and `show mtu' and make the data part of
  `show lcp'.  Also merge `set m[tr]u' and `set openmode'
  implementations into the SetVariable function.
o `set timeout' only accepts the idle timer value as an argument.
o Move our lqr period into struct lcp, and create a `set lqrperiod'
  command.  Display it in `show lcp'.
o Remove VarRetryTimeout, and implement it at the LCP, PAP, CHAP,
  CCP and IPCP levels, creating individual `set XXXretry' commands
  for each.  They must be separate because they have different
  context requirements in multilink mode.
o Display default config values in `show ccp'.
o Tart the man page up a bit (wrt PPP/TCP, compression and LQR) and
  explain the new commands.
1998-04-03 19:24:07 +00:00
Brian Somers
3b0f8d2ed6 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.
1998-04-03 19:21:56 +00:00
Brian Somers
2f7866811e Make struct bundle into a sort of `struct descriptor'.
It does the fdsets/reads/writes for each of it's
datalinks.
1998-03-20 19:48:28 +00:00
Brian Somers
eaa4df37f4 Move VJ compression state and stats into struct ipcp. 1998-03-16 22:54:35 +00:00
Brian Somers
5ca5389af4 Move filter sets into struct bundle. 1998-03-16 22:52:54 +00:00
Brian Somers
5828db6d2d Move the IPCP into struct bundle. 1998-03-13 21:07:46 +00:00
Brian Somers
879ed6fa82 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.
1998-03-13 00:44:26 +00:00
Brian Somers
d2fd8d772f Force IPCP back to initial in bundle_Close().
Add a few un-necessary includes to make us build under
2.2.5.  These'll go when the code is cleaned up at the
end.
1998-03-02 17:25:30 +00:00
Brian Somers
6d6667755e Create struct fsm_parent. FSMs are created with one of these,
and the FSM passes subsequent events to them.

The datalink now hides its CCP from the bundle layer.
1998-02-27 01:22:39 +00:00
Brian Somers
63258dccc5 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.
1998-02-18 19:35:59 +00:00
Brian Somers
7a6f872047 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.
1998-02-02 19:32:16 +00:00
cvs2svn
1ae349f52c This commit was manufactured by cvs2svn to create branch 'MP'. 1998-01-29 00:44:16 +00:00
Brian Somers
aa8e05197c Remove unused #includes.
Make various bits static.
Remove unused variables.
Submitted by: eivind
1998-01-21 02:15:33 +00:00
Brian Somers
cc924f9e6f Lose <net/if_var.h> !
This'll require a `make installworld'.
1998-01-11 17:53:27 +00:00
Brian Somers
c39934ea32 Add (BSD) copyright headers. 1997-12-21 12:11:13 +00:00
Brian Somers
b6e82f33ef 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).
1997-11-22 03:37:54 +00:00
Brian Somers
c7d4711f9e Add id strings to tun.[ch].
Don't try to open ppp.secret if we're never going to use it.
1997-11-17 00:42:41 +00:00
Brian Somers
6a6b4bbb08 Abstract data read from and written to the tun device,
allowing for a possible header on the front of all packets.
In OpenBSD, there's a structure containing the address
family here.
If we're building under OpenBSD, set up the ``flags'' part
of struct tuninfo (not there under FreeBSD) so that we config
the interface as POINTOPOINT.
Prefix prototypes with ``extern'' in os.c for consistency.

These changes are cosmetic under FreeBSD, but allow ppp to
build & work under OpenBSD (bar the srandomdev() stuff,
the inclusing of <net/if_var.h> and some Makefile symantecs).
1997-11-16 22:15:11 +00:00