]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd, lib, ospf6d, ospfd, pimd, zebra: Rework routemap event callback
authorDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 9 May 2019 03:19:55 +0000 (23:19 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 10 May 2019 22:43:21 +0000 (18:43 -0400)
The route_map_event_hook callback was passing the `route_map_event_t`
to each individual interested party.  No-one is ever using this data
so let's cut to the chase a bit and remove the pass through of data.
This is considered ok in that the routemap.c code came this way
originally and after 15+ years no-one is using this functionality.
Nor do I see any `easy` way to do anything useful with this data.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
bgpd/bgp_routemap.c
bgpd/rfapi/bgp_rfapi_cfg.c
lib/routemap.c
lib/routemap.h
ospf6d/ospf6_asbr.c
ospfd/ospf_routemap.c
pimd/pim_routemap.c
zebra/zebra_routemap.c

index 0da9a84b56ece0c456856b9725fdb725aed17b0f..9ff4196dae01c0b3d26b7d10b77ef5674b42ff5c 100644 (file)
@@ -3447,7 +3447,7 @@ static void bgp_route_map_delete(const char *rmap_name)
        route_map_notify_dependencies(rmap_name, RMAP_EVENT_MATCH_DELETED);
 }
 
-static void bgp_route_map_event(route_map_event_t event, const char *rmap_name)
+static void bgp_route_map_event(const char *rmap_name)
 {
        if (route_map_mark_updated(rmap_name) == 0)
                bgp_route_map_mark_update(rmap_name);
index 2220f0ed9abf4fd758c981288f6ac93b8ee61b35..cad33404fad3f86a1d5de781839e0e2d5df55abc 100644 (file)
@@ -2208,24 +2208,6 @@ void vnc_routemap_update(struct bgp *bgp, const char *unused)
        vnc_zlog_debug_verbose("%s done", __func__);
 }
 
-#if 0 /* superseded */
-static void vnc_routemap_event(route_map_event_t type, /* ignored */
-                              const char *rmap_name)  /* ignored */
-{
-       struct listnode *mnode, *mnnode;
-       struct bgp *bgp;
-
-       vnc_zlog_debug_verbose("%s(event type=%d)", __func__, type);
-       if (bm->bgp == NULL) /* may be called during cleanup */
-               return;
-
-       for (ALL_LIST_ELEMENTS(bm->bgp, mnode, mnnode, bgp))
-               vnc_routemap_update(bgp, rmap_name);
-
-       vnc_zlog_debug_verbose("%s: done", __func__);
-}
-#endif
-
 /*-------------------------------------------------------------------------
  *                     nve-group
  *-----------------------------------------------------------------------*/
