Commit Graph

370 Commits

Author SHA1 Message Date
Brian Somers
c60f92ca71 If a packet causes a dial, continue to test whether it's
blocked in the output filter.  If so, proceed with the
dial despite dropping the packet.
1997-12-28 02:46:26 +00:00
Brian Somers
1208d55b60 Allow initial sequence numbers less than what we're expecting.
When CCP is originally negotiated, the only thing we can be
sure about is that we've started adding data to the inflate
dictionary either before or at the same time as the peer.  This
is ok, 'cos DEFLATE is a `sliding window' compressor.
1997-12-28 02:17:06 +00:00
Brian Somers
de7453bb2a Write to the routing socket as uid 0. It's not good enough
to just open it as uid 0 under OpenBSD.
1997-12-27 19:23:13 +00:00
Brian Somers
e7250038b6 Show who closes the diagnostic connection.
Show the IP range (if specified) in "show ipcp".
Close unused descriptors 0 and 2 in interactive mode.
Pass (size_t *) rather than (int *) to sysctl().
1997-12-27 13:45:57 +00:00
Brian Somers
313572f3e3 Allow (and document) execution of commands from within
our chat script.
You can now even run chat(8) - see ppp.conf.sample.
1997-12-27 07:22:12 +00:00
Brian Somers
b40d784ebf Correct copyright.
Requested by: Eivind Eklund <perhaps@yes.no>
1997-12-24 10:28:38 +00:00
Brian Somers
70ee81ff6b Cosmetic (style):
sizeof(var) -> sizeof var
  sizeof type -> sizeof(type)

Suggested by: J Wunsch <j@uriah.heep.sax.de>
1997-12-24 09:29:17 +00:00
Brian Somers
f9925914f1 Use sizeof cftypes128 for NCFTYPES128 macro, not sizeof cftypes !
Lucky that sizeof cftypes < sizeof cftypes128
1997-12-24 09:28:11 +00:00
Brian Somers
6fefd43684 strncpy(x,y,sizeof(x)) --> strncpy(x,y,sizeof(x)-1)
Suggested by: Philippe Charnier <charnier@lirmm.fr>
              Theo de Raadt <deraadt@cvs.openbsd.org>
1997-12-23 22:38:55 +00:00
Brian Somers
4401489a4a Don't forget to ntohs(sin.sin_port) (DUH!) 1997-12-22 02:28:18 +00:00
Brian Somers
abbdf4e916 Charles Mott created these (and told me via email that
they were BSD copyright).  Use his name, not mine.
1997-12-21 14:28:24 +00:00
Brian Somers
c39934ea32 Add (BSD) copyright headers. 1997-12-21 12:11:13 +00:00
Brian Somers
0ec82e961e Cosmetic: Test for comment lines after the lenght has been established.
Pointed out by: Theo de Raadt <deraadt@cvs.openbsd.org>
1997-12-21 03:41:23 +00:00
Brian Somers
8fe71e0656 Allow multiple (comma seperated) devices on the "set device" line.
Submitted by: Derek Inksetter <derek@saidev.com>
1997-12-21 03:16:19 +00:00
Brian Somers
857a4bf337 Mention that leading whitespace is ignored when identifying comments. 1997-12-21 02:34:27 +00:00
Brian Somers
2e14bb4605 Zero struct sockaddr_??s before filling them in.
Suggested by: Theo de Raadt <deraadt@cvs.openbsd.org>
1997-12-21 02:27:32 +00:00
Brian Somers
aa2e5be7ae Allow leading whitespace before '#' when identifying comments.
Submitted by: Dave Bodenstab <imdave@mcs.net>
1997-12-21 02:11:48 +00:00
Brian Somers
0ecc184e10 Cosmetic: Remove blank lines, add .Pp where necessary.
Submitted by:	Theo de Raadt <deraadt@cvs.openbsd.org>
1997-12-21 01:07:13 +00:00
Brian Somers
5a76e22406 Reset our "ifaddr" to zero if the "set ifaddr" fails in
-auto mode.  This makes ppp correctly exit if you kick it
off twice in auto mode with the same label (read: interface).
1997-12-19 18:11:05 +00:00
Brian Somers
f5fb6bd02a If the peer asks for IP 0.0.0.0, choose an IP ourselves
without looking for it in our IP list (and if found, trying
to ifconfig it!).
1997-12-19 04:49:53 +00:00
Brian Somers
16f81f6873 Replace
strcpy(a, b);  /* a and b are the same size */

