Commit Graph

144 Commits

Author SHA1 Message Date
Brian Somers
9dee069d8d Initialise our async escape map (oops, that hurt !). 1998-04-19 01:18:51 +00:00
Brian Somers
39d946522c Destroy struct chat when it's finished in struct datalink.
Initialise chat timers correctly as they're malloc()ed as
part of struct datalink, and initially contain garbage.
1998-04-18 23:17:26 +00:00
Brian Somers
cdbbb6b571 Cosmetic: Clean up warnings. 1998-04-18 01:01:28 +00:00
Brian Somers
3edeb0c69e Support client side DNS server negotiation, disabled
and denied by default (POLA).

o Remove ``enable'' msext.  Now, doing a ``set nbns'' will
  automatically enable a NBNS ACK/NAK rather than a REJ.
o Add accept|disable|deny|enable dns.  If we ``accept'',
  we'll tell the peer what our nameservers are (if he asks).
  The values in resolv.conf can be overridden with the
  ``set dns'' command.  If we ``enable'', we'll REQ using
  our resolv.conf entries, and any NAKs are written back to
  resolv.conf.
o Remove ``show msext'' and show the relevent IP numbers in
  ``show ipcp''.
1998-04-17 22:05:37 +00:00
Brian Somers
030e4ebba8 o Remove bundle_LinkLost() and have the modem routines simply
call datalink_Down() where appropriate rather than
  modem_Hangup().
o Now, when something horrible happens (failed read/write, loss
  of carrier etc), we go offline and run any hangup scripts etc
  in a controlled manner - exactly the same as if someone says
  ``down'' at the prompt or sends us a HUP.
o -dedicated links that fail to make the modem raw close it,
  suffer the redial timeout then try to open it again.
o Add a ``carrier lost'' warning diagnostic.
1998-04-17 22:04:36 +00:00
Brian Somers
50e5c17d3b Fix the worst sort of bug - a SEGV in a diagnostic !
Also, use sizeof sockaddr_in instead of 16 when writing
to the routing socket.
1998-04-16 23:06:53 +00:00
Brian Somers
ee084ab956 Stop the idle timer if the timeout is disabled while
the timer is active.
1998-04-16 22:11:46 +00:00
Brian Somers
26afeaa28b o FsmDown() and FsmClose() any NCP that's still around before
going into phase DEAD when the last physical link disappears.
o Don't go to phase TERMINATE if we're already phase DEAD.
1998-04-16 21:19:05 +00:00
Brian Somers
63f98b41d4 o Understand `syn'' and `finrst'' in filter rules. This
is particularily useful when creating dial filters.
  Original work by: Junichi SATOH (junichi@astec.co.jp)
o Parse a filter IP of ``0.0.0.0'' as having a width of 0,
  not 32.
o Correct "set filter" usage message.
o Warn about bad filter names.
o Expand and correct a number of the man page sections.
1998-04-16 18:30:54 +00:00
Brian Somers
1342caed9c o Move the accept/deny/disable/enable globals either to the
bundle (non-negotiated vars) or to their respective IPCP,
  LCP or CCP.
o Enable rolling throughput statistics by default.
o Remove the `display' command.  These values now appear in
  `show bundle', `show ipcp', `show ccp' and `show lcp'.
o Initialise auth name & key at bundle create time (oops).
o Rename pppd-deflate (the id-24 hack) to deflate24.
o Don't send both a REJ and a NAK to an IPCP or LCP REQ.
  Favour the REJ (already done at the CCP level).
o Recurse in datalink_UpdateSet() when we change state, otherwise
  we end up setting no descriptors and getting jammed in the
  imminent select() instead of doing the dial/login/hangup.
