diff options
author | Mobashshera Rasool <mrasool@vmware.com> | 2023-06-01 10:56:41 +0200 |
---|---|---|
committer | Mobashshera Rasool <mrasool@vmware.com> | 2023-06-07 08:59:55 +0200 |
commit | 692b1f3e97f282362cd57e0e236423fc761a96b9 (patch) | |
tree | 186026a2024cd455f9124de7b9c8e9293cb63464 /pimd | |
parent | pimd, pim6d: Move api pim_if_membership_clear (diff) | |
download | frr-692b1f3e97f282362cd57e0e236423fc761a96b9.tar.xz frr-692b1f3e97f282362cd57e0e236423fc761a96b9.zip |
pimd, pim6d: Rename and move api pim_cmd_interface_delete
Rename pim_cmd_interface_delete to pim_pim_interface_delete
and move the api to pimd/pim_iface.c
Changed the return type of the api from int to void.
Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
Diffstat (limited to 'pimd')
-rw-r--r-- | pimd/pim_iface.c | 24 | ||||
-rw-r--r-- | pimd/pim_iface.h | 1 | ||||
-rw-r--r-- | pimd/pim_nb_config.c | 39 |
3 files changed, 27 insertions, 37 deletions
diff --git a/pimd/pim_iface.c b/pimd/pim_iface.c index 82548454a..a83b8af01 100644 --- a/pimd/pim_iface.c +++ b/pimd/pim_iface.c @@ -1775,3 +1775,27 @@ static void pim_if_membership_clear(struct interface *ifp) pim_ifchannel_membership_clear(ifp); } + +void pim_pim_interface_delete(struct interface *ifp) +{ + struct pim_interface *pim_ifp = ifp->info; + + if (!pim_ifp) + return; + + pim_ifp->pim_enable = false; + + pim_if_membership_clear(ifp); + + /* + * pim_sock_delete() removes all neighbors from + * pim_ifp->pim_neighbor_list. + */ + pim_sock_delete(ifp, "pim unconfigured on interface"); + pim_upstream_nh_if_update(pim_ifp->pim, ifp); + + if (!pim_ifp->gm_enable) { + pim_if_addr_del_all(ifp); + pim_if_delete(ifp); + } +} diff --git a/pimd/pim_iface.h b/pimd/pim_iface.h index 973840a75..ffde72de8 100644 --- a/pimd/pim_iface.h +++ b/pimd/pim_iface.h @@ -243,5 +243,6 @@ bool pim_if_is_vrf_device(struct interface *ifp); int pim_if_ifchannel_count(struct pim_interface *pim_ifp); void pim_iface_init(void); +void pim_pim_interface_delete(struct interface *ifp); #endif /* PIM_IFACE_H */ diff --git a/pimd/pim_nb_config.c b/pimd/pim_nb_config.c index d5d864f4a..a43f461a1 100644 --- a/pimd/pim_nb_config.c +++ b/pimd/pim_nb_config.c @@ -147,32 +147,6 @@ static int pim_cmd_interface_add(struct interface *ifp) return 1; } -static int pim_cmd_interface_delete(struct interface *ifp) -{ - struct pim_interface *pim_ifp = ifp->info; - - if (!pim_ifp) - return 1; - - pim_ifp->pim_enable = false; - - pim_if_membership_clear(ifp); - - /* - * pim_sock_delete() removes all neighbors from - * pim_ifp->pim_neighbor_list. - */ - pim_sock_delete(ifp, "pim unconfigured on interface"); - pim_upstream_nh_if_update(pim_ifp->pim, ifp); - - if (!pim_ifp->gm_enable) { - pim_if_addr_del_all(ifp); - pim_if_delete(ifp); - } - - return 1; -} - static int interface_pim_use_src_cmd_worker(struct interface *ifp, pim_addr source_addr, char *errmsg, size_t errmsg_len) { @@ -1559,12 +1533,7 @@ int lib_interface_pim_address_family_destroy(struct nb_cb_destroy_args *args) if (!pim_ifp) return NB_OK; - if (!pim_cmd_interface_delete(ifp)) { - snprintf(args->errmsg, args->errmsg_len, - "Unable to delete interface information %s", - ifp->name); - return NB_ERR_INCONSISTENCY; - } + pim_pim_interface_delete(ifp); } return NB_OK; @@ -1612,11 +1581,7 @@ int lib_interface_pim_address_family_pim_enable_modify(struct nb_cb_modify_args if (!pim_ifp) return NB_ERR_INCONSISTENCY; - if (!pim_cmd_interface_delete(ifp)) { - snprintf(args->errmsg, args->errmsg_len, - "Unable to delete interface information"); - return NB_ERR_INCONSISTENCY; - } + pim_pim_interface_delete(ifp); } break; } |