Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Oct 2013 08:20:21 +0000 (UTC)
From:      "Andrey V. Elsukov" <ae@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r256508 - user/ae/inet6/sys/netinet
Message-ID:  <201310150820.r9F8KLD5024265@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ae
Date: Tue Oct 15 08:20:20 2013
New Revision: 256508
URL: http://svnweb.freebsd.org/changeset/base/256508

Log:
  It is possible, that many remote hosts have equal link-local addresses,
  but from different scope zones. Thus, they can have different tcp-specific
  metrics. Add ip6_zoneid field in addition to ip6 address to hc_metrics
  structure to be able handle this case.

Modified:
  user/ae/inet6/sys/netinet/tcp_hostcache.c
  user/ae/inet6/sys/netinet/tcp_hostcache.h

Modified: user/ae/inet6/sys/netinet/tcp_hostcache.c
==============================================================================
--- user/ae/inet6/sys/netinet/tcp_hostcache.c	Tue Oct 15 08:04:25 2013	(r256507)
+++ user/ae/inet6/sys/netinet/tcp_hostcache.c	Tue Oct 15 08:20:20 2013	(r256508)
@@ -295,7 +295,8 @@ tcp_hc_lookup(struct in_conninfo *inc)
 	TAILQ_FOREACH(hc_entry, &hc_head->hch_bucket, rmx_q) {
 		if (inc->inc_flags & INC_ISIPV6) {
 			if (memcmp(&inc->inc6_faddr, &hc_entry->ip6,
-			    sizeof(inc->inc6_faddr)) == 0)
+			    sizeof(inc->inc6_faddr)) == 0 &&
+			    hc_entry->ip6_zoneid == inc->inc6_zoneid)
 				return hc_entry;
 		} else {
 			if (memcmp(&inc->inc_faddr, &hc_entry->ip4,
@@ -385,9 +386,10 @@ tcp_hc_insert(struct in_conninfo *inc)
 	 * Initialize basic information of hostcache entry.
 	 */
 	bzero(hc_entry, sizeof(*hc_entry));
-	if (inc->inc_flags & INC_ISIPV6)
-		bcopy(&inc->inc6_faddr, &hc_entry->ip6, sizeof(hc_entry->ip6));
-	else
+	if (inc->inc_flags & INC_ISIPV6) {
+		hc_entry->ip6 = inc->inc6_faddr;
+		hc_entry->ip6_zoneid = inc->inc6_zoneid;
+	} else
 		hc_entry->ip4 = inc->inc_faddr;
 	hc_entry->rmx_head = hc_head;
 	hc_entry->rmx_expire = V_tcp_hostcache.expire;

Modified: user/ae/inet6/sys/netinet/tcp_hostcache.h
==============================================================================
--- user/ae/inet6/sys/netinet/tcp_hostcache.h	Tue Oct 15 08:04:25 2013	(r256507)
+++ user/ae/inet6/sys/netinet/tcp_hostcache.h	Tue Oct 15 08:20:20 2013	(r256508)
@@ -51,6 +51,7 @@ struct hc_metrics {
 	struct	hc_head *rmx_head; /* head of bucket tail queue */
 	struct	in_addr ip4;	/* IP address */
 	struct	in6_addr ip6;	/* IP6 address */
+	uint32_t ip6_zoneid;	/* IPv6 scope zone id */
 	/* endpoint specific values for tcp */
 	u_long	rmx_mtu;	/* MTU for this path */
 	u_long	rmx_ssthresh;	/* outbound gateway buffer limit */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201310150820.r9F8KLD5024265>