o Display our CHAP encryption method despite being built with DES.
o Display VJ as not negotiated in ``show ipcp'' when necessary.
1998-04-16 00:26:21 +00:00
Brian Somers
250920922b Pass all command arguments around with struct cmdargs rather
than incrementing argv and decrementing argc.  Now individual
functions can determine their caller.  This also removes the
"prefix" hack in FindExec().
1998-04-14 23:17:24 +00:00
Brian Somers
7f717ec1b8 Use datalink_Down when LQR fails, not bundle_Close(). 1998-04-14 07:25:37 +00:00
Brian Somers
c08717df31 Remove `show timeout'' and show auth'' and add `show bundle''.
Mention ``show timer'' in the man page.
1998-04-11 21:50:47 +00:00
Brian Somers
99294c8bfa o Fix chats expect-send-expect - it shouldn't be
expect-send-send !
o Say `disabled' rather than 0s in `show timeout'.
o Set all arguments in ``set device'' rather than just
  the first (read: quotes aren't necessary).
o Set the device speed correctly (broken in last commit).
1998-04-10 23:51:33 +00:00
Brian Somers
c8dc575810 Nuke the device name *after* unlocking it. 1998-04-10 14:55:11 +00:00
Brian Somers
73406cdfd5 Oops - fix alignment in `show modem'. 1998-04-10 13:22:38 +00:00
Brian Somers
565e35e50e o Remove the `mode' global - it's now per physical device.
o Shuffle things that live at the datalink level into
  ``show link'' rather than ``show modem''.
o Make both ``show'' commands prettier and more consistent,
  and display carrier status, link type and our name in
  ``show modem''.
o Show redial and reconnect information in ``show link''
  and remove ``show redial'' and ``show reconnect''.
o Down the correct link in bundle_LinkLost().
o Remove stale -direct and -background links at the end
  of our main loop, not when we know they're going.  This
  prevents unexpected pointer-invalidations...
o If we ``set server'' with the same values twice, notice
  and don't moan about failure.
o Record dial script despite our link mode.  The mode may
  be changed later (next mod) :-)  We never run scripts
  in -direct and -dedicated modes.
o Make ``set server none'' functional again.
o Correct datalink state array so that we don't report an
  ``unknown'' state.
o Pass struct ipcp to IpcpCleanInterface, not struct fsm.
o Create TUN_PREFIX define rather than hard-coding in main.c
o prompt_TtyInit now handles a NULL prompt for -direct mode
  rather than having to create one then destroy it uncleanly.
o Mention our mode in the "PPP Started" LogPHASE message.
o Bring all auto links up when we have something to send.
o Remove some redundant Physical_*() functions.
o Show which connection is running a command when logging
  commands.
o Initialise throughput uptime correctly.
1998-04-10 13:19:23 +00:00
Brian Somers
c06d604b03 We don't require a newline before the prompt if we've done
a prompt_*Printf().
1998-04-08 18:27:29 +00:00
Brian Somers
ce6694a567 Correct (yesterdays) broken -background flag. 1998-04-08 18:27:22 +00:00
Brian Somers
85602e5267 Remove MODE_ALIAS and add AliasEnabled() macro.
Remove IsInteractive().
1998-04-07 23:46:09 +00:00
Brian Somers
4a632c808a Initialise bundle::idle::done when the timer's stopped. 1998-04-07 01:49:24 +00:00
Brian Somers
322cffa298 Print mbuf type names in `show mem'. 1998-04-07 01:29:44 +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
cd7bd93a81 Add the clone' and remove' commands for creating and destroying
links.
1998-04-05 22:48:25 +00:00
Brian Somers
a3e274968f int var : 1' -> unsigned var : 1'.
This made things look silly and made us mis-negotiate the
number of VJ slots.
1998-04-05 19:02:49 +00:00
Brian Somers
f91ad6b0b7 Make ^Z, bg & fg work. We don't muck around with
SIGTTIN or SIGTTOU, we just disable use of the prompt
for the controlling terminal (and put a ^Z next to it
in a ``show who'' listing).

Unfortunately, we need to enable a timer to ``poll''
for the terminal having us as the controlling pgrp
when a user does a ``bg''.  If anyone knows how to
do this better - please speak up (is there any
indication to the process group leader when it's
ctrling terminal gets tcsetpgrp()'d back ?)....
1998-04-05 18:25:34 +00:00
Brian Somers
c3a119d0e9 Remove redundant warning.
Send decent output to prompts in term mode (missing %).
1998-04-04 13:01:19 +00:00
Brian Somers
cfb7c5ffe3 Initialise the local log mask.
Only do a prompt_TtyTermMode if we have a prompt.
1998-04-04 10:34:28 +00:00
Brian Somers
6756848772 Correct `LogMaskLocal' when reducing the mask for a
given prompt rather than spamming other prompt masks.
1998-04-03 19:26:40 +00:00
Brian Somers
edc521cc08 Make LQR & ECHO LQR work simultaneously (one from each side):
o Deal with LQRs when the peer has denied LQR, and we've
  accepted and enabled LQR.
  In this scenario, we send ECHO LQR packets (which the
  peer *must* reply to) so that we can detect a dead
  link.  The peer however is sending LQRs.  We now reply
  to the peers LQRs without interrupting our own ECHO LQR
  transmissions.
o Also, also only PROTO_REJ LQRs if we haven't actually sent
  an LQR ourself - otherwise we REJ all the replies and die
  because of reply starvation (duh!).
1998-04-03 19:26:35 +00:00
Brian Somers
833882f740 o Move VarMSChap into struct chap, and remove `set encrypt'
option.  We never ask a client for MSChap when we've got
  chap `enabled', and we dynamically answer using MSChap
  if the peer demands it.
