summaryrefslogtreecommitdiff
path: root/pbrd/pbr_map.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2020-08-20 12:55:45 -0400
committerDonald Sharp <sharpd@cumulusnetworks.com>2020-08-28 07:51:06 -0400
commit7cbdabffb6c11570e62e71a8b2818511c4756c60 (patch)
treeac8624679700e8d3d71f1c98dcd572b8cf5e27be /pbrd/pbr_map.c
parenta251884bff9ef5fac7ec1ff399fb0f5472565b55 (diff)
pbrd: Allow interfaces to be deleted then added back in
PBR needs the ability to allow ephermeal interfaces( bonds, vrfs, dummy, bridges, etc ) to be destroyed and then recreated and at the same time keep track of them and rebuild state as appropriate when we get a change. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'pbrd/pbr_map.c')
-rw-r--r--pbrd/pbr_map.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/pbrd/pbr_map.c b/pbrd/pbr_map.c
index e37110c1cf..b0d1e235fd 100644
--- a/pbrd/pbr_map.c
+++ b/pbrd/pbr_map.c
@@ -796,6 +796,31 @@ void pbr_map_check_vrf_nh_group_change(const char *nh_group,
}
}
+void pbr_map_check_interface_nh_group_change(const char *nh_group,
+ struct interface *ifp,
+ ifindex_t oldifindex)
+{
+ struct pbr_map *pbrm;
+ struct pbr_map_sequence *pbrms;
+ struct listnode *node;
+
+ RB_FOREACH (pbrm, pbr_map_entry_head, &pbr_maps) {
+ for (ALL_LIST_ELEMENTS_RO(pbrm->seqnumbers, node, pbrms)) {
+ if (pbrms->nhgrp_name)
+ continue;
+
+ if (pbrms->nhg
+ && strcmp(nh_group, pbrms->internal_nhg_name))
+ continue;
+
+ if (pbrms->nhg->nexthop->ifindex != oldifindex)
+ continue;
+
+ pbrms->nhg->nexthop->ifindex = ifp->ifindex;
+ }
+ }
+}
+
void pbr_map_check(struct pbr_map_sequence *pbrms, bool changed)
{
struct pbr_map *pbrm;