summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/modem.c
diff options
context:
space:
mode:
authordfr <dfr@FreeBSD.org>1996-01-30 11:08:50 +0000
committerdfr <dfr@FreeBSD.org>1996-01-30 11:08:50 +0000
commit9b03b51375fbd478d56013fc1ed71225a8e90176 (patch)
treed62d7ad9c96e7d604dc6e27cd8519049718a6def /usr.sbin/ppp/modem.c
parentb2ad84f5ce4ebeb44b8e31628cc9c8040c1a2a29 (diff)
downloadFreeBSD-src-9b03b51375fbd478d56013fc1ed71225a8e90176.zip
FreeBSD-src-9b03b51375fbd478d56013fc1ed71225a8e90176.tar.gz
Some patches to ppp which improve stability. I have been running a
ppp based on these patches for about 3 weeks with no downtime. The original submitters comments: Two features iijppp has over kernel ppp that I like are predictor1 compression and demand dialing. Here are a few bug fixes. I expanded the priority queueing scheme and discovered it was broken due to the assignment at ip.c line 300. All packets were being queued at the same priority. Fixing priority queueing broke predictor1 compression. Packets were compressed before being queued and predictor1 worked as long as the packets were popped off the queue in the same order they were pushed onto the queue. There were a few byte order problems in IP header tests also. There is a recursion problem in SendLqrReport(). LcpClose() is called when "Too many echo packets are lost" which winds up in SendLqrReport() again. I believe the original intention was to just stop the LQR timer with the call to StopLqr() but the side effects hurt. Submitted by: John Capo <jc@irbs.com>
Diffstat (limited to 'usr.sbin/ppp/modem.c')
-rw-r--r--usr.sbin/ppp/modem.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/usr.sbin/ppp/modem.c b/usr.sbin/ppp/modem.c
index 020da90..9e7808c 100644
--- a/usr.sbin/ppp/modem.c
+++ b/usr.sbin/ppp/modem.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: modem.c,v 1.10 1996/01/10 21:27:55 phk Exp $
+ * $Id: modem.c,v 1.11 1996/01/11 17:48:54 phk Exp $
*
* TODO:
*/
@@ -30,6 +30,7 @@
#include <time.h>
#include "hdlc.h"
#include "lcp.h"
+#include "ip.h"
#include "modem.h"
#include "vars.h"
@@ -53,9 +54,11 @@ extern void PacketMode();
#define Online (mbits & TIOCM_CD)
static struct mbuf *modemout;
-static struct mqueue OutputQueues[PRI_URGENT+1];
+static struct mqueue OutputQueues[PRI_LINK+1];
static int dev_is_modem;
+#undef QDEBUG
+
void
Enqueue(queue, bp)
struct mqueue *queue;
@@ -627,6 +630,10 @@ int count;
bp = mballoc(count, MB_MODEM);
bcopy(ptr, MBUF_CTOP(bp), count);
+
+ /* Should be NORMAL and LINK only.
+ * All IP frames get here marked NORMAL.
+ */
Enqueue(&OutputQueues[pri], bp);
}
@@ -652,7 +659,7 @@ ModemQlen()
int len = 0;
int i;
- for ( i = PRI_NORMAL; i <= PRI_URGENT; i ++ ) {
+ for ( i = PRI_NORMAL; i <= PRI_LINK; i ++ ) {
queue = &OutputQueues[i];
len += queue->qlen;
}
@@ -667,13 +674,15 @@ int fd;
struct mqueue *queue;
int nb, nw, i;
+ if (modemout == NULL && ModemQlen() == 0)
+ IpStartOutput();
if (modemout == NULL) {
- i = 0;
- for (queue = &OutputQueues[PRI_URGENT]; queue >= OutputQueues; queue--) {
+ i = PRI_LINK;
+ for (queue = &OutputQueues[PRI_LINK]; queue >= OutputQueues; queue--) {
if (queue->top) {
modemout = Dequeue(queue);
#ifdef QDEBUG
- if (i < 2) {
+ if (i > PRI_NORMAL) {
struct mqueue *q;
q = &OutputQueues[0];
@@ -683,13 +692,13 @@ int fd;
#endif
break;
}
- i++;
+ i--;
}
}
if (modemout) {
nb = modemout->cnt;
if (nb > 1600) nb = 1600;
- if (fd == 0) fd = 1;
+ if (fd == 0) fd = 1; /* XXX WTFO! This is bogus */
nw = write(fd, MBUF_CTOP(modemout), nb);
#ifdef QDEBUG
logprintf("wrote: %d(%d)\n", nw, nb);
OpenPOWER on IntegriCloud