]> git.puffer.fish Git - mirror/frr.git/commitdiff
zebra: Remove instance from zebra_rmap_obj data structure
authorDonald Sharp <sharpd@nvidia.com>
Fri, 11 Aug 2023 15:15:06 +0000 (11:15 -0400)
committerDonald Sharp <sharpd@nvidia.com>
Fri, 11 Aug 2023 15:15:06 +0000 (11:15 -0400)
In all cases the instance is derived from the re pointer
and since the re pointer is already stored, let's just
remove it from the game and cut to the chase.

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

index c87da5ed6c55a948589d0697a262432145a3879a..9e73e6a2fdf314a1921130f320f7ce12f8db7549 100644 (file)
@@ -647,8 +647,7 @@ int zebra_add_import_table_entry(struct zebra_vrf *zvrf, struct route_node *rn,
 
        afi = family2afi(rn->p.family);
        if (rmap_name)
-               ret = zebra_import_table_route_map_check(afi, re, re->instance,
-                                                        &rn->p,
+               ret = zebra_import_table_route_map_check(afi, re, &rn->p,
                                                         re->nhe->nhg.nexthop,
                                                         re->tag, rmap_name);
 
index 8c640f4e32bc25c7230d3f57dae8ca90b6b4fd05..b94475fc08ce4c74fe0965dfa3c5594da3bbe5d2 100644 (file)
@@ -2703,8 +2703,7 @@ skip_check:
        }
 
        /* It'll get set if required inside */
-       ret = zebra_route_map_check(family, re, re->instance, p, nexthop, zvrf,
-                                   re->tag);
+       ret = zebra_route_map_check(family, re, p, nexthop, zvrf, re->tag);
        if (ret == RMAP_DENYMATCH) {
                if (IS_ZEBRA_DEBUG_RIB) {
                        zlog_debug(
index e0069912f9bacf3fd6358136207a3e58b5ebcd48..f5c194fe3f774a2513ec5c5f59aec2c705fc7ba5 100644 (file)
@@ -34,7 +34,6 @@ char *zebra_import_table_routemap[AFI_MAX][ZEBRA_KERNEL_TABLE_MAX];
 struct zebra_rmap_obj {
        struct nexthop *nexthop;
        struct route_entry *re;
-       uint8_t instance;
        int metric;
        route_tag_t tag;
 };
@@ -1477,7 +1476,7 @@ route_match_source_instance(void *rule, const struct prefix *p, void *object)
        if (!rm_data)
                return RMAP_NOMATCH;
 
-       return (rm_data->instance == *instance) ? RMAP_MATCH : RMAP_NOMATCH;
+       return (rm_data->re->instance == *instance) ? RMAP_MATCH : RMAP_NOMATCH;
 }
 
 static void *route_match_source_instance_compile(const char *arg)
@@ -1759,10 +1758,10 @@ void zebra_routemap_finish(void)
        route_map_finish();
 }
 
-route_map_result_t
-zebra_route_map_check(afi_t family, struct route_entry *re, uint8_t instance,
-                     const struct prefix *p, struct nexthop *nexthop,
-                     struct zebra_vrf *zvrf, route_tag_t tag)
+route_map_result_t zebra_route_map_check(afi_t family, struct route_entry *re,
+                                        const struct prefix *p,
+                                        struct nexthop *nexthop,
+                                        struct zebra_vrf *zvrf, route_tag_t tag)
 {
        struct route_map *rmap = NULL;
        char *rm_name;
@@ -1771,7 +1770,6 @@ zebra_route_map_check(afi_t family, struct route_entry *re, uint8_t instance,
 
        rm_obj.nexthop = nexthop;
        rm_obj.re = re;
-       rm_obj.instance = instance;
        rm_obj.metric = 0;
        rm_obj.tag = tag;
 
@@ -1813,11 +1811,9 @@ void zebra_del_import_table_route_map(afi_t afi, uint32_t table)
        XFREE(MTYPE_ROUTE_MAP_NAME, zebra_import_table_routemap[afi][table]);
 }
 
-route_map_result_t
-zebra_import_table_route_map_check(int family, struct route_entry *re,
-                                  uint8_t instance, const struct prefix *p,
-                                  struct nexthop *nexthop, route_tag_t tag,
-                                  const char *rmap_name)
+route_map_result_t zebra_import_table_route_map_check(
+       int family, struct route_entry *re, const struct prefix *p,
+       struct nexthop *nexthop, route_tag_t tag, const char *rmap_name)
 {
        struct route_map *rmap = NULL;
        route_map_result_t ret = RMAP_DENYMATCH;
@@ -1825,7 +1821,6 @@ zebra_import_table_route_map_check(int family, struct route_entry *re,
 
        rm_obj.nexthop = nexthop;
        rm_obj.re = re;
-       rm_obj.instance = instance;
        rm_obj.metric = 0;
        rm_obj.tag = tag;
 
@@ -1850,7 +1845,6 @@ route_map_result_t zebra_nht_route_map_check(afi_t afi, int client_proto,
 
        rm_obj.nexthop = nexthop;
        rm_obj.re = re;
-       rm_obj.instance = re->instance;
        rm_obj.metric = re->metric;
        rm_obj.tag = re->tag;
 
index 81a34ef28cf67d5e738bf6b2a3d7fc07525c03b3..3fa14768965e9e4d024396ad9b87b7f39a8e9f69 100644 (file)
@@ -21,13 +21,11 @@ extern void zebra_add_import_table_route_map(afi_t afi, const char *rmap_name,
                                             uint32_t table);
 extern void zebra_del_import_table_route_map(afi_t afi, uint32_t table);
 
+extern route_map_result_t zebra_import_table_route_map_check(
+       int family, struct route_entry *re, const struct prefix *p,
+       struct nexthop *nexthop, route_tag_t tag, const char *rmap_name);
 extern route_map_result_t
-zebra_import_table_route_map_check(int family, struct route_entry *re,
-                                  uint8_t instance, const struct prefix *p,
-                                  struct nexthop *nexthop, route_tag_t tag,
-                                  const char *rmap_name);
-extern route_map_result_t
-zebra_route_map_check(afi_t family, struct route_entry *re, uint8_t instance,
+zebra_route_map_check(afi_t family, struct route_entry *re,
                      const struct prefix *p, struct nexthop *nexthop,
                      struct zebra_vrf *zvrf, route_tag_t tag);
 extern route_map_result_t zebra_nht_route_map_check(afi_t afi, int client_proto,