]> 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 9a4424731b0eb0c269c0224ce879a7b46038e6d8..940a58ae3784c49c9ff7ffc6692b92e429af7d4e 100644 (file)
 #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
@@ -100,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;
@@ -137,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
@@ -153,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);
@@ -182,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);