Return to BSD News archive
Path: sserve!manuel!munnari.oz.au!mips!decwrl!sdd.hp.com!swrinde!gatech!bloom-beacon!eru.mt.luth.se!lunic!sunic!dkuug!flshub!phk
From: phk@data.fls.dk (Poul-Henning Kamp)
Newsgroups: comp.unix.bsd
Subject: PATCH to stabilize SLIP on lossy lines &&/|| UARTS
Keywords: PATCH
Message-ID: <1992Aug30.112824.28717@data.fls.dk>
Date: 30 Aug 92 11:28:24 GMT
Organization: FLS Data A/S, Valby, Copenhagen, Denmark.
Lines: 123
BUG FINDER INFORMATION
NAME: Poul-Henning Kamp
TITLE: Resident UNIX Guru & Network architect
FIRM: FLS Data A/S
ADDRESS: Ramsingsvej 7, DK-2500 Valby
COUNTRY: Denmark
PHONE: (+45) 36 18 12 35
FAX: (+45) 36 18 12 18
EMAIL: phk@data.fls.dk
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.
The com-driver on the other hand does nothing to alert the slip interface
on dropped characters. (Which is a serious problem with non-FIFO UART's)
All the crippled packets produced by these bugs really triggers of some
sanity-checks in /sys/netinet/{ip,tcp}_input.c which does not free the mbuf
but rather leave the mbuf intact, and unusable for the future, thus starving
on mbufs will occur later.
The problem is in ip_input.c a lot of "goto next" should be "goto bad",
and a couple of returns in tcp_input.c might need to be prefixed
with m_free()'s.
I will investigate this carefully now and issue a patch later.
Hacking into to night to Glenn Gould & Bach's French Suite's...
Poul-Henning Kamp
cd /
patch -p < this_article
*** /sys/i386/isa/com.c Sun Jul 5 13:55:12 1992
--- sys.386bsd/i386/isa/com.c Sat Aug 29 14:28:53 1992
***************
*** 370,374 ****
--- 370,377 ----
c |= TTY_PE;
else if (stat & LSR_OE)
+ {
+ 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);
}
*** /sys/net/if_sl.c Wed Jun 3 02:46:02 1992
--- sys.386bsd/net/if_sl.c Sat Aug 29 14:25:56 1992
***************
*** 624,633 ****
if (sc == NULL)
return;
! if (!(tp->t_state&TS_CARR_ON)) /* XXX */
return;
++sc->sc_bytesrcvd;
++sc->sc_if.if_ibytes;
- c &= 0xff; /* XXX */
#ifdef ABT_ESC
--- 624,635 ----
if (sc == NULL)
return;
! if (c > 255 || !(tp->t_state&TS_CARR_ON)) /* XXX */
! {
! sc->sc_flags |= SC_ERROR;
return;
+ }
++sc->sc_bytesrcvd;
++sc->sc_if.if_ibytes;
#ifdef ABT_ESC
***************
*** 675,679 ****
--- 677,687 ----
case FRAME_END:
+ if(sc->sc_flags & SC_ERROR)
+ {
+ sc->sc_flags &= ~SC_ERROR;
+ goto newpack;
+ }
len = sc->sc_mp - sc->sc_buf;
+
if (len < 3)
/* less than min length packet - ignore */
***************
*** 731,734 ****
--- 739,743 ----
return;
}
+ sc->sc_flags |= SC_ERROR;
error:
sc->sc_if.if_ierrors++;
*** /sys/net/if_slvar.h Tue Dec 24 14:24:10 1991
--- sys.386bsd/net/if_slvar.h Sat Aug 29 14:20:54 1992
***************
*** 66,69 ****
--- 66,70 ----
#define SC_AUTOCOMP 0x0008 /* auto-enable TCP compression */
/* internal flags (should be separate) */
+ #define SC_ERROR 0x08000 /* had an input error */
#define SC_ABORT 0x10000 /* have been sent an abort request */
--
phk@data.fls.dk || If you can't join 'em -- beat 'em !
Poul-Henning Kamp || the Danish foreign minister
FLS DATA A/S ||
Phone: (+45) 36 18 12 35 ||