]>
Commit | Line | Data |
---|---|---|
7c551956 DS |
1 | /* |
2 | * Zebra Vrf Header | |
3 | * Copyright (C) 2016 Cumulus Networks | |
4 | * Donald Sahrp | |
5 | * | |
6 | * This file is part of Quagga. | |
7 | * | |
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 | |
11 | * later version. | |
12 | * | |
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. | |
17 | * | |
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 | |
21 | * 02111-1307, USA. | |
22 | */ | |
23 | #if !defined(__ZEBRA_RIB_H__) | |
24 | #define __ZEBRA_RIB_H__ | |
25 | ||
26 | #include <zebra/zebra_ns.h> | |
27 | ||
1b6d5c7e VV |
28 | /* MPLS (Segment Routing) global block */ |
29 | typedef struct mpls_srgb_t_ | |
30 | { | |
31 | u_int32_t start_label; | |
32 | u_int32_t end_label; | |
33 | } mpls_srgb_t; | |
34 | ||
7c551956 DS |
35 | /* Routing table instance. */ |
36 | struct zebra_vrf | |
37 | { | |
661512bf RW |
38 | /* Back pointer */ |
39 | struct vrf *vrf; | |
7c551956 DS |
40 | |
41 | /* Description. */ | |
42 | char *desc; | |
43 | ||
44 | /* FIB identifier. */ | |
45 | u_char fib_id; | |
46 | ||
47 | /* Flags. */ | |
48 | u_int16_t flags; | |
49 | #define ZEBRA_VRF_RIB_SCHEDULED (1 << 0) | |
5a8dfcd8 | 50 | #define ZEBRA_VRF_RETAIN (2 << 0) |
7c551956 DS |
51 | |
52 | u_int32_t table_id; | |
53 | ||
54 | /* Routing table. */ | |
55 | struct route_table *table[AFI_MAX][SAFI_MAX]; | |
56 | ||
57 | /* Static route configuration. */ | |
58 | struct route_table *stable[AFI_MAX][SAFI_MAX]; | |
59 | ||
60 | /* Recursive Nexthop table */ | |
61 | struct route_table *rnh_table[AFI_MAX]; | |
62 | ||
63 | /* Import check table (used mostly by BGP */ | |
64 | struct route_table *import_check_table[AFI_MAX]; | |
65 | ||
66 | /* Routing tables off of main table for redistribute table */ | |
67 | struct route_table *other_table[AFI_MAX][ZEBRA_KERNEL_TABLE_MAX]; | |
68 | ||
69 | /* 2nd pointer type used primarily to quell a warning on | |
70 | * ALL_LIST_ELEMENTS_RO | |
71 | */ | |
72 | struct list _rid_all_sorted_list; | |
73 | struct list _rid_lo_sorted_list; | |
74 | struct list *rid_all_sorted_list; | |
75 | struct list *rid_lo_sorted_list; | |
76 | struct prefix rid_user_assigned; | |
77 | ||
78 | /* | |
79 | * Back pointer to the owning namespace. | |
80 | */ | |
81 | struct zebra_ns *zns; | |
54d48ea1 | 82 | |
83 | /* MPLS static LSP config table */ | |
84 | struct hash *slsp_table; | |
85 | ||
86 | /* MPLS label forwarding table */ | |
87 | struct hash *lsp_table; | |
939fba27 | 88 | |
f31e084c DS |
89 | /* MPLS FEC binding table */ |
90 | struct route_table *fec_table[AFI_MAX]; | |
91 | ||
1b6d5c7e VV |
92 | /* MPLS Segment Routing Global block */ |
93 | mpls_srgb_t mpls_srgb; | |
94 | ||
939fba27 | 95 | /* MPLS processing flags */ |
96 | u_int16_t mpls_flags; | |
97 | #define MPLS_FLAG_SCHEDULE_LSPS (1 << 0) | |
7c551956 DS |
98 | }; |
99 | ||
661512bf RW |
100 | static inline vrf_id_t |
101 | zvrf_id (struct zebra_vrf *zvrf) | |
102 | { | |
103 | return zvrf->vrf->vrf_id; | |
104 | } | |
105 | ||
106 | static inline const char * | |
107 | zvrf_name (struct zebra_vrf *zvrf) | |
108 | { | |
109 | return zvrf->vrf->name; | |
110 | } | |
111 | ||
7c551956 DS |
112 | struct route_table * |
113 | zebra_vrf_table_with_table_id (afi_t afi, safi_t safi, | |
114 | vrf_id_t vrf_id, u_int32_t table_id); | |
115 | ||
fb148af4 | 116 | extern void zebra_vrf_static_route_interface_fixup (struct interface *ifp); |
7c551956 | 117 | extern void zebra_vrf_update_all (struct zserv *client); |
5f3d1bdf | 118 | extern struct zebra_vrf *zebra_vrf_lookup_by_id (vrf_id_t vrf_id); |
05e8e11e | 119 | extern struct zebra_vrf *zebra_vrf_lookup_by_name (const char *); |
661512bf | 120 | extern struct zebra_vrf *zebra_vrf_alloc (void); |
7c551956 | 121 | extern struct route_table *zebra_vrf_table (afi_t, safi_t, vrf_id_t); |
01bb6d57 | 122 | extern struct route_table *zebra_vrf_static_table (afi_t, safi_t, struct zebra_vrf *zvrf); |
7c551956 DS |
123 | extern struct route_table *zebra_vrf_other_route_table (afi_t afi, u_int32_t table_id, |
124 | vrf_id_t vrf_id); | |
125 | extern void zebra_vrf_init (void); | |
126 | #endif |