summaryrefslogtreecommitdiff
path: root/sys/netinet6/in6.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/netinet6/in6.c')
-rw-r--r--sys/netinet6/in6.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c
index 52fd97568f7..99535f54698 100644
--- a/sys/netinet6/in6.c
+++ b/sys/netinet6/in6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6.c,v 1.93 2011/08/08 13:04:35 bluhm Exp $ */
+/* $OpenBSD: in6.c,v 1.94 2011/11/24 17:39:55 sperreault Exp $ */
/* $KAME: in6.c,v 1.372 2004/06/14 08:14:21 itojun Exp $ */
/*
@@ -171,7 +171,8 @@ in6_ifloop_request(int cmd, struct ifaddr *ifa)
if (cmd != RTM_DELETE)
info.rti_info[RTAX_GATEWAY] = ifa->ifa_addr;
info.rti_info[RTAX_NETMASK] = (struct sockaddr *)&all1_sa;
- e = rtrequest1(cmd, &info, RTP_CONNECTED, &nrt, 0);
+ e = rtrequest1(cmd, &info, RTP_CONNECTED, &nrt,
+ ifa->ifa_ifp->if_rdomain);
if (e != 0) {
log(LOG_ERR, "in6_ifloop_request: "
"%s operation failed for %s (errno=%d)\n",
@@ -227,7 +228,7 @@ in6_ifaddloop(struct ifaddr *ifa)
struct rtentry *rt;
/* If there is no loopback entry, allocate one. */
- rt = rtalloc1(ifa->ifa_addr, 0, 0);
+ rt = rtalloc1(ifa->ifa_addr, 0, ifa->ifa_ifp->if_rdomain);
if (rt == NULL || (rt->rt_flags & RTF_HOST) == 0 ||
(rt->rt_ifp->if_flags & IFF_LOOPBACK) == 0)
in6_ifloop_request(RTM_ADD, ifa);
@@ -1084,7 +1085,7 @@ in6_update_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra,
* actually do not need the routes, since they usually specify
* the outgoing interface.
*/
- rt = rtalloc1((struct sockaddr *)&mltaddr, 0, 0);
+ rt = rtalloc1((struct sockaddr *)&mltaddr, 0, ifp->if_rdomain);
if (rt) {
/*
* 32bit came from "mltmask"
@@ -1110,7 +1111,7 @@ in6_update_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra,
/* XXX: we need RTF_CLONING to fake nd6_rtrequest */
info.rti_flags = RTF_UP | RTF_CLONING;
error = rtrequest1(RTM_ADD, &info, RTP_CONNECTED, NULL,
- 0);
+ ifp->if_rdomain);
if (error)
goto cleanup;
} else {
@@ -1156,7 +1157,7 @@ in6_update_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra,
mltaddr.sin6_scope_id = 0;
/* XXX: again, do we really need the route? */
- rt = rtalloc1((struct sockaddr *)&mltaddr, 0, 0);
+ rt = rtalloc1((struct sockaddr *)&mltaddr, 0, ifp->if_rdomain);
if (rt) {
/* 32bit came from "mltmask" */
if (memcmp(&mltaddr.sin6_addr,
@@ -1179,7 +1180,7 @@ in6_update_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra,
(struct sockaddr *)&ia->ia_addr;
info.rti_flags = RTF_UP | RTF_CLONING;
error = rtrequest1(RTM_ADD, &info, RTP_CONNECTED,
- NULL, 0);
+ NULL, ifp->if_rdomain);
if (error)
goto cleanup;
} else {
@@ -1937,7 +1938,7 @@ in6_ifpprefix(const struct ifnet *ifp, const struct in6_addr *addr)
{
struct sockaddr_in6 dst;
struct rtentry *rt;
- u_int tableid = 0; /* XXX */
+ u_int tableid = ifp->if_rdomain;
bzero(&dst, sizeof(dst));
dst.sin6_len = sizeof(struct sockaddr_in6);
@@ -2179,7 +2180,7 @@ in6_prefixlen2mask(struct in6_addr *maskp, int len)
* return the best address out of the same scope
*/
struct in6_ifaddr *
-in6_ifawithscope(struct ifnet *oifp, struct in6_addr *dst)
+in6_ifawithscope(struct ifnet *oifp, struct in6_addr *dst, u_int rdomain)
{
int dst_scope = in6_addrscope(dst), src_scope, best_scope = 0;
int blen = -1;
@@ -2199,6 +2200,9 @@ in6_ifawithscope(struct ifnet *oifp, struct in6_addr *dst)
*/
for (ifp = TAILQ_FIRST(&ifnet); ifp; ifp = TAILQ_NEXT(ifp, if_list))
{
+ if (ifp->if_rdomain != rdomain)
+ continue;
+
/*
* We can never take an address that breaks the scope zone
* of the destination.