Commit graph

1179 commits

Author SHA1 Message Date
Brian Somers 962a3cbc83 If the fsm header reports a length greater than the packet size,
drop the packet rather than just whinging about it in the log.
If the fsm header has a smaller length, continue to whinge.
2000-05-26 21:11:55 +00:00
Brian Somers 07e4efad3d Remove an unused variable 2000-05-26 08:29:11 +00:00
Brian Somers 5e269efe6e When we do a `dial'' or `open'' from DATALINK_READY, go to
DATALINK_CARRIER and turn off scripting.

This should fix instances where ``term'' is used followed by ~.
and then ``dial''/``open'' (it currently just sits there looking
at you).

Reported by: Tim Vanderhoek <vanderh@ecf.utoronto.ca>
2000-05-26 08:26:56 +00:00
Brian Somers 682cb20f5d Fix a topy (if (expr); command;)
Submitted by:	Renaud Waldura <renaud@guppy.evolunet.com>
2000-05-25 16:12:55 +00:00
Brian Somers d4c74446f7 The name /var/log/alias.log is *not* likely to change in the near
future...
2000-05-24 20:56:30 +00:00
Brian Somers 632cd66778 Mention what ``enable proxy'' actually does 2000-05-24 13:49:39 +00:00
Brian Somers d9626e9459 Honour `set speed sync'' and `set device !program'' when
used together by creating a SOCK_DGRAM socketpair() between
the processes.

Be polite when closing !program links and send a HUP to the
process.  This makes ssh tunnels over unreliable media (such
as via httptunnel) reconnect properly.
2000-05-24 09:05:58 +00:00
Brian Somers 4518b0757f Mention it in the log file when we HUP a process that
controls a link.
2000-05-24 09:05:45 +00:00
Brian Somers 7fe0b59209 Don't attempt to fputs(NULL, fp) when ``enable dns'' is given and
there's no resolv.conf.
Use a umask of 022 when creating resolv.conf, not 0644 !
2000-05-24 01:00:24 +00:00
Brian Somers eb598e08ff Always pass packets through libalias when NAT is enabled.
Submitted by: luoqi
Forgotten by: me
2000-05-23 14:55:08 +00:00
Brian Somers bcff338667 Return -2 when tcp_OpenConnection() fails so that ppp doesn't
report that the device name is of an invalid format.
2000-05-22 08:23:35 +00:00
Brian Somers 7ebff0094c Be more verbose when a second link doesn't match the first because the
peer enddisc/authname is different.
2000-05-22 08:23:13 +00:00
Brian Somers 7d7b90c714 Fix a typo 2000-05-11 07:59:21 +00:00
Brian Somers 44d127bc34 Mention that the default is to let external traffic route to
the internal network when NAT is enabled.

Allow ``set target MYADDR'' to stop packets at the gateway.
2000-05-11 07:55:44 +00:00
Brian Somers 17e57a5fe3 Correct a bad bug in m_prepend()
Submitted by: luoqi
2000-05-07 10:08:24 +00:00
Brian Somers 328ecc101e Remove a rogue space 2000-04-13 00:00:46 +00:00
Brian Somers 9bf01bcb6c Add a missing ``break'' 2000-04-09 18:27:08 +00:00
Brian Somers b42135dee3 When running ppp -background, show comfort messages showing
when we're redialing/reconnecting.

While we're here, log redial, reconnect and phone number
announcements to LogCHAT, and reduce some other logging to
LogDEBUG.
2000-04-07 23:46:14 +00:00
Brian Somers c8f30703cd I didn't get this right the last time....
When an NCP reaches TLF, *ONLY* datalink_Close() links that are
in DATALINK_OPEN.

When the last link reaches TLD, DOWN all NCPs (as we used to in the
links TLF (which was the wrong place anyway)), as the NCPs aren't
now going to datalink_Close() us unexpectedly, we get to continue
doing what we were told to do in the first place.

The result:  When we lose a link, the IPCP layer goes down and
we actually call the stuff in ppp.linkdown !
2000-04-06 10:03:48 +00:00
Gary Jennejohn 27173c13e8 Pass me the pointy hat.
It was not a good idea to remove csu_header from struct cspace, it had
ramifications which I didn't notice.

Restore src/usr.sbin/ppp/slcompress.h to the way it was, since MAX_HDR
was already defined as 128 there and it's a user program anyway.

In sys/net/slcompress.h make MAX_HDR 128 intead of MLEN to avoid
bloat.

