summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2019-02-13 23:47:44 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2019-02-13 23:47:44 +0000
commitf4b6c16afb0edf8ec9850cea359a9e430a610635 (patch)
treebbddfaade2c28e0eb1b99cc127fe967a02f01440 /sys
parent6441905bfeadbf0368fbc36fe6e83edbb69f00cc (diff)
change rt_ifa_add and rt_ifa_del so they take an rdomain argument.
this allows mpls interfaces (mpe, mpw) to pass the rdomain they wish the local label to be in, rather than have it implicitly forced to 0 by these functions. right now they'll pass 0, but it will soon be possible to have them rx packets in other rdomains. previously the functions used ifp->if_rdomain for the rdomain. everything other than mpls still passes ifp->if_rdomain. ok mpi@
Diffstat (limited to 'sys')
-rw-r--r--sys/net/if_mpe.c10
-rw-r--r--sys/net/if_mpw.c10
-rw-r--r--sys/net/route.c65
-rw-r--r--sys/net/route.h6
-rw-r--r--sys/netinet/in.c24
-rw-r--r--sys/netinet/ip_mroute.c5
-rw-r--r--sys/netinet6/in6.c15
-rw-r--r--sys/netinet6/in6_ifattach.c5
-rw-r--r--sys/netinet6/ip6_mroute.c3
9 files changed, 81 insertions, 62 deletions
diff --git a/sys/net/if_mpe.c b/sys/net/if_mpe.c
index a3862e67be3..c6a260ad9ed 100644
--- a/sys/net/if_mpe.c
+++ b/sys/net/if_mpe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_mpe.c,v 1.80 2019/02/11 00:11:24 dlg Exp $ */
+/* $OpenBSD: if_mpe.c,v 1.81 2019/02/13 23:47:42 dlg Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@spootnik.org>
@@ -130,7 +130,7 @@ mpe_clone_destroy(struct ifnet *ifp)
if (sc->sc_smpls.smpls_label) {
rt_ifa_del(&sc->sc_ifa, RTF_MPLS,
- smplstosa(&sc->sc_smpls));
+ smplstosa(&sc->sc_smpls), 0);
}
if_detach(ifp);
@@ -316,12 +316,12 @@ mpe_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
if (sc->sc_smpls.smpls_label) {
/* remove old MPLS route */
rt_ifa_del(&sc->sc_ifa, RTF_MPLS,
- smplstosa(&sc->sc_smpls));
+ smplstosa(&sc->sc_smpls), 0);
}
/* add new MPLS route */
sc->sc_smpls.smpls_label = shim.shim_label;
error = rt_ifa_add(&sc->sc_ifa, RTF_MPLS|RTF_LOCAL,
- smplstosa(&sc->sc_smpls));
+ smplstosa(&sc->sc_smpls), 0);
if (error) {
sc->sc_smpls.smpls_label = 0;
break;
@@ -333,7 +333,7 @@ mpe_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
if (ifr->ifr_rdomainid != ifp->if_rdomain) {
if (sc->sc_smpls.smpls_label) {
rt_ifa_add(&sc->sc_ifa, RTF_MPLS,
- smplstosa(&sc->sc_smpls));
+ smplstosa(&sc->sc_smpls), 0);
}
}
/* return with ENOTTY so that the parent handler finishes */
diff --git a/sys/net/if_mpw.c b/sys/net/if_mpw.c
index f58729c8530..36a95040b65 100644
--- a/sys/net/if_mpw.c
+++ b/sys/net/if_mpw.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_mpw.c,v 1.33 2019/02/11 00:11:24 dlg Exp $ */
+/* $OpenBSD: if_mpw.c,v 1.34 2019/02/13 23:47:42 dlg Exp $ */
/*
* Copyright (c) 2015 Rafael Zalamena <rzalamena@openbsd.org>
@@ -120,7 +120,7 @@ mpw_clone_destroy(struct ifnet *ifp)
if (sc->sc_smpls.smpls_label) {
rt_ifa_del(&sc->sc_ifa, RTF_MPLS,
- smplstosa(&sc->sc_smpls));
+ smplstosa(&sc->sc_smpls), 0);
}
ether_ifdetach(ifp);
@@ -166,7 +166,7 @@ mpw_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
sin = (struct sockaddr_in *) &imr.imr_nexthop;
if (sin->sin_addr.s_addr == 0) {
if (rt_ifa_del(&sc->sc_ifa, RTF_MPLS,
- smplstosa(&sc->sc_smpls)) == 0)
+ smplstosa(&sc->sc_smpls), 0) == 0)
sc->sc_smpls.smpls_label = 0;
memset(&sc->sc_rshim, 0, sizeof(sc->sc_rshim));
@@ -195,11 +195,11 @@ mpw_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
if (sc->sc_smpls.smpls_label != imr.imr_lshim.shim_label) {
if (sc->sc_smpls.smpls_label)
rt_ifa_del(&sc->sc_ifa, RTF_MPLS,
- smplstosa(&sc->sc_smpls));
+ smplstosa(&sc->sc_smpls), 0);
sc->sc_smpls.smpls_label = imr.imr_lshim.shim_label;
error = rt_ifa_add(&sc->sc_ifa, RTF_MPLS|RTF_LOCAL,
- smplstosa(&sc->sc_smpls));
+ smplstosa(&sc->sc_smpls), 0);
if (error != 0) {
sc->sc_smpls.smpls_label = 0;
break;
diff --git a/sys/net/route.c b/sys/net/route.c
index 657e507a4e4..b42c51698a4 100644
--- a/sys/net/route.c
+++ b/sys/net/route.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.c,v 1.380 2019/02/10 22:32:26 dlg Exp $ */
+/* $OpenBSD: route.c,v 1.381 2019/02/13 23:47:42 dlg Exp $ */
/* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */
/*
@@ -1030,13 +1030,13 @@ rt_maskedcopy(struct sockaddr *src, struct sockaddr *dst,
}
int
-rt_ifa_add(struct ifaddr *ifa, int flags, struct sockaddr *dst)
+rt_ifa_add(struct ifaddr *ifa, int flags, struct sockaddr *dst,
+ unsigned int rdomain)
{
struct ifnet *ifp = ifa->ifa_ifp;
struct rtentry *rt;
struct sockaddr_rtlabel sa_rl;
struct rt_addrinfo info;
- unsigned int rtableid = ifp->if_rdomain;
uint8_t prio = ifp->if_priority + RTP_STATIC;
int error;
@@ -1048,14 +1048,16 @@ rt_ifa_add(struct ifaddr *ifa, int flags, struct sockaddr *dst)
info.rti_info[RTAX_GATEWAY] = sdltosa(ifp->if_sadl);
else
info.rti_info[RTAX_GATEWAY] = ifa->ifa_addr;
- info.rti_info[RTAX_LABEL] = rtlabel_id2sa(ifp->if_rtlabelid, &sa_rl);
+
+ KASSERT(rdomain == rtable_l2(rdomain));
+ if (rdomain == rtable_l2(ifp->if_rtlabelid)) {
+ info.rti_info[RTAX_LABEL] =
+ rtlabel_id2sa(ifp->if_rtlabelid, &sa_rl);
+ }
#ifdef MPLS
- if ((flags & RTF_MPLS) == RTF_MPLS) {
+ if ((flags & RTF_MPLS) == RTF_MPLS)
info.rti_mpls = MPLS_OP_POP;
- /* MPLS routes only exist in rdomain 0 */
- rtableid = 0;
- }
#endif /* MPLS */
if ((flags & RTF_HOST) == 0)
@@ -1067,7 +1069,7 @@ rt_ifa_add(struct ifaddr *ifa, int flags, struct sockaddr *dst)
if (flags & RTF_CONNECTED)
prio = ifp->if_priority + RTP_CONNECTED;
- error = rtrequest(RTM_ADD, &info, prio, &rt, rtableid);
+ error = rtrequest(RTM_ADD, &info, prio, &rt, rdomain);
if (error == 0) {
/*
* A local route is created for every address configured
@@ -1076,14 +1078,15 @@ rt_ifa_add(struct ifaddr *ifa, int flags, struct sockaddr *dst)
*/
if (flags & RTF_LOCAL)
rtm_addr(RTM_NEWADDR, ifa);
- rtm_send(rt, RTM_ADD, 0, rtableid);
+ rtm_send(rt, RTM_ADD, 0, rdomain);
rtfree(rt);
}
return (error);
}
int
-rt_ifa_del(struct ifaddr *ifa, int flags, struct sockaddr *dst)
+rt_ifa_del(struct ifaddr *ifa, int flags, struct sockaddr *dst,
+ unsigned int rdomain)
{
struct ifnet *ifp = ifa->ifa_ifp;
struct rtentry *rt;
@@ -1091,16 +1094,9 @@ rt_ifa_del(struct ifaddr *ifa, int flags, struct sockaddr *dst)
struct sockaddr *deldst;
struct rt_addrinfo info;
struct sockaddr_rtlabel sa_rl;
- unsigned int rtableid = ifp->if_rdomain;
uint8_t prio = ifp->if_priority + RTP_STATIC;
int error;
-#ifdef MPLS
- if ((flags & RTF_MPLS) == RTF_MPLS)
- /* MPLS routes only exist in rdomain 0 */
- rtableid = 0;
-#endif /* MPLS */
-
if ((flags & RTF_HOST) == 0 && ifa->ifa_netmask) {
m = m_get(M_DONTWAIT, MT_SONAME);
if (m == NULL)
@@ -1116,7 +1112,12 @@ rt_ifa_del(struct ifaddr *ifa, int flags, struct sockaddr *dst)
info.rti_info[RTAX_DST] = dst;
if ((flags & RTF_LLINFO) == 0)
info.rti_info[RTAX_GATEWAY] = ifa->ifa_addr;
- info.rti_info[RTAX_LABEL] = rtlabel_id2sa(ifp->if_rtlabelid, &sa_rl);
+
+ KASSERT(rdomain == rtable_l2(rdomain));
+ if (rdomain == rtable_l2(ifp->if_rtlabelid)) {
+ info.rti_info[RTAX_LABEL] =
+ rtlabel_id2sa(ifp->if_rtlabelid, &sa_rl);
+ }
if ((flags & RTF_HOST) == 0)
info.rti_info[RTAX_NETMASK] = ifa->ifa_netmask;
@@ -1127,9 +1128,9 @@ rt_ifa_del(struct ifaddr *ifa, int flags, struct sockaddr *dst)
if (flags & RTF_CONNECTED)
prio = ifp->if_priority + RTP_CONNECTED;
- error = rtrequest_delete(&info, prio, ifp, &rt, rtableid);
+ error = rtrequest_delete(&info, prio, ifp, &rt, rdomain);
if (error == 0) {
- rtm_send(rt, RTM_DELETE, 0, rtableid);
+ rtm_send(rt, RTM_DELETE, 0, rdomain);
if (flags & RTF_LOCAL)
rtm_addr(RTM_DELADDR, ifa);
rtfree(rt);
@@ -1145,6 +1146,7 @@ rt_ifa_del(struct ifaddr *ifa, int flags, struct sockaddr *dst)
int
rt_ifa_addlocal(struct ifaddr *ifa)
{
+ struct ifnet *ifp = ifa->ifa_ifp;
struct rtentry *rt;
u_int flags = RTF_HOST|RTF_LOCAL;
int error = 0;
@@ -1171,13 +1173,15 @@ rt_ifa_addlocal(struct ifaddr *ifa)
break;
}
- if (!ISSET(ifa->ifa_ifp->if_flags, (IFF_LOOPBACK|IFF_POINTOPOINT)))
+ if (!ISSET(ifp->if_flags, (IFF_LOOPBACK|IFF_POINTOPOINT)))
flags |= RTF_LLINFO;
/* If there is no local entry, allocate one. */
- rt = rtalloc(ifa->ifa_addr, 0, ifa->ifa_ifp->if_rdomain);
- if (rt == NULL || ISSET(rt->rt_flags, flags) != flags)
- error = rt_ifa_add(ifa, flags | RTF_MPATH, ifa->ifa_addr);
+ rt = rtalloc(ifa->ifa_addr, 0, ifp->if_rdomain);
+ if (rt == NULL || ISSET(rt->rt_flags, flags) != flags) {
+ error = rt_ifa_add(ifa, flags | RTF_MPATH, ifa->ifa_addr,
+ ifp->if_rdomain);
+ }
rtfree(rt);
return (error);
@@ -1189,6 +1193,7 @@ rt_ifa_addlocal(struct ifaddr *ifa)
int
rt_ifa_dellocal(struct ifaddr *ifa)
{
+ struct ifnet *ifp = ifa->ifa_ifp;
struct rtentry *rt;
u_int flags = RTF_HOST|RTF_LOCAL;
int error = 0;
@@ -1213,7 +1218,7 @@ rt_ifa_dellocal(struct ifaddr *ifa)
break;
}
- if (!ISSET(ifa->ifa_ifp->if_flags, (IFF_LOOPBACK|IFF_POINTOPOINT)))
+ if (!ISSET(ifp->if_flags, (IFF_LOOPBACK|IFF_POINTOPOINT)))
flags |= RTF_LLINFO;
/*
@@ -1224,9 +1229,11 @@ rt_ifa_dellocal(struct ifaddr *ifa)
* a subnet-router anycast address on an interface attached
* to a shared medium.
*/
- rt = rtalloc(ifa->ifa_addr, 0, ifa->ifa_ifp->if_rdomain);
- if (rt != NULL && ISSET(rt->rt_flags, flags) == flags)
- error = rt_ifa_del(ifa, flags, ifa->ifa_addr);
+ rt = rtalloc(ifa->ifa_addr, 0, ifp->if_rdomain);
+ if (rt != NULL && ISSET(rt->rt_flags, flags) == flags) {
+ error = rt_ifa_del(ifa, flags, ifa->ifa_addr,
+ ifp->if_rdomain);
+ }
rtfree(rt);
return (error);
diff --git a/sys/net/route.h b/sys/net/route.h
index b145964dc55..41aa5a1ace7 100644
--- a/sys/net/route.h
+++ b/sys/net/route.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.h,v 1.173 2018/11/12 16:36:54 krw Exp $ */
+/* $OpenBSD: route.h,v 1.174 2019/02/13 23:47:42 dlg Exp $ */
/* $NetBSD: route.h,v 1.9 1996/02/13 22:00:49 christos Exp $ */
/*
@@ -455,8 +455,8 @@ struct rtentry *rtalloc(struct sockaddr *, int, unsigned int);
void rtref(struct rtentry *);
void rtfree(struct rtentry *);
-int rt_ifa_add(struct ifaddr *, int, struct sockaddr *);
-int rt_ifa_del(struct ifaddr *, int, struct sockaddr *);
+int rt_ifa_add(struct ifaddr *, int, struct sockaddr *, unsigned int);
+int rt_ifa_del(struct ifaddr *, int, struct sockaddr *, unsigned int);
void rt_ifa_purge(struct ifaddr *);
int rt_ifa_addlocal(struct ifaddr *);
int rt_ifa_dellocal(struct ifaddr *);
diff --git a/sys/netinet/in.c b/sys/netinet/in.c
index 64ed3ee50b9..d3ac28349d0 100644
--- a/sys/netinet/in.c
+++ b/sys/netinet/in.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in.c,v 1.161 2019/02/10 22:32:26 dlg Exp $ */
+/* $OpenBSD: in.c,v 1.162 2019/02/13 23:47:43 dlg Exp $ */
/* $NetBSD: in.c,v 1.26 1996/02/13 23:41:39 christos Exp $ */
/*
@@ -694,13 +694,15 @@ in_purgeaddr(struct ifaddr *ifa)
int
in_addhost(struct in_ifaddr *ia, struct sockaddr_in *dst)
{
- return rt_ifa_add(&ia->ia_ifa, RTF_HOST | RTF_MPATH, sintosa(dst));
+ return rt_ifa_add(&ia->ia_ifa, RTF_HOST | RTF_MPATH,
+ sintosa(dst), ia->ia_ifa.ifa_ifp->if_rdomain);
}
int
in_scrubhost(struct in_ifaddr *ia, struct sockaddr_in *dst)
{
- return rt_ifa_del(&ia->ia_ifa, RTF_HOST, sintosa(dst));
+ return rt_ifa_del(&ia->ia_ifa, RTF_HOST,
+ sintosa(dst), ia->ia_ifa.ifa_ifp->if_rdomain);
}
/*
@@ -713,13 +715,14 @@ in_insert_prefix(struct in_ifaddr *ia)
int error;
error = rt_ifa_add(ifa, RTF_CLONING | RTF_CONNECTED | RTF_MPATH,
- ifa->ifa_addr);
+ ifa->ifa_addr, ifa->ifa_ifp->if_rdomain);
if (error)
return (error);
- if (ia->ia_broadaddr.sin_addr.s_addr != 0)
+ if (ia->ia_broadaddr.sin_addr.s_addr != 0) {
error = rt_ifa_add(ifa, RTF_HOST | RTF_BROADCAST | RTF_MPATH,
- ifa->ifa_broadaddr);
+ ifa->ifa_broadaddr, ifa->ifa_ifp->if_rdomain);
+ }
return (error);
}
@@ -729,10 +732,13 @@ in_remove_prefix(struct in_ifaddr *ia)
{
struct ifaddr *ifa = &ia->ia_ifa;
- rt_ifa_del(ifa, RTF_CLONING | RTF_CONNECTED, ifa->ifa_addr);
+ rt_ifa_del(ifa, RTF_CLONING | RTF_CONNECTED,
+ ifa->ifa_addr, ifa->ifa_ifp->if_rdomain);
- if (ia->ia_broadaddr.sin_addr.s_addr != 0)
- rt_ifa_del(ifa, RTF_HOST | RTF_BROADCAST, ifa->ifa_broadaddr);
+ if (ia->ia_broadaddr.sin_addr.s_addr != 0) {
+ rt_ifa_del(ifa, RTF_HOST | RTF_BROADCAST,
+ ifa->ifa_broadaddr, ifa->ifa_ifp->if_rdomain);
+ }
}
/*
diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c
index e56eea13914..0862d377602 100644
--- a/sys/netinet/ip_mroute.c
+++ b/sys/netinet/ip_mroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_mroute.c,v 1.124 2019/02/10 22:32:26 dlg Exp $ */
+/* $OpenBSD: ip_mroute.c,v 1.125 2019/02/13 23:47:43 dlg Exp $ */
/* $NetBSD: ip_mroute.c,v 1.85 2004/04/26 01:31:57 matt Exp $ */
/*
@@ -1308,7 +1308,8 @@ rt_mcast_add(struct ifnet *ifp, struct sockaddr *origin, struct sockaddr *group)
return (NULL);
}
- rv = rt_ifa_add(ifa, RTF_HOST | RTF_MULTICAST | RTF_MPATH, group);
+ rv = rt_ifa_add(ifa, RTF_HOST | RTF_MULTICAST | RTF_MPATH,
+ group, ifp->if_rdomain);
if (rv != 0) {
DPRINTF("rt_ifa_add failed (%d)", rv);
return (NULL);
diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c
index 29b325dbf8c..1a17f925784 100644
--- a/sys/netinet6/in6.c
+++ b/sys/netinet6/in6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6.c,v 1.229 2019/02/10 22:32:26 dlg Exp $ */
+/* $OpenBSD: in6.c,v 1.230 2019/02/13 23:47:43 dlg Exp $ */
/* $KAME: in6.c,v 1.372 2004/06/14 08:14:21 itojun Exp $ */
/*
@@ -378,7 +378,7 @@ in6_ioctl_change_ifaddr(u_long cmd, caddr_t data, struct ifnet *ifp)
error = rt_ifa_add(&ia6->ia_ifa,
RTF_CLONING | RTF_CONNECTED | RTF_MPATH,
- ia6->ia_ifa.ifa_addr);
+ ia6->ia_ifa.ifa_addr, ifp->if_rdomain);
if (error) {
in6_purgeaddr(&ia6->ia_ifa);
break;
@@ -680,7 +680,8 @@ in6_update_ifa(struct ifnet *ifp, struct in6_aliasreq *ifra,
struct ifaddr *ifa = &ia6->ia_ifa;
if ((ia6->ia_flags & IFA_ROUTE) != 0 &&
- rt_ifa_del(ifa, RTF_HOST, ifa->ifa_dstaddr) != 0) {
+ rt_ifa_del(ifa, RTF_HOST, ifa->ifa_dstaddr,
+ ifp->if_rdomain) != 0) {
nd6log((LOG_ERR, "in6_update_ifa: failed to remove "
"a route to the old destination: %s\n",
inet_ntop(AF_INET6, &ia6->ia_addr.sin6_addr,
@@ -888,7 +889,9 @@ in6_purgeaddr(struct ifaddr *ifa)
ia6->ia_dstaddr.sin6_len != 0) {
int e;
- if ((e = rt_ifa_del(ifa, RTF_HOST, ifa->ifa_dstaddr)) != 0) {
+ e = rt_ifa_del(ifa, RTF_HOST, ifa->ifa_dstaddr,
+ ifp->if_rdomain);
+ if (e != 0) {
char addr[INET6_ADDRSTRLEN];
log(LOG_ERR, "in6_purgeaddr: failed to remove "
"a route to the p2p destination: %s on %s, "
@@ -929,7 +932,7 @@ in6_unlink_ifa(struct in6_ifaddr *ia6, struct ifnet *ifp)
plen = in6_mask2len(&ia6->ia_prefixmask.sin6_addr, NULL);
if ((ifp->if_flags & IFF_LOOPBACK) == 0 && plen != 128) {
rt_ifa_del(ifa, RTF_CLONING | RTF_CONNECTED,
- ifa->ifa_addr);
+ ifa->ifa_addr, ifp->if_rdomain);
}
rt_ifa_purge(ifa);
@@ -984,7 +987,7 @@ in6_ifinit(struct ifnet *ifp, struct in6_ifaddr *ia6, int newhost)
ia6->ia_dstaddr.sin6_family == AF_INET6) {
ifa = &ia6->ia_ifa;
error = rt_ifa_add(ifa, RTF_HOST | RTF_MPATH,
- ifa->ifa_dstaddr);
+ ifa->ifa_dstaddr, ifp->if_rdomain);
if (error != 0)
return (error);
ia6->ia_flags |= IFA_ROUTE;
diff --git a/sys/netinet6/in6_ifattach.c b/sys/netinet6/in6_ifattach.c
index 77da29d7d1a..884406957cf 100644
--- a/sys/netinet6/in6_ifattach.c
+++ b/sys/netinet6/in6_ifattach.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6_ifattach.c,v 1.112 2019/02/10 22:32:26 dlg Exp $ */
+/* $OpenBSD: in6_ifattach.c,v 1.113 2019/02/13 23:47:43 dlg Exp $ */
/* $KAME: in6_ifattach.c,v 1.124 2001/07/18 08:32:51 jinmei Exp $ */
/*
@@ -378,7 +378,8 @@ in6_ifattach_linklocal(struct ifnet *ifp, struct in6_addr *ifid)
if ((ifp->if_flags & IFF_POINTOPOINT) == 0)
flags |= RTF_CLONING;
- error = rt_ifa_add(&ia6->ia_ifa, flags, ia6->ia_ifa.ifa_addr);
+ error = rt_ifa_add(&ia6->ia_ifa, flags, ia6->ia_ifa.ifa_addr,
+ ifp->if_rdomain);
if (error) {
in6_purgeaddr(&ia6->ia_ifa);
return (error);
diff --git a/sys/netinet6/ip6_mroute.c b/sys/netinet6/ip6_mroute.c
index 3171c631174..37fb9e2f5d2 100644
--- a/sys/netinet6/ip6_mroute.c
+++ b/sys/netinet6/ip6_mroute.c
@@ -1241,7 +1241,8 @@ mrt6_mcast6_add(struct ifnet *ifp, struct sockaddr *origin,
return NULL;
}
- rv = rt_ifa_add(ifa, RTF_HOST | RTF_MULTICAST | RTF_MPATH, group);
+ rv = rt_ifa_add(ifa, RTF_HOST | RTF_MULTICAST | RTF_MPATH, group,
+ ifp->if_rdomain);
if (rv != 0) {
DPRINTF("rt_ifa_add failed %d", rv);
return NULL;