diff options
Diffstat (limited to 'isisd/isisd.c')
| -rw-r--r-- | isisd/isisd.c | 159 |
1 files changed, 83 insertions, 76 deletions
diff --git a/isisd/isisd.c b/isisd/isisd.c index 4b01a18ecd..772eb9708d 100644 --- a/isisd/isisd.c +++ b/isisd/isisd.c @@ -337,6 +337,7 @@ struct isis_area *isis_area_create(const char *area_tag, const char *vrf_name) flags_initialize(&area->flags); isis_sr_area_init(area); + isis_srv6_area_init(area); /* * Default values @@ -520,7 +521,12 @@ void isis_area_destroy(struct isis_area *area) isis_area_invalidate_routes(area, area->is_type); isis_area_verify_routes(area); +#ifndef FABRICD + flex_algos_free(area->flex_algos); +#endif /* ifndef FABRICD */ + isis_sr_area_term(area); + isis_srv6_area_term(area); isis_mpls_te_term(area); @@ -595,64 +601,66 @@ static int isis_vrf_delete(struct vrf *vrf) static void isis_set_redist_vrf_bitmaps(struct isis *isis, bool set) { - struct listnode *node; + struct listnode *node, *lnode; struct isis_area *area; int type; int level; int protocol; - - char do_subscribe[REDIST_PROTOCOL_COUNT][ZEBRA_ROUTE_MAX + 1]; - - memset(do_subscribe, 0, sizeof(do_subscribe)); + struct isis_redist *redist; for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) for (protocol = 0; protocol < REDIST_PROTOCOL_COUNT; protocol++) for (type = 0; type < ZEBRA_ROUTE_MAX + 1; type++) - for (level = 0; level < ISIS_LEVELS; level++) - if (area->redist_settings[protocol] - [type][level] - .redist - == 1) - do_subscribe[protocol][type] = - 1; - - for (protocol = 0; protocol < REDIST_PROTOCOL_COUNT; protocol++) - for (type = 0; type < ZEBRA_ROUTE_MAX + 1; type++) { - /* This field is actually controlling transmission of - * the IS-IS - * routes to Zebra and has nothing to do with - * redistribution, - * so skip it. */ - if (type == PROTO_TYPE) - continue; - - if (!do_subscribe[protocol][type]) - continue; - - afi_t afi = afi_for_redist_protocol(protocol); - - if (type == DEFAULT_ROUTE) { - if (set) - vrf_bitmap_set( - zclient->default_information - [afi], - isis->vrf_id); - else - vrf_bitmap_unset( - zclient->default_information - [afi], - isis->vrf_id); - } else { - if (set) - vrf_bitmap_set( - zclient->redist[afi][type], - isis->vrf_id); - else - vrf_bitmap_unset( - zclient->redist[afi][type], - isis->vrf_id); - } - } + for (level = 0; level < ISIS_LEVELS; level++) { + if (area->redist_settings[protocol][type] + [level] == NULL) + continue; + for (ALL_LIST_ELEMENTS_RO(area->redist_settings + [protocol] + [type] + [level], + lnode, + redist)) { + if (redist->redist == 0) + continue; + /* This field is actually + * controlling transmission of + * the IS-IS + * routes to Zebra and has + * nothing to do with + * redistribution, + * so skip it. */ + afi_t afi = + afi_for_redist_protocol( + protocol); + + if (type == DEFAULT_ROUTE) { + if (set) + vrf_bitmap_set( + &zclient->default_information + [afi], + isis->vrf_id); + else + vrf_bitmap_unset( + &zclient->default_information + [afi], + isis->vrf_id); + } else { + if (set) + vrf_bitmap_set( + &zclient->redist + [afi] + [type], + isis->vrf_id); + else + vrf_bitmap_unset( + &zclient->redist + [afi] + [type], + isis->vrf_id); + } + } + } } static int isis_vrf_enable(struct vrf *vrf) @@ -3338,35 +3346,19 @@ void isis_area_advertise_high_metrics_set(struct isis_area *area, } /* - * Returns the path of the file (non-volatile memory) that contains restart - * information. - */ -char *isis_restart_filepath(void) -{ - static char filepath[MAXPATHLEN]; - snprintf(filepath, sizeof(filepath), ISISD_RESTART, ""); - return filepath; -} - -/* * Record in non-volatile memory the overload on startup time. */ void isis_restart_write_overload_time(struct isis_area *isis_area, uint32_t overload_time) { - char *filepath; const char *area_name; json_object *json; json_object *json_areas; json_object *json_area; - filepath = isis_restart_filepath(); + json = frr_daemon_state_load(); area_name = isis_area->area_tag; - json = json_object_from_file(filepath); - if (json == NULL) - json = json_object_new_object(); - json_object_object_get_ex(json, "areas", &json_areas); if (!json_areas) { json_areas = json_object_new_object(); @@ -3381,8 +3373,8 @@ void isis_restart_write_overload_time(struct isis_area *isis_area, json_object_int_add(json_area, "overload_time", isis_area->overload_on_startup_time); - json_object_to_file_ext(filepath, json, JSON_C_TO_STRING_PRETTY); - json_object_free(json); + + frr_daemon_state_save(&json); } /* @@ -3390,7 +3382,6 @@ void isis_restart_write_overload_time(struct isis_area *isis_area, */ uint32_t isis_restart_read_overload_time(struct isis_area *isis_area) { - char *filepath; const char *area_name; json_object *json; json_object *json_areas; @@ -3398,12 +3389,9 @@ uint32_t isis_restart_read_overload_time(struct isis_area *isis_area) json_object *json_overload_time; uint32_t overload_time = 0; - filepath = isis_restart_filepath(); area_name = isis_area->area_tag; - json = json_object_from_file(filepath); - if (json == NULL) - json = json_object_new_object(); + json = frr_daemon_state_load(); json_object_object_get_ex(json, "areas", &json_areas); if (!json_areas) { @@ -3425,8 +3413,7 @@ uint32_t isis_restart_read_overload_time(struct isis_area *isis_area) json_object_object_del(json_areas, area_name); - json_object_to_file_ext(filepath, json, JSON_C_TO_STRING_PRETTY); - json_object_free(json); + frr_daemon_state_save(&json); return overload_time; } @@ -3824,6 +3811,20 @@ struct cmd_node isis_flex_algo_node = { }; #endif /* ifdnef FABRICD */ +struct cmd_node isis_srv6_node = { + .name = "isis-srv6", + .node = ISIS_SRV6_NODE, + .parent_node = ISIS_NODE, + .prompt = "%s(config-router-srv6)# ", +}; + +struct cmd_node isis_srv6_node_msd_node = { + .name = "isis-srv6-node-msd", + .node = ISIS_SRV6_NODE_MSD_NODE, + .parent_node = ISIS_SRV6_NODE, + .prompt = "%s(config-router-srv6-node-msd)# ", +}; + void isis_init(void) { /* Install IS-IS top node */ @@ -3936,5 +3937,11 @@ void isis_init(void) install_default(ISIS_FLEX_ALGO_NODE); #endif /* ifdnef FABRICD */ + install_node(&isis_srv6_node); + install_default(ISIS_SRV6_NODE); + + install_node(&isis_srv6_node_msd_node); + install_default(ISIS_SRV6_NODE_MSD_NODE); + spf_backoff_cmd_init(); } |
