BSD 4_3_Net_2 release
[unix-history] / usr / src / sys / netinet / tcp_input.c
index 18477ae..f6fcc06 100644 (file)
@@ -2,9 +2,35 @@
  * Copyright (c) 1982, 1986, 1988, 1990 Regents of the University of California.
  * All rights reserved.
  *
  * Copyright (c) 1982, 1986, 1988, 1990 Regents of the University of California.
  * All rights reserved.
  *
- * %sccs.include.redist.c%
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
  *
  *
- *     @(#)tcp_input.c 7.25 (Berkeley) %G%
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)tcp_input.c 7.25 (Berkeley) 6/30/90
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -569,17 +595,7 @@ trimthenstep6:
                ti->ti_seq++;
                if (ti->ti_len > tp->rcv_wnd) {
                        todrop = ti->ti_len - tp->rcv_wnd;
                ti->ti_seq++;
                if (ti->ti_len > tp->rcv_wnd) {
                        todrop = ti->ti_len - tp->rcv_wnd;
-#if BSD>=43
                        m_adj(m, -todrop);
                        m_adj(m, -todrop);
-#else
-                       /* XXX work around 4.2 m_adj bug */
-                       if (m->m_len) {
-                               m_adj(m, -todrop);
-                       } else {
-                               /* skip tcp/ip header in first mbuf */
-                               m_adj(m->m_next, -todrop);
-                       }
-#endif
                        ti->ti_len = tp->rcv_wnd;
                        tiflags &= ~TH_FIN;
                        tcpstat.tcps_rcvpackafterwin++;
                        ti->ti_len = tp->rcv_wnd;
                        tiflags &= ~TH_FIN;
                        tcpstat.tcps_rcvpackafterwin++;
@@ -693,17 +709,7 @@ trimthenstep6:
                                goto dropafterack;
                } else
                        tcpstat.tcps_rcvbyteafterwin += todrop;
                                goto dropafterack;
                } else
                        tcpstat.tcps_rcvbyteafterwin += todrop;
-#if BSD>=43
                m_adj(m, -todrop);
                m_adj(m, -todrop);
-#else
-               /* XXX work around m_adj bug */
-               if (m->m_len) {
-                       m_adj(m, -todrop);
-               } else {
-                       /* skip tcp/ip header in first mbuf */
-                       m_adj(m->m_next, -todrop);
-               }
-#endif
                ti->ti_len -= todrop;
                tiflags &= ~(TH_PUSH|TH_FIN);
        }
                ti->ti_len -= todrop;
                tiflags &= ~(TH_PUSH|TH_FIN);
        }
@@ -1485,34 +1491,3 @@ tcp_mss(tp, offer)
 #endif /* RTV_MTU */
        return (mss);
 }
 #endif /* RTV_MTU */
        return (mss);
 }
-
-#if BSD<43
-/* XXX this belongs in netinet/in.c */
-in_localaddr(in)
-       struct in_addr in;
-{
-       register u_long i = ntohl(in.s_addr);
-       register struct ifnet *ifp;
-       register struct sockaddr_in *sin;
-       register u_long mask;
-
-       if (IN_CLASSA(i))
-               mask = IN_CLASSA_NET;
-       else if (IN_CLASSB(i))
-               mask = IN_CLASSB_NET;
-       else if (IN_CLASSC(i))
-               mask = IN_CLASSC_NET;
-       else
-               return (0);
-
-       i &= mask;
-       for (ifp = ifnet; ifp; ifp = ifp->if_next) {
-               if (ifp->if_addr.sa_family != AF_INET)
-                       continue;
-               sin = (struct sockaddr_in *)&ifp->if_addr;
-               if ((sin->sin_addr.s_addr & mask) == i)
-                       return (1);
-       }
-       return (0);
-}
-#endif