]> git.proxmox.com Git - mirror_frr.git/blobdiff - pbrd/pbr_map.h
Merge pull request #4765 from opensourcerouting/defaults-v2
[mirror_frr.git] / pbrd / pbr_map.h
index 5cb22d7429ebb3a4acf2198e441d98dc09f243bb..8bd22cbf2a5bc8492d9ab1c437f4aa99ab02c0f6 100644 (file)
 #ifndef __PBR_MAP_H__
 #define __PBR_MAP_H__
 
+#include <bitfield.h>
+
+#include "pbr_vrf.h"
+
 struct pbr_map {
        /*
         * RB Tree of the pbr_maps
@@ -40,20 +44,21 @@ struct pbr_map {
         */
        struct list *incoming;
 
+       bitfield_t ifi_bitfield;
        /*
         * If valid is true we think the pbr_map is valid,
         * If false, look in individual pbrms to see
         * what we think is the invalid reason
         */
        bool valid;
-
-       bool installed;
 };
 
 RB_HEAD(pbr_map_entry_head, pbr_map);
 RB_PROTOTYPE(pbr_map_entry_head, pbr_map, pbr_map_entry, pbr_map_compare)
 
 struct pbr_map_interface {
+       uint32_t install_bit;
+
        struct interface *ifp;
 
        struct pbr_map *pbrm;
@@ -84,12 +89,28 @@ struct pbr_map_sequence {
         */
        struct prefix *src;
        struct prefix *dst;
+       uint32_t mark;
 
        /*
         * Family of the src/dst.  Needed when deleting since we clear them
         */
        unsigned char family;
 
+       /*
+        * Use interface's vrf.
+        */
+       bool vrf_unchanged;
+
+       /*
+        * The vrf to lookup in was directly configured.
+        */
+       bool vrf_lookup;
+
+       /*
+        * VRF to lookup.
+        */
+       char vrf_name[VRF_NAMSIZ + 1];
+
        /*
         * The nexthop group we auto create
         * for when the user specifies a individual
@@ -112,18 +133,19 @@ struct pbr_map_sequence {
        /*
         * Are we installed
         */
-       bool installed;
+       uint64_t installed;
 
        /*
         * A reason of 0 means we think the pbr_map_sequence is good to go
         * We can accumuluate multiple failure states
         */
-#define PBR_MAP_VALID_SEQUENCE_NUMBER  0
-#define PBR_MAP_INVALID_NEXTHOP_GROUP  (1 << 0)
-#define PBR_MAP_INVALID_NEXTHOP        (1 << 1)
-#define PBR_MAP_INVALID_NO_NEXTHOPS    (1 << 2)
-#define PBR_MAP_INVALID_BOTH_NHANDGRP  (1 << 3)
-#define PBR_MAP_INVALID_SRCDST         (1 << 4)
+#define PBR_MAP_VALID_SEQUENCE_NUMBER    0
+#define PBR_MAP_INVALID_NEXTHOP_GROUP    (1 << 0)
+#define PBR_MAP_INVALID_NEXTHOP          (1 << 1)
+#define PBR_MAP_INVALID_NO_NEXTHOPS      (1 << 2)
+#define PBR_MAP_INVALID_BOTH_NHANDGRP    (1 << 3)
+#define PBR_MAP_INVALID_EMPTY            (1 << 4)
+#define PBR_MAP_INVALID_VRF              (1 << 5)
        uint64_t reason;
 
        QOBJ_FIELDS
@@ -134,15 +156,27 @@ DECLARE_QOBJ_TYPE(pbr_map_sequence)
 extern struct pbr_map_entry_head pbr_maps;
 
 extern struct pbr_map_sequence *pbrms_get(const char *name, uint32_t seqno);
-extern struct pbr_map_sequence *pbrms_lookup_unique(uint32_t unique,
-                                                   ifindex_t ifindex);
+extern struct pbr_map_sequence *
+pbrms_lookup_unique(uint32_t unique, ifindex_t ifindex,
+                   struct pbr_map_interface **ppmi);
 
 extern struct pbr_map *pbrm_find(const char *name);
 extern void pbr_map_delete(struct pbr_map_sequence *pbrms);
-extern void pbr_map_delete_nexthop_group(struct pbr_map_sequence *pbrms);
+extern void pbr_map_delete_nexthops(struct pbr_map_sequence *pbrms);
+extern void pbr_map_delete_vrf(struct pbr_map_sequence *pbrms);
 extern void pbr_map_add_interface(struct pbr_map *pbrm, struct interface *ifp);
 extern void pbr_map_interface_delete(struct pbr_map *pbrm,
                                     struct interface *ifp);
+
+/* Update maps installed on interface */
+extern void pbr_map_policy_interface_update(const struct interface *ifp,
+                                           bool state_up);
+
+extern void pbr_map_final_interface_deletion(struct pbr_map *pbrm,
+                                            struct pbr_map_interface *pmi);
+
+extern void pbr_map_vrf_update(const struct pbr_vrf *pbr_vrf);
+
 extern void pbr_map_write_interfaces(struct vty *vty, struct interface *ifp);
 extern void pbr_map_init(void);