]> xenbits.xensource.com Git - people/julieng/freebsd.git/commitdiff
Use embedded scope zone id to determine outgoing interface for link-local
authorae <ae@FreeBSD.org>
Sun, 9 Nov 2014 22:54:40 +0000 (22:54 +0000)
committerae <ae@FreeBSD.org>
Sun, 9 Nov 2014 22:54:40 +0000 (22:54 +0000)
and node-local addresses.

sys/netinet6/in6_src.c

index 9e163da8a41de88824081fd2537abbf307030905..d721fb9cdd9a9525c15b261eb714139db6da2d75 100644 (file)
@@ -555,6 +555,7 @@ selectroute(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts,
        struct sockaddr_in6 *sin6_next;
        struct in6_pktinfo *pi = NULL;
        struct in6_addr *dst = &dstsock->sin6_addr;
+       uint32_t zoneid;
 #if 0
        char ip6buf[INET6_ADDRSTRLEN];
 
@@ -585,7 +586,18 @@ selectroute(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts,
                } else
                        goto getroute;
        }
-
+       /*
+        * If destination address is LLA or link- or node-local multicast,
+        * use it's embedded scope zone id to determine outgoing interface.
+        */
+       if (IN6_IS_SCOPE_LINKLOCAL(dst) ||
+           IN6_IS_ADDR_MC_NODELOCAL(dst)) {
+               zoneid = ntohs(in6_getscope(dst));
+               if (zoneid > 0) {
+                       ifp = in6_getlinkifnet(zoneid);
+                       goto done;
+               }
+       }
        /*
         * If the destination address is a multicast address and the outgoing
         * interface for the address is specified by the caller, use it.