summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/ip.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/ip.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/ip.c')
-rw-r--r--usr.sbin/ppp/ip.c51
1 files changed, 16 insertions, 35 deletions
diff --git a/usr.sbin/ppp/ip.c b/usr.sbin/ppp/ip.c
index 6be717a..239b5b6 100644
--- a/usr.sbin/ppp/ip.c
+++ b/usr.sbin/ppp/ip.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: ip.c,v 1.6 1996/01/10 21:27:50 phk Exp $
+ * $Id: ip.c,v 1.7 1996/01/11 17:48:49 phk Exp $
*
* TODO:
* o Return ICMP message for filterd packet
@@ -80,11 +80,12 @@ RestartIdleTimer()
}
}
-static u_short interactive_ports[8] = {
- 0, 513, 0, 0, 0, 21, 0, 23,
+static u_short interactive_ports[32] = {
+ 544, 513, 514, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 21, 22, 23, 0, 0, 0, 0, 0, 0, 0, 543,
};
-#define INTERACTIVE(p) (interactive_ports[(p) & 7] == (p))
+#define INTERACTIVE(p) (interactive_ports[(p) & 0x1F] == (p))
static char *TcpFlags[] = {
"FIN", "SYN", "RST", "PSH", "ACK", "URG",
@@ -133,7 +134,7 @@ int direction;
if (fp->action) {
/* permit fragments on in and out filter */
if ((direction == FL_IN || direction == FL_OUT) &&
- (pip->ip_off & IP_OFFMASK) != 0) {
+ (ntohs(pip->ip_off) & IP_OFFMASK) != 0) {
return(A_PERMIT);
}
#ifdef DEBUG
@@ -216,7 +217,7 @@ int code;
if (pip->ip_p != IPPROTO_ICMP) {
bp = mballoc(cnt, MB_IPIN);
bcopy(ptr, MBUF_CTOP(bp), cnt);
- SendPppFrame(PRI_URGENT, bp);
+ SendPppFrame(bp);
RestartIdleTimer();
ipOutOctets += cnt;
}
@@ -268,7 +269,7 @@ int direction;
th = (struct tcphdr *)ptop;
if (pip->ip_tos == IPTOS_LOWDELAY)
pri = PRI_FAST;
- else if (pip->ip_off == 0) {
+ else if ((ntohs(pip->ip_off) & IP_OFFMASK) == 0) {
if (INTERACTIVE(ntohs(th->th_sport)) || INTERACTIVE(ntohs(th->th_dport)))
pri = PRI_FAST;
}
@@ -296,8 +297,8 @@ int direction;
}
break;
}
- pri = FilterCheck(pip, direction);
- if (pri & A_DENY) {
+
+ if ((FilterCheck(pip, direction) & A_DENY)) {
#ifdef DEBUG
logprintf("blocked.\n");
#endif
@@ -347,28 +348,7 @@ struct mbuf *bp; /* IN: Pointer to IP pakcet */
RestartIdleTimer();
}
-void
-IpOutput(ptr, cnt)
-u_char *ptr; /* IN: Pointer to IP packet */
-int cnt; /* IN: Length of packet */
-{
- struct mbuf *bp;
- int pri;
-
- if (IpcpFsm.state != ST_OPENED)
- return;
-
- pri = PacketCheck(ptr, cnt, FL_OUT);
- if (pri >= 0) {
- bp = mballoc(cnt, MB_IPIN);
- bcopy(ptr, MBUF_CTOP(bp), cnt);
- SendPppFrame(pri, bp);
- RestartIdleTimer();
- ipOutOctets += cnt;
- }
-}
-
-static struct mqueue IpOutputQueues[PRI_URGENT+1];
+static struct mqueue IpOutputQueues[PRI_FAST+1];
void
IpEnqueue(pri, ptr, count)
@@ -388,7 +368,7 @@ IsIpEnqueued()
{
struct mqueue *queue;
int exist = FALSE;
- for (queue = &IpOutputQueues[PRI_URGENT]; queue >= IpOutputQueues; queue--) {
+ for (queue = &IpOutputQueues[PRI_FAST]; queue >= IpOutputQueues; queue--) {
if ( queue->qlen > 0 ) {
exist = TRUE;
break;
@@ -406,15 +386,16 @@ IpStartOutput()
if (IpcpFsm.state != ST_OPENED)
return;
- pri = PRI_URGENT;
- for (queue = &IpOutputQueues[PRI_URGENT]; queue >= IpOutputQueues; queue--) {
+ pri = PRI_FAST;
+ for (queue = &IpOutputQueues[PRI_FAST]; queue >= IpOutputQueues; queue--) {
if (queue->top) {
bp = Dequeue(queue);
if (bp) {
cnt = plength(bp);
- SendPppFrame(pri, bp);
+ SendPppFrame(bp);
RestartIdleTimer();
ipOutOctets += cnt;
+ break;
}
}
pri--;
OpenPOWER on IntegriCloud