Skip to content

Commit

Permalink
zebra: Reinstall nexthop when interface comes back up
Browse files Browse the repository at this point in the history
If a interface down event caused a nexthop group to remove
one of the entries in the kernel, have it be reinstalled
when the interface comes back up.  Mark the nexthop as
usable.

new behavior:
eva# show nexthop-group rib 181818168
ID: 181818168 (sharp)
     RefCnt: 1
     Uptime: 00:00:23
     VRF: default(bad-value)
     Valid, Installed
     Depends: (35) (38) (44) (51)
           via 192.168.99.33, dummy1 (vrf default), weight 1
           via 192.168.100.33, dummy2 (vrf default), weight 1
           via 192.168.101.33, dummy3 (vrf default), weight 1
           via 192.168.102.33, dummy4 (vrf default), weight 1
eva# conf
eva(config)# int dummy3
eva(config-if)# shut
eva(config-if)# do show nexthop-group rib 181818168
ID: 181818168 (sharp)
     RefCnt: 1
     Uptime: 00:00:44
     VRF: default(bad-value)
     Depends: (35) (38) (44) (51)
           via 192.168.99.33, dummy1 (vrf default), weight 1
           via 192.168.100.33, dummy2 (vrf default), weight 1
           via 192.168.101.33, dummy3 (vrf default) inactive, weight 1
           via 192.168.102.33, dummy4 (vrf default), weight 1
eva(config-if)# no shut
eva(config-if)# do show nexthop-group rib 181818168
ID: 181818168 (sharp)
     RefCnt: 1
     Uptime: 00:00:53
     VRF: default(bad-value)
     Valid, Installed
     Depends: (35) (38) (44) (51)
           via 192.168.99.33, dummy1 (vrf default), weight 1
           via 192.168.100.33, dummy2 (vrf default), weight 1
           via 192.168.101.33, dummy3 (vrf default), weight 1
           via 192.168.102.33, dummy4 (vrf default), weight 1
eva(config-if)# exit
eva(config)# exit
eva# exit
sharpd@eva ~/frr1 (master) [255]> ip nexthop show id 181818168
id 181818168 group 35/38/44/51 proto 194
sharpd@eva ~/frr1 (master)>

Signed-off-by: Donald Sharp <[email protected]>
  • Loading branch information
donaldsharp committed Sep 12, 2024
1 parent aa96bcc commit a03a01a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions zebra/zebra_nhg.c
Original file line number Diff line number Diff line change
Expand Up @@ -3782,6 +3782,17 @@ void zebra_interface_nhg_reinstall(struct interface *ifp)
frr_each_safe (nhg_connected_tree,
&rb_node_dep->nhe->nhg_dependents,
rb_node_dependent) {
struct nexthop *nhop_dependent =
rb_node_dependent->nhe->nhg.nexthop;

while (nhop_dependent &&
!nexthop_same(nhop_dependent, nh))
nhop_dependent = nhop_dependent->next;

if (nhop_dependent)
SET_FLAG(nhop_dependent->flags,
NEXTHOP_FLAG_ACTIVE);

if (IS_ZEBRA_DEBUG_NHG)
zlog_debug("%s dependent nhe %pNG Setting Reinstall flag",
__func__,
Expand Down

0 comments on commit a03a01a

Please sign in to comment.