-/* $OpenBSD: ip_output.c,v 1.362 2021/02/01 13:25:04 bluhm Exp $ */
+/* $OpenBSD: ip_output.c,v 1.363 2021/02/02 17:47:42 claudio Exp $ */
/* $NetBSD: ip_output.c,v 1.28 1996/02/13 23:43:07 christos Exp $ */
/*
*/
if (mreqn.imr_ifindex != 0) {
ifp = if_get(mreqn.imr_ifindex);
- if (ifp == NULL) {
+ if (ifp == NULL ||
+ ifp->if_rdomain != rtable_l2(rtableid)) {
error = EADDRNOTAVAIL;
+ if_put(ifp);
break;
}
imo->imo_ifidx = ifp->if_index;
* supports multicast.
*/
ifp = if_get(ifidx);
- if (ifp == NULL || (ifp->if_flags & IFF_MULTICAST) == 0) {
+ if (ifp == NULL || ifp->if_rdomain != rtable_l2(rtableid) ||
+ (ifp->if_flags & IFF_MULTICAST) == 0) {
error = EADDRNOTAVAIL;
if_put(ifp);
break;