summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2021-09-24 16:45:07 +0200
committerDonald Sharp <sharpd@nvidia.com>2021-09-27 18:38:08 +0200
commit7272e2a461ad4d9015634f3e2a73502518e53873 (patch)
treedeeea94f8f53faf0ceb4f4b14adcebd257e7aabd
parent*: Remove the ZEBRA_IMPORT_ROUTE_XXX zapi messages (diff)
downloadfrr-7272e2a461ad4d9015634f3e2a73502518e53873.tar.xz
frr-7272e2a461ad4d9015634f3e2a73502518e53873.zip
zebra: remove import check resolution from zebra
The entirety of the import checking no longer needs to be in zebra as that no-one is calling it. Remove the code. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
-rw-r--r--zebra/rib.h2
-rw-r--r--zebra/zapi_msg.c8
-rw-r--r--zebra/zebra_rnh.c131
-rw-r--r--zebra/zebra_rnh.h2
-rw-r--r--zebra/zebra_vty.c2
5 files changed, 4 insertions, 141 deletions
diff --git a/zebra/rib.h b/zebra/rib.h
index 0f9d32471..648399176 100644
--- a/zebra/rib.h
+++ b/zebra/rib.h
@@ -46,7 +46,7 @@ DECLARE_MGROUP(ZEBRA);
DECLARE_MTYPE(RE);
-enum rnh_type { RNH_NEXTHOP_TYPE, RNH_IMPORT_CHECK_TYPE };
+enum rnh_type { RNH_NEXTHOP_TYPE };
PREDECL_LIST(rnh_list);
diff --git a/zebra/zapi_msg.c b/zebra/zapi_msg.c
index 0ed905ad7..640b119d0 100644
--- a/zebra/zapi_msg.c
+++ b/zebra/zapi_msg.c
@@ -1240,14 +1240,6 @@ static void zread_rnh_register(ZAPI_HANDLER_ARGS)
else if (!flags
&& CHECK_FLAG(rnh->flags, ZEBRA_NHT_CONNECTED))
UNSET_FLAG(rnh->flags, ZEBRA_NHT_CONNECTED);
- } else if (type == RNH_IMPORT_CHECK_TYPE) {
- if (flags
- && !CHECK_FLAG(rnh->flags, ZEBRA_NHT_EXACT_MATCH))
- SET_FLAG(rnh->flags, ZEBRA_NHT_EXACT_MATCH);
- else if (!flags
- && CHECK_FLAG(rnh->flags,
- ZEBRA_NHT_EXACT_MATCH))
- UNSET_FLAG(rnh->flags, ZEBRA_NHT_EXACT_MATCH);
}
if (resolve_via_default)
diff --git a/zebra/zebra_rnh.c b/zebra/zebra_rnh.c
index ae03a7058..422f2c92c 100644
--- a/zebra/zebra_rnh.c
+++ b/zebra/zebra_rnh.c
@@ -82,9 +82,6 @@ static inline struct route_table *get_rnh_table(vrf_id_t vrfid, afi_t afi,
case RNH_NEXTHOP_TYPE:
t = zvrf->rnh_table[afi];
break;
- case RNH_IMPORT_CHECK_TYPE:
- t = zvrf->import_check_table[afi];
- break;
}
return t;
@@ -419,111 +416,6 @@ static int zebra_rnh_apply_nht_rmap(afi_t afi, struct zebra_vrf *zvrf,
}
/*
- * Determine appropriate route (RE entry) resolving a tracked BGP route
- * for BGP route for import.
- */
-static struct route_entry *
-zebra_rnh_resolve_import_entry(struct zebra_vrf *zvrf, afi_t afi,
- struct route_node *nrn, struct rnh *rnh,
- struct route_node **prn)
-{
- struct route_table *route_table;
- struct route_node *rn;
- struct route_entry *re;
-
- *prn = NULL;
-
- route_table = zvrf->table[afi][SAFI_UNICAST];
- if (!route_table) // unexpected
- return NULL;
-
- rn = route_node_match(route_table, &nrn->p);
- if (!rn)
- return NULL;
-
- /* Unlock route node - we don't need to lock when walking the tree. */
- route_unlock_node(rn);
-
- if (CHECK_FLAG(rnh->flags, ZEBRA_NHT_EXACT_MATCH)
- && !prefix_same(&nrn->p, &rn->p))
- return NULL;
-
- if (IS_ZEBRA_DEBUG_NHT_DETAILED) {
- zlog_debug("%s: %s(%u):%pRN Resolved Import Entry to %pRN",
- __func__, VRF_LOGNAME(zvrf->vrf), rnh->vrf_id,
- rnh->node, rn);
- }
-
- /* Identify appropriate route entry. */
- RNODE_FOREACH_RE (rn, re) {
- if (!CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED)
- && CHECK_FLAG(re->flags, ZEBRA_FLAG_SELECTED)
- && !CHECK_FLAG(re->status, ROUTE_ENTRY_QUEUED)
- && (re->type != ZEBRA_ROUTE_BGP))
- break;
- }
-
- if (re)
- *prn = rn;
-
- if (!re && IS_ZEBRA_DEBUG_NHT_DETAILED)
- zlog_debug(" Rejected due to removed or is a bgp route");
-
- return re;
-}
-
-/*
- * See if a tracked route entry for import (by BGP) has undergone any
- * change, and if so, notify the client.
- */
-static void zebra_rnh_eval_import_check_entry(struct zebra_vrf *zvrf, afi_t afi,
- int force, struct route_node *nrn,
- struct rnh *rnh,
- struct route_node *prn,
- struct route_entry *re)
-{
- int state_changed = 0;
- struct zserv *client;
- struct listnode *node;
-
- zebra_rnh_remove_from_routing_table(rnh);
- if (prn) {
- prefix_copy(&rnh->resolved_route, &prn->p);
- } else {
- int family = rnh->resolved_route.family;
-
- memset(&rnh->resolved_route.family, 0, sizeof(struct prefix));
- rnh->resolved_route.family = family;
- }
- zebra_rnh_store_in_routing_table(rnh);
-
- if (re && (rnh->state == NULL)) {
- if (CHECK_FLAG(re->status, ROUTE_ENTRY_INSTALLED))
- state_changed = 1;
- } else if (!re && (rnh->state != NULL))
- state_changed = 1;
-
- if (compare_state(re, rnh->state)) {
- copy_state(rnh, re, nrn);
- state_changed = 1;
- }
-
- if (state_changed || force) {
- if (IS_ZEBRA_DEBUG_NHT)
- zlog_debug("%s(%u):%pRN: Route import check %s %s",
- VRF_LOGNAME(zvrf->vrf), zvrf->vrf->vrf_id,
- nrn, rnh->state ? "passed" : "failed",
- state_changed ? "(state changed)" : "");
- /* state changed, notify clients */
- for (ALL_LIST_ELEMENTS_RO(rnh->client_list, node, client)) {
- zebra_send_rnh_update(rnh, client,
- RNH_IMPORT_CHECK_TYPE,
- zvrf->vrf->vrf_id, 0);
- }
- }
-}
-
-/*
* Notify clients registered for this nexthop about a change.
*/
static void zebra_rnh_notify_protocol_clients(struct zebra_vrf *zvrf, afi_t afi,
@@ -843,10 +735,7 @@ static void zebra_rnh_evaluate_entry(struct zebra_vrf *zvrf, afi_t afi,
rnh = nrn->info;
/* Identify route entry (RE) resolving this tracked entry. */
- if (type == RNH_IMPORT_CHECK_TYPE)
- re = zebra_rnh_resolve_import_entry(zvrf, afi, nrn, rnh, &prn);
- else
- re = zebra_rnh_resolve_nexthop_entry(zvrf, afi, nrn, rnh, &prn);
+ re = zebra_rnh_resolve_nexthop_entry(zvrf, afi, nrn, rnh, &prn);
/* If the entry cannot be resolved and that is also the existing state,
* there is nothing further to do.
@@ -855,12 +744,7 @@ static void zebra_rnh_evaluate_entry(struct zebra_vrf *zvrf, afi_t afi,
return;
/* Process based on type of entry. */
- if (type == RNH_IMPORT_CHECK_TYPE)
- zebra_rnh_eval_import_check_entry(zvrf, afi, force, nrn, rnh,
- prn, re);
- else
- zebra_rnh_eval_nexthop_entry(zvrf, afi, force, nrn, rnh, prn,
- re);
+ zebra_rnh_eval_nexthop_entry(zvrf, afi, force, nrn, rnh, prn, re);
}
/*
@@ -882,12 +766,7 @@ static void zebra_rnh_clear_nhc_flag(struct zebra_vrf *zvrf, afi_t afi,
rnh = nrn->info;
/* Identify route entry (RIB) resolving this tracked entry. */
- if (type == RNH_IMPORT_CHECK_TYPE)
- re = zebra_rnh_resolve_import_entry(zvrf, afi, nrn, rnh,
- &prn);
- else
- re = zebra_rnh_resolve_nexthop_entry(zvrf, afi, nrn, rnh,
- &prn);
+ re = zebra_rnh_resolve_nexthop_entry(zvrf, afi, nrn, rnh, &prn);
if (re)
UNSET_FLAG(re->status, ROUTE_ENTRY_LABELS_CHANGED);
@@ -1491,10 +1370,6 @@ static int zebra_client_cleanup_rnh(struct zserv *client)
RNH_NEXTHOP_TYPE);
zebra_cleanup_rnh_client(zvrf_id(zvrf), AFI_IP6, client,
RNH_NEXTHOP_TYPE);
- zebra_cleanup_rnh_client(zvrf_id(zvrf), AFI_IP, client,
- RNH_IMPORT_CHECK_TYPE);
- zebra_cleanup_rnh_client(zvrf_id(zvrf), AFI_IP6, client,
- RNH_IMPORT_CHECK_TYPE);
}
}
diff --git a/zebra/zebra_rnh.h b/zebra/zebra_rnh.h
index 24ee6d0bd..6a225d43a 100644
--- a/zebra/zebra_rnh.h
+++ b/zebra/zebra_rnh.h
@@ -36,8 +36,6 @@ static inline const char *rnh_type2str(enum rnh_type type)
switch (type) {
case RNH_NEXTHOP_TYPE:
return "Nexthop";
- case RNH_IMPORT_CHECK_TYPE:
- return "Import";
}
return "ERROR";
diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c
index 9d1df98d3..848926400 100644
--- a/zebra/zebra_vty.c
+++ b/zebra/zebra_vty.c
@@ -1334,8 +1334,6 @@ DEFPY (show_ip_nht,
if (strcmp(type, "nht") == 0)
rtype = RNH_NEXTHOP_TYPE;
- else
- rtype = RNH_IMPORT_CHECK_TYPE;
if (vrf_all) {
struct vrf *vrf;