pimd: Fix PIM VRF support (send register/register stop in VRF)

In 9461953914 and
8ebcc02328, transmission of PIM register and
register stop messages was changed to use a separate socket. However, that
socket is not bound to a possible VRF, so the messages were sent in the
default VRF instead. Call vrf_bind() once after socket creation and when the
VRF is ready to ensure transmission in the correct VRF. vrf_bind() handles
the non-VRF case (i.e. VRF_DEFAULT) automatically, so it may be called
unconditionally.

Signed-off-by: Martin Buck <mb-tmp-tvguho.pbz@gromit.dyndns.org>
This commit is contained in:
Martin Buck 2025-02-21 08:54:49 +01:00 committed by Martin Buck
parent bf8e4a3b83
commit 5a01011e0d

View file

@ -181,6 +181,9 @@ static int pim_vrf_enable(struct vrf *vrf)
zlog_debug("%s: for %s %u", __func__, vrf->name, vrf->vrf_id);
if (vrf_bind(vrf->vrf_id, pim->reg_sock, NULL) < 0)
zlog_warn("Failed to bind register socket to VRF %s", vrf->name);
pim_mroute_socket_enable(pim);
FOR_ALL_INTERFACES (vrf, ifp) {