From 14c6e77243e6ba0aa82d6ae7e97c103468ecd3d2 Mon Sep 17 00:00:00 2001 From: Renato Westphal Date: Mon, 10 Aug 2020 12:23:14 -0300 Subject: isisd: modify signature of isis_area_destroy() Make that function accept an IS-IS area pointer instead of an area name, making it more in line with the rest of the code base (*delete() functions shouldn't perform lookups internally). Signed-off-by: Renato Westphal --- isisd/isis_nb_config.c | 2 +- isisd/isisd.c | 27 ++++++++++++++------------- isisd/isisd.h | 2 +- 3 files changed, 16 insertions(+), 15 deletions(-) (limited to 'isisd') diff --git a/isisd/isis_nb_config.c b/isisd/isis_nb_config.c index 6873c652f..cfe96e6ed 100644 --- a/isisd/isis_nb_config.c +++ b/isisd/isis_nb_config.c @@ -77,7 +77,7 @@ int isis_instance_destroy(struct nb_cb_destroy_args *args) return NB_OK; area = nb_running_unset_entry(args->dnode); - isis_area_destroy(area->area_tag); + isis_area_destroy(area); return NB_OK; } diff --git a/isisd/isisd.c b/isisd/isisd.c index 0c8640f24..79060351f 100644 --- a/isisd/isisd.c +++ b/isisd/isisd.c @@ -247,21 +247,12 @@ int isis_area_get(struct vty *vty, const char *area_tag) return CMD_SUCCESS; } -int isis_area_destroy(const char *area_tag) +void isis_area_destroy(struct isis_area *area) { - struct isis_area *area; struct listnode *node, *nnode; struct isis_circuit *circuit; struct area_addr *addr; - area = isis_area_lookup(area_tag); - - if (area == NULL) { - zlog_warn("%s: could not find area with area-tag %s", - __func__, area_tag); - return CMD_ERR_NO_MATCH; - } - QOBJ_UNREG(area); if (fabricd) @@ -324,8 +315,6 @@ int isis_area_destroy(const char *area_tag) memset(isis->sysid, 0, ISIS_SYS_ID_LEN); isis->sysid_set = 0; } - - return CMD_SUCCESS; } #ifdef FABRICD @@ -1589,8 +1578,20 @@ DEFUN (no_router_openfabric, PROTO_HELP "ISO Routing area tag\n") { + struct isis_area *area; + const char *area_tag; int idx_word = 3; - return isis_area_destroy(argv[idx_word]->arg); + + area_tag = argv[idx_word]->arg; + area = isis_area_lookup(area_tag); + if (area == NULL) { + zlog_warn("%s: could not find area with area-tag %s", + __func__, area_tag); + return CMD_ERR_NO_MATCH; + } + + isis_area_destroy(area); + return CMD_SUCCESS; } #endif /* ifdef FABRICD */ #ifdef FABRICD diff --git a/isisd/isisd.h b/isisd/isisd.h index 57d9691cc..2b76d44c5 100644 --- a/isisd/isisd.h +++ b/isisd/isisd.h @@ -198,7 +198,7 @@ void isis_new(unsigned long process_id, vrf_id_t vrf_id); struct isis_area *isis_area_create(const char *); struct isis_area *isis_area_lookup(const char *); int isis_area_get(struct vty *vty, const char *area_tag); -int isis_area_destroy(const char *area_tag); +void isis_area_destroy(struct isis_area *area); void print_debug(struct vty *, int, int); struct isis_lsp *lsp_for_arg(struct lspdb_head *head, const char *argv); -- cgit v1.2.3