summaryrefslogtreecommitdiff
path: root/pimd/pim_mroute.c
diff options
context:
space:
mode:
authoranlan_cs <vic.lan@pica8.com>2023-04-26 17:59:58 +0800
committeranlan_cs <vic.lan@pica8.com>2023-04-27 09:15:00 +0800
commitad855cdf34a9940322547e570f2428d50c4feac7 (patch)
tree84ab51adc5a8bc194e17617d7f3db8cb4f729e29 /pimd/pim_mroute.c
parent13c426150fd4699466306d88a917df6493faf9bd (diff)
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 <vic.lan@pica8.com>
Diffstat (limited to 'pimd/pim_mroute.c')
-rw-r--r--pimd/pim_mroute.c2
1 files changed, 1 insertions, 1 deletions
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;