]> git.puffer.fish Git - mirror/frr.git/commitdiff
pbrd: Do not delete pmi until completion of rule delete. 3792/head
authorDonald Sharp <sharpd@cumulusnetworks.com>
Tue, 12 Feb 2019 19:55:15 +0000 (14:55 -0500)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 13 Feb 2019 00:22:30 +0000 (19:22 -0500)
When we have a pbr-policy applied to an interface and the
rule is installed and then deleted, we would not properly
clean up the bit field for the pmi as well as not note
the rule as properly deleted.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
pbrd/pbr_map.c
pbrd/pbr_map.h
pbrd/pbr_zebra.c

index 950ce8dfe1c5d11643969b1a0054791a72447e3d..8f8b6aeed17501f8754f95cd047529596b9fb65f 100644 (file)
@@ -121,6 +121,17 @@ void pbr_map_reason_string(unsigned int reason, char *buf, int size)
        }
 }
 
+void pbr_map_final_interface_deletion(struct pbr_map *pbrm,
+                                     struct pbr_map_interface *pmi)
+{
+       if (pmi->delete == true) {
+               listnode_delete(pbrm->incoming, pmi);
+               pmi->pbrm = NULL;
+
+               bf_release_index(pbrm->ifi_bitfield, pmi->install_bit);
+               XFREE(MTYPE_PBR_MAP_INTERFACE, pmi);
+       }
+}
 
 void pbr_map_interface_delete(struct pbr_map *pbrm, struct interface *ifp_del)
 {
@@ -466,11 +477,7 @@ void pbr_map_policy_delete(struct pbr_map *pbrm, struct pbr_map_interface *pmi)
        for (ALL_LIST_ELEMENTS_RO(pbrm->seqnumbers, node, pbrms))
                pbr_send_pbr_map(pbrms, pmi, false);
 
-       listnode_delete(pbrm->incoming, pmi);
-       pmi->pbrm = NULL;
-
-       bf_release_index(pbrm->ifi_bitfield, pmi->install_bit);
-       XFREE(MTYPE_PBR_MAP_INTERFACE, pmi);
+       pmi->delete = true;
 }
 
 /*
index 7cd079d169aa50de4bc84532011ac159c7f86f2e..945f76bb2bbf88ec9c081cc7357802d6346cd88c 100644 (file)
@@ -147,6 +147,8 @@ extern void pbr_map_delete_nexthop_group(struct pbr_map_sequence *pbrms);
 extern void pbr_map_add_interface(struct pbr_map *pbrm, struct interface *ifp);
 extern void pbr_map_interface_delete(struct pbr_map *pbrm,
                                     struct interface *ifp);
+extern void pbr_map_final_interface_deletion(struct pbr_map *pbrm,
+                                            struct pbr_map_interface *pmi);
 extern void pbr_map_write_interfaces(struct vty *vty, struct interface *ifp);
 extern void pbr_map_init(void);
 
index 425bc04b4d5f3bef918300cdd037ea3217acf107..558e635748067a4450f8410b8b512f5908f72c69 100644 (file)
@@ -250,6 +250,8 @@ static int rule_notify_owner(int command, struct zclient *zclient,
                break;
        }
 
+       pbr_map_final_interface_deletion(pbrms->parent, pmi);
+
        return 0;
 }