From 2fb7892ed19ebff651d5da3a986350659f719a17 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 30 Mar 2018 13:38:45 -0400 Subject: [PATCH] pbrd: Prevent attempt at re-install for several scenarios There exists several places we attempt to re-install the same rule. Figure out when we need to not make an attempt at doing anything and do it. Signed-off-by: Donald Sharp --- pbrd/pbr_map.c | 7 +++++-- pbrd/pbr_nht.c | 12 ++++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/pbrd/pbr_map.c b/pbrd/pbr_map.c index ea79320a71..6931e9ad2d 100644 --- a/pbrd/pbr_map.c +++ b/pbrd/pbr_map.c @@ -541,8 +541,11 @@ void pbr_map_check(struct pbr_map_sequence *pbrms) pbrms->seqno, pbrms->reason); } - for (ALL_LIST_ELEMENTS_RO(pbrm->incoming, inode, pmi)) - pbr_send_pbr_map(pbrms, pmi, install); + for (ALL_LIST_ELEMENTS_RO(pbrm->incoming, inode, pmi)) { + if ((install && !pbrms->installed) || + (!install && pbrms->installed)) + pbr_send_pbr_map(pbrms, pmi, install); + } } void pbr_map_install(struct pbr_map *pbrm) diff --git a/pbrd/pbr_nht.c b/pbrd/pbr_nht.c index 1ce8c2104d..c58902cf5e 100644 --- a/pbrd/pbr_nht.c +++ b/pbrd/pbr_nht.c @@ -312,8 +312,16 @@ static void pbr_nht_find_nhg_from_table_install(struct hash_backet *b, if (pnhgc->table_id == *table_id) { DEBUGD(&pbr_dbg_nht, "%s: Table ID (%u) matches %s", __PRETTY_FUNCTION__, *table_id, pnhgc->name); - pnhgc->installed = true; - pbr_map_schedule_policy_from_nhg(pnhgc->name); + + /* + * 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); + } } }