@@ -3699,10 +3681,6 @@ bgp_rfapi_get_ecommunity_by_lni_label(struct bgp *bgp, uint32_t is_import,
 
 void bgp_rfapi_cfg_init(void)
 {
-       /* main bgpd code does not use this hook, but vnc does */
-       /* superseded by bgp_route_map_process_update_cb() */
-       /* bgp_route_map_event_hook_add(vnc_routemap_event); */
-
        install_node(&bgp_vnc_defaults_node, NULL);
        install_node(&bgp_vnc_nve_group_node, NULL);
        install_node(&bgp_vrf_policy_node, NULL);
index f74baa38bd9d0dbc130a9040a3dabd04e9160052..0c75be3323bb19fd2237d28961b8ef444b1fdc54 100644 (file)
@@ -616,7 +616,7 @@ struct route_map_list {
 
        void (*add_hook)(const char *);
        void (*delete_hook)(const char *);
-       void (*event_hook)(route_map_event_t, const char *);
+       void (*event_hook)(const char *);
 };
 
 /* Master list of route map. */
@@ -1077,8 +1077,7 @@ static void route_map_index_delete(struct route_map_index *index, int notify)
 
        /* Execute event hook. */
        if (route_map_master.event_hook && notify) {
-               (*route_map_master.event_hook)(RMAP_EVENT_INDEX_DELETED,
-                                              index->map->name);
+               (*route_map_master.event_hook)(index->map->name);
                route_map_notify_dependencies(index->map->name,
                                              RMAP_EVENT_CALL_ADDED);
        }
@@ -1137,8 +1136,7 @@ route_map_index_add(struct route_map *map, enum route_map_type type, int pref)
 
        /* Execute event hook. */
        if (route_map_master.event_hook) {
-               (*route_map_master.event_hook)(RMAP_EVENT_INDEX_ADDED,
-                                              map->name);
+               (*route_map_master.event_hook)(map->name);
                route_map_notify_dependencies(map->name, RMAP_EVENT_CALL_ADDED);
        }
        return index;
@@ -1337,10 +1335,7 @@ int route_map_add_match(struct route_map_index *index, const char *match_name,
 
        /* Execute event hook. */
        if (route_map_master.event_hook) {
-               (*route_map_master.event_hook)(
-                       replaced ? RMAP_EVENT_MATCH_REPLACED
-                                : RMAP_EVENT_MATCH_ADDED,
-                       index->map->name);
+               (*route_map_master.event_hook)(index->map->name);
                route_map_notify_dependencies(index->map->name,
                                              RMAP_EVENT_CALL_ADDED);
        }
@@ -1365,9 +1360,7 @@ int route_map_delete_match(struct route_map_index *index,
                        route_map_rule_delete(&index->match_list, rule);
                        /* Execute event hook. */
                        if (route_map_master.event_hook) {
-                               (*route_map_master.event_hook)(
-                                       RMAP_EVENT_MATCH_DELETED,
-                                       index->map->name);
+                               (*route_map_master.event_hook)(index->map->name);
                                route_map_notify_dependencies(
                                        index->map->name,
                                        RMAP_EVENT_CALL_ADDED);
@@ -1425,10 +1418,7 @@ int route_map_add_set(struct route_map_index *index, const char *set_name,
 
        /* Execute event hook. */
        if (route_map_master.event_hook) {
-               (*route_map_master.event_hook)(replaced
-                                                      ? RMAP_EVENT_SET_REPLACED
-                                                      : RMAP_EVENT_SET_ADDED,
-                                              index->map->name);
+               (*route_map_master.event_hook)(index->map->name);
                route_map_notify_dependencies(index->map->name,
                                              RMAP_EVENT_CALL_ADDED);
        }
@@ -1452,9 +1442,7 @@ int route_map_delete_set(struct route_map_index *index, const char *set_name,
                        route_map_rule_delete(&index->set_list, rule);
                        /* Execute event hook. */
                        if (route_map_master.event_hook) {
-                               (*route_map_master.event_hook)(
-                                       RMAP_EVENT_SET_DELETED,
-                                       index->map->name);
+                               (*route_map_master.event_hook)(index->map->name);
                                route_map_notify_dependencies(
                                        index->map->name,
                                        RMAP_EVENT_CALL_ADDED);
@@ -1651,7 +1639,7 @@ void route_map_delete_hook(void (*func)(const char *))
        route_map_master.delete_hook = func;
 }
 
-void route_map_event_hook(void (*func)(route_map_event_t, const char *))
+void route_map_event_hook(void (*func)(const char *name))
 {
        route_map_master.event_hook = func;
 }
@@ -1874,13 +1862,12 @@ static struct hash *route_map_get_dep_hash(route_map_event_t event)
 static void route_map_process_dependency(struct hash_bucket *bucket, void *data)
 {
        char *rmap_name = (char *)bucket->data;
-       route_map_event_t type = (route_map_event_t)(ptrdiff_t)data;
 
        if (rmap_debug)
                zlog_debug("%s: Notifying %s of dependency",
                           __FUNCTION__, rmap_name);
        if (route_map_master.event_hook)
-               (*route_map_master.event_hook)(type, rmap_name);
+               (*route_map_master.event_hook)(rmap_name);
 }
 
 void route_map_upd8_dependency(route_map_event_t type, const char *arg,
index e43e74a633dda2424d1491f67c6b5c92698a0d55..9969936a6b9fecf684213bf43be015b05c5259bf 100644 (file)
@@ -238,7 +238,15 @@ extern route_map_result_t route_map_apply(struct route_map *map,
 
 extern void route_map_add_hook(void (*func)(const char *));
 extern void route_map_delete_hook(void (*func)(const char *));
-extern void route_map_event_hook(void (*func)(route_map_event_t, const char *));
+
+/*
+ * This is the callback for when something has changed about a
+ * route-map.  The interested parties can register to receive
+ * this data.
+ *
+ * name - Is the name of the changed route-map
+ */
+extern void route_map_event_hook(void (*func)(const char *name));
 extern int route_map_mark_updated(const char *name);
 extern void route_map_walk_update_list(void (*update_fn)(char *name));
 extern void route_map_upd8_dependency(route_map_event_t type, const char *arg,
index 2795bb9abdfb46c99ad369bb6d162bd359e8cea9..946bbf8cc9423f8fb9a5309f2c79203b4f3f6a16 100644 (file)
@@ -956,7 +956,7 @@ static void ospf6_asbr_routemap_update(const char *mapname)
        }
 }
 
-static void ospf6_asbr_routemap_event(route_map_event_t event, const char *name)
+static void ospf6_asbr_routemap_event(const char *name)
 {
        int type;
 
index 30b2a50bb38f4c57826f8577c4172130c2a387dc..ab2d5ae5844cec5584445526bfb5a768baeb76f6 100644 (file)
@@ -97,7 +97,7 @@ static void ospf_route_map_update(const char *name)
        }
 }
 
-static void ospf_route_map_event(route_map_event_t event, const char *name)
+static void ospf_route_map_event(const char *name)
 {
        struct ospf *ospf;
        int type;
index 4230c127ad31031f89ef4784ad3fd395bd847391..2de94e9031ebd4f783b4caff129bd955d1d2e217 100644 (file)
@@ -36,7 +36,7 @@ static void pim_route_map_delete(const char *rmap_name)
        route_map_notify_dependencies(rmap_name, RMAP_EVENT_MATCH_DELETED);
 }
 
-static void pim_route_map_event(route_map_event_t event, const char *rmap_name)
+static void pim_route_map_event(const char *rmap_name)
 {
        route_map_notify_dependencies(rmap_name, RMAP_EVENT_MATCH_ADDED);
 }
index 5d1cbbe781d5de5b2f5ebbb5ae45000e946ab719..5355fa062e9c127c60f8d2dc195259730550d3f8 100644 (file)
@@ -1798,8 +1798,7 @@ static void zebra_route_map_delete(const char *rmap_name)
        route_map_notify_dependencies(rmap_name, RMAP_EVENT_MATCH_DELETED);
 }
 
-static void zebra_route_map_event(route_map_event_t event,
-                                 const char *rmap_name)
+static void zebra_route_map_event(const char *rmap_name)
 {
        if (route_map_mark_updated(rmap_name) == 0)
                zebra_route_map_mark_update(rmap_name);