]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/netat/atp_read.c
xnu-1228.15.4.tar.gz
[apple/xnu.git] / bsd / netat / atp_read.c
index aacef82b2d9cff9ab41fcdb890f4b24e5cdd0bc0..940a58ae3784c49c9ff7ffc6692b92e429af7d4e 100644 (file)
@@ -1,23 +1,29 @@
 /*
  * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
  *
- * @APPLE_LICENSE_HEADER_START@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  * 
- * The contents of this file constitute Original Code as defined in and
- * are subject to the Apple Public Source License Version 1.1 (the
- * "License").  You may not use this file except in compliance with the
- * License.  Please obtain a copy of the License at
- * http://www.apple.com/publicsource and read it before using this file.
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
  * 
- * This Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
- * License for the specific language governing rights and limitations
- * under the License.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
  * 
- * @APPLE_LICENSE_HEADER_END@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
  */
 /*
  *     Copyright (c) 1996-1998 Apple Computer, Inc.
 #include <sys/malloc.h>
 #include <sys/socket.h>
 
+#include <net/if.h>
+
 #include <netat/sysglue.h>
 #include <netat/appletalk.h>
 #include <netat/ddp.h>
 #include <netat/at_pcb.h>
+#include <netat/at_var.h>
 #include <netat/atp.h>
+#include <netat/asp.h>
 #include <netat/debug.h>
 
-static void atp_trans_complete();
-void atp_x_done();
+__private_extern__ int atp_resp_seqno2big = 0;
+
+static void atp_trans_complete(struct atp_trans *);
 void atp_x_done_locked(void *);
-extern void atp_req_timeout();
+void atp_treq_event(void *);
 
 /*
  *     Decide what to do about received messages
@@ -94,7 +105,6 @@ gbuf_t   *m;
 {
        register at_atp_t *athp;
        register struct atp_state *atp;
-       register int s_gen;
        gbuf_t *m_asp = NULL;
        struct timeval timenow;
        u_short         temp_net;
@@ -131,8 +141,8 @@ gbuf_t   *m;
            case ATP_CMD_TRESP:
            {   
                register struct atp_trans *trp;
-               register int    seqno;
-           register at_ddp_t       *ddp;
+               register unsigned int    seqno;
+               register at_ddp_t       *ddp;
 
                /*
                 * we just got a response, find the trans record
@@ -147,10 +157,20 @@ gbuf_t   *m;
                 *      If we can't find one then ignore the message
                 */
                seqno = athp->bitmap;
+               if (seqno > 7) {
+                       atp_resp_seqno2big++;
+                       ddp = AT_DDP_HDR(m);
+                       dPrintf(D_M_ATP_LOW, (D_L_INPUT|D_L_ERROR),
+                               ("atp_rput: dropping TRESP seqno too big, tid=%d,loc=%d,rem=%d.%d,seqno=%u\n",
+                                UAS_VALUE_NTOH(athp->tid),
+                                ddp->dst_socket, ddp->src_node, ddp->src_socket, seqno));
+                       gbuf_freem(m);
+                       return;
+               }
                if (trp == NULL) {
                ddp = AT_DDP_HDR(m);
                    dPrintf(D_M_ATP_LOW, (D_L_INPUT|D_L_ERROR),
-               ("atp_rput: dropping TRESP, no trp,tid=%d,loc=%d,rem=%d.%d,seqno=%d\n",
+               ("atp_rput: dropping TRESP, no trp,tid=%d,loc=%d,rem=%d.%d,seqno=%u\n",
                            UAS_VALUE_NTOH(athp->tid),
                            ddp->dst_socket, ddp->src_node, ddp->src_socket, seqno));
                    gbuf_freem(m);
@@ -176,7 +196,7 @@ gbuf_t   *m;
                if (!(trp->tr_bitmap&atp_mask[seqno]) || trp->tr_rcv[seqno]) {
                ddp = AT_DDP_HDR(m);
                    dPrintf(D_M_ATP_LOW, (D_L_INPUT|D_L_ERROR),
-               ("atp_rput: dropping TRESP, duplicate,tid=%d,loc=%d,rem=%d.%d,seqno=%d\n",
+               ("atp_rput: dropping TRESP, duplicate,tid=%d,loc=%d,rem=%d.%d,seqno=%u\n",
                            UAS_VALUE_NTOH(athp->tid),
                            ddp->dst_socket, ddp->src_node, ddp->src_socket, seqno));
                    gbuf_freem(m);