summaryrefslogtreecommitdiffstats
path: root/isisd/isisd.c
diff options
context:
space:
mode:
Diffstat (limited to 'isisd/isisd.c')
-rw-r--r--isisd/isisd.c42
1 files changed, 40 insertions, 2 deletions
diff --git a/isisd/isisd.c b/isisd/isisd.c
index 982df083..2863fd91 100644
--- a/isisd/isisd.c
+++ b/isisd/isisd.c
@@ -176,6 +176,11 @@ void isis_master_init(struct event_loop *master)
im->master = master;
}
+void isis_master_terminate(void)
+{
+ list_delete(&im->isis);
+}
+
struct isis *isis_new(const char *vrf_name)
{
struct vrf *vrf;
@@ -272,7 +277,7 @@ void isis_area_del_circuit(struct isis_area *area, struct isis_circuit *circuit)
isis_csm_state_change(ISIS_DISABLE, circuit, area);
}
-static void delete_area_addr(void *arg)
+void isis_area_address_delete(void *arg)
{
struct iso_address *addr = (struct iso_address *)arg;
@@ -330,7 +335,7 @@ struct isis_area *isis_area_create(const char *area_tag, const char *vrf_name)
area->circuit_list = list_new();
area->adjacency_list = list_new();
area->area_addrs = list_new();
- area->area_addrs->del = delete_area_addr;
+ area->area_addrs->del = isis_area_address_delete;
if (!CHECK_FLAG(im->options, F_ISIS_UNIT_TEST))
event_add_timer(master, lsp_tick, area, 1, &area->t_tick);
@@ -471,6 +476,29 @@ struct isis_area *isis_area_lookup(const char *area_tag, vrf_id_t vrf_id)
return NULL;
}
+struct isis_area *isis_area_lookup_by_sysid(const uint8_t *sysid)
+{
+ struct isis_area *area;
+ struct listnode *node;
+ struct isis *isis;
+ struct iso_address *addr = NULL;
+
+ isis = isis_lookup_by_sysid(sysid);
+ if (isis == NULL)
+ return NULL;
+
+ for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) {
+ if (listcount(area->area_addrs) > 0) {
+ addr = listgetdata(listhead(area->area_addrs));
+ if (!memcmp(addr->area_addr + addr->addr_len, sysid,
+ ISIS_SYS_ID_LEN))
+ return area;
+ }
+ }
+
+ return NULL;
+}
+
int isis_area_get(struct vty *vty, const char *area_tag)
{
struct isis_area *area;
@@ -496,6 +524,7 @@ void isis_area_destroy(struct isis_area *area)
{
struct listnode *node, *nnode;
struct isis_circuit *circuit;
+ struct iso_address *addr;
QOBJ_UNREG(area);
@@ -545,6 +574,15 @@ void isis_area_destroy(struct isis_area *area)
if (!CHECK_FLAG(im->options, F_ISIS_UNIT_TEST))
isis_redist_area_finish(area);
+ if (listcount(area->area_addrs) > 0) {
+ addr = listgetdata(listhead(area->area_addrs));
+ if (!memcmp(addr->area_addr + addr->addr_len, area->isis->sysid,
+ ISIS_SYS_ID_LEN)) {
+ memset(area->isis->sysid, 0, ISIS_SYS_ID_LEN);
+ area->isis->sysid_set = 0;
+ }
+ }
+
list_delete(&area->area_addrs);
for (int i = SPF_PREFIX_PRIO_CRITICAL; i <= SPF_PREFIX_PRIO_MEDIUM;