]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: Convert redistribute_delete to use a route_node
authorDonald Sharp <sharpd@nvidia.com>
Fri, 14 Jan 2022 14:48:00 +0000 (09:48 -0500)
committerDonald Sharp <sharpd@nvidia.com>
Tue, 18 Jan 2022 13:39:40 +0000 (08:39 -0500)
FRR is passing around a bunch of data that is encapsulated
within the route node.  Let's just pass that around instead.

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

index b1e8815ce5a425eb3e26dc92e09489f8d02a1292..1efdf02a995bf9056ae4eead2dbe7a9320fe9891 100644 (file)
@@ -247,13 +247,12 @@ void redistribute_update(const struct prefix *p, const struct prefix *src_p,
  * may have seen a redist for 'old_re', but will not see
  * the redist for 'new_re'.
  */
-void redistribute_delete(const struct prefix *p, const struct prefix *src_p,
+void redistribute_delete(const struct route_node *rn,
                         const struct route_entry *old_re,
                         const struct route_entry *new_re)
 {
        struct listnode *node, *nnode;
        struct zserv *client;
-       int afi;
        vrf_id_t vrfid;
 
        if (old_re)
@@ -264,27 +263,19 @@ void redistribute_delete(const struct prefix *p, const struct prefix *src_p,
                return;
 
        if (IS_ZEBRA_DEBUG_RIB) {
-               zlog_debug("%u:%pFX: Redist del: re %p (%s), new re %p (%s)",
-                          vrfid, p, old_re,
+               zlog_debug("%u:%pRN: Redist del: re %p (%s), new re %p (%s)",
+                          vrfid, rn, old_re,
                           old_re ? zebra_route_string(old_re->type) : "None",
                           new_re,
                           new_re ? zebra_route_string(new_re->type) : "None");
        }
 
-       afi = family2afi(p->family);
-       if (!afi) {
-               flog_warn(EC_ZEBRA_REDISTRIBUTE_UNKNOWN_AF,
-                         "%s: Unknown AFI/SAFI prefix received",
-                         __func__);
-               return;
-       }
-
        /* Skip invalid (e.g. linklocal) prefix */
-       if (!zebra_check_addr(p)) {
+       if (!zebra_check_addr(&rn->p)) {
                if (IS_ZEBRA_DEBUG_RIB) {
                        zlog_debug(
-                               "%u:%pFX: Redist del old: skipping invalid prefix",
-                               vrfid, p);
+                               "%u:%pRN: Redist del old: skipping invalid prefix",
+                               vrfid, rn);
                }
                return;
        }
@@ -297,13 +288,19 @@ void redistribute_delete(const struct prefix *p, const struct prefix *src_p,
                 * Skip this client if it will receive an update for the
                 * 'new' re
                 */
-               if (zebra_redistribute_check(new_re, client, p, afi))
+               if (zebra_redistribute_check(new_re, client, &rn->p,
+                                            family2afi(rn->p.family)))
                        continue;
 
                /* Send a delete for the 'old' re to any subscribed client. */
-               if (zebra_redistribute_check(old_re, client, p, afi))
+               if (zebra_redistribute_check(old_re, client, &rn->p,
+                                            family2afi(rn->p.family))) {
+                       const struct prefix *p, *src_p;
+
+                       srcdest_rnode_prefixes(rn, &p, &src_p);
                        zsend_redistribute_route(ZEBRA_REDISTRIBUTE_ROUTE_DEL,
                                                 client, p, src_p, old_re);
+               }
        }
 }
 
index 2685458f968753a032199a0a22bf3ad9446b00b8..17128e891b57e8566f7a1dfd30a3f0eca3a8658f 100644 (file)
@@ -52,7 +52,7 @@ extern void redistribute_update(const struct prefix *p,
  * may have seen a redist for 'old_re', but will not see
  * the redist for 'new_re'.
  */
-void redistribute_delete(const struct prefix *p, const struct prefix *src_p,
+void redistribute_delete(const struct route_node *rn,
                         const struct route_entry *old_re,
                         const struct route_entry *new_re);
 
index 1279c7c9a9481a496e55f7de4a51e21c9f8d9f29..ea587b4e208689c5ab8d0806f25232c9aa79b0d8 100644 (file)
@@ -1288,8 +1288,7 @@ static void rib_process(struct route_node *rn)
                         */
                        if (!new_selected || CHECK_FLAG(old_selected->status,
                                                        ROUTE_ENTRY_REMOVED))
-                               redistribute_delete(p, src_p,
-                                                   old_selected,
+                               redistribute_delete(rn, old_selected,
                                                    new_selected);
 
                        if (old_selected != new_selected)
@@ -2274,7 +2273,7 @@ static void rib_process_dplane_notify(struct zebra_dplane_ctx *ctx)
                dplane_route_notif_update(rn, re, DPLANE_OP_ROUTE_DELETE, ctx);
 
                /* Redistribute, lsp, and nht update */
-               redistribute_delete(dest_pfx, src_pfx, re, NULL);
+               redistribute_delete(rn, re, NULL);
        }
 
        /* Make any changes visible for lsp and nexthop-tracking processing */