mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-07-29 17:55:24 +00:00
zebra: Use switch when handling return from dplane for nhgs
Convert the dplane results function for nhg's over to using a switch for the result enum. Let's specifically call out the unexpected state and also set the nexthop group as not installed when installation fails. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
parent
8f76afd044
commit
0fa9ee396b
@ -3174,7 +3174,8 @@ void zebra_nhg_dplane_result(struct zebra_dplane_ctx *ctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
UNSET_FLAG(nhe->flags, NEXTHOP_GROUP_QUEUED);
|
UNSET_FLAG(nhe->flags, NEXTHOP_GROUP_QUEUED);
|
||||||
if (status == ZEBRA_DPLANE_REQUEST_SUCCESS) {
|
switch (status) {
|
||||||
|
case ZEBRA_DPLANE_REQUEST_SUCCESS:
|
||||||
SET_FLAG(nhe->flags, NEXTHOP_GROUP_VALID);
|
SET_FLAG(nhe->flags, NEXTHOP_GROUP_VALID);
|
||||||
SET_FLAG(nhe->flags, NEXTHOP_GROUP_INSTALLED);
|
SET_FLAG(nhe->flags, NEXTHOP_GROUP_INSTALLED);
|
||||||
zebra_nhg_handle_install(nhe, true);
|
zebra_nhg_handle_install(nhe, true);
|
||||||
@ -3184,7 +3185,9 @@ void zebra_nhg_dplane_result(struct zebra_dplane_ctx *ctx)
|
|||||||
zsend_nhg_notify(nhe->type, nhe->zapi_instance,
|
zsend_nhg_notify(nhe->type, nhe->zapi_instance,
|
||||||
nhe->zapi_session, nhe->id,
|
nhe->zapi_session, nhe->id,
|
||||||
ZAPI_NHG_INSTALLED);
|
ZAPI_NHG_INSTALLED);
|
||||||
} else {
|
break;
|
||||||
|
case ZEBRA_DPLANE_REQUEST_FAILURE:
|
||||||
|
UNSET_FLAG(nhe->flags, NEXTHOP_GROUP_INSTALLED);
|
||||||
/* If daemon nhg, send it an update */
|
/* If daemon nhg, send it an update */
|
||||||
if (PROTO_OWNED(nhe))
|
if (PROTO_OWNED(nhe))
|
||||||
zsend_nhg_notify(nhe->type, nhe->zapi_instance,
|
zsend_nhg_notify(nhe->type, nhe->zapi_instance,
|
||||||
@ -3197,6 +3200,12 @@ void zebra_nhg_dplane_result(struct zebra_dplane_ctx *ctx)
|
|||||||
EC_ZEBRA_DP_INSTALL_FAIL,
|
EC_ZEBRA_DP_INSTALL_FAIL,
|
||||||
"Failed to install Nexthop (%pNG) into the kernel",
|
"Failed to install Nexthop (%pNG) into the kernel",
|
||||||
nhe);
|
nhe);
|
||||||
|
break;
|
||||||
|
case ZEBRA_DPLANE_REQUEST_QUEUED:
|
||||||
|
flog_err(EC_ZEBRA_DP_INVALID_RC,
|
||||||
|
"Dplane returned an invalid result code for a result from the dplane for %pNG into the kernel",
|
||||||
|
nhe);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user