]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: Remove unnecessary condition check for kernel routes
authoranlan_cs <vic.lan@pica8.com>
Mon, 19 Jun 2023 01:10:57 +0000 (09:10 +0800)
committeranlan_cs <vic.lan@pica8.com>
Sun, 2 Jul 2023 02:30:09 +0000 (10:30 +0800)
There are relaxed nexthop requirements for kernel routes because we
trust kernel routes.

Two minor changes for kernel routes:

1. `if_is_up()` is one of the necessary conditions for `if_is_operative()`.
Here, we can remove this unnecessary check for clarity.

2. Since `nexthop_active()` doesn't distinguish whether it is kernel route,
modified the corresponding comment in it.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
zebra/zebra_nhg.c

index 96e021292be469b7b1fe822c9dc87419079a3690..fb474b1add787ddd2dbe0994f287cb8f0c445556 100644 (file)
@@ -2181,11 +2181,7 @@ static int nexthop_active(struct nexthop *nexthop, struct nhg_hash_entry *nhe,
        case NEXTHOP_TYPE_IFINDEX:
 
                ifp = if_lookup_by_index(nexthop->ifindex, nexthop->vrf_id);
-               /*
-                * If the interface exists and its operative or its a kernel
-                * route and interface is up, its active. We trust kernel routes
-                * to be good.
-                */
+               /* If the interface exists and its operative, it's active */
                if (ifp && (if_is_operative(ifp)))
                        return 1;
                else
@@ -2595,7 +2591,7 @@ static unsigned nexthop_active_check(struct route_node *rn,
 
                ifp = if_lookup_by_index(nexthop->ifindex, nexthop->vrf_id);
 
-               if (ifp && (if_is_operative(ifp) || if_is_up(ifp))) {
+               if (ifp && if_is_up(ifp)) {
                        SET_FLAG(nexthop->flags, NEXTHOP_FLAG_ACTIVE);
                        goto skip_check;
                }