]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: Allow rib_update_table to receive a specified route type
authorDonald Sharp <sharpd@nvidia.com>
Thu, 1 Oct 2020 13:54:53 +0000 (09:54 -0400)
committerDonald Sharp <sharpd@nvidia.com>
Sat, 16 Jan 2021 00:34:33 +0000 (19:34 -0500)
When we need to cause a reprocessing of data the code currently
marks all routes as needing to be looked at.  Modify the
rib_update_table code to allow us to specify a specific route
type we only want to reprocess.  At this point none
of the code is behaving differently this is just setup
for a future code change.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
zebra/rib.h
zebra/zebra_rib.c
zebra/zebra_routemap.c

index 42034b3d442a3a115d0ba3a9e0578c993d2ec61f..86766b8175730a338e2cad42f26f55321485d5d2 100644 (file)
@@ -407,7 +407,7 @@ extern struct route_entry *rib_lookup_ipv4(struct prefix_ipv4 *p,
 
 extern void rib_update(enum rib_update_event event);
 extern void rib_update_table(struct route_table *table,
-                            enum rib_update_event event);
+                            enum rib_update_event event, int rtype);
 extern int rib_sweep_route(struct thread *t);
 extern void rib_sweep_table(struct route_table *table);
 extern void rib_close_table(struct route_table *table);
index 0c3efaa0ed2b9aae297c1a4012e7b9bf9fa7d12d..8914f9c59cff9c1d4c04a630f54319a04330d979 100644 (file)
@@ -3453,7 +3453,8 @@ static void rib_update_route_node(struct route_node *rn, int type)
 }
 
 /* Schedule routes of a particular table (address-family) based on event. */
-void rib_update_table(struct route_table *table, enum rib_update_event event)
+void rib_update_table(struct route_table *table, enum rib_update_event event,
+                     int rtype)
 {
        struct route_node *rn;
 
@@ -3466,12 +3467,12 @@ void rib_update_table(struct route_table *table, enum rib_update_event event)
                               : NULL;
                vrf = zvrf ? zvrf->vrf : NULL;
 
-               zlog_debug("%s: %s VRF %s Table %u event %s", __func__,
+               zlog_debug("%s: %s VRF %s Table %u event %s Route type: %s", __func__,
                           table->info ? afi2str(
                                   ((struct rib_table_info *)table->info)->afi)
                                       : "Unknown",
                           VRF_LOGNAME(vrf), zvrf ? zvrf->table_id : 0,
-                          rib_update_event2str(event));
+                          rib_update_event2str(event), zebra_route_string(rtype));
        }
 
        /* Walk all routes and queue for processing, if appropriate for
@@ -3494,7 +3495,7 @@ void rib_update_table(struct route_table *table, enum rib_update_event event)
                        break;
                case RIB_UPDATE_RMAP_CHANGE:
                case RIB_UPDATE_OTHER:
-                       rib_update_route_node(rn, ZEBRA_ROUTE_ALL);
+                       rib_update_route_node(rn, rtype);
                        break;
                default:
                        break;
@@ -3502,7 +3503,8 @@ void rib_update_table(struct route_table *table, enum rib_update_event event)
        }
 }
 
-static void rib_update_handle_vrf(vrf_id_t vrf_id, enum rib_update_event event)
+static void rib_update_handle_vrf(vrf_id_t vrf_id, enum rib_update_event event,
+                                 int rtype)
 {
        struct route_table *table;
 
@@ -3513,14 +3515,14 @@ static void rib_update_handle_vrf(vrf_id_t vrf_id, enum rib_update_event event)
        /* Process routes of interested address-families. */
        table = zebra_vrf_table(AFI_IP, SAFI_UNICAST, vrf_id);
        if (table)
-               rib_update_table(table, event);
+               rib_update_table(table, event, rtype);
 
        table = zebra_vrf_table(AFI_IP6, SAFI_UNICAST, vrf_id);
        if (table)
-               rib_update_table(table, event);
+               rib_update_table(table, event, rtype);
 }
 
-static void rib_update_handle_vrf_all(enum rib_update_event event)
+static void rib_update_handle_vrf_all(enum rib_update_event event, int rtype)
 {
        struct zebra_router_table *zrt;
 
@@ -3530,7 +3532,7 @@ static void rib_update_handle_vrf_all(enum rib_update_event event)
 
        /* Just iterate over all the route tables, rather than vrf lookups */
        RB_FOREACH (zrt, zebra_router_table_head, &zrouter.tables)
-               rib_update_table(zrt->table, event);
+               rib_update_table(zrt->table, event, rtype);
 }
 
 struct rib_update_ctx {
@@ -3564,9 +3566,9 @@ static int rib_update_handler(struct thread *thread)
        ctx = THREAD_ARG(thread);
 
        if (ctx->vrf_all)
-               rib_update_handle_vrf_all(ctx->event);
+               rib_update_handle_vrf_all(ctx->event, ZEBRA_ROUTE_ALL);
        else
-               rib_update_handle_vrf(ctx->vrf_id, ctx->event);
+               rib_update_handle_vrf(ctx->vrf_id, ctx->event, ZEBRA_ROUTE_ALL);
 
        rib_update_ctx_fini(&ctx);
 
index 020a1d9875e9fde3672bb8a593960bf8574b8da1..e99232d55f42d210f7b01c10d6595d5594351842 100644 (file)
@@ -267,7 +267,8 @@ static int ip_protocol_rm_add(struct zebra_vrf *zvrf, const char *rmap,
                /* Process routes of interested address-families. */
                table = zebra_vrf_table(afi, safi, zvrf->vrf->vrf_id);
                if (table)
-                       rib_update_table(table, RIB_UPDATE_RMAP_CHANGE);
+                       rib_update_table(table, RIB_UPDATE_RMAP_CHANGE,
+                                        ZEBRA_ROUTE_ALL);
        }
 
        return CMD_SUCCESS;
@@ -294,7 +295,8 @@ static int ip_protocol_rm_del(struct zebra_vrf *zvrf, const char *rmap,
                        /* Process routes of interested address-families. */
                        table = zebra_vrf_table(afi, safi, zvrf->vrf->vrf_id);
                        if (table)
-                               rib_update_table(table, RIB_UPDATE_RMAP_CHANGE);
+                               rib_update_table(table, RIB_UPDATE_RMAP_CHANGE,
+                                                ZEBRA_ROUTE_ALL);
                }
                XFREE(MTYPE_ROUTE_MAP_NAME, PROTO_RM_NAME(zvrf, afi, rtype));
        }
@@ -1494,7 +1496,8 @@ static void zebra_rib_table_rm_update(const char *rmap)
                                                afi_ip = 1;
                                                rib_update_table(
                                                        table,
-                                                       RIB_UPDATE_RMAP_CHANGE);
+                                                       RIB_UPDATE_RMAP_CHANGE,
+                                                       ZEBRA_ROUTE_ALL);
                                        }
                                }
                        }
@@ -1523,7 +1526,8 @@ static void zebra_rib_table_rm_update(const char *rmap)
                                                afi_ipv6 = 1;
                                                rib_update_table(
                                                        table,
-                                                       RIB_UPDATE_RMAP_CHANGE);
+                                                       RIB_UPDATE_RMAP_CHANGE,
+                                                       ZEBRA_ROUTE_ALL);
                                        }
                                }
                        }