summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonald Sharp <donaldsharp72@gmail.com>2025-03-06 20:33:02 -0500
committerGitHub <noreply@github.com>2025-03-06 20:33:02 -0500
commitc9be4cf7464d0e8bb3e1150b34871d4ae35edd56 (patch)
tree75f1e3d1ccf5d07f16576dae76decea3299cf1c2
parent1c099098e4018d34e0acf8787847b91289a5f5e3 (diff)
parente22eea10ab752dd5020811c3d70ea40d5a8134e6 (diff)
Merge pull request #18332 from FRRouting/mergify/bp/dev/10.3/pr-18315
pimd: Fix PIM6 MLD VRF support (use recvmsg() pktinfo) (backport #18315)
-rw-r--r--pimd/pim6_mld.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/pimd/pim6_mld.c b/pimd/pim6_mld.c
index acfb0c3af3..daedec6f89 100644
--- a/pimd/pim6_mld.c
+++ b/pimd/pim6_mld.c
@@ -1676,18 +1676,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;
@@ -1706,6 +1694,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"));