Author: ae
Date: Wed Sep 10 16:26:18 2014
New Revision: 271400
URL: http://svnweb.freebsd.org/changeset/base/271400

Log:
  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

Modified:
  head/sys/netinet/in_pcb.h
  head/sys/netinet/tcp_hostcache.c
  head/sys/netinet/tcp_hostcache.h

Modified: head/sys/netinet/in_pcb.h
==============================================================================
--- head/sys/netinet/in_pcb.h   Wed Sep 10 15:45:18 2014        (r271399)
+++ head/sys/netinet/in_pcb.h   Wed Sep 10 16:26:18 2014        (r271400)
@@ -94,6 +94,7 @@ struct in_endpoints {
                struct  in_addr_4in6 ie46_local;
                struct  in6_addr ie6_local;
        } ie_dependladdr;
+       u_int32_t       ie6_zoneid;             /* scope zone id */
 };
 #define        ie_faddr        ie_dependfaddr.ie46_foreign.ia46_addr4
 #define        ie_laddr        ie_dependladdr.ie46_local.ia46_addr4
@@ -124,6 +125,7 @@ struct in_conninfo {
 #define        inc_laddr       inc_ie.ie_laddr
 #define        inc6_faddr      inc_ie.ie6_faddr
 #define        inc6_laddr      inc_ie.ie6_laddr
+#define        inc6_zoneid     inc_ie.ie6_zoneid
 
 struct icmp6_filter;
 
@@ -229,6 +231,7 @@ struct inpcb {
 
 #define        in6p_faddr      inp_inc.inc6_faddr
 #define        in6p_laddr      inp_inc.inc6_laddr
+#define        in6p_zoneid     inp_inc.inc6_zoneid
 #define        in6p_hops       inp_depend6.inp6_hops   /* default hop limit */
 #define        in6p_flowinfo   inp_flow
 #define        in6p_options    inp_depend6.inp6_options

Modified: head/sys/netinet/tcp_hostcache.c
==============================================================================
--- head/sys/netinet/tcp_hostcache.c    Wed Sep 10 15:45:18 2014        
(r271399)
+++ head/sys/netinet/tcp_hostcache.c    Wed Sep 10 16:26:18 2014        
(r271400)
@@ -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;

Modified: head/sys/netinet/tcp_hostcache.h
==============================================================================
--- head/sys/netinet/tcp_hostcache.h    Wed Sep 10 15:45:18 2014        
(r271399)
+++ head/sys/netinet/tcp_hostcache.h    Wed Sep 10 16:26:18 2014        
(r271400)
@@ -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 */
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to