Merge pull request #18333 from FRRouting/mergify/bp/stable/10.2/pr-18315

pimd: Fix PIM6 MLD VRF support (use recvmsg() pktinfo) (backport #18315)
This commit is contained in:
Donald Sharp 2025-03-06 20:32:39 -05:00 committed by GitHub
commit aa86d77e45
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1657,18 +1657,6 @@ static void gm_t_recv(struct event *t)
goto out_free;
}
struct interface *ifp;
ifp = if_lookup_by_index(pkt_src->sin6_scope_id, pim->vrf->vrf_id);
if (!ifp || !ifp->info)
goto out_free;
struct pim_interface *pim_ifp = ifp->info;
struct gm_if *gm_ifp = pim_ifp->mld;
if (!gm_ifp)
goto out_free;
for (cmsg = CMSG_FIRSTHDR(mh); cmsg; cmsg = CMSG_NXTHDR(mh, cmsg)) {
if (cmsg->cmsg_level != SOL_IPV6)
continue;
@ -1687,6 +1675,21 @@ static void gm_t_recv(struct event *t)
}
}
/* Prefer pktinfo as that also works in case of VRF */
ifindex_t ifindex = pktinfo ? pktinfo->ipi6_ifindex
: pkt_src->sin6_scope_id;
struct interface *ifp;
ifp = if_lookup_by_index(ifindex, pim->vrf->vrf_id);
if (!ifp || !ifp->info)
goto out_free;
struct pim_interface *pim_ifp = ifp->info;
struct gm_if *gm_ifp = pim_ifp->mld;
if (!gm_ifp)
goto out_free;
if (!pktinfo || !hoplimit) {
zlog_err(log_ifp(
"BUG: packet without IPV6_PKTINFO or IPV6_HOPLIMIT"));