summaryrefslogtreecommitdiffstats
path: root/pbrd/pbr_nht.c
diff options
context:
space:
mode:
authorStephen Worley <sworley@cumulusnetworks.com>2020-07-02 02:02:37 +0200
committerStephen Worley <sworley@cumulusnetworks.com>2020-07-09 17:51:23 +0200
commit09813729c7625ff81056f24763d620f7d33251fa (patch)
tree60dc21084d8bc5a5364e1246c7b7bd9f45e88e1c /pbrd/pbr_nht.c
parentpbrd: uninstall NHG route if not valid anymore (diff)
downloadfrr-09813729c7625ff81056f24763d620f7d33251fa.tar.xz
frr-09813729c7625ff81056f24763d620f7d33251fa.zip
pbrd: nhgc state improvements when installed/removed
Cleanup the marking of a nhc as installed/removed based on table route installation. We were not even handling the removal state at all. We saw some timing issues with the routes being installed/removed multiple times and then never resending the pbr map due to bad states on the nhgc. Dont worry about checking if its already marked installed before scheduling the policy walk. We have a check in `pbr_send_map()` to ensure we dont try to resend a map sequence already installed. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
Diffstat (limited to 'pbrd/pbr_nht.c')
-rw-r--r--pbrd/pbr_nht.c38
1 files changed, 22 insertions, 16 deletions
diff --git a/pbrd/pbr_nht.c b/pbrd/pbr_nht.c
index d7a6751ff..31da65679 100644
--- a/pbrd/pbr_nht.c
+++ b/pbrd/pbr_nht.c
@@ -328,27 +328,29 @@ static struct pbr_nexthop_cache *pbr_nht_lookup_nexthop(struct nexthop *nexthop)
}
#endif
+static void
+pbr_nht_find_nhg_from_table_update(struct pbr_nexthop_group_cache *pnhgc,
+ uint32_t table_id, bool installed)
+{
+ if (pnhgc->table_id == table_id) {
+ DEBUGD(&pbr_dbg_nht, "%s: %s: Table ID (%u) matches %s",
+ __func__, (installed ? "install" : "remove"), table_id,
+ pnhgc->name);
+
+ pnhgc->installed = installed;
+ pnhgc->valid = installed;
+ pbr_map_schedule_policy_from_nhg(pnhgc->name, pnhgc->installed);
+ }
+}
+
static void pbr_nht_find_nhg_from_table_install(struct hash_bucket *b,
void *data)
{
struct pbr_nexthop_group_cache *pnhgc =
(struct pbr_nexthop_group_cache *)b->data;
- uint32_t *table_id = (uint32_t *)data;
-
- if (pnhgc->table_id == *table_id) {
- DEBUGD(&pbr_dbg_nht, "%s: Table ID (%u) matches %s", __func__,
- *table_id, pnhgc->name);
+ uint32_t table_id = *(uint32_t *)data;
- /*
- * If the table has been re-handled by zebra
- * and we are already installed no need to do
- * anything here.
- */
- if (!pnhgc->installed) {
- pnhgc->installed = true;
- pbr_map_schedule_policy_from_nhg(pnhgc->name);
- }
- }
+ pbr_nht_find_nhg_from_table_update(pnhgc, table_id, true);
}
void pbr_nht_route_installed_for_table(uint32_t table_id)
@@ -360,7 +362,11 @@ void pbr_nht_route_installed_for_table(uint32_t table_id)
static void pbr_nht_find_nhg_from_table_remove(struct hash_bucket *b,
void *data)
{
- ;
+ struct pbr_nexthop_group_cache *pnhgc =
+ (struct pbr_nexthop_group_cache *)b->data;
+ uint32_t table_id = *(uint32_t *)data;
+
+ pbr_nht_find_nhg_from_table_update(pnhgc, table_id, false);
}
void pbr_nht_route_removed_for_table(uint32_t table_id)