My apologies for any inconvenience.
2000-04-04 09:20:53 +00:00
Brian Somers 2a8e2fe669 Plug two file descriptor leaks 2000-04-03 19:56:49 +00:00
Gary Jennejohn 8810489433 Nuke csu_hdr from struct cspace. csu_hdr is not used anywhere in the
tree. This considerably reduces unnecessary bloat in struct slcompress.

I'm running with this change right now and have seen no negative
side-effects.

On my sytem this reduced kernel BSS by about 25KB.

Submitted by:	bde
Approved by:	brian for user-ppp
2000-04-03 19:54:33 +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 804e0a12f2 Use INADDR_NONE with PacketAliasSetTarget() if no args are given to
``nat target'', and suggest the use of ``nat target default'' as an
interesting possibility.
2000-03-31 20:42:24 +00:00
Brian Somers 4c2b812c39 Undo the damage done to this file in my last commit 2000-03-31 14:31:36 +00:00
Brian Somers b7d8533c16 Add the ``nat target'' command. 2000-03-31 14:26:23 +00:00
Brian Somers 9962fa3956 Correct address parsing
Pointed out by: Maxim Sobolev <sobomax@altavista.net>
2000-03-30 10:46:20 +00:00
Brian Somers b565321aa1 Log information about packets being dropped (probably due to
``nat deny_incoming yes'') by libalias.
2000-03-29 09:31:52 +00:00
Brian Somers 6578fcf3f3 Allow the use of hostnames instead of (and as well as) IP
numbers in all commands.
If people use hostnames and have dodgy resolvers or try to resolve
the hostname before the link is up, they get what they deserve....

Requested by: ru
2000-03-29 09:31:27 +00:00
Brian Somers 0e20b8777c Mention the value of the unexpected return code in nat_LayerPull() 2000-03-29 00:14:24 +00:00
Brian Somers f3a0d054fe don't treat # specially if PARSE_NOHASH is passed 2000-03-28 15:14:15 +00:00
Brian Somers effc341fe3 Don't treat # specially here 2000-03-28 15:11:38 +00:00
Brian Somers 5a83ad1eb1 Correct the parent notification diagnostic emitted from the child
process in -background mode (it should report failure if appropriate).
2000-03-22 03:02:01 +00:00
Brian Somers 5a8b6a98df If a links LCP FSM has reached TLF and it's the last link,
don't bother to re-initialise the NCPs.  Instead wait for
bundle_LinkClosed() to be called - IFF it actually is called.

By initialising the NCPs at this point, ppp was recursing
back into the fsm_Down() routing for the link, and losing
track of the reason that the link was being brought down.
The end result was that ``set reconnect'' would never do
anything.

Patiently pointed out by: ru
2000-03-22 03:02:00 +00:00
Brian Somers 4b567bf209 Don't bother setting the dial timer if we've closed a
background/foreground/direct and zero'd the redial/reconnect
counts.
2000-03-22 03:01:56 +00:00
Brian Somers 3ce91245fc Do some vfork() trickery so that the parent can determine
if the childs exec() has succeeded or failed by taking advantage
of the fact that both processes share the same memory.

FWIW:
  I tried to implement this by doing a pipe(), setting the
  write desciptors close-on-exec flag in the child and writing
  errno to the descriptor if the exec() fails.  The parent can
  then ``if (read()) got errno else exec worked''.

  This didn't work though - the child could write() to fd[1] on
  exec failure, but the parent got 0 trying to read() from fd[0] !
  Is this a bug in execve() ?
2000-03-22 03:01:53 +00:00
Brian Somers 0cd8e9020a Call bundle_CleanDatalinks() after UpdateSet() in case we're
dropping out of background/foreground/direct mode.

