diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2019-02-12 20:55:15 +0100 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2019-02-13 01:22:30 +0100 |
commit | 38e9ccde2f8edd6946d48c80967027d05e64d73f (patch) | |
tree | f5760f72c410ef0bfb60a1138e6ba769ebfc4145 /pbrd | |
parent | pbrd: If changing policy on an interface be careful what you ask for (diff) | |
download | frr-38e9ccde2f8edd6946d48c80967027d05e64d73f.tar.xz frr-38e9ccde2f8edd6946d48c80967027d05e64d73f.zip |
pbrd: Do not delete pmi until completion of rule delete.
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>
Diffstat (limited to 'pbrd')
-rw-r--r-- | pbrd/pbr_map.c | 17 | ||||
-rw-r--r-- | pbrd/pbr_map.h | 2 | ||||
-rw-r--r-- | pbrd/pbr_zebra.c | 2 |
3 files changed, 16 insertions, 5 deletions
diff --git a/pbrd/pbr_map.c b/pbrd/pbr_map.c index 950ce8dfe..8f8b6aeed 100644 --- a/pbrd/pbr_map.c +++ b/pbrd/pbr_map.c @@ -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; } /* diff --git a/pbrd/pbr_map.h b/pbrd/pbr_map.h index 7cd079d16..945f76bb2 100644 --- a/pbrd/pbr_map.h +++ b/pbrd/pbr_map.h @@ -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); diff --git a/pbrd/pbr_zebra.c b/pbrd/pbr_zebra.c index 425bc04b4..558e63574 100644 --- a/pbrd/pbr_zebra.c +++ b/pbrd/pbr_zebra.c @@ -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; } |