Commit Graph

25 Commits

Author SHA1 Message Date
Brian Somers 5828db6d2d Move the IPCP into struct bundle. 1998-03-13 21:07:46 +00:00
Brian Somers a611cad61d o Don't immediately reply to the first LQR thinking
it's a duplicate ('cos it compares with our initial
  values).
o Move the LCP into struct datalink.
1998-03-13 21:07:14 +00:00
Brian Somers dc0fdb6bc1 "dial" now may optionally have context.
Tidy up some LcpInfo uses.
1998-03-13 00:44:51 +00:00
Brian Somers 5563ebde73 Remove the second bundle_NewPhase argument and do
the tun config from bundle_LayerUp.
1998-03-13 00:44:33 +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 ab886ad0f6 Move the idle timer into struct bundle. There's no
link-level idle timer for the moment.
1998-03-09 19:26:41 +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 e2ebb036fd Do authentication at the datalink level, not the bundle level.
The bundle doesn't get a LayerUp 'till we're authenticated.

Introduce DATALINK_LCP and DATALINK_AUTH phases.
1998-03-01 01:07:49 +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 f4768038f0 o Remove the global CcpInfo. It's now part of the datalink.
Struct bundle will have its own struct ccp in the future
  too.
o The ``set stopped'' command now requires context and doesn't
  work on the IPCP FSM.
o Check if it's time to break out of our top level loop before
  doing a select - otherwise, we'll select forever :-(
o Remove `struct link'::ccp (a temporary hack).  It turns out
  that IpStartOutput() calls link_Output() and link_Output()
  incorrectly calls StartOutput() (really modem_StartOutput)
  requiring the ccp knowledge so that it can call
  IpStartOutput()...  The end result is that the whole IP
  output queue gets dumped into the modem output queue
  and a pile of physical writes are done prematurely.  This
  makes the (original) code in main() actually work in that
  it would not bother selecting() on the tun descriptor when
  our modem queue length was 20 or greater.  Instead, we now
  make that decision based on the overall queue length.

  This will need improvement later.
1998-02-23 00:38:44 +00:00
Brian Somers 503a7782d8 Shuffle around our FSMs a bit. This'll make it
easier to remove the CcpInfo, LcpInfo and IpcpInfo
globals.
1998-02-21 01:45:26 +00:00
Brian Somers d345321b7e Close the link(s) properly from bundle_Close() even
if we're in PHASE_DEAD already.
Don't modem_Raw() 'till we're in packet mode.
1998-02-18 00:27:49 +00:00
Brian Somers c7cc50305f Add datalink state DATALINK_READY to indicate when the datalink
is available, but LCP hasn't yet been started.  We get to this
state in ``term'' mode.
Remove PacketMode().  LCP startup and shutdown is now controlled
by the datalink.
Add ``show links'' command.
Make ``close'' capable of running with and without a context.
Make ``down'' require a context.
Make ``set parity'' and ``set rtscts'' use the correct context.
1998-02-17 19:28:35 +00:00
Brian Somers aef795cc3b Introduce the ``link'' command for controlling
individual links.
1998-02-17 19:28:01 +00:00
Brian Somers c5a5a6ca93 Sort out (fix) the `term' command.
datalink_Up() can now be told to skip the dial/login/hangup
scripts and can be told whether to enter packet mode when
entering the DATALINK_OPENED state.
1998-02-17 01:05:47 +00:00
Brian Somers 5b8b8060c1 Move the dial, login and hangup scripts into struct datalink.
Don't set these scripts in -direct mode.
Always set reconnect_tries to zero for -direct mode.
1998-02-16 19:10:03 +00:00
Brian Somers 3006ec67fe Create struct datalink.
This is a type of physical link that can chat and talk
LCP & CCP.  A bundle contains a list of these (only one
in the list for the moment).

The datalink is a type of descriptor, and dials, enters
LCP (& does CCP), kicks the bundle when its FSMs do
something interesting and does the hangup chat script
on the way down.  It also handles redials and reconnects.

There are lots of loose ends, and probably lots of bugs,
but the data structures are getting there !
1998-02-16 00:01:12 +00:00
Brian Somers 85b542cf4f 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.
1998-02-10 03:23:50 +00:00
Brian Somers 42d4d39668 o Introduce struct descriptor.
This will ultimately be a member of a list of descriptors and
  their handler functions on which we need to select() in the
  main loop.
o Make struct physical into a `sort' of struct descriptor.
1998-02-09 19:21:11 +00:00
Brian Somers 68a0f0ccdd o Add bundle_Destroy().
o Don't remove routes and DOWN the interface when we're
  closed in auto mode.
o Initialize the FSMs in bundle_Create.
o Initialize ipcp::if_mine & ipcp::if_peer only once (so
  that we don't forget that we've SIOCAIFADDR'd the interface).
o Do a SIOCDIFADDR on the specific address to avoid hurting any
  other (still non-existent) NCPs.
o Fix some error/diagnostic messages.
1998-02-08 19:29:45 +00:00
Brian Somers 455aabc3f8 o Hook the FSMs into our bundle.
o The FSM layering is now more sane.
o Move a lot of the NCP stuff into our ipcpstate rather than having it
  in the bundle, including control of the configured IP addresses.  We
  don't need hacks like the global `linkup' variable any more as the
  FSM decides when our ppp.link* files get run.  This is going to eventually
  be configurable based on FSM events anyway.
o Fix a few inconsistencies when both sides require authentication.
o We now have "Ppp..." and "PPp" prompts, reflecting authentication
  and network phase.  We don't print loads of spurious prompts as we
  change phases any more.
o Our phase is part of the bundle now.
o Fix a bug where the FSM wasn't calling LayerFinish.
o Close the FSM down correctly with a signal rather than slamming it
  down as if the line was dropped (the undocumented ``down'' command
  is still available though).
o Remove the forgotten `tunno' variable and fix references to it.
1998-02-07 20:50:08 +00:00
Brian Somers 83d1af558c Isolate fsm callback functions
Derive {lcp,ipcp,ccp}state structures from struct fsm
where convenient.
Create bundle_Down() and remove LcpDown()
1998-02-06 02:24:29 +00:00
Brian Somers 2289f24698 Move pppVars.physical into the bundle (for the moment). 1998-02-06 02:23:48 +00:00
Brian Somers 820de6eb8e Bring the routing seqno into struct bundle. 1998-02-02 19:33:02 +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