diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2020-08-06 09:43:12 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-06 09:43:12 -0400 |
| commit | cd97e9522dbe43973361b4257bc69e6ba4a4579d (patch) | |
| tree | e157fc612eed0b3606a42daf0970389d2f03f3a3 /sharpd/sharp_zebra.c | |
| parent | 3a2bc867f81a21f1f6d512bc8cf71ff884067aae (diff) | |
| parent | faa75dfa6cb503ebaf4f8b034e2c6468b7b0120e (diff) | |
Merge pull request #6854 from mjstapp/sharp_lsp_update
sharpd: support 'update lsp' zapi testing
Diffstat (limited to 'sharpd/sharp_zebra.c')
| -rw-r--r-- | sharpd/sharp_zebra.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/sharpd/sharp_zebra.c b/sharpd/sharp_zebra.c index 74e44014a9..e0f16d71f5 100644 --- a/sharpd/sharp_zebra.c +++ b/sharpd/sharp_zebra.c @@ -114,15 +114,16 @@ static int sharp_ifp_down(struct interface *ifp) return 0; } -int sharp_install_lsps_helper(bool install_p, const struct prefix *p, - uint8_t type, int instance, uint32_t in_label, +int sharp_install_lsps_helper(bool install_p, bool update_p, + const struct prefix *p, uint8_t type, + int instance, uint32_t in_label, const struct nexthop_group *nhg, const struct nexthop_group *backup_nhg) { struct zapi_labels zl = {}; struct zapi_nexthop *znh; const struct nexthop *nh; - int i, ret; + int i, cmd, ret; zl.type = ZEBRA_LSP_SHARP; zl.local_label = in_label; @@ -200,12 +201,17 @@ int sharp_install_lsps_helper(bool install_p, const struct prefix *p, zl.backup_nexthop_num = i; } - if (install_p) - ret = zebra_send_mpls_labels(zclient, ZEBRA_MPLS_LABELS_ADD, - &zl); - else - ret = zebra_send_mpls_labels(zclient, ZEBRA_MPLS_LABELS_DELETE, - &zl); + + if (install_p) { + if (update_p) + cmd = ZEBRA_MPLS_LABELS_REPLACE; + else + cmd = ZEBRA_MPLS_LABELS_ADD; + } else { + cmd = ZEBRA_MPLS_LABELS_DELETE; + } + + ret = zebra_send_mpls_labels(zclient, cmd, &zl); return ret; } |