with

  strncpy(a, b, sizeof(a));
  a[sizeof(a)-1] = '\0';

Making the code `correct at a glance'.

Suggested by: Theo de Raadt <deraadt@cvs.openbsd.org>
1997-12-18 01:10:13 +00:00
Brian Somers
a09d09cbe7 Don't log the actual password when command-logging
"passwd xxxx".
1997-12-18 00:28:36 +00:00
Brian Somers
d27d502ce6 Don't depend on a u_long being 32 bits.
Pointed out by: Theo de Raadt <deraadt@cvs.openbsd.org>
1997-12-17 21:22:05 +00:00
Brian Somers
a19363a911 char filename[200] => char filename[MAXPATHLEN]
Pointed out by: Theo de Raadt <deraadt@cvs.openbsd.org>
1997-12-17 21:22:01 +00:00
Brian Somers
58f264e1f1 Log the source of client connections to the diagnostic port.
Disallow connections from port numbers <1024 as low port numbers
can only really mean trouble (ftp bounces etc.).

Discussed at length with: Theo de Raadt <deraadt@cvs.openbsd.org>
1997-12-17 21:21:56 +00:00
Brian Somers
865f3ab28a Remove useless comparison. 1997-12-17 21:21:53 +00:00
Brian Somers
e3b4c40068 If we've got a descriptor table that's bigger than an
fd_set, make sure that all descriptors >2 are closed
when we start - otherwise we're asking for a dump in
FD_SET().

Problem pointed out by: Theo de Raadt <deraadt@cvs.openbsd.org>
1997-12-17 21:21:47 +00:00
Brian Somers
72ca96bfa5 o Log ******** instead of the actual password for "set authkey"
when command logging is switched on.
o Display ******** for the authkey for "show auth"
o Document how \P should be used, and document the other chat escapes
  while I'm there.
o Make sure the full command is displayed when a compound command
  fails - ie, "set novar rubbish" should say "set novar: Invalid command"
  rather than "novar: Invalid command"

Problem pointed out by: Theo de Raadt <deraadt@cvs.openbsd.org> (among others)
1997-12-17 21:21:42 +00:00
Brian Somers
83c0952d1c Fix a potential overflow where, if the label passed on the command
line is > LINE_LEN (512 bytes), we scribble (*blush*).

Hinted at by: Theo de Raadt <deraadt@cvs.openbsd.org>

Change sprintf(buf, "fixedstring") to strcpy(buf, "fixedstring").
1997-12-17 00:19:25 +00:00
Brian Somers
b399b74b2d Wrap long lines
Submitted by:	Greg Lehey <grog@lemis.com>
1997-12-16 00:32:35 +00:00
Brian Somers
8511968cda Correct return values from alias routines. 1997-12-15 23:34:05 +00:00
Brian Somers
abf533d806 Use LogWARN for command usage messages and unrecognised
commands, not LogCOMMAND.
1997-12-15 20:21:47 +00:00
Brian Somers
32ca334139 Do 2 passes when "delete all"ing. The first pass removes
all RTF_WASCLONED routes, and the second removes the
others.  This avoids the situation where we've added an
RTF_CLONING route (such as ``default''), created some
clones, then deleted the CLONING route before the
WASCLONED route(s).  Without the two passes, we get
errno (not rtm_errno) set to ESRCH when deleting the
WASCLONED route, despite the deletion succeeding !

Also:
  Enhance the route operation failure diagnostics.
  Make portability #ifdefs a bit more generic.
1997-12-15 20:21:15 +00:00
Brian Somers
bcc332bdb0 Allow random IP number allocation to peer.
Validate the peers suggested IP by attempting to make a routing table
entry.
Give up IPCP negotiation if the peer NAKs us with an unusable IP.
Always SIOCDIFADDR then SIOCAIFADDR when configuring the tun device.
Using SIOCSIFDSTADDR allows duplicate dst addresses (which we don't
want)!!!
Allow up to 200 interface names (was 50) (now that ppp can play server
properly).
Up the version number (1.5 -> 1.6).

Cosmetic:
  Log unexpected CCP packets in the CCP log rather than the ERROR log.
  Log unexpected Config Reqs in the appropriate LCP/IPCP/CCP log rather
  than the ERROR log.
  Log failed route additions and deletions with WARN, not TCPIP.
  Log the option id and length for unrecognised IPCP options.
  Change some .Sq to .Ar in the man page.
1997-12-13 02:37:33 +00:00
Brian Somers
038a366695 Deal with inflate() returning avail_in == avail_out == 0
We must call inflate again in case there's any pending output
despite our input buffer being empty.  If the output buffer
is in fact already flushed, inflate() returns Z_BUF_ERROR.
There isn't really an error !
1997-12-08 20:22:12 +00:00
Brian Somers
d4395dc80b Correct usage of add' and delete'. 1997-12-08 20:09:10 +00:00
Brian Somers
b0624e7fc6 Fix PAP, CHAP & LQR req (I broke the byte ordering when
I did the deflate re-org).
Make PAP & CHAP negotiation prettier in the log file.
If both PAP & CHAP are `enabled' and the peer NAKs CHAP
suggesting PAP, be friendly and REQ PAP the next time.
This is in line with the rfc.
1997-12-07 23:55:29 +00:00
Brian Somers
f01e577b07 Only allow one arg to `delete' - the mask & gateway aren't necessary.
Delete AF_LINK routes as well as AF_INET.
Allow the word `default' as the arg to `delete' or in place of the
first two args (dest & netmask) to `add'.
Accept INTERFACE as the third arg to `add'.

  You can now say `add default interface' to create a default route
  through the tun interface.  It's reported that subsequent bind()s
  will bind to a broadcast address and not to the address currently
  assigned to the tun device - this is the first step towards
  supporting that first connection that was around from before the
  dynamic IP negotiation....
1997-12-07 04:09:15 +00:00
Brian Somers
b6871831e5 Correct cftypes128 index. 1997-12-06 22:43:58 +00:00
Brian Somers
4bfaee9023 Understand ``sockaddr_dl''s where sdl_nlen != 0 1997-12-04 18:49:39 +00:00
Brian Somers
702026bc21 Remove duplicate REJECTED macro.
Remove extraneous pointers.
1997-12-04 18:49:35 +00:00
Brian Somers
ea6610416a Initialize ccpstate when CCP comes down.
Remove extraneous pointers.
1997-12-04 18:49:32 +00:00
Brian Somers
0c9d3d050e Parenthesise the REJECTED macro. 1997-12-04 18:49:28 +00:00
Brian Somers
774326ed2e Identify rejected protocol types according to rfc1700. 1997-12-04 18:49:26 +00:00
Brian Somers
4bc84b8c11 Fix the CCP Type field value for DEFLATE.
(I *really* meant to do this  *before* committing the
deflate changes in the first place - oops).

Pppd is horribly broken in this respect - refer to the
ppp man page for details.  Ppp *WON'T* negotiate deflate
with pppd by default - you must ``enable'' and ``accept''
``pppd-deflate'' in your config.

While I'm in there, update the cftypes in ccp.c so that
we recognise some more protocols (we don't actually do
anything with them - just send a REJ).
1997-12-03 23:28:02 +00:00
Brian Somers
0053cc58a9 Abstract the CCP layer a level.
Add DEFLATE support.
1997-12-03 10:23:54 +00:00
Brian Somers
fc85e494d0 Display connect time as 0 if we've never been
connected.
Pointed out by: Jeff Kletsky <Jeff@wagsky.com>
1997-11-26 02:16:10 +00:00
Brian Somers
132502aa4d Fix the help command (broken when I re-prototyped
all the commands).
1997-11-23 20:05:18 +00:00
Brian Somers
82ceff74d2 Up the version number to 1.5. 1997-11-22 13:47:02 +00:00
Brian Somers
9cb1d89ee2 Understand how to derive the names of interfaces
when they aren't ordered.  This is probably vital
for laptop support ;-I
1997-11-22 13:46:02 +00:00