X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/5d5c5d0d5b79ade9a973d55186ffda2638ba2b6e..e2fac8b15b12a7979f72090454d850e612fc5b13:/bsd/netat/atp_read.c?ds=sidebyside diff --git a/bsd/netat/atp_read.c b/bsd/netat/atp_read.c index 6104829c4..940a58ae3 100644 --- a/bsd/netat/atp_read.c +++ b/bsd/netat/atp_read.c @@ -1,31 +1,29 @@ /* * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. * - * @APPLE_LICENSE_OSREFERENCE_HEADER_START@ + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * - * 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. - * - * 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and + * 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. + * + * 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, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and * limitations under the License. - * - * @APPLE_LICENSE_OSREFERENCE_HEADER_END@ + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ /* * Copyright (c) 1996-1998 Apple Computer, Inc. @@ -49,17 +47,22 @@ #include #include +#include + #include #include #include #include +#include #include +#include #include -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 @@ -102,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; @@ -139,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 @@ -155,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); @@ -184,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);