3 * Copyright (C) 2016 Cumulus Networks
6 * This file is part of Quagga.
8 * Quagga is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2, or (at your option) any
13 * Quagga is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with this program; see the file COPYING; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #if !defined(__ZEBRA_RIB_H__)
23 #define __ZEBRA_RIB_H__
25 #include <zebra/zebra_ns.h>
26 #include <zebra/zebra_pw.h>
28 /* MPLS (Segment Routing) global block */
29 typedef struct mpls_srgb_t_
{
30 u_int32_t start_label
;
34 /* Routing table instance. */
47 #define ZEBRA_VRF_RIB_SCHEDULED (1 << 0)
48 #define ZEBRA_VRF_RETAIN (2 << 0)
53 struct route_table
*table
[AFI_MAX
][SAFI_MAX
];
55 /* Static route configuration. */
56 struct route_table
*stable
[AFI_MAX
][SAFI_MAX
];
58 /* Recursive Nexthop table */
59 struct route_table
*rnh_table
[AFI_MAX
];
61 /* Import check table (used mostly by BGP */
62 struct route_table
*import_check_table
[AFI_MAX
];
64 /* Routing tables off of main table for redistribute table */
65 struct route_table
*other_table
[AFI_MAX
][ZEBRA_KERNEL_TABLE_MAX
];
67 /* 2nd pointer type used primarily to quell a warning on
68 * ALL_LIST_ELEMENTS_RO
70 struct list _rid_all_sorted_list
;
71 struct list _rid_lo_sorted_list
;
72 struct list
*rid_all_sorted_list
;
73 struct list
*rid_lo_sorted_list
;
74 struct prefix rid_user_assigned
;
77 * Back pointer to the owning namespace.
81 /* MPLS static LSP config table */
82 struct hash
*slsp_table
;
84 /* MPLS label forwarding table */
85 struct hash
*lsp_table
;
87 /* MPLS FEC binding table */
88 struct route_table
*fec_table
[AFI_MAX
];
90 /* MPLS Segment Routing Global block */
91 mpls_srgb_t mpls_srgb
;
94 struct zebra_pw_head pseudowires
;
95 struct zebra_static_pw_head static_pseudowires
;
97 /* MPLS processing flags */
99 #define MPLS_FLAG_SCHEDULE_LSPS (1 << 0)
102 * VNI hash table (for EVPN). Only in default instance.
104 struct hash
*vni_table
;
106 * Whether EVPN is enabled or not.
108 int advertise_all_vni
;
111 * Whether we are advertising g/w macip in EVPN or not.
113 int advertise_gw_macip
;
118 uint64_t neigh_updates
;
119 uint64_t lsp_installs
;
120 uint64_t lsp_removals
;
123 static inline vrf_id_t
zvrf_id(struct zebra_vrf
*zvrf
)
125 return zvrf
->vrf
->vrf_id
;
128 static inline const char *zvrf_name(struct zebra_vrf
*zvrf
)
130 return zvrf
->vrf
->name
;
133 struct route_table
*zebra_vrf_table_with_table_id(afi_t afi
, safi_t safi
,
137 extern void zebra_vrf_update_all(struct zserv
*client
);
138 extern struct zebra_vrf
*zebra_vrf_lookup_by_id(vrf_id_t vrf_id
);
139 extern struct zebra_vrf
*zebra_vrf_lookup_by_name(const char *);
140 extern struct zebra_vrf
*zebra_vrf_alloc(void);
141 extern struct route_table
*zebra_vrf_table(afi_t
, safi_t
, vrf_id_t
);
142 extern struct route_table
*zebra_vrf_static_table(afi_t
, safi_t
,
143 struct zebra_vrf
*zvrf
);
144 extern struct route_table
*
145 zebra_vrf_other_route_table(afi_t afi
, u_int32_t table_id
, vrf_id_t vrf_id
);
146 extern void zebra_vrf_init(void);