FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
mfib_types.h
Go to the documentation of this file.
1  /*
2  * Copyright (c) 2016 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef __MFIB_TYPES_H__
17 #define __MFIB_TYPES_H__
18 
19 #include <vnet/fib/fib_types.h>
20 
21 /**
22  * Aggregate type for a prefix
23  */
24 typedef struct mfib_prefix_t_ {
25  /**
26  * The mask length
27  */
29 
30  /**
31  * protocol type
32  */
34 
35  /**
36  * Pad to keep the address 4 byte aligned
37  */
38  u8 ___fp___pad;
39 
40  /**
41  * The address type is not deriveable from the fp_addr member.
42  * If it's v4, then the first 3 u32s of the address will be 0.
43  * v6 addresses (even v4 mapped ones) have at least 2 u32s assigned
44  * to non-zero values. true. but when it's all zero, one cannot decide.
45  */
46  ip46_address_t fp_grp_addr;
47  ip46_address_t fp_src_addr;
49 
51 {
53  /**
54  * The control planes needs packets mathing this entry to generate
55  * a signal.
56  */
58  /**
59  * Drop all traffic to this route
60  */
62  /**
63  * The control plane needs to be informed of coneected sources
64  */
66  /**
67  * Accept packets from any incpoming interface
68  * Use with extreme caution
69  */
71  /**
72  * Exclusive - like its unicast counterpart. the source has provided
73  * the forwarding DPO directly. The entry therefore does not resolve
74  * paths via a path-list
75  */
77 
81 
82 #define FOR_EACH_MFIB_ATTRIBUTE(_item) \
83  for (_item = MFIB_ENTRY_ATTRIBUTE_FIRST; \
84  _item <= MFIB_ENTRY_ATTRIBUTE_LAST; \
85  _item++)
86 
87 #define MFIB_ENTRY_NAMES_SHORT { \
88  [MFIB_ENTRY_SIGNAL] = "S", \
89  [MFIB_ENTRY_CONNECTED] = "C", \
90  [MFIB_ENTRY_DROP] = "D", \
91  [MFIB_ENTRY_ACCEPT_ALL_ITF] = "AA", \
92  [MFIB_ENTRY_INHERIT_ACCEPT] = "IA", \
93  [MFIB_ENTRY_EXCLUSIVE] = "E", \
94 }
95 
96 #define MFIB_ENTRY_NAMES_LONG { \
97  [MFIB_ENTRY_SIGNAL] = "Signal", \
98  [MFIB_ENTRY_CONNECTED] = "Connected", \
99  [MFIB_ENTRY_DROP] = "Drop", \
100  [MFIB_ENTRY_ACCEPT_ALL_ITF] = "Accept-all-itf", \
101  [MFIB_ENTRY_INHERIT_ACCEPT] = "Inherit-Accept", \
102  [MFIB_ENTRY_EXCLUSIVE] = "Exclusive", \
103 }
104 
106 {
115 
117 {
126 
127 #define FOR_EACH_MFIB_ITF_ATTRIBUTE(_item) \
128  for (_item = MFIB_ITF_ATTRIBUTE_FIRST; \
129  _item <= MFIB_ITF_ATTRIBUTE_LAST; \
130  _item++)
131 
132 #define MFIB_ITF_NAMES_SHORT { \
133  [MFIB_ITF_NEGATE_SIGNAL] = "NS", \
134  [MFIB_ITF_ACCEPT] = "A", \
135  [MFIB_ITF_FORWARD] = "F", \
136  [MFIB_ITF_SIGNAL_PRESENT] = "SP", \
137  [MFIB_ITF_DONT_PRESERVE] = "DP", \
138 }
139 
140 #define MFIB_ITF_NAMES_LONG { \
141  [MFIB_ITF_NEGATE_SIGNAL] = "Negate-Signal", \
142  [MFIB_ITF_ACCEPT] = "Accept", \
143  [MFIB_ITF_FORWARD] = "Forward", \
144  [MFIB_ITF_SIGNAL_PRESENT] = "Signal-Present", \
145  [MFIB_ITF_DONT_PRESERVE] = "Don't-Preserve", \
146 }
147 
148 typedef enum mfib_itf_flags_t_
149 {
157 
158 /**
159  * Possible [control plane] sources of MFIB entries
160  */
161 typedef enum mfib_source_t_
162 {
178 } mfib_source_t;
179 
180 #define MFIB_SOURCE_NAMES { \
181  [MFIB_SOURCE_SPECIAL] = "Special", \
182  [MFIB_SOURCE_6RD] = "6RD", \
183  [MFIB_SOURCE_API] = "API", \
184  [MFIB_SOURCE_CLI] = "CLI", \
185  [MFIB_SOURCE_DHCP] = "DHCP", \
186  [MFIB_SOURCE_VXLAN] = "VXLAN", \
187  [MFIB_SOURCE_SRv6] = "SRv6", \
188  [MFIB_SOURCE_GTPU] = "GTPU", \
189  [MFIB_SOURCE_VXLAN_GPE] = "VXLAN-GPE", \
190  [MFIB_SOURCE_GENEVE] = "Geneve", \
191  [MFIB_SOURCE_IGMP] = "IGMP", \
192  [MFIB_SOURCE_VXLAN_GBP] = "VXLAN-GBP", \
193  [MFIB_SOURCE_PLUGIN_LOW] = "plugin-low", \
194  [MFIB_SOURCE_RR] = "Recursive-resolution", \
195  [MFIB_SOURCE_DEFAULT_ROUTE] = "Default Route", \
196 }
197 
198 #define FOREACH_MFIB_SOURCE(_ms) \
199  for (_ms = MFIB_SOURCE_SPECIAL; \
200  _ms <= MFIB_SOURCE_DEFAULT_ROUTE; \
201  _ms++)
202 
203 #define MFIB_N_SOURCES (MFIB_SOURCE_DEFAULT_ROUTE + 1)
204 #define MFIB_SOURCE_NONE (MFIB_SOURCE_DEFAULT_ROUTE + 1)
205 
206 /**
207  * \brief Compare two prefixes for equality
208  */
209 extern int mfib_prefix_cmp(const mfib_prefix_t *p1,
210  const mfib_prefix_t *p2);
211 
212 extern u8 * format_mfib_prefix(u8 * s, va_list * args);
213 
214 extern u8 *format_mfib_entry_flags(u8 * s, va_list * args);
215 extern u8 *format_mfib_itf_flags(u8 * s, va_list * args);
217  va_list * args);
219  va_list * args);
220 /**
221  * \brief Compare two prefixes for covering relationship
222  *
223  * \return non-zero if the first prefix is a cover for the second
224  */
225 extern int mfib_prefix_is_cover(const mfib_prefix_t *p1,
226  const mfib_prefix_t *p2);
227 
228 /**
229  * \brief Return true is the prefix is a host prefix
230  */
231 extern int mfib_prefix_is_host(const mfib_prefix_t *p);
232 
235 
236 #endif
MFIB_ENTRY_FLAG_EXCLUSIVE
@ MFIB_ENTRY_FLAG_EXCLUSIVE
Definition: mfib_types.h:112
mfib_prefix_cmp
int mfib_prefix_cmp(const mfib_prefix_t *p1, const mfib_prefix_t *p2)
Compare two prefixes for equality.
MFIB_ITF_SIGNAL_PRESENT
@ MFIB_ITF_SIGNAL_PRESENT
Definition: mfib_types.h:122
MFIB_SOURCE_GTPU
@ MFIB_SOURCE_GTPU
Definition: mfib_types.h:170
MFIB_ENTRY_FLAG_NONE
@ MFIB_ENTRY_FLAG_NONE
Definition: mfib_types.h:107
mfib_forw_chain_type_from_fib_proto
fib_forward_chain_type_t mfib_forw_chain_type_from_fib_proto(fib_protocol_t proto)
Definition: mfib_types.c:90
MFIB_ITF_NEGATE_SIGNAL
@ MFIB_ITF_NEGATE_SIGNAL
Definition: mfib_types.h:119
MFIB_SOURCE_VXLAN_GPE
@ MFIB_SOURCE_VXLAN_GPE
Definition: mfib_types.h:171
MFIB_SOURCE_GENEVE
@ MFIB_SOURCE_GENEVE
Definition: mfib_types.h:172
dpo_proto_t
enum dpo_proto_t_ dpo_proto_t
Data path protocol.
MFIB_SOURCE_RR
@ MFIB_SOURCE_RR
Definition: mfib_types.h:176
MFIB_ENTRY_ATTRIBUTE_FIRST
@ MFIB_ENTRY_ATTRIBUTE_FIRST
Definition: mfib_types.h:52
MFIB_ITF_FLAG_ACCEPT
@ MFIB_ITF_FLAG_ACCEPT
Definition: mfib_types.h:152
format_mfib_prefix
u8 * format_mfib_prefix(u8 *s, va_list *args)
Definition: mfib_types.c:106
MFIB_SOURCE_API
@ MFIB_SOURCE_API
Definition: mfib_types.h:165
mfib_itf_attribute_t
enum mfib_itf_attribute_t_ mfib_itf_attribute_t
mfib_prefix_t_
Aggregate type for a prefix.
Definition: mfib_types.h:24
MFIB_SOURCE_CLI
@ MFIB_SOURCE_CLI
Definition: mfib_types.h:166
mfib_prefix_t_::fp_len
u16 fp_len
The mask length.
Definition: mfib_types.h:28
mfib_prefix_is_host
int mfib_prefix_is_host(const mfib_prefix_t *p)
Return true is the prefix is a host prefix.
Definition: mfib_types.c:55
MFIB_ITF_FLAG_NONE
@ MFIB_ITF_FLAG_NONE
Definition: mfib_types.h:150
MFIB_ITF_DONT_PRESERVE
@ MFIB_ITF_DONT_PRESERVE
Definition: mfib_types.h:123
u16
unsigned short u16
Definition: types.h:57
mfib_entry_attribute_t_
mfib_entry_attribute_t_
Definition: mfib_types.h:50
MFIB_ENTRY_FLAG_INHERIT_ACCEPT
@ MFIB_ENTRY_FLAG_INHERIT_ACCEPT
Definition: mfib_types.h:113
MFIB_ITF_FORWARD
@ MFIB_ITF_FORWARD
Definition: mfib_types.h:121
MFIB_ITF_ACCEPT
@ MFIB_ITF_ACCEPT
Definition: mfib_types.h:120
mfib_entry_flags_t
enum mfib_entry_flags_t_ mfib_entry_flags_t
unformat_input_t
struct _unformat_input_t unformat_input_t
mfib_forw_chain_type_from_dpo_proto
fib_forward_chain_type_t mfib_forw_chain_type_from_dpo_proto(dpo_proto_t proto)
Definition: mfib_types.c:71
mfib_itf_attribute_t_
mfib_itf_attribute_t_
Definition: mfib_types.h:116
MFIB_SOURCE_SPECIAL
@ MFIB_SOURCE_SPECIAL
Definition: mfib_types.h:163
mfib_prefix_t_::fp_src_addr
ip46_address_t fp_src_addr
Definition: mfib_types.h:47
MFIB_SOURCE_PLUGIN_LOW
@ MFIB_SOURCE_PLUGIN_LOW
Definition: mfib_types.h:175
mfib_source_t
enum mfib_source_t_ mfib_source_t
Possible [control plane] sources of MFIB entries.
fib_forward_chain_type_t
enum fib_forward_chain_type_t_ fib_forward_chain_type_t
FIB output chain type.
unformat_mfib_itf_flags
uword unformat_mfib_itf_flags(unformat_input_t *input, va_list *args)
Definition: mfib_types.c:198
mfib_prefix_t
struct mfib_prefix_t_ mfib_prefix_t
Aggregate type for a prefix.
MFIB_ENTRY_FLAG_SIGNAL
@ MFIB_ENTRY_FLAG_SIGNAL
Definition: mfib_types.h:108
MFIB_ITF_ATTRIBUTE_LAST
@ MFIB_ITF_ATTRIBUTE_LAST
Definition: mfib_types.h:124
fib_types.h
uword
u64 uword
Definition: types.h:112
MFIB_SOURCE_DEFAULT_ROUTE
@ MFIB_SOURCE_DEFAULT_ROUTE
Definition: mfib_types.h:177
MFIB_SOURCE_VXLAN
@ MFIB_SOURCE_VXLAN
Definition: mfib_types.h:167
format_mfib_entry_flags
u8 * format_mfib_entry_flags(u8 *s, va_list *args)
Definition: mfib_types.c:161
mfib_itf_flags_t
enum mfib_itf_flags_t_ mfib_itf_flags_t
MFIB_SOURCE_VXLAN_GBP
@ MFIB_SOURCE_VXLAN_GBP
Definition: mfib_types.h:174
mfib_source_t_
mfib_source_t_
Possible [control plane] sources of MFIB entries.
Definition: mfib_types.h:161
mfib_entry_flags_t_
mfib_entry_flags_t_
Definition: mfib_types.h:105
fib_protocol_t
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
mfib_itf_flags_t_
mfib_itf_flags_t_
Definition: mfib_types.h:148
MFIB_ENTRY_FLAG_ACCEPT_ALL_ITF
@ MFIB_ENTRY_FLAG_ACCEPT_ALL_ITF
Definition: mfib_types.h:111
mfib_prefix_t_::fp_proto
fib_protocol_t fp_proto
protocol type
Definition: mfib_types.h:33
MFIB_SOURCE_IGMP
@ MFIB_SOURCE_IGMP
Definition: mfib_types.h:173
mfib_prefix_is_cover
int mfib_prefix_is_cover(const mfib_prefix_t *p1, const mfib_prefix_t *p2)
Compare two prefixes for covering relationship.
Definition: mfib_types.c:30
MFIB_SOURCE_6RD
@ MFIB_SOURCE_6RD
Definition: mfib_types.h:164
MFIB_ITF_FLAG_DONT_PRESERVE
@ MFIB_ITF_FLAG_DONT_PRESERVE
Definition: mfib_types.h:155
mfib_prefix_t_::fp_grp_addr
ip46_address_t fp_grp_addr
The address type is not deriveable from the fp_addr member.
Definition: mfib_types.h:46
MFIB_ENTRY_DROP
@ MFIB_ENTRY_DROP
Drop all traffic to this route.
Definition: mfib_types.h:61
MFIB_ENTRY_SIGNAL
@ MFIB_ENTRY_SIGNAL
The control planes needs packets mathing this entry to generate a signal.
Definition: mfib_types.h:57
MFIB_ITF_ATTRIBUTE_FIRST
@ MFIB_ITF_ATTRIBUTE_FIRST
Definition: mfib_types.h:118
MFIB_ENTRY_INHERIT_ACCEPT
@ MFIB_ENTRY_INHERIT_ACCEPT
Definition: mfib_types.h:78
MFIB_ITF_FLAG_SIGNAL_PRESENT
@ MFIB_ITF_FLAG_SIGNAL_PRESENT
Definition: mfib_types.h:154
MFIB_ENTRY_EXCLUSIVE
@ MFIB_ENTRY_EXCLUSIVE
Exclusive - like its unicast counterpart.
Definition: mfib_types.h:76
MFIB_SOURCE_SRv6
@ MFIB_SOURCE_SRv6
Definition: mfib_types.h:169
u8
unsigned char u8
Definition: types.h:56
MFIB_ENTRY_FLAG_DROP
@ MFIB_ENTRY_FLAG_DROP
Definition: mfib_types.h:109
mfib_entry_attribute_t
enum mfib_entry_attribute_t_ mfib_entry_attribute_t
MFIB_ITF_FLAG_FORWARD
@ MFIB_ITF_FLAG_FORWARD
Definition: mfib_types.h:153
MFIB_ENTRY_CONNECTED
@ MFIB_ENTRY_CONNECTED
The control plane needs to be informed of coneected sources.
Definition: mfib_types.h:65
unformat_mfib_entry_flags
uword unformat_mfib_entry_flags(unformat_input_t *input, va_list *args)
Definition: mfib_types.c:218
MFIB_ENTRY_ACCEPT_ALL_ITF
@ MFIB_ENTRY_ACCEPT_ALL_ITF
Accept packets from any incpoming interface Use with extreme caution.
Definition: mfib_types.h:70
proto
vl_api_ip_proto_t proto
Definition: acl_types.api:51
format_mfib_itf_flags
u8 * format_mfib_itf_flags(u8 *s, va_list *args)
Definition: mfib_types.c:181
MFIB_ENTRY_ATTRIBUTE_LAST
@ MFIB_ENTRY_ATTRIBUTE_LAST
Definition: mfib_types.h:79
MFIB_ENTRY_FLAG_CONNECTED
@ MFIB_ENTRY_FLAG_CONNECTED
Definition: mfib_types.h:110
MFIB_SOURCE_DHCP
@ MFIB_SOURCE_DHCP
Definition: mfib_types.h:168
MFIB_ITF_FLAG_NEGATE_SIGNAL
@ MFIB_ITF_FLAG_NEGATE_SIGNAL
Definition: mfib_types.h:151