Skip to content

Commit c4d6a8f

Browse files
committed
zebra: When reinstalling a NHG, set REINSTALL flag
The current code is unsetting the fact that the NHG is installed. It is installed but we are reinstalling it. Let's note this in the code appropriately as REINSTALL and not remove the INSTALLED FLAG. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
1 parent d6d2f27 commit c4d6a8f

File tree

3 files changed

+24
-10
lines changed

3 files changed

+24
-10
lines changed

zebra/zebra_nhg.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3193,9 +3193,10 @@ void zebra_nhg_install_kernel(struct nhg_hash_entry *nhe)
31933193
zebra_nhg_install_kernel(rb_node_dep->nhe);
31943194
}
31953195

3196-
if (CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_VALID)
3197-
&& !CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_INSTALLED)
3198-
&& !CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_QUEUED)) {
3196+
if (CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_VALID) &&
3197+
(!CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_INSTALLED) ||
3198+
CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_REINSTALL)) &&
3199+
!CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_QUEUED)) {
31993200
/* Change its type to us since we are installing it */
32003201
if (!ZEBRA_NHG_CREATED(nhe)) {
32013202
nhe->type = ZEBRA_ROUTE_NHG;
@@ -3287,6 +3288,7 @@ void zebra_nhg_dplane_result(struct zebra_dplane_ctx *ctx)
32873288
}
32883289

32893290
UNSET_FLAG(nhe->flags, NEXTHOP_GROUP_QUEUED);
3291+
UNSET_FLAG(nhe->flags, NEXTHOP_GROUP_REINSTALL);
32903292
switch (status) {
32913293
case ZEBRA_DPLANE_REQUEST_SUCCESS:
32923294
SET_FLAG(nhe->flags, NEXTHOP_GROUP_INSTALLED);
@@ -3796,12 +3798,11 @@ void zebra_interface_nhg_reinstall(struct interface *ifp)
37963798
&rb_node_dep->nhe->nhg_dependents,
37973799
rb_node_dependent) {
37983800
if (IS_ZEBRA_DEBUG_NHG)
3799-
zlog_debug(
3800-
"%s dependent nhe %pNG unset installed flag",
3801-
__func__,
3802-
rb_node_dependent->nhe);
3803-
UNSET_FLAG(rb_node_dependent->nhe->flags,
3804-
NEXTHOP_GROUP_INSTALLED);
3801+
zlog_debug("%s dependent nhe %pNG Setting Reinstall flag",
3802+
__func__,
3803+
rb_node_dependent->nhe);
3804+
SET_FLAG(rb_node_dependent->nhe->flags,
3805+
NEXTHOP_GROUP_REINSTALL);
38053806
}
38063807
}
38073808
}

zebra/zebra_nhg.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,14 @@ struct nhg_hash_entry {
144144
* Track FPM installation status..
145145
*/
146146
#define NEXTHOP_GROUP_FPM (1 << 7)
147+
148+
/*
149+
* When an interface comes up install the
150+
* singleton's and schedule the NHG's that
151+
* are using this nhg to be reinstalled
152+
* when installation is successful.
153+
*/
154+
#define NEXTHOP_GROUP_REINSTALL (1 << 8)
147155
};
148156

149157
/* Upper 4 bits of the NHG are reserved for indicating the NHG type */

zebra/zebra_vty.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1253,7 +1253,12 @@ static void show_nexthop_group_out(struct vty *vty, struct nhg_hash_entry *nhe,
12531253
json_object_boolean_true_add(json, "valid");
12541254
else
12551255
vty_out(vty, " Valid");
1256-
1256+
if (CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_REINSTALL)) {
1257+
if (json)
1258+
json_object_boolean_true_add(json, "reInstall");
1259+
else
1260+
vty_out(vty, ", Reinstall");
1261+
}
12571262
if (CHECK_FLAG(nhe->flags, NEXTHOP_GROUP_INSTALLED)) {
12581263
if (json)
12591264
json_object_boolean_true_add(json, "installed");

0 commit comments

Comments
 (0)