Commit Graph

1048 Commits

Author SHA1 Message Date
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
Brian Somers
cbee975442 Change the way we transfer links (again). The previous
method avoided all race conditions, but suffered from
sometimes running out of buffer space if enough clients
were piled up at the same time.

Now, the client pushes the link descriptor, one end of a
socketpair() and the ppp version via sendmsg() at the
server.  The server replies with a pid.  The client then
transfers any link lock with uu_lock_txfr() and writev()s
the actual link contents.  The socketpair is now the only
place we need to have large socket buffers and the bind()ed
socket can keep the default 4k buffer while still handling
around 90 racing clients.
1999-11-30 23:52:37 +00:00
Brian Somers
886530ab78 depricated -> deprecated + mention the -alias flag status in README.changes 1999-11-29 18:53:43 +00:00
Brian Somers
97536b3bb8 Don't try to do a DIALOUT in -direct mode or if there's no phone
numbers set.
1999-11-28 15:50:23 +00:00
Brian Somers
f6a4e748a9 Make -foreground a proper option (allowing ``allow mode foreground'',
``set mode foreground'' etc.
1999-11-28 15:50:08 +00:00
Brian Somers
b5c3c9aeda Allow extended pap success messages by believing in the PAP headers
length field rather than the one byte message length field embedded
in the packet.  This steps slightly outside of the protocol boundaries,
but should not cause any problems.

Limitation noted by: Simon Winwood <simon@winwood.org>
1999-11-26 22:44:45 +00:00
Brian Somers
fdc29d54a4 Change ``set cd'' so that its default value is device specific. The
default is still 1 second for ttys, but is now 6 seconds for i4b (ISDN)
devices and 5 seconds for ethernet (PPPoE) devices.
1999-11-26 22:44:33 +00:00
Brian Somers
2cb305af77 Rewrite the link descriptor transfer code in MP mode.
Previously, ppp attempted to bind() to a local domain tcp socket
based on the peer authname & enddisc.  If it succeeded, it listen()ed
and became MP server.  If it failed, it connect()ed and became MP
client.  The server then select()ed on the descriptor, accept()ed
it and wrote its pid to it then read the link data & link file descriptor,
and finally sent an ack (``!'').  The client would read() the server
pid, transfer the link lock to that pid, send the link data & descriptor
and read the ack.  It would then close the descriptor and clean up.

There was a race between the bind() and listen() where someone could
attempt to connect() and fail.

This change removes the race.  Now ppp makes the RCVBUF big enough on a
socket descriptor and attempts to bind() to a local domain *udp* socket
(same name as before).  If it succeeds, it becomes MP server.  If it
fails, it sets the SNDBUF and connect()s, becoming MP client.  The server
select()s on the descriptor and recvmsg()s the message, insisting on at
least two descriptors (plus the link data).  It uses the second descriptor
to write() its pid then read()s an ack (``!'').  The client creates a
socketpair() and sendmsg()s the link data, link descriptor and one of
the socketpair descriptors.  It then read()s the server pid from the
other socketpair descriptor, transfers any locks and write()s an ack.

Now, there can be no race, and a connect() failure indicates a stale
socket file.

This also fixes MP ppp over ethernet, where the struct msghdr was being
misconstructed when transferring the control socket descriptor.

Also, if we fail to send the link, don't hang around in a ``session
owner'' state, just do the setsid() and fork() if it's required to
disown a tty.

UDP idea suggested by: Chris Bennet from Mindspring at FreeBSDCon
1999-11-25 02:47:04 +00:00
Brian Somers
be8bbe8809 Don't setuid() 'till we've called ID0setproctitle() 1999-11-23 00:14:50 +00:00
Brian Somers
31dd45c4e0 Call MkSockNode() as uid 0
Forgotten by: julian
1999-11-21 23:27:23 +00:00
Brian Somers
dc4511d5eb Don't compile NETGRAPH out of ppp for the release crunch 1999-11-20 10:55:27 +00:00
Brian Somers
83569b351c Update the time delta of the first item in TimerList before
inserting a new item.  Without this, it's possible to
mis-insert quite badly... but only by as much as the load of
the first item, which is almost always 1 second.

Initialise the timerservice with `restart' set if we're inserting
at the start of the list.
1999-11-19 23:21:13 +00:00
Brian Somers
cf0a39401d Fix ``set proctitle'' by using setproctitle(). 1999-11-17 21:12:35 +00:00
Brian Somers
02cfb3ba65 Remove some extraneous ifdefs, and don't try to put the socket in
O_NONBLOCK.  The select() is the best best as I don't want to muck
about with the send/receive thresholds.
1999-11-16 21:57:48 +00:00
Brian Somers
fdb4bb1b89 Use modfind() to check if a kld is already loaded.
Submitted mostly by: green
1999-11-16 21:57:34 +00:00
Brian Somers
e6ee5b3933 Don't insist on 4 digit umasks in ``set server''.
Pointed out by: joerg
1999-11-13 16:18:40 +00:00
Brian Somers
9b1b0fc0e0 Make the meaning of the provider part of the PPPoE device spec clearer. 1999-11-13 16:18:27 +00:00
Brian Somers
0c38fb0340 Oops, netgraph.o -> ether.o for the RELEASE build. 1999-11-11 02:25:17 +00:00
Brian Somers
772d2e0939 If dev->connected is already set to CARRIER_OK in ether_AwaitCarrier,
don't go and set it to CARRIER_LOST !
1999-11-09 23:30:59 +00:00
Brian Somers
da8b70349b Don't recurse into datalink_UpdateSet() after
doing a HangupDone().  The HangupDone() may fuel
bundle_CleanDatalinks(), and if so, the bogus
UpdateSet() ends up select()ing on a closed
descriptor.....

Change the main `do/while' loop to a `for' loop so
that any `continue's do the bundle_CleanDatalinks()
& bundle_IsDead() bit.
1999-11-09 23:21:47 +00:00
Brian Somers
9d06928d0e Correct the ``-unix X'' parsing (last time I only corrected
``-unitX''.

Pointed out twice by: Gert-Jan Vons <gert-jan@bigfoot.com>
1999-11-09 21:59:09 +00:00
Brian Somers
4012527343 Be a bit smarter when identifying a netgraph node
(don't dereference NULL).
1999-11-09 19:05:48 +00:00
Brian Somers
0d3751e7bd Don't treat -unit as a mode flag when counting mode flags.
Submitted by: Gert-Jan Vons <gert-jan@bigfoot.com>
1999-11-09 00:32:21 +00:00
Brian Somers
0f9c420717 Add an empty netgraph.o when building a release to keep the
crunch stuff happy.

Breakage spotted by: phk
1999-11-09 00:16:30 +00:00
Brian Somers
6b8b6bef1a Don't zero-pad netgraph node ids
Recommended by: julian
1999-11-07 09:03:45 +00:00
Brian Somers
87c3786e7f Support PPPoE
Help (lots) from: julian, archie
Facilities from: ahebert@pubnix.net
1999-11-06 22:50:59 +00:00
Brian Somers
c116e0c0aa Introduce ``set logout''; another chat script. This is in preparation
for the abstraction of ``set dial'' and ``set hangup''.
1999-10-25 13:49:44 +00:00
Brian Somers
bacfb041e0 Don't (unnecessarily) parse wtmp, force ID0logout() to DTRT instead. 1999-10-25 13:31:42 +00:00
Brian Somers
1a80353cd8 Manually create a correct(*) entry in wtmp when logging out a PPPoTCP or
PPPoUDP connection.

(*) This is as correct as ftp and uucp wtmp entries are - that is,
multiple concurrent connections will not record enough information
in wtmp to tell last(1) who was logged in for how long.
1999-10-21 21:55:22 +00:00
Brian Somers
f1b965c94b If we're running ppp -direct over a tcp or udp connection,
record the IP number in the `from' slot and not the tty slot.
We put ``ppp'' in the tty slot - in line with what ftp (and
probably others) does.
1999-10-21 01:19:23 +00:00
Brian Somers
1b02dfb47c Don't go from PHASE_NETWORK to PHASE_ESTABLISH when we want to
re-open a device.  The fact that we're in NETWORK phase indicates
that there are other links in DATALINK_OPEN and that we don't want
to stop using them.
1999-10-21 00:19:33 +00:00
Brian Somers
c0593e34b7 Add the -unit command line switch for specifying the tun device.
Warn about -alias being depricated (but still allow it).
Don't moan twice about failing to open any tun device.
Fix a diagnostic and add the -quiet switch to the usage message.
1999-10-19 15:21:09 +00:00