This avoids either having to wait for the redial timer before
exiting or jaming up in select() waiting for something that'll
never happen.
2000-03-22 03:01:48 +00:00
Brian Somers a1f961d3a3 Add some diagnostics to prove that incoming IP fragments are
being dealt with correctly.
2000-03-19 12:37:27 +00:00
Brian Somers 311a9da249 Move a comment to make things a bit more readable.
Suggested by: sheldonh
Forgotten by: me
2000-03-16 16:28:27 +00:00
Brian Somers 2793563fc4 Increase bit fields to allow for new values 2000-03-14 20:11:45 +00:00
Brian Somers 959d90ef1d ppps -> ppp's; suggested by sheldonh
.Nm ppp -> .Nm; overlooked by me
Microsofts -> Microsoft's; OpenBSD
2000-03-14 20:04:32 +00:00
Brian Somers a60f44db18 Understand -DNOINET6 2000-03-14 19:33:13 +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 574a3ffd78 Refresh the NAT IP pointer after a potential mbuf reallocation. This
caused frequent lock-ups for individual sessions over a NAT'd ppp link
when MTU sizes ended up more or less exactly wrong.
2000-03-14 01:47:21 +00:00
Brian Somers 209dc10239 Fix some printf-style argument bugs 2000-03-14 01:47:19 +00:00
Brian Somers ceecaea3de Fix some typos
Obtained from: OpenBSD
2000-03-14 01:47:13 +00:00
Brian Somers 499640f195 Adjust whitespace 2000-03-14 01:47:11 +00:00
Brian Somers b9fa960d93 Don't include netinet6/in6.h directly. 2000-03-14 01:47:09 +00:00
Brian Somers 8e7bd08ea4 Correct some typos introduced in the descriptor -> fdescriptor change. 2000-03-14 01:47:07 +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 f84f2c0057 Correct UN_SIZE definition
Submitted by: Ben Smithurst <ben@scientia.demon.co.uk>
2000-03-14 01:46:58 +00:00
Brian Somers 24731321e6 Don't ``break'' when we come accross a non-RTM_IFINFO type
entry in the block returned by the NET_RT_IFLIST mib,
``continue''

Broken a few minutes ago by: me
2000-03-14 01:46:56 +00:00
Brian Somers d6d3eeab46 When ppp can't identify the relevant name, don't use "???", use
<nnn> or <0xxxx> instead.
2000-03-14 01:46:54 +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 6b4579784c The interface list that comes back from the PF_ROUTE/NET_RT_IFLIST mib
is aligned.  Teach this to ``show route''.

Clean up some of the sockaddr parsing routines.
2000-03-14 01:46:44 +00:00
Brian Somers 6b38466448 Support IP6 addresses in ``show route''
Also, don't try to output routing entries if either the
RTA_DST or RTA_GATEWAY sockaddrs aren't present.
2000-03-14 01:46:38 +00:00
Brian Somers 76ce2d4bcb When adjusting timer::rest, round to the closest TICKUNIT usecs
value.

This has minimal impact here, but if ppp ever needs to frequently
remove timers before they've timed out, it can badly skew the next
item in the timer list without this change.

