From owner-p4-projects@FreeBSD.ORG Wed Aug 13 16:02:24 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 4D6EF106568A; Wed, 13 Aug 2008 16:02:24 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0DB201065672 for ; Wed, 13 Aug 2008 16:02:24 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 083E28FC13 for ; Wed, 13 Aug 2008 16:02:24 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.2/8.14.2) with ESMTP id m7DG2NAk060245 for ; Wed, 13 Aug 2008 16:02:23 GMT (envelope-from rpaulo@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.2/8.14.1/Submit) id m7DG2NYC060243 for perforce@freebsd.org; Wed, 13 Aug 2008 16:02:23 GMT (envelope-from rpaulo@FreeBSD.org) Date: Wed, 13 Aug 2008 16:02:23 GMT Message-Id: <200808131602.m7DG2NYC060243@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to rpaulo@FreeBSD.org using -f From: Rui Paulo To: Perforce Change Reviews Cc: Subject: PERFORCE change 147308 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Aug 2008 16:02:24 -0000 http://perforce.freebsd.org/chv.cgi?CH=147308 Change 147308 by rpaulo@rpaulo_epsilon on 2008/08/13 16:01:52 Disable packet padding. It's causing memory corruption. Cope with retransmisted SYN or SYN/ACK during connections. Affected files ... .. //depot/projects/soc2008/rpaulo-tcpad/handler.c#18 edit .. //depot/projects/soc2008/rpaulo-tcpad/timer.c#9 edit .. //depot/projects/soc2008/rpaulo-tcpad/verify.c#8 edit Differences ... ==== //depot/projects/soc2008/rpaulo-tcpad/handler.c#18 (text+ko) ==== @@ -23,7 +23,7 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $P4: //depot/projects/soc2008/rpaulo-tcpad/handler.c#17 $ + * $P4: //depot/projects/soc2008/rpaulo-tcpad/handler.c#18 $ */ #include @@ -94,6 +94,7 @@ rcp = find_conn(ip->ip_dst, ip->ip_src, ntohs(th->th_dport), ntohs(th->th_sport)); +#ifdef notyet /* * Erase the data in the TCP packet. * XXX: This breaks the checksum. @@ -102,6 +103,7 @@ */ memset((inetpkt + sizeof(struct ip) + th->th_off * 4), 'R', snaplen - (sizeof(struct ip) + th->th_off * 4) - 2); +#endif added = 0; if (cp && cp->pktshead) { ==== //depot/projects/soc2008/rpaulo-tcpad/timer.c#9 (text+ko) ==== @@ -23,7 +23,7 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $P4: //depot/projects/soc2008/rpaulo-tcpad/timer.c#8 $ + * $P4: //depot/projects/soc2008/rpaulo-tcpad/timer.c#9 $ */ #include @@ -117,10 +117,10 @@ setitimer(ITIMER_REAL, &itp, NULL); LIST_FOREACH_SAFE(cp, &tcpchead, entries, cp_t) { - if (cp->pktshead) + if (cp->pktshead) { dumper_free(cp); - if (cp->rcp && cp->rcp->pktshead) cp->rcp->pktshead = NULL; + } LIST_REMOVE(cp, entries); free(cp); } ==== //depot/projects/soc2008/rpaulo-tcpad/verify.c#8 (text+ko) ==== @@ -23,7 +23,7 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $P4: //depot/projects/soc2008/rpaulo-tcpad/verify.c#7 $ + * $P4: //depot/projects/soc2008/rpaulo-tcpad/verify.c#8 $ */ #include @@ -232,6 +232,8 @@ */ if ((th->th_flags & TH_SYN) && !(th->th_flags & TH_ACK) && !(th->th_flags & TH_RST) && !(th->th_flags & TH_FIN)) { + if (tp && th->th_seq == tp->irs) + return (cp); cp = malloc(sizeof(*cp)); memset(cp, 0, sizeof(*cp)); @@ -294,11 +296,10 @@ TCPAD_VERIFY_DIRECTION_IN); break; default: - dumper_error(cp, "SYN/ACK received, state != SYN_SENT"); - dumper_free(cp); - LIST_REMOVE(cp, entries); - free(cp); - return NULL; + /* + * We got a SYN/ACK retransmission. Just ignore it. + */ + return (cp); } tp->irs = th->th_seq; tp->rcv_wnd = th->th_win;