[PATCH] fixes of tcp_hostcache.c

Taku YAMAMOTO taku at cent.saitama-u.ac.jp
Mon Dec 1 18:56:40 PST 2003


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  <taku at cent.saitama-u.ac.jp>
 | __ <
-------------- next part --------------
--- 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);
 }
 



More information about the freebsd-current mailing list