aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet/tcp_hostcache.c
diff options
context:
space:
mode:
authorAndrey V. Elsukov <ae@FreeBSD.org>2014-09-10 16:26:18 +0000
committerAndrey V. Elsukov <ae@FreeBSD.org>2014-09-10 16:26:18 +0000
commit028bdf289df048af19dd5d599114dff27afc36c5 (patch)
treeb93298b87693389ded830b8e1830613117b2ba1d /sys/netinet/tcp_hostcache.c
parentb8fd1e31d984c0ffe888bed30908e71ae7950dd9 (diff)
downloadsrc-028bdf289df048af19dd5d599114dff27afc36c5.tar.gz
src-028bdf289df048af19dd5d599114dff27afc36c5.zip
Add scope zone id to the in_endpoints and hc_metrics structures.
A non-global IPv6 address can be used in more than one zone of the same scope. This zone index is used to identify to which zone a non-global address belongs. Also we can have many foreign hosts with equal non-global addresses, but from different zones. So, they can have different metrics in the host cache. Obtained from: Yandex LLC Sponsored by: Yandex LLC
Notes
Notes: svn path=/head/; revision=271400
Diffstat (limited to 'sys/netinet/tcp_hostcache.c')
-rw-r--r--sys/netinet/tcp_hostcache.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/netinet/tcp_hostcache.c b/sys/netinet/tcp_hostcache.c
index d53323529890..a215325155f2 100644
--- a/sys/netinet/tcp_hostcache.c
+++ b/sys/netinet/tcp_hostcache.c
@@ -295,6 +295,7 @@ tcp_hc_lookup(struct in_conninfo *inc)
*/
TAILQ_FOREACH(hc_entry, &hc_head->hch_bucket, rmx_q) {
if (inc->inc_flags & INC_ISIPV6) {
+ /* XXX: check ip6_zoneid */
if (memcmp(&inc->inc6_faddr, &hc_entry->ip6,
sizeof(inc->inc6_faddr)) == 0)
return hc_entry;
@@ -386,9 +387,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;