Skip to content

Commit

Permalink
zebra: do not read speed if underlying vrf not ready
Browse files Browse the repository at this point in the history
if interface is created at config, but the underlying vrf is not ready,
then prevent from reading speed and updating the client with that.

Signed-off-by: Philippe Guibert <[email protected]>
  • Loading branch information
pguibert6WIND committed Dec 2, 2021
1 parent 9660ebf commit 520e1d2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions zebra/interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,16 @@ static int if_zebra_speed_update(struct thread *thread)
{
struct interface *ifp = THREAD_ARG(thread);
struct zebra_if *zif = ifp->info;
uint32_t new_speed;
uint32_t new_speed = DEFAULT_SPEED;
bool changed = false;
int error = 0;

zif->speed_update = NULL;

new_speed = kernel_get_speed(ifp, &error);
if (ifp->vrf_id == VRF_UNKNOWN)
error = INTERFACE_SPEED_ERROR_UNKNOWN;
else
new_speed = kernel_get_speed(ifp, &error);

/* error may indicate vrf not available or
* interfaces not available.
Expand All @@ -83,7 +86,7 @@ static int if_zebra_speed_update(struct thread *thread)
if (error == INTERFACE_SPEED_ERROR_READ)
return 1;

if (new_speed != ifp->speed) {
if (new_speed != ifp->speed && !error) {
zlog_info("%s: %s old speed: %u new speed: %u", __func__,
ifp->name, ifp->speed, new_speed);
if (error == INTERFACE_SPEED_ERROR_UNKNOWN)
Expand Down

0 comments on commit 520e1d2

Please sign in to comment.