home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / amiga / os / bsdss4.tz / bsdss4 / bsdss / server / net / slcompress.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-07-09  |  15.9 KB  |  572 lines

  1. /* 
  2.  * Mach Operating System
  3.  * Copyright (c) 1992 Carnegie Mellon University
  4.  * All Rights Reserved.
  5.  * 
  6.  * Permission to use, copy, modify and distribute this software and its
  7.  * documentation is hereby granted, provided that both the copyright
  8.  * notice and this permission notice appear in all copies of the
  9.  * software, derivative works or modified versions, and any portions
  10.  * thereof, and that both notices appear in supporting documentation.
  11.  * 
  12.  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
  13.  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
  14.  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
  15.  * 
  16.  * Carnegie Mellon requests users of this software to return to
  17.  * 
  18.  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
  19.  *  School of Computer Science
  20.  *  Carnegie Mellon University
  21.  *  Pittsburgh PA 15213-3890
  22.  * 
  23.  * any improvements or extensions that they make and grant Carnegie Mellon 
  24.  * the rights to redistribute these changes.
  25.  */
  26. /*
  27.  * HISTORY
  28.  * $Log:    slcompress.c,v $
  29.  * Revision 2.2  92/07/08  16:20:08  mrt
  30.  *     Fixed for bnr2ss by A.Richter.
  31.  *     [92/07/06            rwd]
  32.  * 
  33.  * Revision 2.1  92/04/21  17:13:45  rwd
  34.  * BSDSS
  35.  * 
  36.  *
  37.  */
  38.  
  39. /*-
  40.  * Copyright (c) 1989 The Regents of the University of California.
  41.  * All rights reserved.
  42.  *
  43.  * Redistribution and use in source and binary forms, with or without
  44.  * modification, are permitted provided that the following conditions
  45.  * are met:
  46.  * 1. Redistributions of source code must retain the above copyright
  47.  *    notice, this list of conditions and the following disclaimer.
  48.  * 2. Redistributions in binary form must reproduce the above copyright
  49.  *    notice, this list of conditions and the following disclaimer in the
  50.  *    documentation and/or other materials provided with the distribution.
  51.  * 3. All advertising materials mentioning features or use of this software
  52.  *    must display the following acknowledgement:
  53.  *    This product includes software developed by the University of
  54.  *    California, Berkeley and its contributors.
  55.  * 4. Neither the name of the University nor the names of its contributors
  56.  *    may be used to endorse or promote products derived from this software
  57.  *    without specific prior written permission.
  58.  *
  59.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  60.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  61.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  62.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  63.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  64.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  65.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  66.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  67.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  68.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  69.  * SUCH DAMAGE.
  70.  *
  71.  *    @(#)slcompress.c    7.7 (Berkeley) 5/7/91
  72.  */
  73.  
  74. /*
  75.  * Routines to compress and uncompess tcp packets (for transmission
  76.  * over low speed serial lines.
  77.  *
  78.  * Van Jacobson (van@helios.ee.lbl.gov), Dec 31, 1989:
  79.  *    - Initial distribution.
  80.  *
  81.  * static char rcsid[] =
  82.  * "$Header: slcompress.c,v 2.2 92/07/08 16:20:08 mrt Exp $";
  83.  */
  84.  
  85. #include <sys/param.h>
  86. #include <sys/mbuf.h>
  87. #include <netinet/in.h>
  88. #include <netinet/in_systm.h>
  89. #include <netinet/ip.h>
  90. #include <netinet/tcp.h>
  91.  
  92. #include "slcompress.h"
  93.  
  94. #ifndef SL_NO_STATS
  95. #define INCR(counter) ++comp->counter;
  96. #else
  97. #define INCR(counter)
  98. #endif
  99.  
  100. #define BCMP(p1, p2, n) bcmp((char *)(p1), (char *)(p2), (int)(n))
  101. #define BCOPY(p1, p2, n) bcopy((char *)(p1), (char *)(p2), (int)(n))
  102. #define ovbcopy bcopy
  103.  
  104.  
  105. void
  106. sl_compress_init(comp)
  107.     struct slcompress *comp;
  108. {
  109.     register u_int i;
  110.     register struct cstate *tstate = comp->tstate;
  111.  
  112.     bzero((char *)comp, sizeof(*comp));
  113.     for (i = MAX_STATES - 1; i > 0; --i) {
  114.         tstate[i].cs_id = i;
  115.         tstate[i].cs_next = &tstate[i - 1];
  116.     }
  117.     tstate[0].cs_next = &tstate[MAX_STATES - 1];
  118.     tstate[0].cs_id = 0;
  119.     comp->last_cs = &tstate[0];
  120.     comp->last_recv = 255;
  121.     comp->last_xmit = 255;
  122. }
  123.  
  124.  
  125. /* ENCODE encodes a number that is known to be non-zero.  ENCODEZ
  126.  * checks for zero (since zero has to be encoded in the long, 3 byte
  127.  * form).
  128.  */
  129. #define ENCODE(n) { \
  130.     if ((u_short)(n) >= 256) { \
  131.         *cp++ = 0; \
  132.         cp[1] = (n); \
  133.         cp[0] = (n) >> 8; \
  134.         cp += 2; \
  135.     } else { \
  136.         *cp++ = (n); \
  137.     } \
  138. }
  139. #define ENCODEZ(n) { \
  140.     if ((u_short)(n) >= 256 || (u_short)(n) == 0) { \
  141.         *cp++ = 0; \
  142.         cp[1] = (n); \
  143.         cp[0] = (n) >> 8; \
  144.         cp += 2; \
  145.     } else { \
  146.         *cp++ = (n); \
  147.     } \
  148. }
  149.  
  150. #define DECODEL(f) { \
  151.     if (*cp == 0) {\
  152.         (f) = htonl(ntohl(f) + ((cp[1] << 8) | cp[2])); \
  153.         cp += 3; \
  154.     } else { \
  155.         (f) = htonl(ntohl(f) + (u_long)*cp++); \
  156.     } \
  157. }
  158.  
  159. #define DECODES(f) { \
  160.     if (*cp == 0) {\
  161.         (f) = htons(ntohs(f) + ((cp[1] << 8) | cp[2])); \
  162.         cp += 3; \
  163.     } else { \
  164.         (f) = htons(ntohs(f) + (u_long)*cp++); \
  165.     } \
  166. }
  167.  
  168. #define DECODEU(f) { \
  169.     if (*cp == 0) {\
  170.         (f) = htons((cp[1] << 8) | cp[2]); \
  171.         cp += 3; \
  172.     } else { \
  173.         (f) = htons((u_long)*cp++); \
  174.     } \
  175. }
  176.  
  177.  
  178. u_char
  179. sl_compress_tcp(m, ip, comp, compress_cid)
  180.     struct mbuf *m;
  181.     register struct ip *ip;
  182.     struct slcompress *comp;
  183.     int compress_cid;
  184. {
  185.     register struct cstate *cs = comp->last_cs->cs_next;
  186.     register u_int hlen = ip->ip_hl;
  187.     register struct tcphdr *oth;
  188.     register struct tcphdr *th;
  189.     register u_int deltaS, deltaA;
  190.     register u_int changes = 0;
  191.     u_char new_seq[16];
  192.     register u_char *cp = new_seq;
  193.  
  194.     /*
  195.      * Bail if this is an IP fragment or if the TCP packet isn't
  196.      * `compressible' (i.e., ACK isn't set or some other control bit is
  197.      * set).  (We assume that the caller has already made sure the
  198.      * packet is IP proto TCP).
  199.      */
  200.     if ((ip->ip_off & htons(0x3fff)) || m->m_len < 40)
  201.         return (TYPE_IP);
  202.  
  203.     th = (struct tcphdr *)&((int *)ip)[hlen];
  204.     if ((th->th_flags & (TH_SYN|TH_FIN|TH_RST|TH_ACK)) != TH_ACK)
  205.         return (TYPE_IP);
  206.     /*
  207.      * Packet is compressible -- we're going to send either a
  208.      * COMPRESSED_TCP or UNCOMPRESSED_TCP packet.  Either way we need
  209.      * to locate (or create) the connection state.  Special case the
  210.      * most recently used connection since it's most likely to be used
  211.      * again & we don't have to do any reordering if it's used.
  212.      */
  213.     INCR(sls_packets)
  214.     if (ip->ip_src.s_addr != cs->cs_ip.ip_src.s_addr ||
  215.         ip->ip_dst.s_addr != cs->cs_ip.ip_dst.s_addr ||
  216.         *(int *)th != ((int *)&cs->cs_ip)[cs->cs_ip.ip_hl]) {
  217.         /*
  218.          * Wasn't the first -- search for it.
  219.          *
  220.          * States are kept in a circularly linked list with
  221.          * last_cs pointing to the end of the list.  The
  222.          * list is kept in lru order by moving a state to the
  223.          * head of the list whenever it is referenced.  Since
  224.          * the list is short and, empirically, the connection
  225.          * we want is almost always near the front, we locate
  226.          * states via linear search.  If we don't find a state
  227.          * for the datagram, the oldest state is (re-)used.
  228.          */
  229.         register struct cstate *lcs;
  230.         register struct cstate *lastcs = comp->last_cs;
  231.  
  232.         do {
  233.             lcs = cs; cs = cs->cs_next;
  234.             INCR(sls_searches)
  235.             if (ip->ip_src.s_addr == cs->cs_ip.ip_src.s_addr
  236.                 && ip->ip_dst.s_addr == cs->cs_ip.ip_dst.s_addr
  237.                 && *(int *)th == ((int *)&cs->cs_ip)[cs->cs_ip.ip_hl])
  238.                 goto found;
  239.         } while (cs != lastcs);
  240.  
  241.         /*
  242.          * Didn't find it -- re-use oldest cstate.  Send an
  243.          * uncompressed packet that tells the other side what
  244.          * connection number we're using for this conversation.
  245.          * Note that since the state list is circular, the oldest
  246.          * state points to the newest and we only need to set
  247.          * last_cs to update the lru linkage.
  248.          */
  249.         INCR(sls_misses)
  250.         comp->last_cs = lcs;
  251.         hlen += th->th_off;
  252.         hlen <<= 2;
  253.         goto uncompressed;
  254.  
  255.     found:
  256.         /*
  257.          * Found it -- move to the front on the connection list.
  258.          */
  259.         if (cs == lastcs)
  260.             comp->last_cs = lcs;
  261.         else {
  262.             lcs->cs_next = cs->cs_next;
  263.             cs->cs_next = lastcs->cs_next;
  264.             lastcs->cs_next = cs;
  265.         }
  266.     }
  267.  
  268.     /*
  269.      * Make sure that only what we expect to change changed. The first
  270.      * line of the `if' checks the IP protocol version, header length &
  271.      * type of service.  The 2nd line checks the "Don't fragment" bit.
  272.      * The 3rd line checks the time-to-live and protocol (the protocol
  273.      * check is unnecessary but costless).  The 4th line checks the TCP
  274.      * header length.  The 5th line checks IP options, if any.  The 6th
  275.      * line checks TCP options, if any.  If any of these things are
  276.      * different between the previous & current datagram, we send the
  277.      * current datagram `uncompressed'.
  278.      */
  279.     oth = (struct tcphdr *)&((int *)&cs->cs_ip)[hlen];
  280.     deltaS = hlen;
  281.     hlen += th->th_off;
  282.     hlen <<= 2;
  283.  
  284.     if (((u_short *)ip)[0] != ((u_short *)&cs->cs_ip)[0] ||
  285.         ((u_short *)ip)[3] != ((u_short *)&cs->cs_ip)[3] ||
  286.         ((u_short *)ip)[4] != ((u_short *)&cs->cs_ip)[4] ||
  287.         th->th_off != oth->th_off ||
  288.         (deltaS > 5 &&
  289.          BCMP(ip + 1, &cs->cs_ip + 1, (deltaS - 5) << 2)) ||
  290.         (th->th_off > 5 &&
  291.          BCMP(th + 1, oth + 1, (th->th_off - 5) << 2)))
  292.         goto uncompressed;
  293.  
  294.     /*
  295.      * Figure out which of the changing fields changed.  The
  296.      * receiver expects changes in the order: urgent, window,
  297.      * ack, seq (the order minimizes the number of temporaries
  298.      * needed in this section of code).
  299.      */
  300.     if (th->th_flags & TH_URG) {
  301.         deltaS = ntohs(th->th_urp);
  302.         ENCODEZ(deltaS);
  303.         changes |= NEW_U;
  304.     } else if (th->th_urp != oth->th_urp)
  305.         /* argh! URG not set but urp changed -- a sensible
  306.          * implementation should never do this but RFC793
  307.          * doesn't prohibit the change so we have to deal
  308.          * with it. */
  309.          goto uncompressed;
  310.  
  311.     if (deltaS = (u_short)(ntohs(th->th_win) - ntohs(oth->th_win))) {
  312.         ENCODE(deltaS);
  313.         changes |= NEW_W;
  314.     }
  315.  
  316.     if (deltaA = ntohl(th->th_ack) - ntohl(oth->th_ack)) {
  317.         if (deltaA > 0xffff)
  318.             goto uncompressed;
  319.         ENCODE(deltaA);
  320.         changes |= NEW_A;
  321.     }
  322.  
  323.     if (deltaS = ntohl(th->th_seq) - ntohl(oth->th_seq)) {
  324.         if (deltaS > 0xffff)
  325.             goto uncompressed;
  326.         ENCODE(deltaS);
  327.         changes |= NEW_S;
  328.     }
  329.  
  330.     switch(changes) {
  331.  
  332.     case 0:
  333.         /*
  334.          * Nothing changed. If this packet contains data and the
  335.          * last one didn't, this is probably a data packet following
  336.          * an ack (normal on an interactive connection) and we send
  337.          * it compressed.  Otherwise it's probably a retransmit,
  338.          * retransmitted ack or window probe.  Send it uncompressed
  339.          * in case the other side missed the compressed version.
  340.          */
  341.         if (ip->ip_len != cs->cs_ip.ip_len &&
  342.             ntohs(cs->cs_ip.ip_len) == hlen)
  343.             break;
  344.  
  345.         /* (fall through) */
  346.  
  347.     case SPECIAL_I:
  348.     case SPECIAL_D:
  349.         /*
  350.          * actual changes match one of our special case encodings --
  351.          * send packet uncompressed.
  352.          */
  353.         goto uncompressed;
  354.  
  355.     case NEW_S|NEW_A:
  356.         if (deltaS == deltaA &&
  357.             deltaS == ntohs(cs->cs_ip.ip_len) - hlen) {
  358.             /* special case for echoed terminal traffic */
  359.             changes = SPECIAL_I;
  360.             cp = new_seq;
  361.         }
  362.         break;
  363.  
  364.     case NEW_S:
  365.         if (deltaS == ntohs(cs->cs_ip.ip_len) - hlen) {
  366.             /* special case for data xfer */
  367.             changes = SPECIAL_D;
  368.             cp = new_seq;
  369.         }
  370.         break;
  371.     }
  372.  
  373.     deltaS = ntohs(ip->ip_id) - ntohs(cs->cs_ip.ip_id);
  374.     if (deltaS != 1) {
  375.         ENCODEZ(deltaS);
  376.         changes |= NEW_I;
  377.     }
  378.     if (th->th_flags & TH_PUSH)
  379.         changes |= TCP_PUSH_BIT;
  380.     /*
  381.      * Grab the cksum before we overwrite it below.  Then update our
  382.      * state with this packet's header.
  383.      */
  384.     deltaA = ntohs(th->th_sum);
  385.     BCOPY(ip, &cs->cs_ip, hlen);
  386.  
  387.     /*
  388.      * We want to use the original packet as our compressed packet.
  389.      * (cp - new_seq) is the number of bytes we need for compressed
  390.      * sequence numbers.  In addition we need one byte for the change
  391.      * mask, one for the connection id and two for the tcp checksum.
  392.      * So, (cp - new_seq) + 4 bytes of header are needed.  hlen is how
  393.      * many bytes of the original packet to toss so subtract the two to
  394.      * get the new packet size.
  395.      */
  396.     deltaS = cp - new_seq;
  397.     cp = (u_char *)ip;
  398.     if (compress_cid == 0 || comp->last_xmit != cs->cs_id) {
  399.         comp->last_xmit = cs->cs_id;
  400.         hlen -= deltaS + 4;
  401.         cp += hlen;
  402.         *cp++ = changes | NEW_C;
  403.         *cp++ = cs->cs_id;
  404.     } else {
  405.         hlen -= deltaS + 3;
  406.         cp += hlen;
  407.         *cp++ = changes;
  408.     }
  409.     m->m_len -= hlen;
  410.     m->m_data += hlen;
  411.     *cp++ = deltaA >> 8;
  412.     *cp++ = deltaA;
  413.     BCOPY(new_seq, cp, deltaS);
  414.     INCR(sls_compressed)
  415.     return (TYPE_COMPRESSED_TCP);
  416.  
  417.     /*
  418.      * Update connection state cs & send uncompressed packet ('uncompressed'
  419.      * means a regular ip/tcp packet but with the 'conversation id' we hope
  420.      * to use on future compressed packets in the protocol field).
  421.      */
  422. uncompressed:
  423.     BCOPY(ip, &cs->cs_ip, hlen);
  424.     ip->ip_p = cs->cs_id;
  425.     comp->last_xmit = cs->cs_id;
  426.     return (TYPE_UNCOMPRESSED_TCP);
  427. }
  428.  
  429.  
  430. int
  431. sl_uncompress_tcp(bufp, len, type, comp)
  432.     u_char **bufp;
  433.     int len;
  434.     u_int type;
  435.     struct slcompress *comp;
  436. {
  437.     register u_char *cp;
  438.     register u_int hlen, changes;
  439.     register struct tcphdr *th;
  440.     register struct cstate *cs;
  441.     register struct ip *ip;
  442.  
  443.     switch (type) {
  444.  
  445.     case TYPE_UNCOMPRESSED_TCP:
  446.         ip = (struct ip *) *bufp;
  447.         if (ip->ip_p >= MAX_STATES)
  448.             goto bad;
  449.         cs = &comp->rstate[comp->last_recv = ip->ip_p];
  450.         comp->flags &=~ SLF_TOSS;
  451.         ip->ip_p = IPPROTO_TCP;
  452.         hlen = ip->ip_hl;
  453.         hlen += ((struct tcphdr *)&((int *)ip)[hlen])->th_off;
  454.         hlen <<= 2;
  455.         BCOPY(ip, &cs->cs_ip, hlen);
  456.         cs->cs_ip.ip_sum = 0;
  457.         cs->cs_hlen = hlen;
  458.         INCR(sls_uncompressedin)
  459.         return (len);
  460.  
  461.     default:
  462.         goto bad;
  463.  
  464.     case TYPE_COMPRESSED_TCP:
  465.         break;
  466.     }
  467.     /* We've got a compressed packet. */
  468.     INCR(sls_compressedin)
  469.     cp = *bufp;
  470.     changes = *cp++;
  471.     if (changes & NEW_C) {
  472.         /* Make sure the state index is in range, then grab the state.
  473.          * If we have a good state index, clear the 'discard' flag. */
  474.         if (*cp >= MAX_STATES)
  475.             goto bad;
  476.  
  477.         comp->flags &=~ SLF_TOSS;
  478.         comp->last_recv = *cp++;
  479.     } else {
  480.         /* this packet has an implicit state index.  If we've
  481.          * had a line error since the last time we got an
  482.          * explicit state index, we have to toss the packet. */
  483.         if (comp->flags & SLF_TOSS) {
  484.             INCR(sls_tossed)
  485.             return (0);
  486.         }
  487.     }
  488.     cs = &comp->rstate[comp->last_recv];
  489.     hlen = cs->cs_ip.ip_hl << 2;
  490.     th = (struct tcphdr *)&((u_char *)&cs->cs_ip)[hlen];
  491.     th->th_sum = htons((*cp << 8) | cp[1]);
  492.     cp += 2;
  493.     if (changes & TCP_PUSH_BIT)
  494.         th->th_flags |= TH_PUSH;
  495.     else
  496.         th->th_flags &=~ TH_PUSH;
  497.  
  498.     switch (changes & SPECIALS_MASK) {
  499.     case SPECIAL_I:
  500.         {
  501.         register u_int i = ntohs(cs->cs_ip.ip_len) - cs->cs_hlen;
  502.         th->th_ack = htonl(ntohl(th->th_ack) + i);
  503.         th->th_seq = htonl(ntohl(th->th_seq) + i);
  504.         }
  505.         break;
  506.  
  507.     case SPECIAL_D:
  508.         th->th_seq = htonl(ntohl(th->th_seq) + ntohs(cs->cs_ip.ip_len)
  509.                    - cs->cs_hlen);
  510.         break;
  511.  
  512.     default:
  513.         if (changes & NEW_U) {
  514.             th->th_flags |= TH_URG;
  515.             DECODEU(th->th_urp)
  516.         } else
  517.             th->th_flags &=~ TH_URG;
  518.         if (changes & NEW_W)
  519.             DECODES(th->th_win)
  520.         if (changes & NEW_A)
  521.             DECODEL(th->th_ack)
  522.         if (changes & NEW_S)
  523.             DECODEL(th->th_seq)
  524.         break;
  525.     }
  526.     if (changes & NEW_I) {
  527.         DECODES(cs->cs_ip.ip_id)
  528.     } else
  529.         cs->cs_ip.ip_id = htons(ntohs(cs->cs_ip.ip_id) + 1);
  530.  
  531.     /*
  532.      * At this point, cp points to the first byte of data in the
  533.      * packet.  If we're not aligned on a 4-byte boundary, copy the
  534.      * data down so the ip & tcp headers will be aligned.  Then back up
  535.      * cp by the tcp/ip header length to make room for the reconstructed
  536.      * header (we assume the packet we were handed has enough space to
  537.      * prepend 128 bytes of header).  Adjust the length to account for
  538.      * the new header & fill in the IP total length.
  539.      */
  540.     len -= (cp - *bufp);
  541.     if (len < 0)
  542.         /* we must have dropped some characters (crc should detect
  543.          * this but the old slip framing won't) */
  544.         goto bad;
  545.  
  546.     if ((int)cp & 3) {
  547.         if (len > 0)
  548.             (void) ovbcopy(cp, (caddr_t)((int)cp &~ 3), len);
  549.         cp = (u_char *)((int)cp &~ 3);
  550.     }
  551.     cp -= cs->cs_hlen;
  552.     len += cs->cs_hlen;
  553.     cs->cs_ip.ip_len = htons(len);
  554.     BCOPY(&cs->cs_ip, cp, cs->cs_hlen);
  555.     *bufp = cp;
  556.  
  557.     /* recompute the ip header checksum */
  558.     {
  559.         register u_short *bp = (u_short *)cp;
  560.         for (changes = 0; hlen > 0; hlen -= 2)
  561.             changes += *bp++;
  562.         changes = (changes & 0xffff) + (changes >> 16);
  563.         changes = (changes & 0xffff) + (changes >> 16);
  564.         ((struct ip *)cp)->ip_sum = ~ changes;
  565.     }
  566.     return (len);
  567. bad:
  568.     comp->flags |= SLF_TOSS;
  569.     INCR(sls_errorin)
  570.     return (0);
  571. }
  572.