From 05e2df41cafcb95cf73b24d9cbc448349071bed2 Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Sun, 30 Aug 1992 00:00:00 +0000 Subject: [PATCH] CLEAN UP SLIP INTERFACE TO KEEP FROM HANGING Here is a patch to clean up the interface between the tty-drivers, in particular the com driver, and the sl# interfaces, this is not a work-around but a genuine bug-fix. Symptoms: after a number of "com#: silo overflow" SLIP ceases to work. Overview of the problem: the slip interface will disregard any notice from the tty-driver on problems (parity errors, framing errors or overruns), which basicly means the one might as well throw the packet away right away. Also overrun in the packetizing will go relatively unnotized. AUTHOR: Poul-Henning Kamp (phk@data.fls.dk) 386BSD-Patchkit: patch00019 --- usr/src/sys.386bsd/i386/isa/com.c | 7 +++++-- usr/src/sys.386bsd/net/if_sl.c | 17 ++++++++++++++++- usr/src/sys.386bsd/net/if_slvar.h | 8 ++++++++ 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/usr/src/sys.386bsd/i386/isa/com.c b/usr/src/sys.386bsd/i386/isa/com.c index 5b1c5fd53f..b370f30488 100644 --- a/usr/src/sys.386bsd/i386/isa/com.c +++ b/usr/src/sys.386bsd/i386/isa/com.c @@ -34,9 +34,10 @@ * * PATCHES MAGIC LEVEL PATCH THAT GOT US HERE * -------------------- ----- ---------------------- - * CURRENT PATCH LEVEL: 1 00018 + * CURRENT PATCH LEVEL: 2 00019 * -------------------- ----- ---------------------- * + * 30 Aug 92 Poul-Henning Kamp Stabilize SLIP on lossy lines/UARTS * 09 Aug 92 Christoph Robitschko Correct minor number on com ports */ static char rcsid[] = "$Header: /usr/bill/working/sys/i386/isa/RCS/com.c,v 1.2 92/01/21 14:34:11 william Exp $"; @@ -375,8 +376,10 @@ comeint(unit, stat, com) c |= TTY_FE; else if (stat & LSR_PE) c |= TTY_PE; - else if (stat & LSR_OE) + else if (stat & LSR_OE) { /* 30 Aug 92*/ + c |= TTY_PE; /* Ought to have it's own define... */ log(LOG_WARNING, "com%d: silo overflow\n", unit); + } (*linesw[tp->t_line].l_rint)(c, tp); } diff --git a/usr/src/sys.386bsd/net/if_sl.c b/usr/src/sys.386bsd/net/if_sl.c index 733c7b27e8..7e97e07f07 100644 --- a/usr/src/sys.386bsd/net/if_sl.c +++ b/usr/src/sys.386bsd/net/if_sl.c @@ -31,6 +31,13 @@ * SUCH DAMAGE. * * @(#)if_sl.c 7.22 (Berkeley) 4/20/91 + * + * PATCHES MAGIC LEVEL PATCH THAT GOT US HERE + * -------------------- ----- ---------------------- + * CURRENT PATCH LEVEL: 1 00019 + * -------------------- ----- ---------------------- + * + * 30 Aug 92 Poul-Henning Kamp Stabilize SLIP on lossy lines/UARTS */ /* @@ -623,8 +630,10 @@ slinput(c, tp) sc = (struct sl_softc *)tp->t_sc; if (sc == NULL) return; - if (!(tp->t_state&TS_CARR_ON)) /* XXX */ + if (c > 255 || !(tp->t_state&TS_CARR_ON)) { /* XXX 30 Aug 92*/ + sc->sc_flags |= SC_ERROR; return; + } ++sc->sc_bytesrcvd; ++sc->sc_if.if_ibytes; @@ -674,7 +683,12 @@ slinput(c, tp) return; case FRAME_END: + if(sc->sc_flags & SC_ERROR) { /* 30 Aug 92*/ + sc->sc_flags &= ~SC_ERROR; + goto newpack; + } len = sc->sc_mp - sc->sc_buf; + if (len < 3) /* less than min length packet - ignore */ goto newpack; @@ -730,6 +744,7 @@ slinput(c, tp) sc->sc_escape = 0; return; } + sc->sc_flags |= SC_ERROR; /* 30 Aug 92*/ error: sc->sc_if.if_ierrors++; newpack: diff --git a/usr/src/sys.386bsd/net/if_slvar.h b/usr/src/sys.386bsd/net/if_slvar.h index 076c0518f4..8fc81937bf 100644 --- a/usr/src/sys.386bsd/net/if_slvar.h +++ b/usr/src/sys.386bsd/net/if_slvar.h @@ -33,6 +33,13 @@ * @(#)if_slvar.h 7.7 (Berkeley) 5/7/91 * * $Header: if_slvar.h,v 1.3 89/05/31 02:25:18 van Exp $ + * + * PATCHES MAGIC LEVEL PATCH THAT GOT US HERE + * -------------------- ----- ---------------------- + * CURRENT PATCH LEVEL: 1 00019 + * -------------------- ----- ---------------------- + * + * 30 Aug 92 Poul-Henning Kamp Stabilize SLIP on lossy lines/UARTS */ /* @@ -65,6 +72,7 @@ struct sl_softc { #define SC_NOICMP 0x0004 /* supress ICMP traffic */ #define SC_AUTOCOMP 0x0008 /* auto-enable TCP compression */ /* internal flags (should be separate) */ +#define SC_ERROR 0x08000 /* had an input error - 30 Aug 92*/ #define SC_ABORT 0x10000 /* have been sent an abort request */ /* this stuff doesn't belong here... */ -- 2.20.1