Commit Graph

827 Commits

Author SHA1 Message Date
brian
5bbfb9a312 Add missing linefeed. 1999-12-20 20:30:35 +00:00
brian
7a62d8a465 Cosmetic: clean up some parenthesis confusion 1999-12-20 20:30:30 +00:00
brian
d574ab6d26 Handle comments at the end of lines. 1999-12-20 20:30:25 +00:00
brian
3e6b8e10f7 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
5579308326 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
919d0f538f Cosmetic: Make struct mbuf more like kernel mbufs. 1999-12-20 20:29:47 +00:00
brian
17689cb175 Learn to do pointer arithmatic (doh!) 1999-12-18 02:31:36 +00:00
brian
920758ddf3 Handle PPPoPTY correctly. 1999-12-13 18:45:21 +00:00
brian
ee3f468587 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
9491d4a14b 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
90f2d067c1 depricated -> deprecated + mention the -alias flag status in README.changes 1999-11-29 18:53:43 +00:00
brian
c0de590a5c 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
ddd684a1a2 Make -foreground a proper option (allowing ``allow mode foreground'',
``set mode foreground'' etc.
1999-11-28 15:50:08 +00:00
brian
428643dd44 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
3c65bdc9a6 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
a5fa2f99ed 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
2aeda99cbb Don't setuid() 'till we've called ID0setproctitle() 1999-11-23 00:14:50 +00:00
brian
2c7a1f86db Call MkSockNode() as uid 0
Forgotten by: julian
1999-11-21 23:27:23 +00:00
brian
a853a364d8 Don't compile NETGRAPH out of ppp for the release crunch 1999-11-20 10:55:27 +00:00
brian
a1c1bf8f7c 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
b484490afe Fix ``set proctitle'' by using setproctitle(). 1999-11-17 21:12:35 +00:00
brian
eb7a7a45a7 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
f6ac69f153 Use modfind() to check if a kld is already loaded.
Submitted mostly by: green
1999-11-16 21:57:34 +00:00
brian
5151d97759 Don't insist on 4 digit umasks in ``set server''.
Pointed out by: joerg
1999-11-13 16:18:40 +00:00
brian
7be13127ce Make the meaning of the provider part of the PPPoE device spec clearer. 1999-11-13 16:18:27 +00:00
brian
dc3ab5d742 Oops, netgraph.o -> ether.o for the RELEASE build. 1999-11-11 02:25:17 +00:00
brian
c5d2ca82c6 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
e1e62f8cd4 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
64d12e8b5b 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
a519ec330f Be a bit smarter when identifying a netgraph node
(don't dereference NULL).
1999-11-09 19:05:48 +00:00
brian
50dd1d29fc 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
35e0fd3284 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
b9908f0754 Don't zero-pad netgraph node ids
Recommended by: julian
1999-11-07 09:03:45 +00:00
brian
8bac1154cf Support PPPoE
Help (lots) from: julian, archie
Facilities from: ahebert@pubnix.net
1999-11-06 22:50:59 +00:00
brian
b3ddae2734 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
3c23268eff Don't (unnecessarily) parse wtmp, force ID0logout() to DTRT instead. 1999-10-25 13:31:42 +00:00
brian
aff584d577 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
a960365ba9 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
44b4c57a07 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
492cd0a5e5 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
brian
366399cf8b Correct a few diagnostics 1999-10-16 13:28:04 +00:00
brian
5a964a75d5 Don't ntohl() the signature before printing it... it's already
been done.

Spotted by: Gert-Jan Vons <gert-jan@bigfoot.com>
1999-10-16 09:18:15 +00:00
brian
420eed68cc When more than one timer is expired at once, allow for the possibility
that the first timer ends up doing a timer_Stop() on the second.

When this happens, remove the timer from the pending list so that
we still call any subsequent timers.

This bug has been here for several years, but has only been tickled
recently with my device layering changes.

With enormous thanks for the perseverance of: Ruslan Ermilov <ru@ucb.crimea.ua>
1999-10-15 20:44:34 +00:00
brian
3b5db3e08a When we get the last NCP TLD, close all datalinks with CLOSE_STAYDOWN
rather than CLOSE_NORMAL.
1999-10-15 20:36:04 +00:00
brian
a7eff426e3 Redefine CRTS_IFLOW and CCTS_OFLOW on the mac.
Submitted by: Kazuyoshi Kato <kazk@yyy.or.jp>
1999-10-15 20:30:44 +00:00
brian
79847cf7ae When uncompressing VJ-compressed frames, fix the ip_sum directly
in struct cstate rather than copying the stored header slot into a
potentially mis-aligned buffer then trying to update the ip_sum
without causing an exception on non-i386 hardware.

I've never been able to reproduce this problem, but it has been
reported by many people... besides, the code is now a bit cleaner.

Testing & patience by: Anthony Solovjoff <asolovjoff@hotmail.com>
1999-10-13 07:49:13 +00:00
brian
700dab7295 Revert the 1.44 -> 1.45 change. It doesn't work as expected. 1999-10-08 16:09:15 +00:00
brian
9348e209d6 Don't go from datalink state opening directly to lcp, go via
carrier instead so that we can set up our carrier detect
timer and eventually notice when we lose carrier.

Honour the script.run value when coming out of carrier state.

PR:	14145
1999-10-07 07:32:12 +00:00
brian
0ffffae973 Mention the received/expected magic for dodgy ECHO LQRs. 1999-10-06 23:22:54 +00:00
brian
76903a0107 Bring links down gently when their throughput isn't enough for
the ``set autoload'' value.  Don't just ``down'' the link.
Don't get stuck in ``ready'' the first time we ``close'' a link.
1999-10-05 05:01:44 +00:00