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
19 * along with GNU Zebra; see the file COPYING. If not, write to the Free
20 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
23 #if !defined(__ZEBRA_RIB_H__)
24 #define __ZEBRA_RIB_H__
26 #include <zebra/zebra_ns.h>
27 #include <zebra/zebra_pw.h>
29 /* Routing table instance. */
43 #define ZEBRA_VRF_RIB_SCHEDULED (1 << 0)
44 #define ZEBRA_VRF_RETAIN (2 << 0)
49 struct route_table
*table
[AFI_MAX
][SAFI_MAX
];
51 /* Static route configuration. */
52 struct route_table
*stable
[AFI_MAX
][SAFI_MAX
];
54 /* Recursive Nexthop table */
55 struct route_table
*rnh_table
[AFI_MAX
];
57 /* Import check table (used mostly by BGP */
58 struct route_table
*import_check_table
[AFI_MAX
];
60 /* Routing tables off of main table for redistribute table */
61 struct route_table
*other_table
[AFI_MAX
][ZEBRA_KERNEL_TABLE_MAX
];
63 /* 2nd pointer type used primarily to quell a warning on
64 * ALL_LIST_ELEMENTS_RO
66 struct list _rid_all_sorted_list
;
67 struct list _rid_lo_sorted_list
;
68 struct list
*rid_all_sorted_list
;
69 struct list
*rid_lo_sorted_list
;
70 struct prefix rid_user_assigned
;
73 * Back pointer to the owning namespace.
77 /* MPLS static LSP config table */
78 struct hash
*slsp_table
;
80 /* MPLS label forwarding table */
81 struct hash
*lsp_table
;
84 struct zebra_pw_head pseudowires
;
86 /* MPLS processing flags */
88 #define MPLS_FLAG_SCHEDULE_LSPS (1 << 0)
91 static inline vrf_id_t
92 zvrf_id (struct zebra_vrf
*zvrf
)
94 return zvrf
->vrf
->vrf_id
;
97 static inline const char *
98 zvrf_name (struct zebra_vrf
*zvrf
)
100 return zvrf
->vrf
->name
;
104 zebra_vrf_table_with_table_id (afi_t afi
, safi_t safi
,
105 vrf_id_t vrf_id
, u_int32_t table_id
);
107 extern void zebra_vrf_static_route_interface_fixup (struct interface
*ifp
);
108 extern void zebra_vrf_update_all (struct zserv
*client
);
109 extern struct zebra_vrf
*zebra_vrf_lookup_by_id (vrf_id_t vrf_id
);
110 extern struct zebra_vrf
*zebra_vrf_lookup_by_name (const char *);
111 extern struct zebra_vrf
*zebra_vrf_alloc (void);
112 extern struct route_table
*zebra_vrf_table (afi_t
, safi_t
, vrf_id_t
);
113 extern struct route_table
*zebra_vrf_static_table (afi_t
, safi_t
, struct zebra_vrf
*zvrf
);
114 extern struct route_table
*zebra_vrf_other_route_table (afi_t afi
, u_int32_t table_id
,
116 extern void zebra_vrf_init (void);