diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-04-06 22:38:20 +0200 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-04-18 00:43:46 +0200 |
commit | 37c606ffbf9353de5d6a0e3332cec5228c185938 (patch) | |
tree | a91345d4e3cc22404fb9545c3e428140b354e86e /pbrd/pbr_map.c | |
parent | pbrd: Fix installation and deletion in some cases (diff) | |
download | frr-37c606ffbf9353de5d6a0e3332cec5228c185938.tar.xz frr-37c606ffbf9353de5d6a0e3332cec5228c185938.zip |
pbrd, zebra: Fix multiple pbr-policy install
Somewhere along the way the ability to install multiple
pbr-policys for the same pbr-map was lost.
Add this back. There is a limitation in that we are limited
to 64 interfaces per pbr-policy.
Ticket: CM-20429
Signed-off-by: Donald Sharp sharpd@cumulusnetworks.com>
Diffstat (limited to 'pbrd/pbr_map.c')
-rw-r--r-- | pbrd/pbr_map.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/pbrd/pbr_map.c b/pbrd/pbr_map.c index 6931e9ad2..db17cdd8b 100644 --- a/pbrd/pbr_map.c +++ b/pbrd/pbr_map.c @@ -152,6 +152,7 @@ void pbr_map_add_interface(struct pbr_map *pbrm, struct interface *ifp_add) pmi->pbrm = pbrm; listnode_add_sort(pbrm->incoming, pmi); + bf_assign_index(pbrm->ifi_bitfield, pmi->install_bit); pbr_map_check_valid(pbrm->name); if (pbrm->valid && !pbrm->installed) pbr_map_install(pbrm); @@ -193,6 +194,8 @@ extern void pbr_map_delete(struct pbr_map_sequence *pbrms) if (pbrm->seqnumbers->count == 0) { RB_REMOVE(pbr_map_entry_head, &pbr_maps, pbrm); + + bf_free(pbrm->ifi_bitfield); XFREE(MTYPE_PBR_MAP, pbrm); } } @@ -210,13 +213,12 @@ void pbr_map_delete_nexthop_group(struct pbr_map_sequence *pbrms) pbrm->valid = false; pbrms->nhs_installed = false; - pbrms->installed = false; pbrms->reason |= PBR_MAP_INVALID_NO_NEXTHOPS; pbrms->nhgrp_name = NULL; } -struct pbr_map_sequence *pbrms_lookup_unique(uint32_t unique, - ifindex_t ifindex) +struct pbr_map_sequence *pbrms_lookup_unique(uint32_t unique, ifindex_t ifindex, + struct pbr_map_interface **ppmi) { struct pbr_map_sequence *pbrms; struct listnode *snode, *inode; @@ -228,6 +230,9 @@ struct pbr_map_sequence *pbrms_lookup_unique(uint32_t unique, if (pmi->ifp->ifindex != ifindex) continue; + if (ppmi) + *ppmi = pmi; + for (ALL_LIST_ELEMENTS_RO(pbrm->seqnumbers, snode, pbrms)) { DEBUGD(&pbr_dbg_map, "%s: Comparing %u to %u", @@ -284,6 +289,7 @@ struct pbr_map_sequence *pbrms_get(const char *name, uint32_t seqno) RB_INSERT(pbr_map_entry_head, &pbr_maps, pbrm); + bf_init(pbrm->ifi_bitfield, 64); pbr_map_add_interfaces(pbrm); } @@ -463,6 +469,8 @@ void pbr_map_policy_delete(struct pbr_map *pbrm, struct pbr_map_interface *pmi) listnode_delete(pbrm->incoming, pmi); pmi->pbrm = NULL; + + bf_release_index(pbrm->ifi_bitfield, pmi->install_bit); XFREE(MTYPE_PBR_MAP_INTERFACE, pmi); } @@ -542,9 +550,7 @@ void pbr_map_check(struct pbr_map_sequence *pbrms) } for (ALL_LIST_ELEMENTS_RO(pbrm->incoming, inode, pmi)) { - if ((install && !pbrms->installed) || - (!install && pbrms->installed)) - pbr_send_pbr_map(pbrms, pmi, install); + pbr_send_pbr_map(pbrms, pmi, install); } } |