From 59293b8e70a7983d8f022f9c8b79c20619659bc2 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Thu, 28 Jan 2021 13:21:12 -0500 Subject: [PATCH] ospfd: Remove #if 0 code The #if 0 code in ospfd, has not been compiled since at least 2012. If we are at least 9 years old at this point with no effort to use or save, we should just get rid of it. Signed-off-by: Donald Sharp --- ospfd/ospf_ase.c | 78 ----------------------------------- ospfd/ospf_lsa.c | 19 --------- ospfd/ospf_spf.c | 62 ---------------------------- ospfd/ospf_vty.c | 103 ----------------------------------------------- ospfd/ospfd.c | 40 ------------------ 5 files changed, 302 deletions(-) diff --git a/ospfd/ospf_ase.c b/ospfd/ospf_ase.c index e18d8ddb31..51da4a55a7 100644 --- a/ospfd/ospf_ase.c +++ b/ospfd/ospf_ase.c @@ -156,84 +156,6 @@ static int ospf_ase_forward_address_check(struct ospf *ospf, return 1; } -#if 0 -/* Calculate ASBR route. */ -static struct ospf_route * -ospf_ase_calculate_asbr_route (struct ospf *ospf, - struct route_table *rt_network, - struct route_table *rt_router, - struct as_external_lsa *al) -{ - struct prefix_ipv4 asbr; - struct ospf_route *asbr_route; - struct route_node *rn; - - /* Find ASBR route from Router routing table. */ - asbr.family = AF_INET; - asbr.prefix = al->header.adv_router; - asbr.prefixlen = IPV4_MAX_BITLEN; - apply_mask_ipv4 (&asbr); - - asbr_route = ospf_find_asbr_route (ospf, rt_router, &asbr); - - if (asbr_route == NULL) - { - if (IS_DEBUG_OSPF (lsa, LSA)) - zlog_debug ("ospf_ase_calculate(): Route to ASBR %pI4 not found", - &asbr.prefix); - return NULL; - } - - if (!(asbr_route->u.std.flags & ROUTER_LSA_EXTERNAL)) - { - if (IS_DEBUG_OSPF (lsa, LSA)) - zlog_debug ("ospf_ase_calculate(): Originating router is not an ASBR"); - return NULL; - } - - if (al->e[0].fwd_addr.s_addr != INADDR_ANY) - { - if (IS_DEBUG_OSPF (lsa, LSA)) - zlog_debug ("ospf_ase_calculate(): Forwarding address is not 0.0.0.0."); - - if (! ospf_ase_forward_address_check (ospf, al->e[0].fwd_addr)) - { - if (IS_DEBUG_OSPF (lsa, LSA)) - zlog_debug ("ospf_ase_calculate(): Forwarding address is one of our addresses, Ignore."); - return NULL; - } - - if (IS_DEBUG_OSPF (lsa, LSA)) - zlog_debug ("ospf_ase_calculate(): Looking up in the Network Routing Table."); - - /* Looking up the path to the fwd_addr from Network route. */ - asbr.family = AF_INET; - asbr.prefix = al->e[0].fwd_addr; - asbr.prefixlen = IPV4_MAX_BITLEN; - - rn = route_node_match (rt_network, (struct prefix *) &asbr); - - if (rn == NULL) - { - if (IS_DEBUG_OSPF (lsa, LSA)) - zlog_debug ("ospf_ase_calculate(): Couldn't find a route to the forwarding address."); - return NULL; - } - - route_unlock_node (rn); - - if ((asbr_route = rn->info) == NULL) - { - if (IS_DEBUG_OSPF (lsa, LSA)) - zlog_debug ("ospf_ase_calculate(): Somehow OSPF route to ASBR is lost"); - return NULL; - } - } - - return asbr_route; -} -#endif - static struct ospf_route * ospf_ase_calculate_new_route(struct ospf_lsa *lsa, struct ospf_route *asbr_route, uint32_t metric) diff --git a/ospfd/ospf_lsa.c b/ospfd/ospf_lsa.c index 72201355e7..8268039f2a 100644 --- a/ospfd/ospf_lsa.c +++ b/ospfd/ospf_lsa.c @@ -2163,12 +2163,6 @@ void ospf_external_lsa_flush(struct ospf *ospf, uint8_t type, /* Sweep LSA from Link State Retransmit List. */ ospf_ls_retransmit_delete_nbr_as(ospf, lsa); -/* There must be no self-originated LSA in rtrs_external. */ -#if 0 - /* Remove External route from Zebra. */ - ospf_zebra_delete ((struct prefix_ipv4 *) p, &nexthop); -#endif - if (!IS_LSA_MAXAGE(lsa)) { /* Unregister LSA from Refresh queue. */ ospf_refresher_unregister_lsa(ospf, lsa); @@ -2440,12 +2434,7 @@ ospf_summary_lsa_install(struct ospf *ospf, struct ospf_lsa *new, int rt_recalc) necessary to re-examine all the AS-external-LSAs. */ -#if 0 - /* This doesn't exist yet... */ - ospf_summary_incremental_update(new); */ -#else /* #if 0 */ ospf_spf_calculate_schedule(ospf, SPF_FLAG_SUMMARY_LSA_INSTALL); -#endif /* #if 0 */ } if (IS_LSA_SELF(new)) @@ -2466,16 +2455,8 @@ static struct ospf_lsa *ospf_summary_asbr_lsa_install(struct ospf *ospf, destination is an AS boundary router, it may also be necessary to re-examine all the AS-external-LSAs. */ -#if 0 - /* These don't exist yet... */ - ospf_summary_incremental_update(new); - /* Isn't this done by the above call? - - RFC 2328 Section 16.5 implies it should be */ - /* ospf_ase_calculate_schedule(); */ -#else /* #if 0 */ ospf_spf_calculate_schedule(ospf, SPF_FLAG_ASBR_SUMMARY_LSA_INSTALL); -#endif /* #if 0 */ } /* register LSA to refresh-list. */ diff --git a/ospfd/ospf_spf.c b/ospfd/ospf_spf.c index fae4f1e10c..82acd0829c 100644 --- a/ospfd/ospf_spf.c +++ b/ospfd/ospf_spf.c @@ -1683,68 +1683,6 @@ void ospf_spf_cleanup(struct vertex *spf, struct list *vertex_list) list_delete(&vertex_list); } -#if 0 -static void -ospf_rtrs_print (struct route_table *rtrs) -{ - struct route_node *rn; - struct list *or_list; - struct listnode *ln; - struct listnode *pnode; - struct ospf_route *or; - struct ospf_path *path; - char buf1[BUFSIZ]; - char buf2[BUFSIZ]; - - if (IS_DEBUG_OSPF_EVENT) - zlog_debug ("ospf_rtrs_print() start"); - - for (rn = route_top (rtrs); rn; rn = route_next (rn)) - if ((or_list = rn->info) != NULL) - for (ALL_LIST_ELEMENTS_RO (or_list, ln, or)) - { - switch (or->path_type) - { - case OSPF_PATH_INTRA_AREA: - if (IS_DEBUG_OSPF_EVENT) - zlog_debug ("%s [%d] area: %s", - inet_ntop (AF_INET, &or->id, buf1, BUFSIZ), - or->cost, inet_ntop (AF_INET, &or->u.std.area_id, - buf2, BUFSIZ)); - break; - case OSPF_PATH_INTER_AREA: - if (IS_DEBUG_OSPF_EVENT) - zlog_debug ("%s IA [%d] area: %s", - inet_ntop (AF_INET, &or->id, buf1, BUFSIZ), - or->cost, inet_ntop (AF_INET, &or->u.std.area_id, - buf2, BUFSIZ)); - break; - default: - break; - } - - for (ALL_LIST_ELEMENTS_RO (or->paths, pnode, path)) - { - if (path->nexthop.s_addr == INADDR_ANY) - { - if (IS_DEBUG_OSPF_EVENT) - zlog_debug (" directly attached to %s\r", - ifindex2ifname (path->ifindex), VRF_DEFAULT); - } - else - { - if (IS_DEBUG_OSPF_EVENT) - zlog_debug (" via %pI4, %s\r", - &path->nexthop, - ifindex2ifname (path->ifindex), VRF_DEFAULT); - } - } - } - - zlog_debug ("ospf_rtrs_print() end"); -} -#endif - /* Calculating the shortest-path tree for an area, see RFC2328 16.1. */ void ospf_spf_calculate(struct ospf_area *area, struct ospf_lsa *root_lsa, struct route_table *new_table, diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index a4a220b1f6..949582278f 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -6406,31 +6406,7 @@ static int show_as_external_lsa_detail(struct vty *vty, struct ospf_lsa *lsa, return 0; } -#if 0 -static int -show_as_external_lsa_stdvty (struct ospf_lsa *lsa) -{ - struct as_external_lsa *al = (struct as_external_lsa *) lsa->data; - - /* show_ip_ospf_database_header (vty, lsa); */ - - zlog_debug( " Network Mask: /%d%s", - ip_masklen (al->mask), "\n"); - zlog_debug( " Metric Type: %s%s", - IS_EXTERNAL_METRIC (al->e[0].tos) ? - "2 (Larger than any link state path)" : "1", "\n"); - zlog_debug( " TOS: 0%s", "\n"); - zlog_debug( " Metric: %d%s", - GET_METRIC (al->e[0].metric), "\n"); - zlog_debug( " Forward Address: %pI4%s", - &al->e[0].fwd_addr, "\n"); - zlog_debug( " External Route Tag: %"ROUTE_TAG_PRI"%s%s", - (route_tag_t)ntohl (al->e[0].route_tag), "\n", "\n"); - - return 0; -} -#endif /* Show AS-NSSA-LSA detail information. */ static int show_as_nssa_lsa_detail(struct vty *vty, struct ospf_lsa *lsa, json_object *json) @@ -9467,78 +9443,6 @@ DEFUN (ospf_distance_ospf, return CMD_SUCCESS; } -#if 0 -DEFUN (ospf_distance_source, - ospf_distance_source_cmd, - "distance (1-255) A.B.C.D/M", - "Administrative distance\n" - "Distance value\n" - "IP source prefix\n") -{ - VTY_DECLVAR_CONTEXT(ospf, ospf); - int idx_number = 1; - int idx_ipv4_prefixlen = 2; - - ospf_distance_set (vty, ospf, argv[idx_number]->arg, argv[idx_ipv4_prefixlen]->arg, NULL); - - return CMD_SUCCESS; -} - -DEFUN (no_ospf_distance_source, - no_ospf_distance_source_cmd, - "no distance (1-255) A.B.C.D/M", - NO_STR - "Administrative distance\n" - "Distance value\n" - "IP source prefix\n") -{ - VTY_DECLVAR_CONTEXT(ospf, ospf); - int idx_number = 2; - int idx_ipv4_prefixlen = 3; - - ospf_distance_unset (vty, ospf, argv[idx_number]->arg, argv[idx_ipv4_prefixlen]->arg, NULL); - - return CMD_SUCCESS; -} - -DEFUN (ospf_distance_source_access_list, - ospf_distance_source_access_list_cmd, - "distance (1-255) A.B.C.D/M WORD", - "Administrative distance\n" - "Distance value\n" - "IP source prefix\n" - "Access list name\n") -{ - VTY_DECLVAR_CONTEXT(ospf, ospf); - int idx_number = 1; - int idx_ipv4_prefixlen = 2; - int idx_word = 3; - - ospf_distance_set (vty, ospf, argv[idx_number]->arg, argv[idx_ipv4_prefixlen]->arg, argv[idx_word]->arg); - - return CMD_SUCCESS; -} - -DEFUN (no_ospf_distance_source_access_list, - no_ospf_distance_source_access_list_cmd, - "no distance (1-255) A.B.C.D/M WORD", - NO_STR - "Administrative distance\n" - "Distance value\n" - "IP source prefix\n" - "Access list name\n") -{ - VTY_DECLVAR_CONTEXT(ospf, ospf); - int idx_number = 2; - int idx_ipv4_prefixlen = 3; - int idx_word = 4; - - ospf_distance_unset (vty, ospf, argv[idx_number]->arg, argv[idx_ipv4_prefixlen]->arg, argv[idx_word]->arg); - - return CMD_SUCCESS; -} -#endif - DEFUN (ip_ospf_mtu_ignore, ip_ospf_mtu_ignore_addr_cmd, "ip ospf mtu-ignore [A.B.C.D]", @@ -12653,13 +12557,6 @@ static void ospf_vty_zebra_init(void) &no_ospf_external_route_aggregation_no_adrvertise_cmd); install_element(OSPF_NODE, &ospf_route_aggregation_timer_cmd); install_element(OSPF_NODE, &no_ospf_route_aggregation_timer_cmd); - -#if 0 - install_element (OSPF_NODE, &ospf_distance_source_cmd); - install_element (OSPF_NODE, &no_ospf_distance_source_cmd); - install_element (OSPF_NODE, &ospf_distance_source_access_list_cmd); - install_element (OSPF_NODE, &no_ospf_distance_source_access_list_cmd); -#endif /* 0 */ } static int ospf_config_write(struct vty *vty); diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c index 56424abeca..dfb1b44e34 100644 --- a/ospfd/ospfd.c +++ b/ospfd/ospfd.c @@ -1739,26 +1739,6 @@ int ospf_area_nssa_translator_role_set(struct ospf *ospf, return 1; } -#if 0 -/* XXX: unused? Leave for symmetry? */ -static int -ospf_area_nssa_translator_role_unset (struct ospf *ospf, - struct in_addr area_id) -{ - struct ospf_area *area; - - area = ospf_area_lookup_by_area_id (ospf, area_id); - if (area == NULL) - return 0; - - area->NSSATranslatorRole = OSPF_NSSA_ROLE_CANDIDATE; - - ospf_area_check_free (ospf, area_id); - - return 1; -} -#endif - int ospf_area_export_list_set(struct ospf *ospf, struct ospf_area *area, const char *list_name) { @@ -2004,29 +1984,9 @@ struct ospf_nbr_nbma *ospf_nbr_nbma_lookup(struct ospf *ospf, struct ospf_nbr_nbma *ospf_nbr_nbma_lookup_next(struct ospf *ospf, struct in_addr *addr, int first) { -#if 0 - struct ospf_nbr_nbma *nbr_nbma; - struct listnode *node; -#endif - if (ospf == NULL) return NULL; -#if 0 - for (ALL_LIST_ELEMENTS_RO (ospf->nbr_nbma, node, nbr_nbma)) - { - if (first) - { - *addr = nbr_nbma->addr; - return nbr_nbma; - } - else if (ntohl (nbr_nbma->addr.s_addr) > ntohl (addr->s_addr)) - { - *addr = nbr_nbma->addr; - return nbr_nbma; - } - } -#endif return NULL; } -- 2.39.5