diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2019-02-13 01:17:05 +0100 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2019-02-13 01:21:28 +0100 |
commit | 6eb499b0315eea9df04908dea3ef58973f43b9b3 (patch) | |
tree | 0a5d58aad161c8ec3ac6bb4546da4ce3841a5d47 | |
parent | Merge pull request #3781 from donaldsharp/pbr_debug (diff) | |
download | frr-6eb499b0315eea9df04908dea3ef58973f43b9b3.tar.xz frr-6eb499b0315eea9df04908dea3ef58973f43b9b3.zip |
pbrd: If changing policy on an interface be careful what you ask for
When changing policy on an interface, only delete the old_pbrm
if it is different than the current, this covers the case:
current config:
int swp1
pbr-policy DONNA
To a config entered of:
int swp1
pbr-policy EVA
Additionally there is no need to reinstall if we enter the same
pbr-policy two times in a row.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
-rw-r--r-- | pbrd/pbr_vty.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/pbrd/pbr_vty.c b/pbrd/pbr_vty.c index a4b87f99d..2b6c38593 100644 --- a/pbrd/pbr_vty.c +++ b/pbrd/pbr_vty.c @@ -349,6 +349,7 @@ DEFPY (pbr_policy, struct pbr_map *pbrm, *old_pbrm; struct pbr_interface *pbr_ifp = ifp->info; + old_pbrm = NULL; pbrm = pbrm_find(mapname); if (!pbr_ifp) { @@ -369,12 +370,23 @@ DEFPY (pbr_policy, } else { if (strcmp(pbr_ifp->mapname, "") != 0) { old_pbrm = pbrm_find(pbr_ifp->mapname); - if (old_pbrm) + + /* + * So if we have an old pbrm we should only + * delete it if we are actually deleting and + * moving to a new pbrm + */ + if (old_pbrm && old_pbrm != pbrm) pbr_map_interface_delete(old_pbrm, ifp); } snprintf(pbr_ifp->mapname, sizeof(pbr_ifp->mapname), "%s", mapname); - if (pbrm) + + /* + * So only reinstall if the old_pbrm and this pbrm are + * different. + */ + if (pbrm && pbrm != old_pbrm) pbr_map_add_interface(pbrm, ifp); } |