The correct fix would be to store usecs in `rest' rather than
TICKUNITs, but the math is easier if we just round...
2000-03-14 01:46:34 +00:00
Brian Somers e722aa17f8 When we stop a timer that's the first in the timer list, ensure
that we adjust that timers `rest' value (with the current getitimer()
values) before using that to adjust the next items `rest' value.
After adjusting that value, restart the timer service so that we've
now got the correct setitimer() values.
2000-03-14 01:46:31 +00:00
Brian Somers f013f33ee2 To avoid namespace polution in NetBSD:
``struct descriptor'' -> ``struct fdescriptor''
2000-03-14 01:46:09 +00:00
Kris Kennaway 38e1809ae3 Remove the last vestiges of libRSAglue now that it's an empty stub.
This should fix the buildworld problems some people were seeing.

Approved by:	jkh
2000-03-11 22:34:10 +00:00
Kris Kennaway bb49f794f5 Buildworld fixes for NO_OPENSSH and NO_OPENSSL
Approved by:	jkh
2000-03-09 06:29:05 +00:00
Sheldon Hearn 4e86fcacf6 Remove more single-space hard sentence breaks. 2000-03-02 14:54:02 +00:00
Mark Murray ec81a4cee3 Update DISTRIBUTION for new crypto world order 2000-02-29 11:44:18 +00:00
Mark Murray 512182f3ff Use libcrypto instead of libdes. 2000-02-24 21:10:28 +00:00
Ruslan Ermilov dfd9528b30 Unbroke the reference to libalias(3). 2000-02-05 15:25:15 +00:00
Brian Somers cda4644c28 Remove MAINTAINER=
I don't claim to own the code and certainly don't want to discourage
people from fixing or updating it.

[I know it's the 29th, but the FREEZE hasn't yet been posted to committers]
2000-01-29 11:08:00 +00:00
Brian Somers 225e259db9 If we're in callback mode, don't forget this fact when we
get into datalink_Down().

Submitted by: David Hedley <david@inty.co.uk>
2000-01-27 00:40:25 +00:00
Brian Somers d81cf7d011 Actually ignore comments at the end of lines - broken with the commit
that made ppp *not* treat #s in quoted arguments as comments.
2000-01-27 00:40:10 +00:00
Brian Somers 3a7b6d76a7 Handle the availability of TUNSIFHEAD. If it's there, use it.
For the moment this is just overhead, but it'll be used for INET6
support later.
2000-01-23 01:48:19 +00:00
Brian Somers 06b47306d1 Use TUNSIFPID when we change our PID (if it exists). 2000-01-21 00:33:27 +00:00
Brian Somers 82de8666e1 Use AUTHLEN for the length of authname 2000-01-17 12:27:29 +00:00
Brian Somers 278657c32d Don't set ifaddr::in_addrs to 1 after an ``iface clear'' on an interface
with no addresses.
2000-01-07 03:47:12 +00:00
Brian Somers 35099b5d17 include stdlib.h (setproctitle() is prototyped there in OpenBSD) 2000-01-07 03:23:38 +00:00
Brian Somers ff36f30c56 Call serial devices `cuaXX'' instead of `cuaaX'' (in line
with OpenBSD conventions).
2000-01-07 03:11:56 +00:00
Brian Somers bb8ec81ec9 .Bl -tag requires -width too
Obtained from: OpenBSD
2000-01-07 03:11:42 +00:00
Brian Somers 57f0cd1068 Remove an unused #define 2000-01-07 03:11:31 +00:00
Brian Somers 323b15a1c0 Ensure that there's a bit of extra space in our buffer when it's
passed to libalias.  If there's not enough space, things like ftp
PORT commands start failing....

Reported by: Gianmarco Giovannelli <gmarco@giovannelli.it>
2000-01-03 20:09:23 +00:00
Brian Somers a40fdd98b0 Increase M_MAXLEN from 2048 - sizeof struct mbuf to
4096 - sizeof struct mbuf, and set MAX_MRU and MAX_MTU
back to 2048.

2048 is big enough as an MTU/MRU, but we need to be able
to allocate larger mbufs after reassembling IP fragments.
1999-12-30 13:27:15 +00:00
Brian Somers e7d008b4bd Add a few missing #includes 1999-12-30 03:40:29 +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 bb7d10c9c5 Mention that it's only necessary to escape the '-' in chat scripts
twice (once for the arg parsing and once to make it a normal character).
Make the man page example consistent.

Reminded by: Bryan Liesner <bleez@netaxs.com>
1999-12-29 22:31:10 +00:00
Brian Somers 182c898a22 Add a bunch of `const's and fix a typo.
Submitted by: Rich Neswold <rneswold@MCS.Net>
1999-12-27 11:54:57 +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 e62ce959d0 Don't bother fork()ing after closing a ctty if ppp is about to
terminate anyway.
1999-12-23 21:43:25 +00:00
Brian Somers 1bbd8362c7 Understand double-quotes anywhere on a command line in the same
way that a shell does.  The previous way ppp did it just didn't
make any sense.
1999-12-23 21:43:12 +00:00
Brian Somers 90e7fb01df Correct warning about unindented commands when the unindented command
is actually a new label with a comment at the end of the line.
1999-12-23 21:43:00 +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 1b365e7039 Fix my '#'-at-end-of-lines change, spammed by a subsequent commit. 1999-12-20 20:47:58 +00:00
Brian Somers 687d9f5709 Use getpwuid()->pw_dir instead of $HOME when expanding ``~''. 1999-12-20 20:30:47 +00:00
Brian Somers 8b50b30fa7 Use getpwuid() instead of getlogin() in ``allow users''. 1999-12-20 20:30:40 +00:00
Brian Somers ef0a48491b Add missing linefeed. 1999-12-20 20:30:35 +00:00
Brian Somers dbde41c0b7 Cosmetic: clean up some parenthesis confusion 1999-12-20 20:30:30 +00:00
Brian Somers 9409953d84 Handle comments at the end of lines. 1999-12-20 20:30:25 +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 dae8dd31bf Implement mbuf allocation internally by maintaining 8 buckets of
different sized mbufs, and mallocing them in chunks of 20 mbufs
at a time.

This improves back-to-back throughput by between 7 and 8%
1999-12-20 20:29:51 +00:00
Brian Somers 26af0ae966 Cosmetic: Make struct mbuf more like kernel mbufs. 1999-12-20 20:29:47 +00:00
Brian Somers aa4e734249 Learn to do pointer arithmatic (doh!) 1999-12-18 02:31:36 +00:00
Brian Somers 9acc846078 Handle PPPoPTY correctly. 1999-12-13 18:45:21 +00:00
Brian Somers ffcfaec721 Be careful not to re-initialise `struct stat' while it still has
a running timer.  This fixes a problem where a dial is manually
aborted, the hangup script kicks in and the chat timer ends up
on the timer queue twice (tick tick tick tick *boom*)
1999-12-03 06:33:10 +00:00