]> git.puffer.fish Git - matthieu/frr.git/commitdiff
pbrd: cleanup pbr ifp info if not sent to zebra
authorStephen Worley <sworley@cumulusnetworks.com>
Thu, 17 Sep 2020 19:34:36 +0000 (15:34 -0400)
committerIgor Ryzhov <iryzhov@nfware.com>
Wed, 7 Oct 2020 08:01:16 +0000 (11:01 +0300)
Properly cleanup the pbr interface data if nothing actually
gets sent to zebra, since we will never get the callback
notification from zapi to issue final deletion.

Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
pbrd/pbr_map.c

index fe2778c877e1194aadc08499453dacf2570cd8e7..b282db999df55e7fe9340d28474f105be9ca921f 100644 (file)
@@ -721,12 +721,23 @@ void pbr_map_policy_delete(struct pbr_map *pbrm, struct pbr_map_interface *pmi)
 {
        struct listnode *node;
        struct pbr_map_sequence *pbrms;
+       bool sent = false;
 
 
        for (ALL_LIST_ELEMENTS_RO(pbrm->seqnumbers, node, pbrms))
-               pbr_send_pbr_map(pbrms, pmi, false, false);
+               if (!pbr_send_pbr_map(pbrms, pmi, false, true))
+                       sent = true; /* rule removal sent to zebra */
 
        pmi->delete = true;
+
+       /*
+        * If we actually sent something for deletion, wait on zapi callback
+        * before clearing data.
+        */
+       if (sent)
+               return;
+
+       pbr_map_final_interface_deletion(pbrm, pmi);
 }
 
 /*