From ad855cdf34a9940322547e570f2428d50c4feac7 Mon Sep 17 00:00:00 2001 From: anlan_cs Date: Wed, 26 Apr 2023 17:59:58 +0800 Subject: [PATCH] pimd: Fix wrong setsockopt() call `setsockopt()` should be only called once with `MRT_TABLE` in "enable" case, otherwise it will fail. In current code, `mroute_socket` of "pim instance" with VRF can't be correctly closed. Skip it in the "disable" case to let `mroute_socket` safely closed. Signed-off-by: anlan_cs --- pimd/pim_mroute.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pimd/pim_mroute.c b/pimd/pim_mroute.c index 4d5da31827..b64fcdeb87 100644 --- a/pimd/pim_mroute.c +++ b/pimd/pim_mroute.c @@ -46,7 +46,7 @@ int pim_mroute_set(struct pim_instance *pim, int enable) /* * We need to create the VRF table for the pim mroute_socket */ - if (pim->vrf->vrf_id != VRF_DEFAULT) { + if (enable && pim->vrf->vrf_id != VRF_DEFAULT) { frr_with_privs (&pimd_privs) { data = pim->vrf->data.l.table_id; -- 2.39.5