]> git.proxmox.com Git - mirror_frr.git/blobdiff - zebra/zebra_vrf.h
Merge pull request #5278 from slankdev/slankdev-bgpd-fix-prefix-sid-fetch-error
[mirror_frr.git] / zebra / zebra_vrf.h
index 2dd47b5561a7b80b3ebfeeec13c0207460fa7dbe..5448e170735aea719d8d1ff349297df22f2f976a 100644 (file)
@@ -43,6 +43,18 @@ struct zebra_rmap {
        struct route_map *map;
 };
 
+PREDECL_RBTREE_UNIQ(otable);
+
+struct other_route_table {
+       struct otable_item next;
+
+       afi_t afi;
+       safi_t safi;
+       uint32_t table_id;
+
+       struct route_table *table;
+};
+
 /* Routing table instance.  */
 struct zebra_vrf {
        /* Back pointer */
@@ -57,6 +69,7 @@ struct zebra_vrf {
        /* Flags. */
        uint16_t flags;
 #define ZEBRA_VRF_RETAIN          (1 << 0)
+#define ZEBRA_PIM_SEND_VXLAN_SG   (1 << 1)
 
        uint32_t table_id;
 
@@ -69,6 +82,8 @@ struct zebra_vrf {
        /* Import check table (used mostly by BGP */
        struct route_table *import_check_table[AFI_MAX];
 
+       struct otable_head other_tables;
+
        /* 2nd pointer type used primarily to quell a warning on
         * ALL_LIST_ELEMENTS_RO
         */
@@ -159,6 +174,9 @@ struct zebra_vrf {
 #if defined(HAVE_RTADV)
        struct rtadv rtadv;
 #endif /* HAVE_RTADV */
+
+       int zebra_rnh_ip_default_route;
+       int zebra_rnh_ipv6_default_route;
 };
 #define PROTO_RM_NAME(zvrf, afi, rtype) zvrf->proto_rm[afi][rtype].name
 #define NHT_RM_NAME(zvrf, afi, rtype) zvrf->nht_rm[afi][rtype].name
@@ -196,9 +214,32 @@ static inline bool zvrf_is_active(struct zebra_vrf *zvrf)
        return zvrf->vrf->status & VRF_ACTIVE;
 }
 
-struct route_table *zebra_vrf_table_with_table_id(afi_t afi, safi_t safi,
-                                                 vrf_id_t vrf_id,
-                                                 uint32_t table_id);
+static inline int
+zvrf_other_table_compare_func(const struct other_route_table *a,
+                             const struct other_route_table *b)
+{
+       if (a->afi != b->afi)
+               return a->afi - b->afi;
+
+       if (a->safi != b->safi)
+               return a->safi - b->safi;
+
+       if (a->table_id != b->table_id)
+               return a->table_id - b->table_id;
+
+       return 0;
+}
+
+DECLARE_RBTREE_UNIQ(otable, struct other_route_table, next,
+                   zvrf_other_table_compare_func)
+
+extern struct route_table *
+zebra_vrf_lookup_table_with_table_id(afi_t afi, safi_t safi, vrf_id_t vrf_id,
+                                    uint32_t table_id);
+extern struct route_table *zebra_vrf_get_table_with_table_id(afi_t afi,
+                                                            safi_t safi,
+                                                            vrf_id_t vrf_id,
+                                                            uint32_t table_id);
 
 extern void zebra_vrf_update_all(struct zserv *client);
 extern struct zebra_vrf *zebra_vrf_lookup_by_id(vrf_id_t vrf_id);
@@ -206,8 +247,6 @@ extern struct zebra_vrf *zebra_vrf_lookup_by_name(const char *);
 extern struct zebra_vrf *zebra_vrf_alloc(void);
 extern struct route_table *zebra_vrf_table(afi_t, safi_t, vrf_id_t);
 
-extern struct route_table *
-zebra_vrf_other_route_table(afi_t afi, uint32_t table_id, vrf_id_t vrf_id);
 extern int zebra_vrf_has_config(struct zebra_vrf *zvrf);
 extern void zebra_vrf_init(void);