summaryrefslogtreecommitdiff
path: root/sharpd/sharp_nht.c
diff options
context:
space:
mode:
authorStephen Worley <sworley@cumulusnetworks.com>2020-09-25 13:48:21 -0400
committerStephen Worley <sworley@cumulusnetworks.com>2020-09-28 12:41:00 -0400
commit21735352987e56f11facdc9fb1f4c53602aba9f6 (patch)
treed085984eacfd352271cb47980c1443db92aa7059 /sharpd/sharp_nht.c
parentc6ce9334b5387f482af4112ed1ffe6a49debe352 (diff)
lib,zebra,sharpd: add code for backup proto-NHs but disabled
Add the zapi code for encoding/decoding of backup nexthops for when we are ready for it, but disable it for now so that we revert to the old way with them. When zebra gets a proto-NHG with a backup in it, we early fail and tell the upper level proto. In this case sharpd. Sharpd then reverts to the old way of installation with the route. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
Diffstat (limited to 'sharpd/sharp_nht.c')
-rw-r--r--sharpd/sharp_nht.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/sharpd/sharp_nht.c b/sharpd/sharp_nht.c
index 9f31552720..5b3fe2583e 100644
--- a/sharpd/sharp_nht.c
+++ b/sharpd/sharp_nht.c
@@ -133,11 +133,15 @@ static void sharp_nhgroup_add_nexthop_cb(const struct nexthop_group_cmd *nhgc,
{
struct sharp_nhg lookup;
struct sharp_nhg *snhg;
+ struct nexthop_group_cmd *bnhgc = NULL;
strlcpy(lookup.name, nhgc->name, sizeof(lookup.name));
snhg = sharp_nhg_rb_find(&nhg_head, &lookup);
- nhg_add(snhg->id, &nhgc->nhg);
+ if (nhgc->backup_list_name[0])
+ bnhgc = nhgc_find(nhgc->backup_list_name);
+
+ nhg_add(snhg->id, &nhgc->nhg, (bnhgc ? &bnhgc->nhg : NULL));
}
static void sharp_nhgroup_del_nexthop_cb(const struct nexthop_group_cmd *nhgc,
@@ -145,11 +149,15 @@ static void sharp_nhgroup_del_nexthop_cb(const struct nexthop_group_cmd *nhgc,
{
struct sharp_nhg lookup;
struct sharp_nhg *snhg;
+ struct nexthop_group_cmd *bnhgc = NULL;
strlcpy(lookup.name, nhgc->name, sizeof(lookup.name));
snhg = sharp_nhg_rb_find(&nhg_head, &lookup);
- nhg_add(snhg->id, &nhgc->nhg);
+ if (nhgc->backup_list_name[0])
+ bnhgc = nhgc_find(nhgc->backup_list_name);
+
+ nhg_add(snhg->id, &nhgc->nhg, (bnhgc ? &bnhgc->nhg : NULL));
}
static void sharp_nhgroup_delete_cb(const char *name)