o Remove all of the bundle2*() series of functions except
  bundle2datalink() as they're too expensive.  The only
  calls to bundle2datalink() are made from command.c when
  determining context.
o Write to the correct modem in term mode, and check the
  return value, dropping back to command mode if the write
  fails.

Cosmetic:
  Make the PPP COMMAND LIST section of the man page
  prettier, better and more consistent.  Alphabeticalise
  all command lists and document missing commands.
1998-04-03 19:26:29 +00:00
Brian Somers
97ce322d3a Initialise multilink LCPs according to rfc1990. 1998-04-03 19:26:12 +00:00
Brian Somers
b6217683dc Deglobalise `struct prompt':
o Our diagnostic socket has its password set in the `set socket'
    line only (not in ppp.secret).
  o Passwords are per server socket (*VarAuthKey are gone)
  o Authority is per prompt (VarLocalAuth is gone).
  o Local logging is per prompt.
  o Add a `show who' command to see who's connected.  No identd
    routine - just a `where the connection came from' display.
  o SIGUSR1 is disabled for now - we have no way of choosing a
    password for the socket created :-(

Prompts are attached as a list of `struct descriptor's in
struct bundle, and serviced under the bundles descriptor
service routines.  Ultimately, everything should be done
like this.

Cosmetic:
  o alphabeticalise SRCS in Makefile.
  o Add a few comments in command.h

TODO: Start checking that we don't overflow the descriptor sets
      in select() now that we can have any number of descriptors.
1998-04-03 19:26:02 +00:00
Brian Somers
8390b57662 o Drop packets that fail the dial filter when we're in
phase DEAD.  They'll almost definitely have timed out
  by the time we dial anyway.
o Log dial filters again (LogTCPIP).
o Make DEBUG diagnostics for filter checking actually mean
  something to the common observer.
o Do our best to keep any already-configured IP numbers at
  IPCP negotiation time.  We always first request our configured
  IP, and if the peer asks for an invalid IP, we NAK with HISADDR

Cosmetic:
  o Add a linefeed to the `set timeout' arg count error message.
  o Log unacceptable address errors to LogPHASE if LogIPCP is
    switched off.
  o Fix ``destination system not found'' error message.
  o Get out immediately if we get a fatal error before entering
    the main loop.
1998-04-03 19:25:07 +00:00
Brian Somers
92f4ff1ccd Move authname and authkey into struct bundle and only allow
their alteration in PHASE_DEAD.
Remove redundant pppConfs array element.
1998-04-03 19:24:49 +00:00
Brian Somers
4df39d1c8f Cosmetic: Don't allocate one-too-many in the `struct
pppconfdesc' array.
1998-04-03 19:24:36 +00:00
Brian Somers
a0241060fc Cosmetic:
Sort & tidy command lists.
  Give help on command alias, not just command names.
1998-04-03 19:24:31 +00:00
Brian Somers
0b3acc6e48 Remove set loopback' and show loopback' and add
`enable loopback' and `disable loopback'.  Re-write
the explaination of `enable idcheck'.
1998-04-03 19:24:23 +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
5cf4388bdf Tidy up the parent notification stuff for -background mode.
Remove extraneous extern decls of tun_{in,out} and netfd.
1998-03-25 18:38:59 +00:00
Brian Somers
75b8d2834b Handle sig 1, 2, 3 and 15 when we're the parent in background mode
by sending a SIGINT to the child.  This was intended before, but
pending_signal() was wrongly used - resulting in no action being
taken as the parent will never enter the main processing loop.
1998-03-25 18:38:24 +00:00
Brian Somers
398381d7d2 Honour the reconnect command when the link is closed due
to the lack of an LQR response.  After all, the link is
being dropped due to something beyond our control.
1998-03-25 18:37:51 +00:00
Brian Somers
9e46ce35b5 Use bundle_Phase(), not bundle->phase. 1998-03-25 00:59:38 +00:00
Brian Somers
1e991daad5 Remove some more globals:
o int modem was unused.
  o StateNames[] is now accessed via State2Nam()
  o ipKeepAlive is no more.  As a result, we must call FilterCheck()
    twice if we're doing TCP/IP logging (once when we queue and log
    the packet and once when we transmit it and need to know if the
    idle timer should be reset), but this won't be the case
    in normal life.
1998-03-24 18:47:32 +00:00
Brian Somers
6c56b953f7 Call modem_Hangup() from modem_Close() if it hasn't already
been called.
1998-03-21 22:58:43 +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
62043f48c6 Don't show ECHO LQRs in the LQM log - they're already
show in the LCP log.
1998-03-20 19:47:30 +00:00
Brian Somers
4c2d498275 Remove struct physical::abort. 1998-03-20 19:47:22 +00:00