SCCS-vsn: sys/net/if_sl.c 7.24
*
* %sccs.include.redist.c%
*
*
* %sccs.include.redist.c%
*
- * @(#)if_sl.c 7.23 (Berkeley) %G%
+ * @(#)if_sl.c 7.24 (Berkeley) %G%
* interrupts and network activity; thus, splimp must be >= spltty.
*/
* interrupts and network activity; thus, splimp must be >= spltty.
*/
-/* $Header: /usr/src/sys/net/RCS/if_sl.c,v 1.1 91/08/30 11:14:57 william Exp Locker: william $ */
-/* from if_sl.c,v 1.11 84/10/04 12:54:47 rick Exp */
-
#include "sl.h"
#if NSL > 0
#include "sl.h"
#if NSL > 0
* SLIP ABORT ESCAPE MECHANISM:
* (inspired by HAYES modem escape arrangement)
* 1sec escape 1sec escape 1sec escape { 1sec escape 1sec escape }
* SLIP ABORT ESCAPE MECHANISM:
* (inspired by HAYES modem escape arrangement)
* 1sec escape 1sec escape 1sec escape { 1sec escape 1sec escape }
- * signals a "soft" exit from slip mode by usermode process
+ * within window time signals a "soft" exit from slip mode by remote end
*/
#define ABT_ESC '\033' /* can't be t_intr - distant host must know it*/
*/
#define ABT_ESC '\033' /* can't be t_intr - distant host must know it*/
-#define ABT_WAIT 1 /* in seconds - idle before an escape & after */
-#define ABT_RECYCLE (5*2+2) /* in seconds - time window processing abort */
+#define ABT_IDLE 1 /* in seconds - idle before an escape */
+#define ABT_COUNT 3 /* count of escapes for abort */
+#define ABT_WINDOW (ABT_COUNT*2+2) /* in seconds - time to count */
-#define ABT_SOFT 3 /* count of escapes */
/*
* The following disgusting hack gets around the problem that IP TOS
* can't be set yet. We want to put "interactive" traffic on a high
/*
* The following disgusting hack gets around the problem that IP TOS
* can't be set yet. We want to put "interactive" traffic on a high
0, 21, 0, 23,
};
#define INTERACTIVE(p) (interactive_ports[(p) & 7] == (p))
0, 21, 0, 23,
};
#define INTERACTIVE(p) (interactive_ports[(p) & 7] == (p))
struct sl_softc sl_softc[NSL];
struct sl_softc sl_softc[NSL];
*(int *)data = sc->sc_if.if_unit;
break;
*(int *)data = sc->sc_if.if_unit;
break;
case SLIOCGFLAGS:
*(int *)data = sc->sc_if.if_flags;
break;
case SLIOCGFLAGS:
*(int *)data = sc->sc_if.if_flags;
break;
-#define LLC_MASK (IFF_LLC0|IFF_LLC1|IFF_LLC2)
- sc->sc_if.if_flags =
- (sc->sc_if.if_flags &~ LLC_MASK)
- | ((*(int *)data) & LLC_MASK);
+ /* temp compat */
+ sc->sc_if.if_flags &= ~(SC_COMPRESS | SC_NOICMP | SC_AUTOCOMP);
+ if (*(int *)data & 0x2)
+ sc->sc_if.if_flags |= SC_COMPRESS;
+ if (*(int *)data & 0x4)
+ sc->sc_if.if_flags |= SC_NOICMP;
+ if (*(int *)data & 0x8)
+ sc->sc_if.if_flags |= SC_AUTOCOMP;
printf("sl%d: af%d not supported\n", sc->sc_if.if_unit,
dst->sa_family);
m_freem(m);
printf("sl%d: af%d not supported\n", sc->sc_if.if_unit,
dst->sa_family);
m_freem(m);
+ sc->sc_if.if_noproto++;
}
ifq = &sc->sc_if.if_snd;
if ((ip = mtod(m, struct ip *))->ip_p == IPPROTO_TCP) {
}
ifq = &sc->sc_if.if_snd;
if ((ip = mtod(m, struct ip *))->ip_p == IPPROTO_TCP) {
register int p = ((int *)ip)[ip->ip_hl];
if (INTERACTIVE(p & 0xffff) || INTERACTIVE(p >> 16)) {
register int p = ((int *)ip)[ip->ip_hl];
if (INTERACTIVE(p & 0xffff) || INTERACTIVE(p >> 16)) {
+#else
+ register int p;
+
+ if (ip->ip_tos & IPTOS_LOWDELAY) {
+ ifq = &sc->sc_fastq;
+ p = 1;
+ } else
+ p = 0;
+#endif
if (sc->sc_if.if_flags & SC_COMPRESS) {
/*
if (sc->sc_if.if_flags & SC_COMPRESS) {
/*
}
} else if (sc->sc_if.if_flags & SC_NOICMP && ip->ip_p == IPPROTO_ICMP) {
m_freem(m);
}
} else if (sc->sc_if.if_flags & SC_NOICMP && ip->ip_p == IPPROTO_ICMP) {
m_freem(m);
+ return (ENETRESET); /* XXX ? */
}
s = splimp();
if (IF_QFULL(ifq)) {
}
s = splimp();
if (IF_QFULL(ifq)) {
*/
s = splimp();
IF_DEQUEUE(&sc->sc_fastq, m);
*/
s = splimp();
IF_DEQUEUE(&sc->sc_fastq, m);
+ if (m)
+ sc->sc_if.if_omcasts++; /* XXX */
+ else
IF_DEQUEUE(&sc->sc_if.if_snd, m);
splx(s);
if (m == NULL)
IF_DEQUEUE(&sc->sc_if.if_snd, m);
splx(s);
if (m == NULL)
* the line may have been idle for some time.
*/
if (tp->t_outq.c_cc == 0) {
* the line may have been idle for some time.
*/
if (tp->t_outq.c_cc == 0) {
(void) putc(FRAME_END, &tp->t_outq);
}
(void) putc(FRAME_END, &tp->t_outq);
}
*/
if (b_to_q((char *)bp, cp - bp, &tp->t_outq))
break;
*/
if (b_to_q((char *)bp, cp - bp, &tp->t_outq))
break;
- sc->sc_bytessent += cp - bp;
+ sc->sc_if.if_obytes += cp - bp;
}
/*
* If there are characters left in the mbuf,
}
/*
* If there are characters left in the mbuf,
(void) unputc(&tp->t_outq);
break;
}
(void) unputc(&tp->t_outq);
break;
}
+ sc->sc_if.if_obytes += 2;
(void) putc(FRAME_END, &tp->t_outq);
sc->sc_if.if_collisions++;
} else {
(void) putc(FRAME_END, &tp->t_outq);
sc->sc_if.if_collisions++;
} else {
sc->sc_if.if_opackets++;
}
sc->sc_if.if_opackets++;
}
- sc->sc_if.if_obytes = sc->sc_bytessent;
if (!(tp->t_state&TS_CARR_ON)) /* XXX */
return;
if (!(tp->t_state&TS_CARR_ON)) /* XXX */
return;
++sc->sc_if.if_ibytes;
c &= 0xff; /* XXX */
#ifdef ABT_ESC
++sc->sc_if.if_ibytes;
c &= 0xff; /* XXX */
#ifdef ABT_ESC
- {
- /* if we see an abort after "idle" time, count it */
- if (c == ABT_ESC && time.tv_sec >= sc->sc_lasttime + ABT_WAIT) {
- sc->sc_abortcount++;
- /* record when the first abort escape arrived */
- if (sc->sc_abortcount == 1)
- sc->sc_starttime = time.tv_sec;
- }
- /*
- * if we have an abort, see that we have not run out of time,
- * or that we have an "idle" time after the complete escape
- * sequence
- */
- if (sc->sc_abortcount) {
- if (time.tv_sec >= sc->sc_starttime + ABT_RECYCLE)
+ if (sc->sc_if.if_flags & IFF_DEBUG) {
+ if (c == ABT_ESC) {
+ /*
+ * If we have a previous abort, see whether
+ * this one is within the time limit.
+ */
+ if (sc->sc_abortcount &&
+ time.tv_sec >= sc->sc_starttime + ABT_WINDOW)
- if (sc->sc_abortcount >= ABT_SOFT &&
- time.tv_sec >= sc->sc_lasttime + ABT_WAIT) {
- slclose(tp);
- return;
+ /*
+ * If we see an abort after "idle" time, count it;
+ * record when the first abort escape arrived.
+ */
+ if (time.tv_sec >= sc->sc_lasttime + ABT_IDLE) {
+ if (++sc->sc_abortcount == 1)
+ sc->sc_starttime = time.tv_sec;
+ if (sc->sc_abortcount >= ABT_COUNT) {
+ slclose(tp);
+ return;
+ }
+ } else
+ sc->sc_abortcount = 0;
sc->sc_lasttime = time.tv_sec;
}
#endif
sc->sc_lasttime = time.tv_sec;
}
#endif