From owner-freebsd-current@FreeBSD.ORG Mon Dec 1 18:56:40 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8476F16A4CE for ; Mon, 1 Dec 2003 18:56:40 -0800 (PST) Received: from maestro.tackymt.homeip.net (dhcp-7.cent.saitama-u.ac.jp [133.38.4.33]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0694743F75 for ; Mon, 1 Dec 2003 18:56:38 -0800 (PST) (envelope-from taku@cent.saitama-u.ac.jp) Received: from dhcp-7.cent.saitama-u.ac.jp (localhost [IPv6:::1]) hB22uVX8001183 for ; Tue, 2 Dec 2003 11:56:31 +0900 (JST) (envelope-from taku@cent.saitama-u.ac.jp) Date: Tue, 2 Dec 2003 11:56:30 +0900 From: Taku YAMAMOTO To: current@freebsd.org Message-Id: <20031202115630.717587dd.taku@cent.saitama-u.ac.jp> Organization: Advanced Computer and Communication Studies Society X-Mailer: Sylpheed version 0.9.5-gtk2-20030906 (GTK+ 2.2.2; i386-portbld-freebsd5.1) Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Multipart_Tue__2_Dec_2003_11_56_30_+0900_085b1000" Subject: [PATCH] fixes of tcp_hostcache.c X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Dec 2003 02:56:40 -0000 This is a multi-part message in MIME format. --Multipart_Tue__2_Dec_2003_11_56_30_+0900_085b1000 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Greetings, I found two calls of bcopy() in tcp_hostcache.c got the source and the destination pointer wrongly. # Perhaps the author got confused with memcpy(), I guess. The fix is attached as a patch against tcp_hostcache.c as of revision 1.2. Please review and incorporate the patch to the tree because the bug makes hostcache useless with TCPv6 and/or brings TTCP (RFC1644) meaningless. Especially the bug renders it unusable to use TCPv6 and TTCP together. # To confirm this: sysctl net.inet.tcp.rfc1644=1; telnet ::1 Best regards, Taku -- -|-__ YAMAMOTO, Taku | __ < --Multipart_Tue__2_Dec_2003_11_56_30_+0900_085b1000 Content-Type: text/plain; name="hostcache-bcopy.patch" Content-Disposition: attachment; filename="hostcache-bcopy.patch" Content-Transfer-Encoding: 7bit --- sys/netinet/tcp_hostcache.c.orig Sat Nov 29 01:33:03 2003 +++ sys/netinet/tcp_hostcache.c Tue Dec 2 10:17:57 2003 @@ -377,7 +377,7 @@ */ bzero(hc_entry, sizeof(*hc_entry)); if (inc->inc_isipv6) - bcopy(&hc_entry->ip6, &inc->inc6_faddr, sizeof(hc_entry->ip6)); + bcopy(&inc->inc6_faddr, &hc_entry->ip6, sizeof(hc_entry->ip6)); else hc_entry->ip4 = inc->inc_faddr; hc_entry->rmx_head = hc_head; @@ -474,7 +474,7 @@ hc_entry->rmx_hits++; hc_entry->rmx_expire = tcp_hostcache.expire; /* start over again */ - bcopy(tao, &hc_entry->rmx_tao, sizeof(*tao)); + bcopy(&hc_entry->rmx_tao, tao, sizeof(*tao)); THC_UNLOCK(&hc_entry->rmx_head->hch_mtx); } --Multipart_Tue__2_Dec_2003_11_56_30_+0900_085b1000--