]> git.proxmox.com Git - mirror_frr.git/blobdiff - lib/routemap.h
zebra, lib: fix the ZEBRA_INTERFACE_VRF_UPDATE zapi message
[mirror_frr.git] / lib / routemap.h
index 990c7fa72f43d28f50e7c7a8969432425141b047..463aa91725a98b64b10a7516c9a5320fb641af7c 100644 (file)
@@ -87,8 +87,10 @@ struct route_map_rule_cmd {
        const char *str;
 
        /* Function for value set or match. */
-       route_map_result_t (*func_apply)(void *, struct prefix *,
-                                        route_map_object_t, void *);
+       route_map_result_t (*func_apply)(void *rule,
+                                        const struct prefix *prefix,
+                                        route_map_object_t type,
+                                        void *object);
 
        /* Compile argument and return result as void *. */
        void *(*func_compile)(const char *);
@@ -140,6 +142,9 @@ struct route_map_index {
        struct route_map_index *next;
        struct route_map_index *prev;
 
+       /* Keep track how many times we've try to apply */
+       uint64_t applied;
+
        QOBJ_FIELDS
 };
 DECLARE_QOBJ_TYPE(route_map_index)
@@ -161,12 +166,21 @@ struct route_map {
        bool to_be_processed; /* True if modification isn't acted on yet */
        bool deleted;         /* If 1, then this node will be deleted */
 
+       /* How many times have we applied this route-map */
+       uint64_t applied;
+
        QOBJ_FIELDS
 };
 DECLARE_QOBJ_TYPE(route_map)
 
 /* Prototypes. */
 extern void route_map_init(void);
+
+/*
+ * This should only be called on shutdown
+ * Additionally this function sets the hooks to NULL
+ * before any processing is done.
+ */
 extern void route_map_finish(void);
 
 /* Add match statement to route map. */
@@ -206,18 +220,20 @@ extern void route_map_install_set(struct route_map_rule_cmd *cmd);
 /* Lookup route map by name. */
 extern struct route_map *route_map_lookup_by_name(const char *name);
 
+/* Simple helper to warn if route-map does not exist. */
+struct route_map *route_map_lookup_warn_noexist(struct vty *vty, const char *name);
+
 /* Apply route map to the object. */
 extern route_map_result_t route_map_apply(struct route_map *map,
-                                         struct prefix *,
+                                         const struct prefix *prefix,
                                          route_map_object_t object_type,
                                          void *object);
 
 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 *));
-extern int route_map_mark_updated(const char *name, int deleted);
-extern int route_map_clear_updated(struct route_map *rmap);
-extern void route_map_walk_update_list(int (*update_fn)(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,
                                      const char *rmap_name);
 extern void route_map_notify_dependencies(const char *affected_name,
@@ -276,6 +292,14 @@ extern void route_map_match_ip_next_hop_prefix_list_hook(int (*func)(
 extern void route_map_no_match_ip_next_hop_prefix_list_hook(int (*func)(
        struct vty *vty, struct route_map_index *index, const char *command,
        const char *arg, route_map_event_t type));
+/* match ip next hop type */
+extern void route_map_match_ip_next_hop_type_hook(int (*func)(
+       struct vty *vty, struct route_map_index *index, const char *command,
+       const char *arg, route_map_event_t type));
+/* no match ip next hop type */
+extern void route_map_no_match_ip_next_hop_type_hook(int (*func)(
+       struct vty *vty, struct route_map_index *index, const char *command,
+       const char *arg, route_map_event_t type));
 /* match ipv6 address */
 extern void route_map_match_ipv6_address_hook(int (*func)(
        struct vty *vty, struct route_map_index *index, const char *command,
@@ -292,6 +316,14 @@ extern void route_map_match_ipv6_address_prefix_list_hook(int (*func)(
 extern void route_map_no_match_ipv6_address_prefix_list_hook(int (*func)(
        struct vty *vty, struct route_map_index *index, const char *command,
        const char *arg, route_map_event_t type));
+/* match ipv6 next-hop type */
+extern void route_map_match_ipv6_next_hop_type_hook(int (*func)(
+       struct vty *vty, struct route_map_index *index, const char *command,
+       const char *arg, route_map_event_t type));
+/* no match ipv6 next-hop type */
+extern void route_map_no_match_ipv6_next_hop_type_hook(int (*func)(
+       struct vty *vty, struct route_map_index *index, const char *command,
+       const char *arg, route_map_event_t type));
 /* match metric */
 extern void route_map_match_metric_hook(int (*func)(
        struct vty *vty, struct route_map_index *index, const char *command,