From ffed4c0be3569ea9c8901f66e67e289c11922692 Mon Sep 17 00:00:00 2001 From: Paul Mackerras Date: Wed, 30 Apr 1997 05:39:44 +0000 Subject: [PATCH] updates from Steve Perkins --- NeXT/INSTALL | 336 ++++++++++++++++++++++-------------- NeXT/Makefile | 54 +++--- NeXT/Makefile.top | 106 +++++------- NeXT/NeXT_Version | 6 +- NeXT/TODO.NeXT | 22 +-- NeXT/bsd-comp.c | 75 ++++---- NeXT/if_ppp.c | 427 ++++++++++++++++++++++++++++++---------------- NeXT/if_pppvar.h | 10 +- NeXT/inlines.h | 30 ++-- NeXT/nbq.h | 222 ++++++++++++++++++++++-- NeXT/ppp_tty.c | 374 +++++++++++++++++++++------------------- NeXT/vjcompress.c | 11 +- README.NeXT | 409 +++----------------------------------------- 13 files changed, 1064 insertions(+), 1018 deletions(-) diff --git a/NeXT/INSTALL b/NeXT/INSTALL index db657cb..d43f541 100644 --- a/NeXT/INSTALL +++ b/NeXT/INSTALL @@ -1,14 +1,31 @@ -Installation Instructions -========================= + PPP-2.3 for systems running NeXTSTEP + ==================================== + + +Authoritative information can be found at: + + WWW site: http://www.thoughtport.com:8080/PPP/ + FTP site: ftp://ftp.thoughtport.com/pub/next/ppp + Mirror FTP: ftp://ftp.duq.edu/pub/next/ppp/ + Mirror FTP: ftp://ftp.NMR.EMBL-Heidelberg.DE/pub/next/ppp/ + +If you have questions or problems, please visit the WWW site +for FAQ and mailing list information. -Files, information, and an FAQ are available from: - http://www.thoughtport.com:8080/PPP/ -Full source and an MAB installer package are available. If you don't -currently have access to a WWW viewer, you may get the files from -ftp.thoughtport.com (199.171.224.105) in the directory /pub/next/ppp/. +NEW: If you want to submit a bug report, use the new MailBug.app + provided in this directory. You will need to install it as + you would any package. If you don't have email access, please + use bug submission form on the WWW site. -If you have questions or problems, please mail -nextppp@listproc.thoughtport.com _before_ you go to usenet. +If you use this software and are pleased with its performance, you are +encouraged to make a donation to support continued development. 50% +of all donations go to charity. For more information, please see: + http://www.thoughtport.com:8080/PPP/donations.html + + + +NeXT Specific Installation Instructions +======================================= The procedure for an initial installation and for an upgrade are very similar. However, if this is the first time you are installing PPP, @@ -18,43 +35,50 @@ They will be described later in this document. Making the source files ========================= -To install on a NeXT: +To install on a computer running NeXTSTEP: 1) Read this file completely through before you start. 2) If you are on an HP-PA system, read the file ./NeXT/hppa/README.hppa and install the serial driver patch. Successfull installation of this - patch will require a reboot of your machine. + patch will require a reboot of your machine. HPPA + is not supported. 3) If you have previously installed a SLIP package, comment out the slip configuration code in /etc/rc.local and reboot your machine. SLIP and PPP _should_ interoperate but for initial testing it is best to remove SLIP. - 4) If you plan in using tcpdump to monitor packets, you must + 4) If you are using Intel, you _must_ get the latest NeXT serial + drivers from NeXTAnswers. You need both the serial and ttyport + drivers (version 3.33 or later). Install these according to + the directions. PPP-2.3 is optimized to work with + the NeXT drivers. It will work with the Mux driver, but + that driver has been known to cause panics with PPP. + + 5) If you plan in using tcpdump to monitor packets, you must enable the Berkley Packet Filter code. Edit ./NeXT/Makefile and make sure the '-DNBPFILTER' option is defined in DFLAGS. WARNING: If you choose to use BPF, you must make sure that you compile _AND LOAD_ the bpf_reloc LKS _BEFORE_ you load the - ppp_reloc LKS. See the ./NeXT/bpf directory for more information. + ppp_reloc LKS. Also, make sure you read the installation file in + ./NeXT/bpf. You will need to create a few special device files in + /dev/. If you don't want to compile in this code, please make sure that '-DBPFILTER' is _not_ defined in the ./NeXT/Makefile DFLAGS. - Also, make sure you read the installation file in ./NeXT/bpf. You - will need to create a few special device files in /dev/. - - 5) Type ./configure in the top level PPP directory. This will set + 6) Type ./configure in the top level PPP directory. This will set up some necessary links. - 6) If you have developer 3.2, you need to use the old version of + 7) If you have developer 3.2, you need to use the old version of chat.c. Perform: a) cd to the chat directory b) backup chat.c (mv chat.c chat.c.orig) c) use the old chat (mv chat.c.3.2 chat.c) - 7) Edit ./Makefile and set the installation directories. + 8) Edit ./Makefile and set the installation directories. If you change the ETCDIR you will need to modify pathnames in pppd/pathnames.h. I recommend keeping it set to /etc/ppp. If you don't specifically like that directory, you may @@ -62,13 +86,13 @@ To install on a NeXT: that points to the proper place. You will also want to set the -arch flags to the appropriate - architectures. - + architectures. Leaving it blank will default to your current + architecture. - 8) Do a: + 9) Do a: make - 9) If you are satisfied with the results, then as root, type: + 10) If you are satisfied with the results, then as root, type: make install @@ -80,6 +104,11 @@ to load the bpf_reloc LKS (if you enabled BPF support). You should be able to start the upgraded PPP just like normal. If this doesn't work, see the "Troubleshooting" section later on. +Also, you might want to compare the ip-up and ip-down scripts in +the ./NeXT/Examples directory with those you have installed in +/etc/ppp/ip-up and /etc/ppp/ip-down. Most things included in the +examples should be in any installation. + Extra Steps for Initial Configuration ===================================== @@ -128,11 +157,15 @@ if [ -f /usr/local/ppp/reloc/ppp_reloc ]; then fi ====================================================================== - This code will now be executed next time you reboot your - machine. You can verify that this was executed by checking - the output of /usr/adm/messages upon a successful reboot. There - should be a section of output that says the PPP-2.2 LKS was - successfully loaded. + If you choose not to use BPF, then comment out the first lines + of code by adding the '#' mark in front of them (similar to the + comment lines that are already in place). All three lines + (including the 'if' and 'fi') need to be commented. + + This code will now be executed next time you reboot your machine. + You can verify that this was executed by checking the output of + /usr/adm/messages upon a successful reboot. There should be a + section of output that says the PPP-2.2 LKS was successfully loaded. 2) The default Makefile paths place PPP files in a directory called @@ -154,12 +187,10 @@ fi ln -s /usr/local/ppp/bin/* /usr/local/bin ln -s /usr/local/ppp/man/man8/* /usr/local/man/man8 - Some or all of the 'mkdir' commands may fail if the directories - already exists. This is OK. Futher, to get the man program to - understand that you have added some pages to the /usr/local/man - directory, you need to make sure that the environment variable - MANPATH includes the /usr/local/man entry. In my .cshrc file - I have an entry that looks like: + To get the man program to understand that you have added some pages + to the /usr/local/man directory, you need to make sure that the + environment variable MANPATH includes the /usr/local/man entry. In + my .cshrc file (in my home directory) I have an entry that looks like: setenv MANPATH "/usr/local/man:/usr/man:.:.." See 'man man' for more information. @@ -223,14 +254,34 @@ mail.info /usr/spool/mqueue/syslog (remember to specify the 'debug' option to pppd to get reasonable information sent to the logging file). +4) You should copy a few files to a new directory. Part of the + installation process creates a new directory (or link) + called /etc/ppp/. Further, it creates an empty file called + /etc/ppp/options. An empty options file is the bare minimum of what + is necessary. However, the directory ./NeXT/Examples contains + several files that are useful in almost any setup. It is + recommended that you perform the following steps to place better + files in the directory /etc/ppp. As user root, perform the + following commands. It assumes you are in the PPP distribution + directory: + + cp NeXT/Examples/options /etc/ppp/options + cp NeXT/Examples/ip-up.example /etc/ppp/ip-up + cp NeXT/Examples/ip-down.example /etc/ppp/ip-down + /usr/etc/chown root.wheel /etc/ppp/options /etc/ppp/ip-up /etc/ppp/ip-down + chmod 644 /etc/ppp/options + chmod 511 /etc/ppp/ip-up /etc/ppp/ip-down + -4) If you have a standalone machine, it is necessary for you to make +5) If you have a standalone machine, it is necessary for you to make sure your system is configured to correctly support a network. The following steps will help in correctly configuring your machine. Please note, if you do not have a standalone machine (i.e. you are on a local network), you need to speak with your system administrator to determine the proper configuration for your - machine. The following only applies to standalone machines. + machine. In most cases, a machine correctly configured for a + network will not need to perform the steps listed here. The + following only applies to standalone machines. It is suggested that you reboot your machine _before_ you start these procedures. This is to verify that you successfully @@ -240,25 +291,6 @@ mail.info /usr/spool/mqueue/syslog failed. After successfully rebooting, you are ready to move on to these steps. - As root, make a backup copy of /etc/iftab. You might name it - /etc/iftab.prePPP. Then, modify this file by adding the line: - - lo0 inet 127.0.0.1 netmask 0xff000000 -trailers up - - right before the -1- entry that already exists in the file. The - finished file should look similar to (minus the ---- separators): - ---------------------------------------------------------------------- - - lo0 inet 127.0.0.1 netmask 0xff000000 -trailers up - -1- inet -HOSTCONFIG- - * inet -AUTOMATIC- netmask -AUTOMATIC- -trailers up - - ---------------------------------------------------------------------- - Please note that the file probably has a bunch of comments - at the top (lines that start with #). I left those out in the - example above so I could save space. They of course, can remain - in your copy. - As root, make a backup copy of /etc/hostconfig. You might name it /etc/hostconfig.prePPP. If, after the following steps, you run into problems booting your machine, you may replace @@ -281,9 +313,13 @@ mail.info /usr/spool/mqueue/syslog For "NIS Domain Name", select "None" For "Internet Address", use the provided IP address - (probably 127.0.0.1) unless your system administrator has + (probably 192.42.172.1) unless your system administrator has assigned you your own unique IP address. In this case, - reverify that you are a standalone machine. + reverify that you are a standalone machine. Please + note... if your PPP service provider has assigned you an + IP address, do _NOT_ use that address here. That address + will be used later. Use whatever address is already in + the display. For "Broadcast Address", select "Default" @@ -306,7 +342,6 @@ mail.info /usr/spool/mqueue/syslog to make. Your network administrator will be able to provide you with the correct details for your particular site. - Congratulations! You have successfully installed PPP and are now ready to start up a connection. See the section "Initial Testing" for steps to verify that PPP works on your system. @@ -338,13 +373,10 @@ perform. Once you _know_ ppp works, you can spend time on the dial scripts. Please note, you _must_ exit from your communications program before -you start your local pppd. For example if you are in kermit and you -start the peer pppd process by hand, you must completely exit kermit -before you start pppd. If you don't, the connection will not form. -Further, if you find that when you exit, your modem immediately hangs -up, you need to instruct the modem to ignore DTR. There is an AT -command that will do this (AT&D on Supra), but you will need to check -your modem manual to determine the correct command. +you start your local pppd. If you find that when you exit, your modem +immediately hangs up, you need to instruct the modem to ignore DTR. +There is an AT command that will do this (AT&D on Supra), but you will +need to check your modem manual to determine the correct command. If you are planning on using kermit, Stephane I. Matis , has supplied this excellent definition @@ -357,11 +389,12 @@ define pppd - !pppd < \v(line) > \v(line) defaultroute ---------------------------------------------------------------------- -To use this, add the above to your ~/.kermrc file (minus the '---...---' -separators). Then start kermit. After you have started the remote PPP -server by hand, return back to your local kermit prompt and execute -the command 'do pppd'. In this particular circumstance, you will not -need to exit from kermit. +To use this, add the above to your ~/.kermrc file (minus the +'---...---' separators). Then start kermit. After you have started +the remote PPP server by hand and you see garbage being printed on the +screen, return back to your local kermit prompt and execute the +command 'do pppd'. In this particular circumstance, you will not need +to exit completely from kermit. Before you start initial testing, you may want to read the pppd man page. This will allow you to familiarize yourself with the some of @@ -404,15 +437,16 @@ established. I will go through some of them. is an example of what you might see: Routing tables - Destination Gateway Flags Refs Use Interface - 127.0.0.1 127.0.0.1 UH 2 558 lo0 - 35.9.10.14 35.9.12.104 UH 0 0 ppp0 - default 35.9.10.14 UG 2 25 ppp0 - 192.42.172 192.42.172.1 U 6 1939 en0 + Destination Gateway Flags Refs Use Interface + 35.9.10.32 35.9.15.107 UH 0 0 ppp0 + 127.0.0.1 127.0.0.1 UH 12 2636 lo0 + 35.9.15.107 127.0.0.1 UH 0 0 lo0 + default 35.9.10.32 UG 2 6 ppp0 + 192.42.172 192.42.172.1 U 15 8872 en0 - In the above case, the peer is 35.9.10.14 and my local machine has - been assigned 35.9.12.104. All foreign traffic goes through the + In the above case, the peer is 35.9.10.32 and my local machine has + been assigned 35.9.15.107. All foreign traffic goes through the default route to the peer. If you don't have an ethernet card installed on your system, you @@ -433,7 +467,11 @@ PPP will negotiate the address with the peer. This is the preferred mechanism of operation. Probably the only time you should specify an IP address as an argument to pppd is if you are assigned your own IP address by your system administrator. Otherwise, sit back and let PPP -do the work for you. +do the work for you. If you are assigned an address by your PPP +provider, that address does _NOT_ go in the hostconfig.app or netinfo. +Instead, you provide that IP address as a command line option to pppd +when you start it up. See the pppd man page for details on specifying +a fixed IP address. A Typical PPP Session @@ -456,10 +494,11 @@ point, ppp will terminate the phone connection and pppd will die off. You may start and kill the ppp session as many times as you like while you are logged on. However, if you do not kill the PPP session, it -will not die once you log out. Thus your telephone will remain off -the hook and your computer will remain connected to the net until you -log back in and shut down the connection. Turning off the computer -will obviously close the connection. +will not die once you log out (unless you use the idle timer option to +pppd). Thus your telephone will remain off the hook and your computer +will remain connected to the net until you log back in and shut down +the connection. Turning off the computer will obviously close the +connection. Name Resolution @@ -561,57 +600,82 @@ place it in the /etc/ppp/options file). Troubleshooting =============== -The NeXT port of ppp-2.2 is stable. However, the PD ppp-2.2 is -considered to be in alpha release. If you have problem, please mail -me before you go to usenet. I'm especially -interested in hearing your suggestions and comments about the package -and related documentation. - -Any time that you have a bug report to send, please include your +Any time that you have a bug report, please use the included +MailBug.app (in the NeXT directory) to submit an electronic report. +If you don't have email capability, please see the WWW site and use +the bug report form found there. Please remember to include your hardware type and the LKS version number in all reports. This number may be found in the file /usr/adm/messages (once the LKS has been installed). Also, for most questions, it is best to append a copy of the /usr/adm/ppp2.2.log file. -There are some common problems that people have. I have listed them -here: +If you do have troubles, please see the FAQ on: + http://www.thoughtport.com:8080/PPP/ + +Here are a few of the more common problems that this FAQ addresses: + ====================================================================== 1) pppd bombs out with an error similar to: Jan 26 14:46:25 localhost pppd[256]: Connected... Jan 26 14:46:26 localhost pppd[256]: ioctl(PPPIOCGUNIT): Inappropriate ioctl for device Jan 26 14:46:26 localhost pppd[256]: Exit. -This is typically the result of using the wrong LKS with pppd. Some -versions of PPP installed the LKS (ppp_reloc) in +There are two things that can cause this error. The most common error +is that you are using the innappropriate device for communication to +your modem. You should be using /dev/cufa or /dev/cufb. Second, the +Loadable Kernel Server (LKS) and the user level daemon (pppd) must be +of the same version. While unusual, the error above can be the result +of using the wrong Loadable Kernel Server (LKS) with pppd (or vice +versa). Some versions of PPP installed the LKS (ppp_reloc) in /usr/lib/kern_loader/ppp and some in /usr/local/ppp/reloc. The second -is going to be the standard place for installation from now on. Make -sure that your /etc/rc.local is loading the correct version of the LKS -and make sure you are really calling the correct pppd for use with the -LKS that you loaded. +is going to be the standard place for installation from now on. +Solution: Make sure that you are using the appropriate device for +communications with your modem. Further, make sure that your +/etc/rc.local is loading the correct version of the LKS and make sure +you are really calling the correct pppd for use with the LKS that you +loaded. ====================================================================== 2) PPP works fine, but when the link is up, netinfo sleeps when you try to print or send mail. -You'll see this problem if you don't have a route from your "hostname" -to localhost. In essence, your host doesn't know how to "get back to -itself". My guess is that you didn't follow the installation -instructions and you chose an IP address different than 127.0.0.1. -There is a fix! ;) Do this in your rc.local: +This problem is typically a result of an improper routing setup on the +PPP client (your host). When PPP starts up, it will dynamically +negotiate an IP address for use on the PPP interface (usually ppp0). +If you don't specify an IP address to pppd, then the address will +usually be provided by the peer. It may change each time that you +bring up a PPP link. If you did specify an IP address, pppd will +attempt to use that address first. If that fails, it will try to get +an address from the peer. Either way, the PPP interface usually has a +new IP address. The routing problem can result when trying to access +your local host (and netinfo) on the IP address that was dynamically +negotiated. + +Solution: The solution is straightforward. You must add a route from +the IP address that your PPP interface uses to the special loopback IP +address 127.0.0.1. The 'route' command will allow you to do this. +For instance, if you are assigned the address 35.8.74.211 during PPP +negotiation, you can add the needed route byentering (as the user +root): + + /usr/etc/route add 35.8.74.211 127.0.0.1 0 + +This route needs to be added each time the link comes up. However, +one problem with hard coding this command into /etc/ppp/ip-up is that +you may get a different IP address each time the link comes +up. Fortunately, Bill Bereza submitted +this nice script clip that can be pasted into /etc/ppp/ip-up. This +will create the correct route entry for you automatically. Place this +in /etc/ppp/ip-up: -route add your_host_name localhost 0 + /usr/etc/route add $4 127.0.0.1 0 -(with the appropriate substitution of your_host_name) Without it, -netinfo will sleep when trying to connect to the local domain. You -will need to reboot or perform this command manually (as root) for it -to take affect. +You will also want to add this little clip to /etc/ppp/ip-down:
-Many thanks to: - Scott Bender - Pete French - Terence Parr -for help on this one. + /usr/etc/route delete $4 127.0.0.1 + +This removes the route when your link goes down. ====================================================================== @@ -622,8 +686,7 @@ for help on this one. Check out the 'proxyarp' option to pppd. Servers (connected to their LAN) must proxyarp for the remote address (i.e. the address of the -machine dialing in). Further, read the file ./NeXT/README.NeXT (not -this file) for more information on proxyarp. +machine dialing in). ====================================================================== @@ -646,24 +709,26 @@ this file) for more information on proxyarp. Mar 13 12:03:12 crystal pppd[243]: Serial link is not 8-bit clean: Mar 13 12:03:12 crystal pppd[243]: All received characters had bit 7 set to 0 -This is a common problem. It is typically the result of a failure to -properly start the remote PPP process. Make sure you add the '-v' -option to chat (in your dial script) and then check the output of -/usr/adm/ppp2.2.log to see why chat failed to start the remote PPP -process. +Discussion: This is a common problem. It is typically the result of a +failure to properly start the remote PPP process. The problem arises +since the local PPP starts sending packets as soon as chat +exits. Since there is no remote PPP process running to interpret the +packets, the remote command line interpreter starts sending error +messages for each received packet (considered garbage to the remote +CLI). Thus, your local PPP process is receiveing error message text +instead of the expected PPP packets. Since error message text is +usually ascii (values < 127) PPP believes that the link is not 8-bit +clean. + +Solution: Make sure you add the '-v' option to chat (in your dial +script) and then check the output of /usr/adm/ppp2.2.log to see why +chat failed to start the remote PPP process. -====================================================================== -5) Your LCP sessions get into an infinite loop while trying to - negotiate the magic numer. Alternately, every LCP echo you send - is accompanied with a message saying that "our own echo reply was - received". I'm not sure why some systems have this trouble, but - the solution is to turn off magic number negotiation at your end. - Add the '-mn' flag to pppd. ====================================================================== -6) NXHosting applications over PPP fails. I don't know why this +5) NXHosting applications over PPP fails. I don't know why this happens. Rest assured, that I and others do have it working. The most obvious things to check are that you have your system set up as a public window server. Also, make sure that you reset the @@ -677,7 +742,7 @@ process. Updates ======= -You may also want to join the mailing list for PPP. This will keep +You may want to join the mailing list for PPP. This will keep you informed of new releases and will provide an arena for discussing problems with the NeXT specific PPP port. To add yourself to the list (or for any other administrative requests), send an email message to: @@ -702,7 +767,6 @@ note that the pppd file is installed suid root. This is a potential security hazard. - Noted bugs ========== @@ -728,3 +792,17 @@ dropped, the modem will disconnect. On my modem the command is dialins, you must read your modem manual to determine the correct setting. + +Obtaining the Software by Electronic Mail +----------------------------------------- + +Do not send me requests for the software; they will be ignored +(without response). If you cannot use FTP at all, there is a service +called "ftpmail" available from decwrl.dec.com: you can send e-mail to +this machine and it will use FTP to retrieve files for you and send +you the files back again via e-mail. To find out more about the +ftpmail service, send a message to "ftpmail@decwrl.dec.com" whose body +consists of the single line "help". + + +Thanks Stephen J. Perkins diff --git a/NeXT/Makefile b/NeXT/Makefile index 243e816..f3be5f6 100755 --- a/NeXT/Makefile +++ b/NeXT/Makefile @@ -1,52 +1,63 @@ # # Makefile for NeXT OS 3.2 # -# $Id: Makefile,v 1.1 1995/12/18 03:29:50 paulus Exp $ +# $Id: Makefile,v 1.2 1997/04/30 05:39:28 paulus Exp $ # -#ARCHFLAGS = -arch i386 -arch m68k -arch hppa -arch sparc #ARCHFLAGS = -arch i386 -arch m68k -#ARCHFLAGS = -arch i386 -ARCHFLAGS = +ARCHFLAGS = BINDIR = /usr/local/ppp/bin MANDIR = /usr/local/ppp/man -ETCDIR = /etc/ppp +ETCDIR = /usr/local/ppp/etc + # # If you change this pathname, you must also change the path # in and rc.local (or rc.ppp). # LKS_DIR=/usr/local/ppp/reloc -IFLAGS = -I. -I.. -I../pppd - # # NUM_PPP=x The number of ppp interfaces you want to create +# # VJC If defined, enables VJ header compression +# # PPP_COMPRESS If defined, enables BSD packet compression +# # HAS_BROKEN_TIOCSPGRP Fixes broken IOCTL with NeXT serial drivers -# ADD_ERRORS If defined adds pseudo-random errors to packets. -# (Only really used for robustness testing.) +# # OLD_MUX Fixes double buffer problem with the MuX serial # driver. +# # NBPFILTER If defined, adds hooks for the Berkley Packet Filter # If this symbol is defined, you must load the # bpf_reloc LKS _BEFORE_ you load the ppp_reloc LKS. # See the ./bpf directory for more information. # +# NETBUF_PROXY Enable proxy routines for custom Netbuf handling +# +# CHECK_BOUNDS Turn on bounds checking on netbufs. NETBUF_PROXY +# must be enabled for this to work. +# # OPTIMIZE_PPPREND Enable an optimization supported by the NeXT serial # drivers. Basically they buffer characters for an # interrupt and call ppprend. +# +# NEW_CLOCAL Used to enable the new code that sets CLOCAL. Else, +# the old code is used. +# +# +# -DFLAGS = -DINET -DKERNEL -DMACH -DNBPFILTER \ +DFLAGS = -DINET -DKERNEL -DMACH -DPOSIX_KERN \ -DNUM_PPP=2 -DVJC -DPPP_COMPRESS \ - -DDEBUG -DHAS_BROKEN_TIOCSPGRP -DOLD_MUX \ - -DOPTIMIZE_PPPREND + -DDEBUG -DNEW_CLOCAL -DNBPFILTER -DOPTIMIZE_PPPREND +IFLAGS = -I. -I.. -I../pppd -CFLAGS = -O $(ARCHFLAGS) $(DFLAGS) $(IFLAGS) +CFLAGS = -pipe -posix $(ARCHFLAGS) $(DFLAGS) $(IFLAGS) -OBJS = bsd-comp.o if_ppp.o ppp_tty.o vjcompress.o random.o +OBJS = bsd-comp.o if_ppp.o nbq.o ppp_tty.o vjcompress.o SRCS = $(OBJS:.o=.c) @@ -59,6 +70,7 @@ all: ppp_reloc install: all /bin/mkdirs $(ETCDIR) $(LKS_DIR) + if (test ! -r /etc/ppp) then (ln -s $(ETCDIR) /etc/ppp) fi install -c -m 644 -o root -g daemon ppp_reloc $(LKS_DIR) touch $(ETCDIR)/options cd bpf; $(MAKE) ARCHFLAGS="$(ARCHFLAGS)" install @@ -68,18 +80,8 @@ ppp_reloc: $(OBJS) Load_Commands.sect Unload_Commands.sect -i instance -o $@ $(OBJS) clean: - rm -f ppp_reloc ppp_loadable core make $(OBJS) *~ #* .depend + rm -f ppp_reloc ppp_loadable core make $(OBJS) *~ cd bpf; $(MAKE) clean -depend: - cc -M $(CFLAGS) $(SRCS) >.depend - -$(SRCS): if_pppvar.h nbq.h inlines.h - -#.depend: $(SRCS) $(PPPSTATSRCS) -# cc -M $(CFLAGS) $(SRCS) >.depend -# @echo Check dependencies if needed - -FORCE: -#include .depend +$(SRCS): if_pppvar.h nbq.h inlines.h Makefile diff --git a/NeXT/Makefile.top b/NeXT/Makefile.top index c281bc3..e833fdf 100644 --- a/NeXT/Makefile.top +++ b/NeXT/Makefile.top @@ -1,15 +1,15 @@ # ppp top level makefile for NeXT systems # -# $Id: Makefile.top,v 1.1 1995/12/18 03:29:52 paulus Exp $ +# $Id: Makefile.top,v 1.2 1997/04/30 05:39:28 paulus Exp $ # BINDIR = /usr/local/ppp/bin MANDIR = /usr/local/ppp/man ETCDIR = /etc/ppp + #ARCHFLAGS = -arch i386 -arch m68k -arch hppa -arch sparc #ARCHFLAGS = -arch i386 -arch m68k -#ARCHFLAGS = -arch i386 ARCHFLAGS = all: @@ -38,32 +38,21 @@ clean: NEXTTOP = \ - README.NeXT \ + README.NeXT \ ${NULL} NEXTPPPD = \ pppd/Makefile.NeXT \ - pppd/ipcp.c \ - pppd/ipcp.h \ - pppd/options.c \ pppd/sys-NeXT.c \ ${NULL} NEXTNET = \ - ${NULL} - - -# -# Currently not supported -# -NEXTPPPEXC = \ - pppexclude/Makefile.NeXT \ - pppexclude/pppipexclude.8 \ - pppexclude/pppipexclude.c \ + net/if_ppp.h \ ${NULL} NEXTSTATS = \ pppstats/Makefile.NeXT \ + pppstats/pppstats.c \ ${NULL} NEXTCHAT = \ @@ -72,24 +61,24 @@ NEXTCHAT = \ ${NULL} NEXTLKS = \ + NeXT/ChangeLog.rtf \ NeXT/INSTALL \ NeXT/Load_Commands.sect \ + NeXT/MailBug.app.tar.gz \ NeXT/Makefile \ NeXT/Makefile.top \ NeXT/NeXT_Version \ - NeXT/README.NeXT \ NeXT/TODO.NeXT \ NeXT/Unload_Commands.sect \ - NeXT/bsd-comp.c \ + NeXT/bsd-comp.c \ NeXT/if_ppp.c \ NeXT/if_pppvar.h \ NeXT/inlines.h \ NeXT/linedisc.h \ + NeXT/nbq.c \ NeXT/nbq.h \ NeXT/netbuf.h \ NeXT/ppp_tty.c \ - NeXT/random.c \ - NeXT/random.h \ NeXT/spl.h \ NeXT/vjcompress.c \ ${NULL} @@ -97,55 +86,53 @@ NEXTLKS = \ NEXTHPPA = \ NeXT/hppa/README.hppa \ NeXT/hppa/hppaSerialPatch.tar.gz \ - $(NULL} + ${NULL} NEXTMACH = \ NeXT/mach/features.h \ - $(NULL} + ${NULL} NEXTBPF = \ - NeXT/bpf/Load_Commands.sect \ - NeXT/bpf/Makefile \ - NeXT/bpf/NeXT_Support.c \ - NeXT/bpf/README.NeXT \ - NeXT/bpf/Unload_Commands.sect \ - NeXT/bpf/bpf.4 \ - NeXT/bpf/bpf.c \ - NeXT/bpf/bpf.h \ - NeXT/bpf/bpf_compat.h \ - NeXT/bpf/bpf_filter.c \ - NeXT/bpf/bpfdesc.h \ - NeXT/bpf/netbuf.h \ - NeXT/bpf/promisc.c \ - NeXT/bpf/spl.h \ + NeXT/bpf/Load_Commands.sect \ + NeXT/bpf/Makefile \ + NeXT/bpf/NeXT_Support.c \ + NeXT/bpf/README.NeXT \ + NeXT/bpf/Unload_Commands.sect \ + NeXT/bpf/bpf.4 \ + NeXT/bpf/bpf.c \ + NeXT/bpf/bpf.h \ + NeXT/bpf/bpf_compat.h \ + NeXT/bpf/bpf_filter.c \ + NeXT/bpf/bpfdesc.h \ + NeXT/bpf/netbuf.h \ + NeXT/bpf/promisc.c \ + NeXT/bpf/spl.h \ ${NULL} NEXTEXAMP = \ - Examples/NXHosting_with_PPP \ - Examples/Persistent_Connection \ - Examples/README \ - Examples/flow-control-hints \ - Examples/ip-down.example \ - Examples/ip-up.example \ - Examples/options \ - Examples/pdial \ - Examples/ppp_multiple_hosts.tar.gz \ - Examples/pppdown \ - Examples/pppkill.c \ - Examples/pppup.annex \ - Examples/pppup.direct \ - Examples/pppup.portmaster \ - Examples/pppup.remote \ - Examples/pppup.zyxel \ - Examples/rc.ppp \ - Examples/redial.sh \ + NeXT/Examples/Persistent_Connection \ + NeXT/Examples/README \ + NeXT/Examples/flow-control-hints \ + NeXT/Examples/ip-down.example \ + NeXT/Examples/ip-up.example \ + NeXT/Examples/options \ + NeXT/Examples/ppp_multiple_hosts.tar.gz \ + NeXT/Examples/pppdown \ + NeXT/Examples/pppkill.c \ + NeXT/Examples/pppup.annex \ + NeXT/Examples/pppup.direct \ + NeXT/Examples/pppup.portmaster \ + NeXT/Examples/pppup.remote \ + NeXT/Examples/pppup.zyxel \ + NeXT/Examples/rc.ppp \ + NeXT/Examples/redial.sh \ ${NULL} - NEXTPORT = \ ${NEXTTOP} \ ${NEXTPPPD} \ + ${NEXTNET} \ ${NEXTSTATS} \ ${NEXTCHAT} \ ${NEXTLKS} \ @@ -167,29 +154,30 @@ NEXTPORT = \ # the archive. # - portdist: - echo NeXT-ppp2.2-`sed -e '/version_string/!d' \ + echo NeXT-ppp2.3-`sed -e '/version_string/!d' \ -e 's/[^0-9.]*\([0-9.]*\).*/\1/' -e q ./NeXT/NeXT_Version` > .fname rm -rf `cat .fname` mkdir `cat .fname` mkdir `cat .fname`/pppd + mkdir `cat .fname`/net mkdir `cat .fname`/chat mkdir `cat .fname`/NeXT mkdir `cat .fname`/NeXT/hppa mkdir `cat .fname`/NeXT/mach mkdir `cat .fname`/NeXT/bpf + mkdir `cat .fname`/NeXT/Examples mkdir `cat .fname`/pppstats - mkdir `cat .fname`/Examples -ln $(NEXTTOP) `cat .fname` -ln $(NEXTPPPD) `cat .fname`/pppd + -ln $(NEXTNET) `cat .fname`/net -ln $(NEXTCHAT) `cat .fname`/chat -ln $(NEXTLKS) `cat .fname`/NeXT -ln $(NEXTHPPA) `cat .fname`/NeXT/hppa -ln $(NEXTMACH) `cat .fname`/NeXT/mach -ln $(NEXTBPF) `cat .fname`/NeXT/bpf + -ln $(NEXTEXAMP) `cat .fname`/NeXT/Examples -ln $(NEXTSTATS) `cat .fname`/pppstats - -ln $(NEXTEXAMP) `cat .fname`/Examples for file in $(NEXTPORT); do \ test -r `cat .fname`/$$file || cp -p $$file `cat .fname`; \ done diff --git a/NeXT/NeXT_Version b/NeXT/NeXT_Version index a137f36..4b23fed 100644 --- a/NeXT/NeXT_Version +++ b/NeXT/NeXT_Version @@ -1,6 +1,6 @@ # -# ppp-2.2 port to the NeXT -# version_string 0.4.6 +# ppp-2.3 port to the NeXT +# version_string 0.5.0 # -# $Id: NeXT_Version,v 1.1 1995/12/18 03:29:53 paulus Exp $ +# $Id: NeXT_Version,v 1.2 1997/04/30 05:39:29 paulus Exp $ # diff --git a/NeXT/TODO.NeXT b/NeXT/TODO.NeXT index 20c7780..fc0c1a9 100644 --- a/NeXT/TODO.NeXT +++ b/NeXT/TODO.NeXT @@ -1,9 +1,7 @@ # -# $Id: TODO.NeXT,v 1.1 1995/12/18 03:29:55 paulus Exp $ +# $Id: TODO.NeXT,v 1.2 1997/04/30 05:39:29 paulus Exp $ # -* FAQ on IPCP failure because of AUTH - * FAQ on shell chat scripts and special characters * Add /dev/bpf* in installation docs @@ -21,22 +19,16 @@ * Better Load support for BPF. Figure out how to support NeXT (moto) with driverkit stuff. -* Verify 1500 minimum - -* Limit resources for runaway UDP. - -* Better support for getting/releasing netbufs. - -* >Jan 10 21:41:46 beatty pppd[1427]: rcvd [IPCP ConfNak id=0x1 ] - -* Break up installer into Smaller packages - * Fix with VirtModem * If the dialing program fails to get a line, but returns success, then ppp will report that it could not determine the ip address, and not notice the "received own echo reply" condition. -* Look into stack overflow as cause of kernel panics. - * Use kget inside interrupt handler. + +Look at NAT:There *is* a way to get multiple machines on a network to use + one IP address. RFC 1631 -- The IP Network Address Translator + (NAT) describes how this works. + http://www.mischler.com + http://willow.canberra.edu.au/~chrisc/nat.html \ No newline at end of file diff --git a/NeXT/bsd-comp.c b/NeXT/bsd-comp.c index 02dc20c..a77c450 100644 --- a/NeXT/bsd-comp.c +++ b/NeXT/bsd-comp.c @@ -49,9 +49,10 @@ /* * This version is for use with mbufs on BSD-derived systems. * - * $Id: bsd-comp.c,v 1.3 1996/09/14 05:08:26 paulus Exp $ + * $Id: bsd-comp.c,v 1.4 1997/04/30 05:39:29 paulus Exp $ */ +#include #include #include #include @@ -63,10 +64,11 @@ #include #include -#define PACKETPTR netbuf_t +#include "nbq.h" + +#define PACKETPTR NETBUF_T #include -#include "nbq.h" /* * We align with this number of bits zero. The code makes the somewhat @@ -90,7 +92,7 @@ #include #include -#define mtod(m,type) ((type)nb_map(m)) +#define mtod(m,type) ((type)NB_MAP(m)) typedef unsigned short u_int16_t; /* @@ -175,10 +177,10 @@ static int bsd_comp_init __P((void *state, u_char *options, int opt_len, int unit, int hdrlen, int debug)); static int bsd_decomp_init __P((void *state, u_char *options, int opt_len, int unit, int hdrlen, int mru, int debug)); -static int bsd_compress __P((void *state, netbuf_t *mret, - netbuf_t mp, int slen, int maxolen)); -static void bsd_incomp __P((void *state, netbuf_t dmsg)); -static int bsd_decompress __P((void *state, netbuf_t cmp, netbuf_t *dmpp)); +static int bsd_compress __P((void *state, NETBUF_T *mret, + NETBUF_T mp, int slen, int maxolen)); +static void bsd_incomp __P((void *state, NETBUF_T dmsg)); +static int bsd_decompress __P((void *state, NETBUF_T cmp, NETBUF_T *dmpp)); static void bsd_reset __P((void *state)); static void bsd_comp_stats __P((void *state, struct compstat *stats)); @@ -245,6 +247,7 @@ bsd_clear(db) db->ratio = 0; db->bytes_out = 0; db->in_count = 0; + db->incomp_count = 0; db->checkpoint = CHECK_GAP; } @@ -267,7 +270,9 @@ bsd_check(db) { u_int new_ratio; - if (db->in_count >= db->checkpoint) { + if (db->in_count >= db->checkpoint) + { + /* age the ratio by limiting the size of the counts */ if (db->in_count >= RATIO_MAX || db->bytes_out >= RATIO_MAX) { @@ -289,10 +294,11 @@ bsd_check(db) if (db->bytes_out != 0) new_ratio /= db->bytes_out; - if (new_ratio < db->ratio || new_ratio < 1 * RATIO_SCALE) { + if (new_ratio < db->ratio || new_ratio < 1 * RATIO_SCALE) + { bsd_clear(db); return 1; - } + } db->ratio = new_ratio; } } @@ -518,8 +524,8 @@ bsd_decomp_init(state, options, opt_len, unit, hdrlen, mru, debug) int /* new slen */ bsd_compress(state, mret, mp, slen, maxolen) void *state; - netbuf_t *mret; /* return compressed netbuf here */ - netbuf_t mp; /* from here */ + NETBUF_T *mret; /* return compressed netbuf here */ + NETBUF_T mp; /* from here */ int slen; /* uncompressed length */ int maxolen; /* max compressed length */ { @@ -535,7 +541,7 @@ bsd_compress(state, mret, mp, slen, maxolen) u_char *rptr, *wptr; u_char *cp_end; int olen; - netbuf_t m; + NETBUF_T m; #define PUTBYTE(v) { \ ++olen; \ @@ -574,12 +580,12 @@ bsd_compress(state, mret, mp, slen, maxolen) maxolen = slen; /* Allocate one mbuf to start with. (don't forget space for the FCS!) */ - m = ppp_nb_alloc(maxolen + db->hdrlen + PPP_FCSLEN); + m = NB_ALLOC(maxolen + db->hdrlen + PPP_FCSLEN); *mret = m; if (m != NULL) { if (db->hdrlen > 0) - ppp_nb_shrink_top(m, db->hdrlen); - nb_shrink_bot(m, PPP_FCSLEN); /* grown by pppstart() */ + NB_SHRINK_TOP(m, db->hdrlen); + NB_SHRINK_BOT(m, PPP_FCSLEN); /* grown by pppstart() */ wptr = mtod(m, u_char *); cp_end = wptr + maxolen; } else @@ -601,7 +607,7 @@ bsd_compress(state, mret, mp, slen, maxolen) olen = 0; rptr += PPP_HDRLEN; - slen = nb_size(mp) - PPP_HDRLEN; + slen = NB_SIZE(mp) - PPP_HDRLEN; ilen = slen + 1; while (slen > 0) { slen--; @@ -684,13 +690,13 @@ bsd_compress(state, mret, mp, slen, maxolen) if (olen + PPP_HDRLEN + BSD_OVHD > maxolen || wptr == NULL) { /* throw away the compressed stuff if it is longer than uncompressed */ if (*mret != NULL) { - nb_free(*mret); + NB_FREE(*mret); *mret = NULL; } ++db->incomp_count; db->incomp_bytes += ilen; } else { - nb_shrink_bot(m, nb_size(m) - (wptr - mtod(m, u_char *))); + NB_SHRINK_BOT(m, NB_SIZE(m) - (wptr - mtod(m, u_char *))); ++db->comp_count; db->comp_bytes += olen + BSD_OVHD; } @@ -708,7 +714,7 @@ bsd_compress(state, mret, mp, slen, maxolen) static void bsd_incomp(state, dmsg) void *state; - netbuf_t dmsg; + NETBUF_T dmsg; { struct bsd_db *db = (struct bsd_db *) state; u_int hshift = db->hshift; @@ -733,10 +739,11 @@ bsd_incomp(state, dmsg) if (ent < CI_BSD_COMPRESS || ent > 0xf9) return; + db->incomp_count++; db->seqno++; ilen = 1; /* count the protocol as 1 byte */ rptr += PPP_HDRLEN; - slen = nb_size(dmsg) - PPP_HDRLEN; + slen = NB_SIZE(dmsg) - PPP_HDRLEN; ilen += slen; do { @@ -828,7 +835,7 @@ bsd_incomp(state, dmsg) int bsd_decompress(state, cmp, dmpp) void *state; - netbuf_t cmp, *dmpp; + NETBUF_T cmp, *dmpp; { struct bsd_db *db = (struct bsd_db *) state; u_int max_ent = db->max_ent; @@ -840,7 +847,7 @@ bsd_decompress(state, cmp, dmpp) int explen, seq, len; u_int incode, oldcode, finchar; u_char *p, *rptr, *wptr; - netbuf_t dmp, mret; + NETBUF_T dmp, mret; int adrs, ctrl, ilen; int space, codelen, extra, maxilen; @@ -853,7 +860,7 @@ bsd_decompress(state, cmp, dmpp) adrs = PPP_ADDRESS(rptr); ctrl = PPP_CONTROL(rptr); rptr += PPP_HDRLEN; - len = nb_size(cmp) - PPP_HDRLEN; + len = NB_SIZE(cmp) - PPP_HDRLEN; seq = (rptr[0] << 8) + rptr[1]; rptr += BSD_OVHD; len -= BSD_OVHD; @@ -873,14 +880,14 @@ bsd_decompress(state, cmp, dmpp) * Allocate an netbuf large enough for all the data. */ maxilen = db->mru + db->hdrlen + PPP_HDRLEN; /* no FCS */ - dmp = ppp_nb_alloc(maxilen); /* XXX */ + dmp = NB_ALLOC(maxilen); /* XXX */ if (dmp == NULL) return DECOMP_ERROR; if (db->hdrlen > 0) - ppp_nb_shrink_top(dmp, db->hdrlen); + NB_SHRINK_TOP(dmp, db->hdrlen); mret = dmp; wptr = mtod(dmp, u_char *); - space = nb_size(dmp) - PPP_HDRLEN + 1; + space = NB_SIZE(dmp) - PPP_HDRLEN + 1; /* * Fill in the ppp header, but not the last byte of the protocol @@ -916,7 +923,7 @@ bsd_decompress(state, cmp, dmpp) * empty mbuf at the end. */ if (len > 0) { - nb_free(mret); + NB_FREE(mret); IOLogDbg("bsd_decomp%d: bad CLEAR\n", db->unit); return DECOMP_FATALERROR; /* probably a bug */ } @@ -927,7 +934,7 @@ bsd_decompress(state, cmp, dmpp) if (incode > max_ent + 2 || incode > db->maxmaxcode || incode > max_ent && oldcode == CLEAR) { - nb_free(mret); + NB_FREE(mret); IOLogDbg("bsd_decomp%d: bad code 0x%x oldcode=0x%x max_ent=0x%x explen=%d seqno=%d\n", db->unit, incode, oldcode, max_ent, explen, db->seqno); return DECOMP_FATALERROR; /* probably a bug */ @@ -945,7 +952,7 @@ bsd_decompress(state, cmp, dmpp) codelen = db->lens[finchar]; explen += codelen + extra; if (explen > db->mru + 1) { - nb_free(mret); + NB_FREE(mret); IOLogDbg("bsd_decomp%d: ran out of mru\n len=%d, finchar=0x%x, codelen=%d, explen=%d\n", db->unit, len, finchar, codelen, explen); return DECOMP_FATALERROR; @@ -957,7 +964,7 @@ bsd_decompress(state, cmp, dmpp) if ((space -= codelen + extra) < 0) { IOLog("bsd_decompress%d: no space left in netbuf (need %d bytes)\n", db->unit, (codelen + extra) - space); - nb_free(mret); + NB_FREE(mret); return DECOMP_ERROR; } @@ -1035,7 +1042,7 @@ bsd_decompress(state, cmp, dmpp) } oldcode = incode; } - nb_shrink_bot(dmp, nb_size(dmp) - (wptr - mtod(dmp, u_char *))); + NB_SHRINK_BOT(dmp, NB_SIZE(dmp) - (wptr - mtod(dmp, u_char *))); /* * Keep the checkpoint right so that incompressible packets @@ -1066,7 +1073,7 @@ bsd_decompress(state, cmp, dmpp) db->unit, incode, finchar, oldcode, db->dict[finchar].cptr, dictp->codem1); } - nb_free(mret); + NB_FREE(mret); return DECOMP_FATALERROR; #endif /* DEBUG */ } diff --git a/NeXT/if_ppp.c b/NeXT/if_ppp.c index 54cabda..3f3e2c9 100644 --- a/NeXT/if_ppp.c +++ b/NeXT/if_ppp.c @@ -81,7 +81,7 @@ /* from if_sl.c,v 1.11 84/10/04 12:54:47 rick Exp */ #if !defined(lint) -static char sccsid[] = "$Revision: 1.1 $ ($Date: 1995/12/18 03:30:02 $)"; +static char sccsid[] = "$Revision: 1.2 $ ($Date: 1997/04/30 05:39:30 $)"; #endif /* not lint*/ #define KERNEL 1 @@ -90,6 +90,7 @@ static char sccsid[] = "$Revision: 1.1 $ ($Date: 1995/12/18 03:30:02 $)"; /* #include "ppp.h" */ + #include #include #include "netbuf.h" @@ -118,6 +119,7 @@ static char sccsid[] = "$Revision: 1.1 $ ($Date: 1995/12/18 03:30:02 $)"; #include #include #include +#include #endif @@ -130,8 +132,9 @@ static char sccsid[] = "$Revision: 1.1 $ ($Date: 1995/12/18 03:30:02 $)"; struct ppp_softc ppp_softc[NUM_PPP]; + #ifdef PPP_COMPRESS -#define PACKETPTR netbuf_t +#define PACKETPTR NETBUF_T #include #endif @@ -145,10 +148,10 @@ struct bpf_fns fnarg; #endif /* - * The max number of netbuf_ts we wish to compress and cache for + * The max number of NETBUF_Ts we wish to compress and cache for * sending. */ -#define COMPRESS_CACHE_LEN 5 +#define COMPRESS_CACHE_LEN 1 #include "inlines.h" @@ -165,15 +168,14 @@ void pppgetm __P((register struct ppp_softc *sc)); static void ppp_requeue __P((struct ppp_softc *)); static void ppp_outpkt __P((struct ppp_softc *)); -static void ppp_ccp __P((struct ppp_softc *, netbuf_t, int rcvd)); +static void ppp_ccp __P((struct ppp_softc *, NETBUF_T, int rcvd)); static void ppp_ccp_closed __P((struct ppp_softc *)); -static void ppp_inproc __P((struct ppp_softc *, netbuf_t)); -static void pppdumpm __P((netbuf_t)); +static void ppp_inproc __P((struct ppp_softc *, NETBUF_T)); +static void pppdumpm __P((NETBUF_T)); extern int install_ppp_ld __P((void)); extern int tty_ld_remove __P((int)); - /* * We steal two bits in the mbuf m_flags, to mark high-priority packets * for output, and received packets following lost/corrupted packets. @@ -196,10 +198,10 @@ enum { QFREE, QRAW, QFAST, QSLOW, QIN, QNP, QCACHE }; static struct qparms qparms[] = { {20, 40, 50, "free"}, /* freeq */ - {5, 20, 25, "fast"}, /* rawq */ - {5, 20, 25, "slow"}, /* fastq */ - {5, 20, 25, "in"}, /* slowq */ - {5, 20, 25, "out"}, /* inq */ + {5, 20, 25, "raw"}, /* rawq */ + {5, 20, 25, "fast"}, /* fastq */ + {5, 20, 25, "slow"}, /* slowq */ + {5, 20, 25, "in"}, /* inq */ {5, 20, 25, "np"}, /* npq */ {0, COMPRESS_CACHE_LEN, COMPRESS_CACHE_LEN, "cache"} /* cache */ }; @@ -248,38 +250,45 @@ union ifr_ifru { }; +/* + * Returns a new "outgoing" netbuf. + * + * Must return an actual netbuf_t since other protocols + * use this to get our buffers. Before releasing, save + * any space we may need when the buffer returns. + */ + netbuf_t pppgetbuf(netif_t ifp) { - netbuf_t nb; + NETBUF_T nb; int len = MAX(if_mtu(ifp), PPP_MTU) + PPP_HDRLEN + PPP_FCSLEN; - nb = ppp_nb_alloc(len); + nb = NB_ALLOC(len); if (nb != NULL) { - ppp_nb_shrink_top(nb, PPP_HDRLEN); - nb_shrink_bot(nb, PPP_FCSLEN); /* grown by pppstart() */ + NB_SHRINK_TOP(nb, PPP_HDRLEN); + NB_SHRINK_BOT(nb, PPP_FCSLEN); /* grown by pppstart() */ } - return nb; + return NB_TO_nb(nb); } /* * Called from boot code to establish ppp interfaces. */ -int +void pppattach() { register struct ppp_softc *sc; register int i = 0; - - IOLog("\nPPP version 2.2 released for NS 3.2 and 3.3\n"); + + IOLog("\nPPP version 2.3b3 for NS 3.2 and 3.3\n"); IOLog("LKS: %s\n", sccsid); IOLog("by Stephen Perkins, Philip Prindeville, and Pete French\n"); IOLog("Installing PPP on Line Discipline %d\n", PPPDISC); if (install_ppp_ld() < 0) { IOLog("ppp: Could not install line discipline\n"); - return 0; } @@ -304,8 +313,8 @@ pppattach() ipforwarding = 1; ipsendredirects = 1; - IOLog("PPP-2.2 Successfully Installed.\n\n"); - return 1; + + IOLog("PPP-2.3 Successfully Installed.\n\n"); } int @@ -332,7 +341,7 @@ pppdetach() bzero(sc->sc_if, sizeof(netif_t)); IOLog(" ppp%d successfully detached.\n", i); } - IOLog("PPP-2.2 Successfully Removed.\n\n"); + IOLog("PPP-2.3 Successfully Removed.\n\n"); return 0; } @@ -375,18 +384,6 @@ pppalloc(pid) sc->sc_compsched = 0; sc->sc_decompsched = 0; -#if 0 - /* - * Clear PPP stats information for the new session - */ - sc->sc_bytessent = 0; - sc->sc_bytesrcvd = 0; - if_opackets_set(sc->sc_if, 0); - if_ipackets_set(sc->sc_if, 0); - if_oerrors_set(sc->sc_if, 0); - if_ierrors_set(sc->sc_if, 0); -#endif - /* * XXX -- We need to get packets here, and we don't care if we do block... * We do this after we set the sc_mru. @@ -442,7 +439,7 @@ pppioctl(sc, cmd, data, flag) #ifdef PPP_COMPRESS u_char ccp_option[CCP_MAX_OPTION_LENGTH]; #endif - netbuf_t m; + NETBUF_T m; #ifdef HAS_BROKEN_TIOCSPGRP struct tty *tp = sc->sc_devp; #endif @@ -451,7 +448,7 @@ pppioctl(sc, cmd, data, flag) case FIONREAD: s = splimp(); /* paranoid; splnet probably ok */ if ((m = nbq_peek(&sc->sc_inq)) != NULL) - *(int *)data = nb_size(m); + *(int *)data = NB_SIZE(m); else *(int *)data = 0; splx(s); @@ -459,16 +456,10 @@ pppioctl(sc, cmd, data, flag) case PPPIOCGUNIT: *(int *)data = if_unit(sc->sc_if); -#if 0 - IOLogDbg("ppp%d: unit gets %d\n", if_unit(sc->sc_if), *(int *)data); -#endif break; case PPPIOCGFLAGS: *(u_int *)data = sc->sc_flags; -#if 0 - IOLogDbg("ppp%d: flags gets 0x%x\n", if_unit(sc->sc_if), *(u_int *)data); -#endif break; case PPPIOCSFLAGS: @@ -484,19 +475,15 @@ pppioctl(sc, cmd, data, flag) oldflags = sc->sc_flags; sc->sc_flags = (sc->sc_flags & ~SC_MASK) | flags; splx(s); -#if 0 - IOLogDbg("ppp%d: data 0x%x, flags: old 0x%x new 0x%x\n", - if_unit(sc->sc_if), flags, oldflags, sc->sc_flags); -#endif break; case PPPIOCSMRU: if (! suser()) return EPERM; mru = *(int *)data; -#if 0 + IOLogDbg("ppp%d: setting mru %d\n", if_unit(sc->sc_if), mru); -#endif + if (mru >= PPP_MRU && mru <= PPP_MAXMRU) { /* To make sure we handle the received packet @@ -509,7 +496,7 @@ pppioctl(sc, cmd, data, flag) nbq_flush(&sc->sc_freeq); /* get rid of old buffers */ sc->sc_mru = mru; if (sc->sc_m){ - nb_free(sc->sc_m); + NB_FREE(sc->sc_m); sc->sc_m = NULL; if (sc->sc_ilen != 0) sc->sc_flags |= SC_FLUSH; @@ -523,18 +510,12 @@ pppioctl(sc, cmd, data, flag) case PPPIOCGMRU: *(int *)data = sc->sc_mru; -#if 0 - IOLogDbg("ppp%d: mru gets 0x%x\n", if_unit(sc->sc_if), *(int *)data); -#endif break; #ifdef VJC case PPPIOCSMAXCID: if (! suser()) return EPERM; -#if 0 - IOLogDbg("ppp%d: setting max cid %d\n", if_unit(sc->sc_if), *(int *)data); -#endif s = splnet(); vj_compress_init(&sc->sc_comp, *(int *)data); splx(s); @@ -545,9 +526,6 @@ pppioctl(sc, cmd, data, flag) if (! suser()) return EPERM; sc->sc_xfer = p->p_pid; -#if 0 - IOLogDbg("ppp%d: setting pid %d\n", if_unit(sc->sc_if), sc->sc_xfer); -#endif break; #ifdef PPP_COMPRESS @@ -573,7 +551,7 @@ pppioctl(sc, cmd, data, flag) if (odp->transmit) { if (sc->sc_xc_state != NULL) (*sc->sc_xcomp->comp_free)(sc->sc_xc_state); - sc->sc_xcomp = *cp; + sc->sc_xcomp = *cp; /* entry points for compressor */ sc->sc_xc_state = (*cp)->comp_alloc(ccp_option, nb); if (sc->sc_xc_state == NULL) { IOLogDbg("ppp%d: comp_alloc failed", if_unit(sc->sc_if)); @@ -584,7 +562,7 @@ pppioctl(sc, cmd, data, flag) } else { if (sc->sc_rc_state != NULL) (*sc->sc_rcomp->decomp_free)(sc->sc_rc_state); - sc->sc_rcomp = *cp; + sc->sc_rcomp = *cp; /* entry points for compressor */ sc->sc_rc_state = (*cp)->decomp_alloc(ccp_option, nb); if (sc->sc_rc_state == NULL) { IOLogDbg("ppp%d: decomp_alloc failed", if_unit(sc->sc_if)); @@ -603,11 +581,6 @@ pppioctl(sc, cmd, data, flag) #ifdef HAS_BROKEN_TIOCSPGRP case TIOCSPGRP: -#if 0 - IOLogDbg("ppp%d: pgrp was %d, setting pgrp %d, flags 0x%x, state 0x%x\n", - if_unit(sc->sc_if), tp->t_pgrp, *(int *)data, - tp->t_flags, tp->t_state); -#endif tp->t_pgrp = *(int *)data; break; #endif @@ -627,9 +600,6 @@ pppioctl(sc, cmd, data, flag) } else { if (! suser()) return EPERM; -#if 0 - IOLogDbg("ppp%d: setting protocol %d to mode %d\n", if_unit(sc->sc_if), npx, npi->mode); -#endif if (npi->mode != sc->sc_npmode[npx]) { s = splimp(); sc->sc_npmode[npx] = npi->mode; @@ -662,9 +632,6 @@ pppcontrol(ifp, cmd, data) const char *cmd; void *data; { -#if 0 - register struct ppp_softc *sc = &ppp_softc[if_unit(ifp)]; -#endif if (!strcmp(cmd, IFCONTROL_UNIXIOCTL)) { if_ioctl_t* ctl = (if_ioctl_t*)data; @@ -675,10 +642,6 @@ pppcontrol(ifp, cmd, data) struct sockaddr_in *sin = (struct sockaddr_in *)data; if (sin->sin_family != AF_INET) return EAFNOSUPPORT; -#if 0 - IOLogDbg("ppp%d: setting address, and bringing up interface\n", - if_unit(ifp)); -#endif if_flags_set(ifp, if_flags(ifp) | IFF_UP); return 0; } @@ -692,18 +655,11 @@ pppcontrol(ifp, cmd, data) struct sockaddr_in *sin = (struct sockaddr_in *) data; if (sin->sin_family != AF_INET) return EAFNOSUPPORT; -#if 0 - IOLogDbg("ppp%d: probing for interface address\n", if_unit(ifp)); -#endif return 0; } else if (!strcmp(cmd, IFCONTROL_SETFLAGS)) { register union ifr_ifru *ifr = (union ifr_ifru *)data; if (!suser()) return EPERM; -#if 0 - IOLogDbg("ppp%d: old flags 0x%x, new flags 0x%x\n", if_unit(ifp), - if_flags(ifp), ifr->ifru_flags); -#endif if_flags_set(ifp, ifr->ifru_flags); return 0; } @@ -743,10 +699,6 @@ pppsioctl(ifp, cmd, data) switch (cmd) { case SIOCSIFFLAGS: IOLog("ppp%d: pppioctl: SIOCSIFFLAGS called!\n", if_unit(ifp)); -#if 0 - if_flags_set(ifp, (if_flags(ifp) & IFF_CANTCHANGE) - | (ifr->ifr_flags & ~IFF_CANTCHANGE)); -#endif break; case SIOCSIFADDR: @@ -816,11 +768,16 @@ pppsioctl(ifp, cmd, data) /* * Queue a packet. Start transmission if not active. * Packet is placed in Information field of PPP frame. + * + * This procedure MUST take an actual netbuf_t as input + * since it may be called by procedures outside of us. + * The buffer received must be in the same format as that + * returned by pppgetbuf(). */ int -pppoutput(ifp, m0, arg) +pppoutput(ifp, in_nb, arg) netif_t ifp; - netbuf_t m0; + netbuf_t in_nb; void *arg; { register struct ppp_softc *sc = &ppp_softc[if_unit(ifp)]; @@ -832,6 +789,9 @@ pppoutput(ifp, m0, arg) struct ip *ip; struct nb_queue *ifq; enum NPmode mode; + NETBUF_T m0; + + m0 = nb_TO_NB(in_nb); if (sc->sc_devp == NULL || (if_flags(ifp) & IFF_RUNNING) == 0 || (if_flags(ifp) & IFF_UP) == 0 && dst->sa_family != AF_UNSPEC) { @@ -839,6 +799,12 @@ pppoutput(ifp, m0, arg) goto bad; } +#ifdef NETBUF_PROXY + m0->pktinfo.first.tv_sec = time.tv_sec; + m0->pktinfo.first.tv_usec = time.tv_usec; + m0->pktinfo.size1 = NB_SIZE(m0); +#endif + /* * Compute PPP header. */ @@ -900,7 +866,7 @@ urgent: flags |= M_HIGHPRI; /* * Add PPP header. */ - ppp_nb_grow_top(m0, PPP_HDRLEN); + NB_GROW_TOP(m0, PPP_HDRLEN); cp = mtod(m0, u_char *); *cp++ = address; @@ -908,25 +874,42 @@ urgent: flags |= M_HIGHPRI; *cp++ = protocol >> 8; *cp++ = protocol & 0xff; +#if defined(NBPFILTER) && defined(NETBUF_PROXY) + /* + * We need to copy the header to the original copy. + */ + bcopy(mtod(m0, u_char *), NB_MAP_ORIG(m0), PPP_HDRLEN); + +#endif + if (sc->sc_flags & SC_LOG_OUTPKT) { IOLog("ppp%d: output:\n", if_unit(ifp)); /* XXX */ pppdumpm(m0); } -#ifdef NBPFILTER + +#if defined(NBPFILTER) && !defined(NETBUF_PROXY) /* * See if bpf wants to look at the packet. + * We must hand it off _before_ any compression + * takes place. If NETBUF_PROXY is defined, + * we do the handoff later (in ppp_tty.c) + * because we keep a copy of the original + * datagram around. */ - if (sc->sc_bpf) - bpf_tap(sc->sc_bpf, nb_map(m0), nb_size(m0)); + + if (sc->sc_bpf) + bpf_tap(sc->sc_bpf, NB_MAP(m0), NB_SIZE(m0)); + #endif + /* * Put the packet on the appropriate queue. */ s = splimp(); /* splnet should be OK now */ if (mode == NPMODE_QUEUE) { - nb_set_mark(m0,flags); /* save priority */ + NB_SET_MARK(m0,flags); /* save priority */ /* XXX we should limit the number of packets on this queue */ nbq_enqueue(&sc->sc_npq, m0); /* XXX is this correct? */ } else { @@ -965,7 +948,7 @@ urgent: flags |= M_HIGHPRI; return (0); bad: - nb_free(m0); + NB_FREE(m0); return (error); } @@ -982,14 +965,14 @@ static void ppp_requeue(sc) struct ppp_softc *sc; { - netbuf_t m, lm, nm; + NETBUF_T m, lm, nm; struct nb_queue *ifq; enum NPmode mode; mark_t flags; lm = nm = NULL; for (m = sc->sc_npq.head; m; ) { - nb_get_next(m,&nm); + NB_GET_NEXT(m,&nm); switch (PPP_PROTOCOL(mtod(m, u_char *))) { case PPP_IP: @@ -1005,16 +988,16 @@ ppp_requeue(sc) * This packet can now go on one of the queues to be sent. */ if(lm) - nb_set_next(lm,nm); + NB_SET_NEXT(lm,nm); else sc->sc_npq.head = nm; - nb_set_next(m,NULL); - nb_get_mark(m,&flags); + NB_SET_NEXT(m,NULL); + NB_GET_MARK(m,&flags); ifq = (flags & M_HIGHPRI)? &sc->sc_fastq: &sc->sc_slowq; if (nbq_full(ifq)) { nbq_drop(ifq); incr_cnt(sc->sc_if, if_oerrors); - nb_free(m); + NB_FREE(m); } else nbq_enqueue(ifq, m); sc->sc_npq.len--; @@ -1023,7 +1006,7 @@ ppp_requeue(sc) case NPMODE_DROP: case NPMODE_ERROR: sc->sc_npq.len--; - nb_free(m); + NB_FREE(m); break; case NPMODE_QUEUE: @@ -1042,11 +1025,11 @@ ppp_requeue(sc) * to prepare a new packet; the device start routine gets called * again when a packet is ready. */ -netbuf_t +NETBUF_T ppp_dequeue(sc) struct ppp_softc *sc; { - netbuf_t m; + NETBUF_T m; int error; m = nbq_dequeue(&sc->sc_compq); @@ -1081,7 +1064,7 @@ pppintr_decomp(arg) { struct ppp_softc *sc = (struct ppp_softc *)arg; int s; - netbuf_t m; + NETBUF_T m; if (nbq_low(&sc->sc_freeq)) pppfillfreeq((void *) sc); @@ -1126,19 +1109,19 @@ pppintr_comp(arg) { struct ppp_softc *sc = (struct ppp_softc *)arg; int s; - netbuf_t m; + NETBUF_T m; - if (nbq_low(&sc->sc_freeq)) - pppfillfreeq((void *) sc); + if (nbq_low(&sc->sc_freeq)) + pppfillfreeq((void *) sc); while (!nbq_full(&sc->sc_compq) && !nbq_empty(&sc->sc_fastq)) ppp_outpkt(sc); - if (!nbq_full(&sc->sc_compq) && !nbq_empty(&sc->sc_slowq)) - ppp_outpkt(sc); + if (!nbq_full(&sc->sc_compq) && !nbq_empty(&sc->sc_slowq)) + ppp_outpkt(sc); - sc->sc_compsched = 0; + sc->sc_compsched = 0; } /* @@ -1151,7 +1134,7 @@ ppp_outpkt(sc) struct ppp_softc *sc; { int s; - netbuf_t m; + NETBUF_T m; u_char *cp; int address, control, protocol; @@ -1174,6 +1157,11 @@ ppp_outpkt(sc) control = PPP_CONTROL(cp); protocol = PPP_PROTOCOL(cp); +#ifdef NETBUF_PROXY + m->pktinfo.second.tv_sec = time.tv_sec; + m->pktinfo.second.tv_usec = time.tv_usec; +#endif + switch (protocol) { case PPP_IP: /* @@ -1193,15 +1181,21 @@ ppp_outpkt(sc) ip = (struct ip *) (cp + PPP_HDRLEN); /* this code assumes the IP/TCP header is in one netbuf */ if (ip->ip_p == IPPROTO_TCP) { - type = vj_compress_tcp(ip, nb_size(m) - PPP_HDRLEN, + type = vj_compress_tcp(ip, NB_SIZE(m) - PPP_HDRLEN, &sc->sc_comp, !(sc->sc_flags & SC_NO_TCP_CCID), &vjhdr); switch (type) { case TYPE_UNCOMPRESSED_TCP: protocol = PPP_VJC_UNCOMP; +#ifdef NETBUF_PROXY + m->pktinfo.flags |= NBFLAG_VJCINC; +#endif break; case TYPE_COMPRESSED_TCP: - ppp_nb_shrink_top(m, vjhdr - (u_char *) ip); + NB_SHRINK_TOP(m, vjhdr - (u_char *) ip); +#ifdef NETBUF_PROXY + m->pktinfo.flags |= NBFLAG_VJC; +#endif protocol = PPP_VJC_COMP; cp = mtod(m, u_char *); cp[0] = address; /* header has moved */ @@ -1212,7 +1206,9 @@ ppp_outpkt(sc) cp[3] = protocol; /* update protocol in PPP header */ } } + #endif /* VJC */ + break; #ifdef PPP_COMPRESS @@ -1222,25 +1218,59 @@ ppp_outpkt(sc) #endif /* PPP_COMPRESS */ } + +#ifdef NETBUF_PROXY + m->pktinfo.size2 = NB_SIZE(m); +#endif + + #ifdef PPP_COMPRESS if (protocol != PPP_LCP && protocol != PPP_CCP && sc->sc_xc_state && (sc->sc_flags & SC_COMP_RUN)) { - netbuf_t mcomp; + NETBUF_T mcomp; int slen, clen; - slen = nb_size(m); + slen = NB_SIZE(m); + clen = (*sc->sc_xcomp->compress) (sc->sc_xc_state, &mcomp, m, slen, sc->sc_flags & SC_CCP_UP? if_mtu(sc->sc_if): 0); + + + if (mcomp && (NB_SIZE(mcomp) >= slen)) + IOLog("BSD Warning... packet growth: Orig=%d New=%d.\n", + slen, NB_SIZE(mcomp)); + if (mcomp != NULL) { - nb_free(m); + +#ifdef NETBUF_PROXY + /* + * duplicate all the stat info into the new + * buffer. + */ + m->pktinfo.flags |= NBFLAG_CCP; + + NB_DUPLICATE(m, mcomp); +#endif + + NB_FREE(m); m = mcomp; cp = mtod(m, u_char *); protocol = cp[3]; } +#ifdef NETBUF_PROXY + else + m->pktinfo.flags |= NBFLAG_CCPINC; +#endif + } #endif /* PPP_COMPRESS */ +#ifdef NETBUF_PROXY + m->pktinfo.size3 = NB_SIZE(m); +#endif + + /* * Compress the address/control and protocol, if possible. */ @@ -1248,7 +1278,10 @@ ppp_outpkt(sc) control == PPP_UI && protocol != PPP_ALLSTATIONS && protocol != PPP_LCP) { /* can compress address/control */ - ppp_nb_shrink_top(m, 2); + NB_SHRINK_TOP(m, 2); +#ifdef NETBUF_PROXY + m->pktinfo.flags |= NBFLAG_AC; +#endif } if (sc->sc_flags & SC_COMP_PROT && protocol < 0xFF) { /* can compress protocol */ @@ -1256,9 +1289,17 @@ ppp_outpkt(sc) cp[2] = cp[1]; /* move address/control up */ cp[1] = cp[0]; } - ppp_nb_shrink_top(m, 1); + NB_SHRINK_TOP(m, 1); +#ifdef NETBUF_PROXY + m->pktinfo.flags |= NBFLAG_PC; +#endif } +#ifdef NETBUF_PROXY + m->pktinfo.third.tv_sec = time.tv_sec; + m->pktinfo.third.tv_usec = time.tv_usec; +#endif + s = splimp(); nbq_enqueue(&sc->sc_compq, m); (*sc->sc_start)(sc); @@ -1273,7 +1314,7 @@ ppp_outpkt(sc) static void ppp_ccp(sc, m, rcvd) struct ppp_softc *sc; - netbuf_t m; + NETBUF_T m; int rcvd; { u_char *dp, *ep; @@ -1284,13 +1325,13 @@ ppp_ccp(sc, m, rcvd) */ dp = mtod(m, u_char *) + PPP_HDRLEN; - ep = mtod(m, u_char *) + nb_size(m); + ep = mtod(m, u_char *) + NB_SIZE(m); if (dp + CCP_HDRLEN > ep) return; slen = CCP_LENGTH(dp); if (dp + slen > ep) { IOLogDbg("ppp%d: ccp: not enough data in netbuf (%x+%x > %x+%x)\n", - if_unit(sc->sc_if), dp, slen, mtod(m, u_char *), nb_size(m)); + if_unit(sc->sc_if), dp, slen, mtod(m, u_char *), NB_SIZE(m)); return; } @@ -1386,12 +1427,12 @@ ppp_ccp_closed(sc) void ppppktin(sc, m, lost) struct ppp_softc *sc; - netbuf_t m; + NETBUF_T m; int lost; { int error, s = splimp(); - nb_set_mark(m,(lost ? M_ERRMARK : 0)); + NB_SET_MARK(m,(lost ? M_ERRMARK : 0)); /* XXX - we should check for the raw queue overflowing... */ nbq_enqueue(&sc->sc_rawq, m); @@ -1416,22 +1457,27 @@ ppppktin(sc, m, lost) static void ppp_inproc(sc, m) struct ppp_softc *sc; - netbuf_t m; + NETBUF_T m; { struct nb_queue *inq; int s, ilen, xlen, proto, rv; mark_t flags; u_char *cp, adrs, ctrl; - netbuf_t dmp; + NETBUF_T dmp; u_char *iphdr; u_int hlen; +#ifdef NETBUF_PROXY + m->pktinfo.third.tv_sec = time.tv_sec; + m->pktinfo.third.tv_usec = time.tv_usec; +#endif + incr_cnt(sc->sc_if, if_ipackets); - nb_get_mark(m,&flags); + NB_GET_MARK(m,&flags); if (sc->sc_flags & SC_LOG_INPKT) { - IOLog("ppp%d: got %d bytes\n", if_unit(sc->sc_if), nb_size(m)); + IOLog("ppp%d: got %d bytes\n", if_unit(sc->sc_if), NB_SIZE(m)); pppdumpm(m); } @@ -1453,18 +1499,30 @@ ppp_inproc(sc, m) */ if (proto == PPP_COMP && sc->sc_rc_state && (sc->sc_flags & SC_DECOMP_RUN) && !(sc->sc_flags & SC_DC_ERROR) && !(sc->sc_flags & SC_DC_FERROR)) { +#ifdef NETBUF_PROXY + m->pktinfo.flags |= NBFLAG_CCP; +#endif /* decompress this packet */ rv = (*sc->sc_rcomp->decompress)(sc->sc_rc_state, m, &dmp); if (rv == DECOMP_OK){ - nb_free(m); - if (dmp == NULL){ - /* No error, but no decompressed packet returned */ - return; - } + +#ifdef NETBUF_PROXY + if (dmp != NULL) + { + + NB_DUPLICATE(m, dmp); +/* bcopy(&(m->pktinfo), &(dmp->pktinfo), sizeof(bpf_encapsulater)); */ + + } +#endif + NB_FREE(m); + if (dmp == NULL){ + /* No error, but no decompressed packet returned */ + return; + } m = dmp; cp = mtod(m, u_char *); proto = PPP_PROTOCOL(cp); - } else { /* * An error has occurred in decompression. @@ -1474,6 +1532,7 @@ ppp_inproc(sc, m) IOLogDbg("ppp%d: decompress failed %d\n", if_unit(sc->sc_if), rv); s = splimp(); sc->sc_flags |= SC_VJ_RESET; + if (rv == DECOMP_ERROR) sc->sc_flags |= SC_DC_ERROR; else @@ -1482,7 +1541,12 @@ ppp_inproc(sc, m) } } else { - if (sc->sc_rc_state && (sc->sc_flags & SC_DECOMP_RUN)) { + if (sc->sc_rc_state && (sc->sc_flags & SC_DECOMP_RUN)) + { + +#ifdef NETBUF_PROXY + m->pktinfo.flags |= NBFLAG_CCPINC; +#endif (*sc->sc_rcomp->incomp)(sc->sc_rc_state, m); } if (proto == PPP_CCP) { @@ -1491,7 +1555,11 @@ ppp_inproc(sc, m) } #endif - ilen = nb_size(m); + ilen = NB_SIZE(m); + +#ifdef NETBUF_PROXY + m->pktinfo.size2 = ilen; +#endif #ifdef VJC if (sc->sc_flags & SC_VJ_RESET) { @@ -1499,6 +1567,9 @@ ppp_inproc(sc, m) * If we've missed a packet, we must toss subsequent compressed * packets which don't have an explicit connection ID. */ + +/* IOLog("SC_VJ_RESET was set!\n"); */ + vj_uncompress_err(&sc->sc_comp); s = splimp(); sc->sc_flags &= ~SC_VJ_RESET; @@ -1512,20 +1583,61 @@ ppp_inproc(sc, m) if (sc->sc_flags & SC_REJ_COMP_TCP) goto bad; +#ifdef NETBUF_PROXY + m->pktinfo.flags |= NBFLAG_VJC; +#endif + xlen = vj_uncompress_tcp(cp + PPP_HDRLEN, ilen - PPP_HDRLEN, ilen - PPP_HDRLEN, &sc->sc_comp, &iphdr, &hlen); if (xlen <= 0) { - IOLogDbg("ppp%d: VJ uncompress failed on type comp\n", +/* + IOLogDbg("ppp%d: VJ uncompress failed on type comp\n", if_unit(sc->sc_if)); +*/ goto bad; } - ppp_nb_grow_top(m, hlen - xlen); - nb_write(m, PPP_HDRLEN, hlen, iphdr); + /* + * Write the IP/TCP header back into the datagram. + * The pointers point to the stored copy in the VJ + * compression table. + */ + + NB_GROW_TOP(m, hlen - xlen); + NB_WRITE(m, PPP_HDRLEN, hlen, iphdr); cp = mtod(m, u_char *); + +#ifdef TCP_CHECKSUM + { +#define getip_hl(base) ((base).ip_hl) + + u_short mytcpcksum (struct ip *pip); + struct tcphdr *ptcp; + struct ip *iphdr; + u_short thecksum; + u_long hlen; + + iphdr = (struct ip*) (cp + PPP_HDRLEN); + hlen = getip_hl(*iphdr) << 2; /* Length is in words */ + ptcp = (struct tcphdr *)&((u_char *)iphdr)[hlen]; + + thecksum = (u_short)mytcpcksum(iphdr); + + if(ptcp->th_sum != thecksum) + { +#ifdef NEWVJ_RESYNC + set_newvj_error_mode(); +#endif + IOLog("NEWVJ: Warning... TCP checksum failed Received=%u, Calculated=%u)\n", + (ptcp->th_sum)&0xffff, thecksum&0xffff); + } + } +#endif + + cp[0] = adrs; cp[1] = ctrl; cp[2] = 0; @@ -1538,17 +1650,34 @@ ppp_inproc(sc, m) if (sc->sc_flags & SC_REJ_COMP_TCP) goto bad; - vj_uncompress_uncomp(cp + PPP_HDRLEN, &sc->sc_comp); +#ifdef NETBUF_PROXY + m->pktinfo.flags |= NBFLAG_VJCINC; +#endif + + vj_uncompress_uncomp(cp + PPP_HDRLEN, ilen-PPP_HDRLEN, &sc->sc_comp); proto = PPP_IP; cp[3] = PPP_IP; } #endif /* VJC */ +#ifdef NETBUF_PROXY + m->pktinfo.size3 = NB_SIZE(m); + m->pktinfo.fourth.tv_sec = time.tv_sec; + m->pktinfo.fourth.tv_usec = time.tv_usec; +#endif + #ifdef NBPFILTER - /* See if bpf wants to look at the packet. */ + /* + * See if bpf wants to look at the packet. + * Size includes the PPP header by not the trailer. + */ if (sc->sc_bpf) - bpf_tap(sc->sc_bpf, nb_map(m), nb_size(m)); +#ifndef NETBUF_PROXY + bpf_tap(sc->sc_bpf, NB_MAP(m), NB_SIZE(m)); +#else + bpf_tap(sc->sc_bpf, m, 0); +#endif #endif rv = 0; @@ -1561,12 +1690,12 @@ ppp_inproc(sc, m) if ((if_flags(sc->sc_if) & IFF_UP) == 0 || sc->sc_npmode[NP_IP] != NPMODE_PASS) { /* interface is down - drop the packet. */ - nb_free(m); + NB_FREE(m); IOLogDbg("ppp%d: IP packed dropped (NPmode)\n", if_unit(sc->sc_if)); return; } - ppp_nb_shrink_top(m, PPP_HDRLEN); - inet_queue(sc->sc_if, m); + NB_SHRINK_TOP(m, PPP_HDRLEN); + inet_queue(sc->sc_if, NB_TO_nb(m)); sc->sc_last_recv = time.tv_sec; /* update time of last pkt rcvd */ return; #endif @@ -1599,7 +1728,7 @@ ppp_inproc(sc, m) return; bad: - nb_free(m); + NB_FREE(m); incr_cnt(sc->sc_if, if_ierrors); } @@ -1607,12 +1736,12 @@ ppp_inproc(sc, m) static void pppdumpm(m0) - netbuf_t m0; + NETBUF_T m0; { char buf[3*MAX_DUMP_BYTES+4]; char *bp = buf; static char digits[] = "0123456789abcdef"; - int l = nb_size(m0); + int l = NB_SIZE(m0); u_char *rptr = mtod(m0, u_char *); while (l--) { diff --git a/NeXT/if_pppvar.h b/NeXT/if_pppvar.h index 49a1fc7..bbad31d 100644 --- a/NeXT/if_pppvar.h +++ b/NeXT/if_pppvar.h @@ -33,7 +33,7 @@ /* only defined in the posix universe... */ -typedef int pid_t; +/*typedef int pid_t; */ typedef unsigned short u_int16_t; struct ppp_softc { @@ -45,7 +45,7 @@ struct ppp_softc { void (*sc_relinq) __P((struct ppp_softc *)); /* relinquish ifunit */ u_int16_t sc_mru; /* max receive unit */ pid_t sc_xfer; /* used in transferring unit */ - netbuf_t sc_m; /* Current TTY input netbuf */ + NETBUF_T sc_m; /* Current TTY input netbuf */ struct nb_queue sc_freeq; /* reserve netbufs */ struct nb_queue sc_rawq; /* Raw input buffers */ struct nb_queue sc_fastq; /* For telnet, rlogin, and ftp control */ @@ -78,7 +78,7 @@ struct ppp_softc { /* Device-dependent part for async lines. */ ext_accm sc_asyncmap; /* async control character map */ u_int32_t sc_rasyncmap; /* receive async control char map */ - netbuf_t sc_outm; /* netbuf currently being output */ + NETBUF_T sc_outm; /* netbuf currently being output */ char *sc_mp; /* ptr to next char in input netbuf */ u_int16_t sc_ilen; /* length of input packet so far */ u_int16_t sc_fcs; /* FCS so far (input) */ @@ -92,8 +92,8 @@ extern struct ppp_softc ppp_softc[]; struct ppp_softc *pppalloc __P((pid_t pid)); void pppdealloc __P((struct ppp_softc *sc)); int pppioctl __P((struct ppp_softc *sc, u_long cmd, void *data, int flag)); -void ppppktin __P((struct ppp_softc *sc, netbuf_t m, int lost)); -netbuf_t ppp_dequeue __P((struct ppp_softc *sc)); +void ppppktin __P((struct ppp_softc *sc, NETBUF_T m, int lost)); +NETBUF_T ppp_dequeue __P((struct ppp_softc *sc)); #define t_sc T_LINEP diff --git a/NeXT/inlines.h b/NeXT/inlines.h index 46b0299..5a83d07 100644 --- a/NeXT/inlines.h +++ b/NeXT/inlines.h @@ -68,11 +68,11 @@ nbq_high(struct nb_queue* nbq) return rv; } -static inline netbuf_t +static inline NETBUF_T nbq_peek(struct nb_queue* nbq) { int s; - netbuf_t nb; + NETBUF_T nb; s = splimp(); nb = nbq->head; @@ -80,18 +80,18 @@ nbq_peek(struct nb_queue* nbq) return nb; } -static inline netbuf_t +static inline NETBUF_T nbq_dequeue(struct nb_queue* nbq) { int s; - netbuf_t nb; + NETBUF_T nb; if (!nbq->head) return NULL; s = splimp(); nb = nbq->head; - nb_get_next(nb,&nbq->head); + NB_GET_NEXT(nb,&nbq->head); if (!nbq->head) nbq->tail = NULL; --nbq->len; @@ -118,14 +118,14 @@ nbq_dequeue(struct nb_queue* nbq) */ static inline int -nbq_enqueue(struct nb_queue* nbq, netbuf_t nb) +nbq_enqueue(struct nb_queue* nbq, NETBUF_T nb) { int s; - nb_set_next(nb,NULL); + NB_SET_NEXT(nb,NULL); s = splimp(); if (nbq->tail) - nb_set_next(nbq->tail,nb); + NB_SET_NEXT(nbq->tail,nb); else nbq->head = nb; nbq->tail = nb; @@ -137,15 +137,15 @@ nbq_enqueue(struct nb_queue* nbq, netbuf_t nb) static inline void nbq_flush(struct nb_queue *nbq) { - netbuf_t nb,temp; + NETBUF_T nb,temp; int s; s = splimp(); nb = nbq->head; while(nb) { temp=nb; - nb_get_next(nb,&nb); - nb_free(temp); + NB_GET_NEXT(nb,&nb); + NB_FREE(temp); } nbq->head = nbq->tail = NULL; @@ -185,7 +185,7 @@ nbq_drop(struct nb_queue *nbq) /* * Not very pretty, but it makes for less "diffs"... */ -#define mtod(m,type) ((type) nb_map(m)) +#define mtod(m,type) ((type) NB_MAP(m)) typedef void (*pfv)(void *); @@ -236,7 +236,11 @@ bpfattach(caddr_t *driverp, netif_t ifp, u_int dlt, u_int hdrlen) static inline void -bpf_tap(caddr_t arg, u_char *pkt, u_int pktlen) +#ifndef NETBUF_PROXY + bpf_tap(caddr_t arg, u_char *pkt, u_int pktlen) +#else + bpf_tap(caddr_t arg, NETBUF_T pkt, u_int pktlen) +#endif { (*fnarg.tapfn)(arg, pkt, pktlen); } diff --git a/NeXT/nbq.h b/NeXT/nbq.h index 73f7c1c..d4b16c6 100644 --- a/NeXT/nbq.h +++ b/NeXT/nbq.h @@ -11,11 +11,197 @@ #ifndef __NBQ_H__ #define __NBQ_H__ + #define KERNEL 1 #include #include + #include "netbuf.h" +typedef u_int mark_t; + +/* + * Netbufs and Netbuf wrappers don't help us because we + * have no way of keeping track of information on start + * position once nb_grow* or nb_shrink* are called. + */ + +#ifdef NETBUF_PROXY + +#warning ...you are compiling with NETBUF_PROXY + +typedef struct _bpf_encapsulater +{ + /* + * Depending on the direction of packet travel, these + * values have different meanings. + * + * INCOMING: + * first -- time first byte of packet received. + * second -- time last byte of packet received. + * third -- Decompression start time + * fourth -- Packet Handoff time + * (second-first) -- receive time + * (third-second) -- queue time waiting for decompression + * (fourth-third) -- decompression time + * (fourth - first) -- total receive time. + * (fourth - second) -- total system process time. + * + * async_esc -- The number of characters escaped in this packet. + * size1 -- The size of the inital packet before decompression. + * This value includes the expansion caused by AC and PC compression. + * If flags set: + * AC implies packet got increased by 2 during receive. + * PC implies packet got increased by 1 during receive. + * This + "async_esc" - (AC + PC expansion) describe actual bytes over link. + * Includes PPP header and trailer. + * Doesn't count framing PPP_FLAG character. + * + * size2 -- The size after BSD decompression. PPP trailer was removed + * so packet should be at least 2 shorter than original. + * size3 -- The size after VJ decompression. + * + * + * OUTGOING: (very similar to incoming) + * first -- time packet arrived to pppwrite() or pppoutput() + * second -- time compression started + * third -- time compression ended + * fourth -- time first byte sent to interface + * fifth -- time last byte sent to interface + * + * (second - first) Time waiting in system before compression + * (third - second) Time for compression + * (fourth - third) Time waiting in system out queue waiting to be + * selected for sending to interface + * (fourth - first) Total system processing time + * (fifth-fourth) Total interface send time. + * (fifth-first) Total send time. + * + * size1 -- The size of the intial packet as receved from the stack + * size2 -- The size after VJ compression + * size3 -- The size after BSD compression + * + */ + struct timeval first, second, third, fourth, fifth; + unsigned async_esc, size1, size2, size3; + + int flags; /* info about packet */ +#define NBFLAG_INCOMING 0x01 /* else outgoing */ +#define NBFLAG_AC 0x02 /* Address compressed */ +#define NBFLAG_PC 0x04 /* Protocol Compressed */ +#define NBFLAG_VJC 0x08 /* VJ compressed */ +#define NBFLAG_CCP 0x10 /* BSD compressed */ +#define NBFLAG_CCPINC 0x20 /* BSD incompressible */ +#define NBFLAG_VJCINC 0x40 /* VJ incompressible */ + +} bpf_encapsulater; + +typedef struct _ppp_netbuf_t +{ + netbuf_t buffer; + netbuf_t orig_buffer; /* + * Original outgoing datagram + * received. We do compression and + * statistics gathering on buffer, + * we send buffer, but we return + * orig_buffer to BPF so that it doesn't + * have to understand all the compression. + */ + + + struct _ppp_netbuf_t *next; /* for linked list */ + + unsigned int size; /* original size requested for netbuf. + * We leave it up to caller to + * determine extra space they need. We + * may also include extra space we need + * for bounds checking. + */ + + unsigned char *wrapper, /* unaligned address returned for this containing + * structure. Used for freeing. + */ + + *init_offset; /* Init_offset is nb_map of the netbuf_t before + * user can change it around. Can check bounds + * against this. + */ + mark_t mark; + + bpf_encapsulater pktinfo; /* The size and compression stats that + * get passed to user level tcpdump + */ + +} *ppp_netbuf_t; + +/* + * These prototypes are identical to the corrisponding functions + * found in netbuf.h except they use the ppp_netbuf_t type. + */ + +extern ppp_netbuf_t cb_nb_alloc(unsigned size); +extern void cb_nb_free(ppp_netbuf_t nb); +extern void cb_nb_duplicate(ppp_netbuf_t from, ppp_netbuf_t to); +extern char * cb_nb_map(ppp_netbuf_t nb); +extern char * cb_nb_map_orig(ppp_netbuf_t nb); +extern unsigned cb_nb_size(ppp_netbuf_t nb); +extern unsigned cb_nb_size_orig(ppp_netbuf_t nb); +extern int cb_nb_shrink_top(ppp_netbuf_t nb, unsigned size); +extern int cb_nb_grow_top(ppp_netbuf_t nb, unsigned size); +extern int cb_nb_shrink_bot(ppp_netbuf_t nb, unsigned size); +extern int cb_nb_grow_bot(ppp_netbuf_t nb, unsigned size); +extern int cb_nb_read(ppp_netbuf_t nb, unsigned offset, unsigned size, void *target); +extern int cb_nb_write(ppp_netbuf_t nb, unsigned offset, unsigned size, void *source); +extern void cb_nb_get_mark(ppp_netbuf_t nb, mark_t *ptr); +extern void cb_nb_set_mark(ppp_netbuf_t nb, mark_t ptr); +extern void cb_nb_get_next(ppp_netbuf_t nb, ppp_netbuf_t *ptr); +extern void cb_nb_set_next(ppp_netbuf_t nb, ppp_netbuf_t ptr); +extern ppp_netbuf_t cb_nb_to_NB(netbuf_t); +extern netbuf_t cb_NB_to_nb(ppp_netbuf_t); + +#define NETBUF_T ppp_netbuf_t +#define NB_ALLOC cb_nb_alloc +#define NB_FREE cb_nb_free +#define NB_DUPLICATE cb_nb_duplicate +#define NB_MAP cb_nb_map +#define NB_MAP_ORIG cb_nb_map_orig +#define NB_SIZE cb_nb_size +#define NB_SIZE_ORIG cb_nb_size_orig +#define NB_SHRINK_TOP cb_nb_shrink_top +#define NB_GROW_TOP cb_nb_grow_top +#define NB_SHRINK_BOT cb_nb_shrink_bot +#define NB_GROW_BOT cb_nb_grow_bot +#define NB_READ cb_nb_read +#define NB_WRITE cb_nb_write +#define NB_GET_MARK cb_nb_get_mark +#define NB_SET_MARK cb_nb_set_mark +#define NB_GET_NEXT cb_nb_get_next +#define NB_SET_NEXT cb_nb_set_next +#define nb_TO_NB cb_nb_to_NB +#define NB_TO_nb cb_NB_to_nb + +#else /* NETBUF_PROXY */ + +#define NETBUF_T netbuf_t +#define NB_ALLOC ppp_nb_alloc +#define NB_FREE nb_free +#define NB_MAP nb_map +#define NB_SIZE nb_size +#define NB_SHRINK_TOP ppp_nb_shrink_top +#define NB_GROW_TOP ppp_nb_grow_top +#define NB_SHRINK_BOT nb_shrink_bot +#define NB_GROW_BOT nb_grow_bot +#define NB_READ nb_read +#define NB_WRITE nb_write +#define NB_GET_MARK nb_get_mark +#define NB_SET_MARK nb_set_mark +#define NB_GET_NEXT nb_get_next +#define NB_SET_NEXT nb_set_next +#define nb_TO_NB(nb) (nb) +#define NB_TO_nb(NB) (NB) + +#endif /* NETBUF_PROXY */ + struct qparms { u_char q_low, q_high, q_max; @@ -25,34 +211,34 @@ struct qparms { struct nb_queue { char *name; int low, high, max, len, dropped; - netbuf_t head, tail; + NETBUF_T head, tail; }; -typedef u_int mark_t; +#ifndef NETBUF_PROXY #define NB_EXTRA (sizeof(mark_t)+sizeof(netbuf_t)) static inline void nb_set_next(netbuf_t nb, netbuf_t ptr) { -if(nb) bcopy(&ptr,nb_map(nb)-sizeof(netbuf_t),sizeof(netbuf_t)); +if(nb) bcopy(&ptr,NB_MAP(nb)-sizeof(netbuf_t),sizeof(netbuf_t)); } static inline void nb_get_next(netbuf_t nb, netbuf_t *ptr) { -if(nb && ptr) bcopy(nb_map(nb)-sizeof(netbuf_t),ptr,sizeof(netbuf_t)); +if(nb && ptr) bcopy(NB_MAP(nb)-sizeof(netbuf_t),ptr,sizeof(netbuf_t)); } static inline void nb_set_mark(netbuf_t nb, mark_t ptr) { -if(nb) bcopy(&ptr,nb_map(nb)-NB_EXTRA,sizeof(mark_t)); +if(nb) bcopy(&ptr,NB_MAP(nb)-NB_EXTRA,sizeof(mark_t)); } static inline void nb_get_mark(netbuf_t nb, mark_t *ptr) { -if(nb && ptr) bcopy(nb_map(nb)-NB_EXTRA,ptr,sizeof(mark_t)); +if(nb && ptr) bcopy(NB_MAP(nb)-NB_EXTRA,ptr,sizeof(mark_t)); } static inline void @@ -60,11 +246,11 @@ ppp_nb_shrink_top(netbuf_t nb, unsigned int size) { netbuf_t ptr; mark_t mark; - nb_get_next(nb,&ptr); - nb_get_mark(nb,&mark); + NB_GET_NEXT(nb,&ptr); + NB_GET_MARK(nb,&mark); nb_shrink_top(nb,size); - nb_set_mark(nb,mark); - nb_set_next(nb,ptr); + NB_SET_MARK(nb,mark); + NB_SET_NEXT(nb,ptr); } static inline void @@ -72,13 +258,14 @@ ppp_nb_grow_top(netbuf_t nb, unsigned int size) { netbuf_t ptr; mark_t mark; - nb_get_next(nb,&ptr); - nb_get_mark(nb,&mark); + NB_GET_NEXT(nb,&ptr); + NB_GET_MARK(nb,&mark); nb_grow_top(nb,size); - nb_set_mark(nb,mark); - nb_set_next(nb,ptr); + NB_SET_MARK(nb,mark); + NB_SET_NEXT(nb,ptr); } + static inline netbuf_t ppp_nb_alloc(unsigned int size) { @@ -87,11 +274,12 @@ ppp_nb_alloc(unsigned int size) size+=NB_EXTRA; nb=nb_alloc(size); if(nb) { - nb_shrink_top(nb,NB_EXTRA); - nb_set_next(nb,NULL); - nb_set_mark(nb,0); + NB_SHRINK_TOP(nb,NB_EXTRA); + NB_SET_NEXT(nb,NULL); + NB_SET_MARK(nb,0); } return nb; } +#endif /* NETBUF_PROXY */ #endif /* __NBQ_H__ */ diff --git a/NeXT/ppp_tty.c b/NeXT/ppp_tty.c index 76aed49..18286a3 100644 --- a/NeXT/ppp_tty.c +++ b/NeXT/ppp_tty.c @@ -144,9 +144,17 @@ int ppptioctl __P((struct tty *tp, int cmd, void *data, int flag)); void pppinput __P((int c, struct tty *tp)); void pppstart __P((struct tty *tp)); +/* + * Must return an actual netbuf_t since other protocols + * use this to get our buffers. + */ netbuf_t pppgetbuf __P((netif_t)); + +/* + * Must accept an actual netbuf_t since others use this + * Procedure to access our output routine. + */ int pppoutput __P((netif_t ifp, netbuf_t m, void *arg)); -void pppintr __P((void *)); static u_int16_t pppfcs __P((u_int16_t fcs, u_char *cp, int len)); static void pppasyncstart __P((struct ppp_softc *)); @@ -159,19 +167,6 @@ void ppplogchar __P((struct ppp_softc *, int)); extern kern_server_t instance; -#ifdef ADD_ERRORS - -static int in_error_pkt_count = 0; /* Number of packets received */ -static int in_error_limit = -1; /* Insert error at this limit */ -static int in_error_max_sep = 50; /* Max range of random number */ - -static int out_error_pkt_count = 0; /* Number of packets sent */ -static int out_error_limit = -1; /* Insert error at this limit */ -static int out_error_max_sep = 50; /* Max range of random number */ - -#endif /* ADD_ERRORS */ - - /* * Does c need to be escaped? */ @@ -188,23 +183,23 @@ extern int ttymodem(struct tty*, int); extern int ttselect(struct tty *tp, int rw); -static netbuf_t +static NETBUF_T pppgetinbuf(netif_t ifp) { register struct ppp_softc *sc = &ppp_softc[if_unit(ifp)]; - netbuf_t nb; + NETBUF_T nb; int len = MAX(sc->sc_mru, PPP_MTU) + sizeof (struct ifnet *) + #ifdef VJC VJ_HDRLEN + #endif PPP_HDRLEN + PPP_FCSLEN; - nb = ppp_nb_alloc(len); + nb = NB_ALLOC(len); if (nb != NULL) { #ifdef VJC - ppp_nb_shrink_top(nb, VJ_HDRLEN + PPP_HDRLEN); + NB_SHRINK_TOP(nb, VJ_HDRLEN + PPP_HDRLEN); #else - ppp_nb_shrink_top(nb, PPP_HDRLEN); + NB_SHRINK_TOP(nb, PPP_HDRLEN); #endif } @@ -219,7 +214,7 @@ void pppfillfreeq(void *arg) { struct ppp_softc *sc = (struct ppp_softc *)arg; - netbuf_t nb; + NETBUF_T nb; volatile static int in = 0; if (in) @@ -229,14 +224,6 @@ pppfillfreeq(void *arg) while(!nbq_high(&sc->sc_freeq)) { nb = pppgetinbuf(sc->sc_if); if (! nb) break; -#if 0 - /* - * we no longer reset the length to 0 and then advance the - * packet length bit by bit; instead we write into it whenever - * we want, and at the end resize the packet before handing-off. - */ - nb_shrink_bot(nb, nb_size(nb)); -#endif nbq_enqueue(&sc->sc_freeq, nb); } @@ -279,7 +266,7 @@ pppopen(dev, tp) sc->sc_m = NULL; bzero(sc->sc_asyncmap, sizeof(sc->sc_asyncmap)); sc->sc_asyncmap[0] = 0xffffffff; - sc->sc_asyncmap[3] = 0x60000000; + sc->sc_asyncmap[3] = 0x60000000; /* 0x7D and 0x7E */ sc->sc_rasyncmap = 0; sc->sc_devp = (void *) tp; sc->sc_start = pppasyncstart; @@ -334,11 +321,11 @@ pppasyncrelinq(sc) s = splimp(); if (sc->sc_outm) { - nb_free(sc->sc_outm); + NB_FREE(sc->sc_outm); sc->sc_outm = NULL; } if (sc->sc_m) { - nb_free(sc->sc_m); + NB_FREE(sc->sc_m); sc->sc_m = NULL; } if (sc->sc_flags & SC_TIMEOUT) { @@ -357,12 +344,22 @@ pppread(tp, uio) struct uio *uio; { register struct ppp_softc *sc = (struct ppp_softc *)tp->t_sc; - netbuf_t m; + NETBUF_T m; register int s; int error = 0; + struct nty *np = ttynty(tp); + +#ifdef NEW_CLOCAL + if ((tp->t_state & TS_CARR_ON) == 0 && (np->t_pflags & TP_CLOCAL) == 0) + return 0; /* end of file */ + +#else if ((tp->t_state & TS_CARR_ON) == 0 && (tp->t_flags & CLOCAL) == 0) return 0; /* end of file */ + +#endif /* NEW_CLOCAL */ + if (sc == NULL || tp != (struct tty *) sc->sc_devp) return 0; s = splimp(); @@ -371,16 +368,7 @@ pppread(tp, uio) splx(s); return (EWOULDBLOCK); } -#if 0 - /* NetBSD version... */ - error = ttysleep(tp, (caddr_t)&tp->t_rawq, TTIPRI|PCATCH, ttyin, 0); - if (error) { - splx(s); - return error; - } -#else sleep((caddr_t)&tp->t_rawq, TTIPRI); -#endif } if (tp->t_line != PPPDISC) { splx(s); @@ -398,8 +386,8 @@ pppread(tp, uio) IOLogDbg("Read didn't get a buffer at %s %d\n", __FILE__, __LINE__); return -1; } - error = uiomove(nb_map(m), nb_size(m), UIO_READ, uio); - nb_free(m); + error = uiomove(NB_MAP(m), NB_SIZE(m), UIO_READ, uio); + NB_FREE(m); return (error); } @@ -412,12 +400,23 @@ pppwrite(tp, uio) struct uio *uio; { register struct ppp_softc *sc = (struct ppp_softc *)tp->t_sc; - netbuf_t m; + NETBUF_T m; struct sockaddr dst; int len, error; + struct nty *np = ttynty(tp); + +#ifdef NEW_CLOCAL + + if ((tp->t_state & TS_CARR_ON) == 0 && (np->t_pflags & TP_CLOCAL) == 0) + return 0; /* wrote 0 bytes */ + +#else if ((tp->t_state & TS_CARR_ON) == 0 && (tp->t_flags & CLOCAL) == 0) return 0; /* wrote 0 bytes */ + +#endif /* NEW_CLOCAL */ + if (tp->t_line != PPPDISC) return (EINVAL); if (sc == NULL || tp != (struct tty *) sc->sc_devp) @@ -425,23 +424,25 @@ pppwrite(tp, uio) if (uio->uio_resid > if_mtu(sc->sc_if) + PPP_HDRLEN || uio->uio_resid < PPP_HDRLEN) return (EMSGSIZE); - m = pppgetbuf(sc->sc_if); + m = nb_TO_NB(pppgetbuf(sc->sc_if)); + if (m == NULL){ if (sc->sc_flags & SC_DEBUG) IOLogDbg("No buffers available for user level write()\n"); return(ENOBUFS); } - ppp_nb_grow_top(m, PPP_HDRLEN); + NB_GROW_TOP(m, PPP_HDRLEN); len = uio->uio_resid; - if (error = uiomove(nb_map(m), nb_size(m), UIO_WRITE, uio)) { - nb_free(m); + if (error = uiomove(NB_MAP(m), NB_SIZE(m), UIO_WRITE, uio)) { + NB_FREE(m); return error; } - nb_shrink_bot(m, nb_size(m) - len); + NB_SHRINK_BOT(m, NB_SIZE(m) - len); dst.sa_family = AF_UNSPEC; bcopy(mtod(m, u_char *), dst.sa_data, PPP_HDRLEN); - ppp_nb_shrink_top(m, PPP_HDRLEN); - return (pppoutput(sc->sc_if, m, &dst)); + + NB_SHRINK_TOP(m, PPP_HDRLEN); + return (pppoutput(sc->sc_if, NB_TO_nb(m), &dst)); } /* @@ -467,34 +468,22 @@ ppptioctl(tp, cmd, data, flag) case PPPIOCSASYNCMAP: if (! suser()) return EPERM; -#if 0 - IOLogDbg("ppp%d: set async map to 0x%08x\n", if_unit(sc->sc_if), - *(u_long *)data); -#endif + sc->sc_asyncmap[0] = *(u_int *)data; break; case PPPIOCGASYNCMAP: *(u_int *)data = sc->sc_asyncmap[0]; -#if 0 - IOLogDbg("ppp%d: asyncmap gets 0x%x\n", if_unit(sc->sc_if), *(u_int *)data); -#endif break; case PPPIOCSRASYNCMAP: if (! suser()) return EPERM; sc->sc_rasyncmap = *(u_int *)data; -#if 0 - IOLogDbg("ppp%d: setting rasyncmap 0x%x\n", if_unit(sc->sc_if), sc->sc_rasyncmap); -#endif break; case PPPIOCGRASYNCMAP: *(u_int *)data = sc->sc_rasyncmap; -#if 0 - IOLogDbg("ppp%d: rasyncmap gets 0x%x\n", if_unit(sc->sc_if), *(u_int *)data); -#endif break; case PPPIOCSXASYNCMAP: @@ -510,9 +499,6 @@ ppptioctl(tp, cmd, data, flag) case PPPIOCGXASYNCMAP: bcopy(sc->sc_asyncmap, data, sizeof(sc->sc_asyncmap)); -#if 0 - IOLogDbg("ppp%d: xasyncmap gets 0x%x/0x%x/0x%x/0x%x\n", if_unit(sc->sc_if), ((u_int *)data)[0], ((u_int *)data)[1], ((u_int *)data)[2], ((u_int *)data)[3]); -#endif break; default: @@ -626,12 +612,22 @@ pppstart(tp) register struct tty *tp; { register struct ppp_softc *sc = (struct ppp_softc *) tp->t_sc; - register netbuf_t m; + register NETBUF_T m; register int len; register u_char *start, *stop, *cp; int n, ndone, done, idle; + struct nty *np = ttynty(tp); + +#ifdef NEW_CLOCAL + + if ((tp->t_state & TS_CARR_ON) == 0 && (np->t_pflags & TP_CLOCAL) == 0 + +#else + + if ((tp->t_state & TS_CARR_ON) == 0 && (tp->t_flags & CLOCAL) == 0 + +#endif /* NEW_CLOCAL */ - if ((tp->t_state & TS_CARR_ON) == 0 && (tp->t_flags & CLOCAL) == 0 || sc == NULL || tp != (struct tty *) sc->sc_devp) { if (tp->t_oproc != NULL) (*tp->t_oproc)(tp); @@ -670,44 +666,23 @@ pppstart(tp) } /* Calculate the FCS for the first netbuf's worth. */ - sc->sc_outfcs = pppfcs(PPP_INITFCS, mtod(m, u_char *), nb_size(m)); + sc->sc_outfcs = pppfcs(PPP_INITFCS, mtod(m, u_char *), NB_SIZE(m)); sc->sc_outfcs ^= 0xffff; - -#ifdef ADD_ERRORS - /* - * This section will adds random errors to - * outgoing packets. - */ - - if (out_error_limit == -1) /* Initial time through */ - { - out_error_limit = rand() % out_error_max_sep; - IOLog("Introducing outgoing random error after %d more packets\n", - out_error_limit); - } - - if (out_error_pkt_count >= out_error_limit) - { - sc->sc_outfcs ^= 0x99; /* Munge with some noise */ - out_error_pkt_count = 0; - out_error_limit = rand() % out_error_max_sep; - IOLog("Introducing outgoing random error after %d more packets\n", - out_error_limit); - } - else - ++out_error_pkt_count; - - -#endif /* ADD_ERRORS */ - - cp = mtod(m, u_char *) + nb_size(m); - nb_grow_bot(m, PPP_FCSLEN); + + cp = mtod(m, u_char *) + NB_SIZE(m); + NB_GROW_BOT(m, PPP_FCSLEN); *cp++ = sc->sc_outfcs & 0xFF; *cp++ = (sc->sc_outfcs >> 8) & 0xFF; } +#ifdef NETBUF_PROXY + m->pktinfo.fourth.tv_sec = time.tv_sec; + m->pktinfo.fourth.tv_usec = time.tv_usec; +#endif + + start = mtod(m, u_char *); - len = nb_size(m); + len = NB_SIZE(m); stop = start + len; while (len > 0) { /* @@ -717,9 +692,16 @@ pppstart(tp) for (cp = start; cp < stop; cp++) if (ESCAPE_P(*cp)) break; + n = cp - start; + if (n) { - /* NetBSD (0.9 or later), 4.3-Reno or similar. */ + /* + * b_to_q returns the number of characters + * _not_ sent + * + * NetBSD (0.9 or later), 4.3-Reno or similar. + */ ndone = n - b_to_q(start, n, &tp->t_outq); len -= ndone; start += ndone; @@ -727,6 +709,7 @@ pppstart(tp) if (ndone < n) break; /* packet doesn't fit */ + } /* @@ -744,6 +727,9 @@ pppstart(tp) sc->sc_bytessent += 2; start++; len--; +#ifdef NETBUF_PROXY + ++(m->pktinfo.async_esc); +#endif } } /* @@ -753,7 +739,7 @@ pppstart(tp) if (!done) { /* remember where we got to */ - ppp_nb_shrink_top(m, start - mtod(m, u_char *)); + NB_SHRINK_TOP(m, start - mtod(m, u_char *)); break; /* can't do any more at the moment */ } @@ -762,13 +748,39 @@ pppstart(tp) * We make the length zero in case the flag * cannot be output immediately. */ - ppp_nb_shrink_top(m, nb_size(m)); + NB_SHRINK_TOP(m, NB_SIZE(m)); if (putc(PPP_FLAG, &tp->t_outq)) break; sc->sc_bytessent++; + +#ifdef NETBUF_PROXY + m->pktinfo.fifth.tv_sec = time.tv_sec; + m->pktinfo.fifth.tv_usec = time.tv_usec; +#endif + + +#if defined(NBPFILTER) && defined(NETBUF_PROXY) + + /* + * See if bpf wants to look at the packet. Gotta be careful + * here because BPF want the uncompressed packet. For now we + * stash a copy that we hand off. In the future, we may try + * to modify BPF to handle compressed packets instead. + * + * The BPF process point will not work for + * non-NETBUF_PROXY points. In this case, we hand the packet + * to BPF earlier in the process (see if_ppp.c). + * + */ + + if (sc->sc_bpf) + bpf_tap(sc->sc_bpf, m, 0); + +#endif + /* Finished with this netbuf; free it and move on. */ - nb_free(m); + NB_FREE(m); m = NULL; incr_cnt(sc->sc_if, if_opackets); @@ -831,7 +843,7 @@ pppgetm(sc) * hand-shake is lock-step (ie. single packet). */ if (sc->sc_m != NULL) - nb_free(sc->sc_m); + NB_FREE(sc->sc_m); sc->sc_m = nbq_dequeue(&sc->sc_freeq); splx(s); } @@ -861,9 +873,10 @@ ppprend(cp, n, tp) { #ifndef OPTIMIZE_PPPREND +#warning PPPREND Not optimized!!! while (n--) pppinput((u_char) *cp++, tp); #else -#warning OPTIMIZE_PPPREND in effect + register struct ppp_softc *sc = (struct ppp_softc *)tp->t_sc; register int ret; @@ -896,39 +909,40 @@ ppprend(cp, n, tp) while(--n); } else if (sc->sc_ilen > 3 && - (nb_size(sc->sc_m) - sc->sc_ilen) > n && - *cp != PPP_FLAG && - *cp != PPP_ESCAPE) /* Dont really handle escapes properly...should */ + (NB_SIZE(sc->sc_m) - sc->sc_ilen) > n && + *cp != PPP_FLAG && + *cp != PPP_ESCAPE) /* Dont really handle escapes properly...should */ { - unsigned char* cp1 = cp; - if (sc->sc_flags & SC_ESCAPED) + unsigned char* cp1 = cp; + if (sc->sc_flags & SC_ESCAPED) { - sc->sc_flags &= ~SC_ESCAPED; - *cp ^= PPP_TRANS; - } - - do + sc->sc_flags &= ~SC_ESCAPED; + *cp ^= PPP_TRANS; + } + + do { - sc->sc_fcs = PPP_FCS(sc->sc_fcs, *(cp++)); - if (sc->sc_flags & SC_LOG_RAWIN) - ppplogchar(sc, *cp); - + sc->sc_fcs = PPP_FCS(sc->sc_fcs, *(cp++)); + if (sc->sc_flags & SC_LOG_RAWIN) + ppplogchar(sc, *cp); + } while(--n && *cp != PPP_FLAG && *cp != PPP_ESCAPE); - - - bcopy(cp1, sc->sc_mp, (cp-cp1)); - - sc->sc_bytesrcvd += (cp - cp1); - sc->sc_ilen += (cp-cp1); - sc->sc_mp += (cp-cp1); + + + bcopy(cp1, sc->sc_mp, (cp-cp1)); + + sc->sc_bytesrcvd += (cp - cp1); + sc->sc_ilen += (cp-cp1); + sc->sc_mp += (cp-cp1); + } - else + else { - --n; - pppinput(*(cp++), tp); + --n; + pppinput(*(cp++), tp); } } - + #endif /* OPTIMIZE_PPPREND */ } @@ -946,7 +960,7 @@ pppinput(c, tp) register struct tty *tp; { register struct ppp_softc *sc; - netbuf_t m; + NETBUF_T m; int ilen, s; sc = (struct ppp_softc *) tp->t_sc; @@ -978,6 +992,8 @@ pppinput(c, tp) if (c == PPP_FLAG) { + if (sc->sc_ilen == 0) + return; ilen = sc->sc_ilen; sc->sc_ilen = 0; @@ -985,37 +1001,6 @@ pppinput(c, tp) if (sc->sc_rawin_count > 0) ppplogchar(sc, -1); -#ifdef ADD_ERRORS - /* - * This section will adds random packet - * errors if defined. - */ - - /* - * Initial time through - */ - if (in_error_limit == -1) - { - in_error_limit = rand() % in_error_max_sep; - IOLog("Introducing incoming random error after %d more packets\n", - in_error_limit); - } - - if ((in_error_pkt_count >= in_error_limit) && (ilen != 0)) - { - sc->sc_fcs = !PPP_GOODFCS; - in_error_pkt_count = 0; - in_error_limit = rand() % in_error_max_sep; - IOLog("Introducing incoming random error after %d more packets\n", - in_error_limit); - } - - if (ilen != 0) - ++in_error_pkt_count; - - -#endif /* ADD_ERRORS */ - /* * From the RFC: * Each Control Escape octet is also @@ -1025,32 +1010,45 @@ pppinput(c, tp) * So, if SC_ESCAPED is set, then we've seen the packet * abort sequence "}~". */ - - if (sc->sc_flags & (SC_FLUSH | SC_ESCAPED) - || ilen > 0 && sc->sc_fcs != PPP_GOODFCS) { + if ((sc->sc_flags & (SC_FLUSH | SC_ESCAPED)) || + ((ilen > 0) && (sc->sc_fcs != PPP_GOODFCS))) + { sc->sc_flags |= SC_PKTLOST; /* note the dropped packet */ - if ((sc->sc_flags & (SC_FLUSH | SC_ESCAPED)) == 0){ - IOLogDbg("ppp%d: bad fcs 0x%04x\n", if_unit(sc->sc_if), sc->sc_fcs); + if ((sc->sc_flags & (SC_FLUSH | SC_ESCAPED)) == 0) + { + IOLog("ppp%d: bad fcs 0x%04x\n", if_unit(sc->sc_if), sc->sc_fcs); incr_cnt(sc->sc_if, if_ierrors); - } else + } + else + { + IOLog("ppp%d: bad packet flushed...\n", if_unit(sc->sc_if)); sc->sc_flags &= ~(SC_FLUSH | SC_ESCAPED); + } return; - } - - if (ilen < PPP_HDRLEN + PPP_FCSLEN) { - if (ilen) { + } + + if (ilen < (PPP_HDRLEN + PPP_FCSLEN)) + { + if (ilen) + { IOLogDbg("ppp%d: too short (%d)\n", if_unit(sc->sc_if), ilen); incr_cnt(sc->sc_if, if_ierrors); sc->sc_flags |= SC_PKTLOST; - } + } return; - } + } + +#ifdef NETBUF_PROXY + sc->sc_m->pktinfo.second.tv_sec = time.tv_sec; + sc->sc_m->pktinfo.second.tv_usec = time.tv_usec; + sc->sc_m->pktinfo.size1 = ilen; +#endif /* * Remove FCS trailer. Set packet length... */ ilen -= PPP_FCSLEN; - nb_shrink_bot(sc->sc_m, nb_size(sc->sc_m) - ilen); + NB_SHRINK_BOT(sc->sc_m, NB_SIZE(sc->sc_m) - ilen); /* excise this netbuf */ m = sc->sc_m; @@ -1078,7 +1076,6 @@ pppinput(c, tp) * removed, and the following octet is exclusive-or'd with hexadecimal * 0x20, unless it is the Flag Sequence (which aborts a frame). */ - if (c < 0x20 && (sc->sc_rasyncmap & (1 << c))) { return; } @@ -1088,7 +1085,9 @@ pppinput(c, tp) c ^= PPP_TRANS; } else if (c == PPP_ESCAPE) { sc->sc_flags |= SC_ESCAPED; -/* splx(s); */ +#ifdef NETBUF_PROXY + ++(sc->sc_m->pktinfo.async_esc); +#endif return; } @@ -1102,6 +1101,7 @@ pppinput(c, tp) * Fourth octet is second octet of protocol. */ if (sc->sc_ilen == 0) { + /* reset the input netbuf */ if (sc->sc_m == NULL) { pppgetm(sc); @@ -1118,6 +1118,12 @@ pppinput(c, tp) m = sc->sc_m; sc->sc_mp = mtod(m, char *); sc->sc_fcs = PPP_INITFCS; + +#ifdef NETBUF_PROXY + m->pktinfo.first.tv_sec = time.tv_sec; + m->pktinfo.first.tv_usec = time.tv_usec; + m->pktinfo.flags |= NBFLAG_INCOMING; +#endif if (c != PPP_ALLSTATIONS) { if (sc->sc_flags & SC_REJ_COMP_AC) { IOLogDbg("ppp%d: garbage received: 0x%02x (need 0x%02x)\n", @@ -1127,18 +1133,28 @@ pppinput(c, tp) *sc->sc_mp++ = PPP_ALLSTATIONS; *sc->sc_mp++ = PPP_UI; sc->sc_ilen += 2; +#ifdef NETBUF_PROXY + m->pktinfo.flags |= NBFLAG_AC; +#endif } } + + if (sc->sc_ilen == 1 && c != PPP_UI) { IOLogDbg("ppp%d: missing UI (0x%02x), got 0x%02x\n", if_unit(sc->sc_if), PPP_UI, c); goto flush; } + if (sc->sc_ilen == 2 && (c & 1) == 1) { /* a compressed protocol */ *sc->sc_mp++ = 0; sc->sc_ilen++; +#ifdef NETBUF_PROXY + m->pktinfo.flags |= NBFLAG_PC; +#endif } + if (sc->sc_ilen == 3 && (c & 1) == 0) { IOLogDbg("ppp%d: bad protocol %x\n", if_unit(sc->sc_if), (sc->sc_mp[-1] << 8) + c); diff --git a/NeXT/vjcompress.c b/NeXT/vjcompress.c index 0a0a29a..cbbab89 100644 --- a/NeXT/vjcompress.c +++ b/NeXT/vjcompress.c @@ -26,16 +26,16 @@ */ /* - * This version is used under SunOS 4.x, DEC Alpha OSF/1, AIX 4.x, + * This version is used under SunOS 4.x, Digital UNIX, AIX 4.x, * and SVR4 systems including Solaris 2. * - * $Id: vjcompress.c,v 1.2 1996/05/24 07:04:06 paulus Exp $ + * $Id: vjcompress.c,v 1.3 1997/04/30 05:39:44 paulus Exp $ */ #include #include -#ifdef __svr4__ +#ifdef SVR4 #ifndef __GNUC__ #include /* for ntohl, etc. */ #else @@ -49,7 +49,7 @@ #endif #include -#ifdef __aix4__ +#ifdef AIX4 #define _NETINET_IN_SYSTM_H_ typedef u_long n_long; #else @@ -430,8 +430,9 @@ vj_uncompress_err(comp) * "Uncompress" a packet of type TYPE_UNCOMPRESSED_TCP. */ int -vj_uncompress_uncomp(buf, comp) +vj_uncompress_uncomp(buf, buflen, comp) u_char *buf; + int buflen; struct vjcompress *comp; { register u_int hlen; diff --git a/README.NeXT b/README.NeXT index d13cab1..519f43f 100644 --- a/README.NeXT +++ b/README.NeXT @@ -1,405 +1,46 @@ # -# $Id: README.NeXT,v 1.2 1995/12/18 03:29:36 paulus Exp $ +# $Id: README.NeXT,v 1.3 1997/04/30 05:37:02 paulus Exp $ # -This distribution contains a port of PPP-2.2 for NeXT. The full +This distribution contains a port of PPP-2.3 for NeXT. The full source code is available as well as an MAB installer package. Since this project is a continuing effort, you are encouraged to check out -the WWW page to see if you have the latest software. This is -especially true if you find you have problems with the version you -presently use. For more information on the NeXT PPP port see: +the "PPP-2.3 for NeXTSTEP" web page to see if you have the latest +software. This is especially true if you find you have problems with +the version you presently use. The web site contains a comprehensive +NeXT specific FAQ, mailing list information, and a bug submission +form. Please see: + http://www.thoughtport.com:8080/PPP/ -or- ftp://ftp.thoughtport.com/pub/next/ppp/ -For more information on PPP in general, you might want to check out: - http://cs.uni-bonn.de/ppp/faq.html - -and- - ftp://morningstar.com/pub/papers/ppp-white-paper.ps.gz - -and- - http://www.cis.ohio-state.edu/hypertext/faq/usenet/pdial/faq.html - (This last is a list of internet providers) - - -See the file ./README for general information regarding PPP-2.2 for - all computer systems. -See the file ./SETUP for general setup information for all computer systems. -See the file ./NeXT/INSTALL for NeXT Specific installation instructions. -See the file ./NeXT/README.NeXT for bugs. - -New to release 0.4.6 (LKS version 4.14) -======================================= - - * Added a kernel optimization that will reduce the - interrupt load on the CPU. This optimization will - only work if you use the latest serial drivers supplied - by NeXT. You can get these drivers off of NeXTAnswers. - The optimization will not work if you use the Mux serial - driver. I believe that this optimization will solve many - of the kernel panics that people have reported. - - * Added support for Microsoft's extended DNS negotiation. - This will only be of use for people who server PPP clients - using Win95, TechSmith Corporation's Foray PPP client - (http://www.techsmith.com) for WFWG 3.11, or others whose - client supports this mechanism. Thanks to - clameter@hur.fuller.edu (Christoph Lameter) for supplying the - patches. This patch is totally untested since I don't serve - any clients, and if I did I wouldn't admit to running a - MicroSloth operating system. - - * Various minor fixes to documentation and examples. - - -New to release 0.4.5 (LKS version 4.9 release1) -====================================== - - * This release is based on the third beta release of - PPP-2.2 (ppp-2.2b3.tar.gz) by Paul Mackerras. It will - probably be the version released along with PPP-2.2. - - * Some enhancements to the Example ip-up and ip-down - scripts. - - * Several documentation enhancements to support the - actual release. - - * Removed the new locking code. Temporarily, we continue - to rely on the old mechanism. - - * This program runs on Intel, Moto, and Sparc. It apparently - runs fine on HP until shutdown. Then there appear to be problems. - Due to time constraints, this will have to be corrected as a patch. - As usual, this will be available on ftp.thoughtport.com:/pub/next/ppp/. - - -New to release 0.4.4 (LKS version 4.5) -====================================== - - * The netbuf queueing mechanism was significantly - simplified. It is hoped that some HP memory - alignment problems were also solved. This may - help solve some of the mysterious panics others have - seen. - - * A new locking mechanism was implemented that - may simplify the spl() calls. - - * Memory allocation in BSD Compress code was cleaned up in - an attempt to solve HP alignment problems. - - * Thanks go to Pete French for all the - above modifications - -New to release 0.4.3 (LKS version 4.4) -====================================== - - * This release fixes some problems regarding - HP and SPARC support. It is said to now run - on Sparc. I would hope HP also but havn't heard - yet. Thanks to Dave Hess - for finding the problems for Sparc. - - * Minor documentation fixes. - - -New to release 0.4.0 (LKS version 4.1 - summerb2) -================================================= - - * This release is based on the second beta release - of PPP-2.2 (ppp-2.2b2). - - * The default chat is now the one supplied in the beta - PPP release. This chat will compile fine using Dev 3.3. - However, if you are running Dev 3.2, you will not be able - to compile the default chat (POSIX problems). In this case, - you may use the old chat (renamed as ./chat/chat.c.3.2). - - - -New to release 0.4.0 (LKS version 4.0 - summerb1) -================================================= - - * This release is based on the first beta release - of PPP-2.2 (ppp-2.2b1). - - * Chat was updated in the new beta. However, because - of broken posix functionality under NeXTSTEP (3.2) it - will not compile properly. Therefore, the old chat - is being used. The newer chat is backed up as - ./chat/chat.c.orig. Those with Dev 3.3 may wish to - try to compile to see if the posix problems were fixed. - - * Support for the Microsoft Call Back Configuration Protocol. - See the file ./README.cbcp. - - - -New to release 0.3.0 (LKS version 3.0 - summera51) -===================================== - - * This release is the first to be based on the fifth alpha - release of PPP-2.2 (ppp-2.2a5). - - * Major kernel revision. This release attempts to merge - the LKS written by Perkins and that written by Prindeville/French. - The hope is that this new merged kernel will allow us to maintain - one set of sources. This kernel, or a variant thereof, will - probably be the one that is released with the PPP-2.2 beta - distribution. - - * Fixed a bug that caused problems with NXFax's capability - to determine port usage. - - * Added support for the Berkley Packet Filter (BPF) and tcpdump. - Use of BPF requires special installation instructions. See - the installation file for more info. - - * Fixed a header include problem that kept sources from compiling - under NS 3.3 Dev. for m68k. *Sigh* I guess support for m68k - continues to falter... :( - - * Officially changed the name of the log file from: - /usr/adm/ppp2.2.debug - -to- - /usr/adm/ppp2.2.log - If you are upgrading, you should change the name of the file - in /etc/syslog.conf. Remember to watch out for the tab character - and remember to create the initial file. For more information see - ./NeXT/INSTALL. - - This change was done so that the file could be opened from the - workspace. There was a naming conflict with the .debug extension. - Note also, that this name is a bit different than that suggested in - the ./SETUP file. - - * Fixed a problem with the pppd option 'local'. - -As part of a5: - - * Fixed a bug in pppd that would allow service (under some circumstances) - to peers who refuse to authenticate. - - * Fixed a bug with CCP negotiation. - - * Fixed a bug that caused negotation with an NT RAS PPP server to fail. - - -New to release 1.9 (LKS version 2.1) -===================================== - - * Support for NS Sparc has been added. Sparc users note, the SUN - serial driver in the pre-release was not very robust at high speeds. - This has been fixed for the final release. This could cause problems - with testing on Sparc. Low bps rates should be OK...like 2400 to - maybe 9600 with low system activity. Thanks go to - John Landwehr for this work. - - * Fixed a nasty little bug that degraded performance of multiple - interfaces on Intel systems. - - * Added support for IP address filtering. This allows - detection and prevetion of IP address spoofing. Check out - the new ./pppexclude directory. Thanks to - Lawrence E. Freil for this code. - - * More support for multiple ppp connections to different - hosts. Check out ./Examples/ppp_multiple_hosts.tar.gz. - Thanks to Jonathan Adams for this - code. - - * Modified lock file for better UUCP interaction. Special - thanks to Kim Shrier for this code. +If you use this software and are pleased with its performance, you are +encouraged to make a donation to support continued development. 50% +of all donations go to charity. For more information, please see: + http://www.thoughtport.com:8080/PPP/donations.html - * Fixed the new 3.3 multicast warning. - * Improved installation documentation. +The subdirectory NeXT contains several files of interest: + INSTALL - A file giving specific directions for installing + ppp-2.3 on a NeXT computer. -New to release 1.8 (LKS version 1.3) -===================================== + Examples - This directory provides more examples of + scripts and other helpful utilities. - * Moved to ppp-2.2a4, the fourth alpha release - from Paul Mackerras . + MailBug.app - This application is similar to BugNeXT. It will + allow you to submit bugs electronically. + Many thanks to Running-Start, Inc. for this program. + The WWW page also has a bug submission form. - * Fixed a bug that I introduced in 1.7 that could cause - kernel panics when BSD compression was used in conjunction - with VJ header compression. + NeXT_Version - This file describes what NeXT specific version of + PPP-2.3 you have. - * LKS Numbering Scheme changed (due to my screwup with a4 and CVS). + ChangeLog.rtf - A history of development and bug fixes for ppp-2.3. - * Removed support for extra pppd option 'usepty'. Can be done - with an external program if desired. + TODO.NeXT - A wishlist for features. - * Included the old modified pppstats.c that shows compression - statistics. - -New to release 1.7 (LKS version 1.31) -===================================== - - * Moved packet compression outside the interrupt handler. - Previously, only packet decompression was done outside. - - * Made many enhancements as suggested by Paul Mackerras. - - * Fixed a bug that sometimes caused "bad fcs" errors to panic - the machine. - - * Fixed a problem that caused NFS traffic to force - compression to exit (and sometimes hang NFS). - NFS traffic works properly now (regardless of the buffer size - set via the NFSManager.app). - - * Fixed a timeout problem in pppd that could sometimes cause - negotiations to loop endlessly. This fix should eventually make - it into ppp2.2a4. - - * Split code into multiple files for better organization. - - * Fixed pppstats to show compression ratios on the proper - side. Left side is for incoming packets and right side is - for outgoing packets. - - * Added some suggested enhancements to - pppd. These suggestions were brought up - on the ports mailing list and will probably - be included in ppp2.2a4. I added them for - the interrim. They basically involve better permissions - for running the ip-up and ip-down scripts. They are now run - as the effective user-id of pppd. So if you run pppd suid, - root, then ip-up and ip-down are run as root. - - * Corrected several minor documentation problems. - - -New to release 1.6 (LKS version 1.24) -===================================== - - * Added support for HP-PA systems. Many thanks go to - Alain Fauconnet for his efforts in this - work. - - * Added further performance enhancements to the LKS. This resulted - in fewer "silo overflows", and thus dropped packets, when operating - at high speed (>= 38.4KBS) sustained bidirectional transfers over - multiple interfaces. - - * Updated the installation instructions. - - -New to release 1.5 (LKS version 1.22) -===================================== - - * Not a real release. Used for distributing - tests to HPPA users. - - -New to release 1.4 (LKS version 1.18) -===================================== - - * Fixed problem that delayed many PPP protcol packets from timely - delivery to pppd. - - * Added compression statistics support for pppstats. - - * Cleaned up processor priority levels. - - * Added better support for netbuf queue monitoring. - - -New to release 1.3 (LKS version 1.16) -===================================== - - * At compile time, you have the option to decompress VJ/BSD - packets either inside or outside the interrupt handler. - See the DECOMP_OUT flag in ./NeXT/Makefile. The old - functionality was to do the work inside the interrupt - handler. It is probably more appropriate to do it - outside. Thanks to Pete French for - discussion on this topic. - - * Added initial support for operation over pseudo - ttys. See the USEPTY flag in ./pppd/Makefile.NeXT. - This adds a new option to pppd, "usepty ". - If this option is used, pppd will fire up an rlogin - session to . You may then use chat as normal - to start the remote ppp. Thereafter, the packets flow - over the rlogin session. This may potentially be used - to start a new ppp session over an open ppp session. - - * Added enhancements and changes suggested for ppp-2.2a3. - This includes some fixes to the BSD compression code - that caused it to turn off compression inappropriately - under error conditions. - - * Patched pppd to better support code that sleeps but never - wakes in ip-up scripts. Thanks to longyear@netcom.com - (Al Longyear) and Bill Hay . - - * Did more verification with the full version of NXFAX installed. - Seems to work flawlessly! Thanks to Rick Damon - at Black and White for his help in the matter. - - * Added a new 'Examples' directory to the hierarchy. This - will become a collecting place for user info. - - - -New to release 1.2 (LKS version 1.13) -===================================== - - * The system now supports BSD Packet compression using the new CCP. - Of course, both ends must negotiate this option. - - -New to release 1.1 -================== - - * The system now works with the MuX serial driver V1.5. Probably - version 1.4 also. No changes need to be made to the MuX buffer - (and DOUBLE_BUFFER) values. - - * The system now works when NXFax is installed. - - * There have been some internal optimizations for those - who use the NeXT supplied serial drivers. - - -New to release 1.0 -================== - - * On Intel systems, some ioctl calls did not return the proper value. - This turned out to be a bug in the OS. A true workaround has been - implemented. The ioctl return value macro is now only used to - check for return value errors. Flags are now correctly set without - the macro. - - * Multiple interfaces now work properly. The ioctl fix above solved - the problem of a second interface "stealing" the first interface. - - * lcp-echo-failure works. - - * We are now using the default pppstats. This was modified to - use an ioctl to get information. One less program we have to - support. pppstats no longer requires the SUID bit or the loadable. - - * We are now using the default VJ compression code. Another - file we do not have to support. - - * PPP-2.2 uses a new mechanism for determining when to kill pppd. - This should solve the process group problems we have been - experiencing. - - * Compression is not yet implemented. This release should give you - the same (but more stable) functionality as the ppp-2.1.2 release. - - - -For problems, please mail nextppp@listproc.thoughtport.com. Make -sure you read the TROUBLESHOOTING section in ./NeXT/INSTALL so that -you send all the appropriate information. Further, there is an -extensive FAQ available at: - http://www.thoughtport.com:8080/PPP/ -- 2.39.2