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 15, 2021
1 parent 4b40dcd commit eecda3e
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions zebra/interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ static int if_zebra_speed_update(struct thread *thread)

zif->speed_update = NULL;

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

/* error may indicate vrf not available or
* interfaces not available.
Expand All @@ -83,16 +86,14 @@ 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)
ifp->speed = 0;
else
ifp->speed = new_speed;
ifp->speed = new_speed;
if_add_update(ifp);
changed = true;
}
} else if (error == INTERFACE_SPEED_ERROR_UNKNOWN)
ifp->speed = 0;

if (changed || error == INTERFACE_SPEED_ERROR_UNKNOWN)
thread_add_timer(zrouter.master, if_zebra_speed_update, ifp, 5,
Expand Down

0 comments on commit eecda3e

Please sign in to comment.