diff options
| author | Donald Sharp <sharpd@nvidia.com> | 2024-02-07 14:56:15 -0500 | 
|---|---|---|
| committer | Donald Sharp <sharpd@nvidia.com> | 2024-09-16 09:34:05 -0400 | 
| commit | 1bbbcf043b1896b21cc303c37c99732858b6e1ed (patch) | |
| tree | 3df86a2a91b959612474cd89aa5d0c02908199da /zebra | |
| parent | 5a589217f873efaa7684a994c0c2b4ffebe28409 (diff) | |
zebra: Properly note that a nhg's nexthop has gone down
Current code when a link is set down is to just mark the
nexthop group as not properly setup.  Leaving situations
where when an interface goes down and show output is
entered we see incorrect state.  This is true for anything
that would be checking those flags at that point in time.
Modify the interface down nexthop group code to notice the
nexthops appropriately ( and I mean set the appropriate flags )
and to allow a `show ip route` command to actually display
what is going on with the nexthops.
eva# show ip route 1.0.0.0
Routing entry for 1.0.0.0/32
  Known via "sharp", distance 150, metric 0, best
  Last update 00:00:06 ago
  * 192.168.44.33, via dummy1, weight 1
  * 192.168.45.33, via dummy2, weight 1
sharpd@eva:~/frr1$ sudo ip link set dummy2 down
eva# show ip route 1.0.0.0
Routing entry for 1.0.0.0/32
  Known via "sharp", distance 150, metric 0, best
  Last update 00:00:12 ago
  * 192.168.44.33, via dummy1, weight 1
    192.168.45.33, via dummy2 inactive, weight 1
Notice now that the 1.0.0.0/32 route now correctly
displays the route for the nexthop group entry.
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'zebra')
| -rw-r--r-- | zebra/zebra_nhg.c | 10 | 
1 files changed, 7 insertions, 3 deletions
diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c index 637eabde8d..3dc4f24374 100644 --- a/zebra/zebra_nhg.c +++ b/zebra/zebra_nhg.c @@ -1101,11 +1101,15 @@ void zebra_nhg_check_valid(struct nhg_hash_entry *nhe)  	bool valid = false;  	/* -	 * If I have other nhe's depending on me, then this is a -	 * singleton nhe so set this nexthops flag as appropriate. +	 * If I have other nhe's depending on me, or I have nothing +	 * I am depending on then this is a +	 * singleton nhe so set this nexthops flag as appropriate.   	 */ -	if (nhg_connected_tree_count(&nhe->nhg_depends)) +	if (nhg_connected_tree_count(&nhe->nhg_depends) || +	    nhg_connected_tree_count(&nhe->nhg_dependents) == 0) { +		UNSET_FLAG(nhe->nhg.nexthop->flags, NEXTHOP_FLAG_FIB);  		UNSET_FLAG(nhe->nhg.nexthop->flags, NEXTHOP_FLAG_ACTIVE); +	}  	/* If anthing else in the group is valid, the group is valid */  	frr_each(nhg_connected_tree, &nhe->nhg_depends, rb_node_dep) {  | 
