* The lower the value the higher the priority
*/
typedef enum fib_source_t_ {
+ /**
+ * An invalid source of value 0
+ */
+ FIB_SOURCE_INVALID,
/**
* Marker. Add new values after this one.
*/
* Classify. A route that links directly to a classify adj
*/
FIB_SOURCE_CLASSIFY,
+ /**
+ * A route the is being 'proxied' on behalf of another device
+ */
+ FIB_SOURCE_PROXY,
/**
* Route added as a result of interface configuration.
* this will also come from the API/CLI, but the distinction is
* that is from confiiguration on an interface, not a 'ip route' command
*/
FIB_SOURCE_INTERFACE,
+ /**
+ * SRv6 and SR-MPLS
+ */
+ FIB_SOURCE_SR,
/**
* A high priority source a plugin can use
*/
FIB_SOURCE_PLUGIN_HI,
+ /**
+ * From the BIER subsystem
+ */
+ FIB_SOURCE_BIER,
/**
* From the control plane API
*/
* LISP
*/
FIB_SOURCE_LISP,
- /**
- * SRv6
- */
- FIB_SOURCE_SR,
/**
* IPv[46] Mapping
*/
#define FIB_SOURCE_MAX (FIB_SOURCE_LAST+1)
#define FIB_SOURCES { \
+ [FIB_SOURCE_INVALID] = "invalid", \
[FIB_SOURCE_SPECIAL] = "special", \
[FIB_SOURCE_INTERFACE] = "interface", \
+ [FIB_SOURCE_PROXY] = "proxy", \
+ [FIB_SOURCE_BIER] = "BIER", \
[FIB_SOURCE_API] = "API", \
[FIB_SOURCE_CLI] = "CLI", \
[FIB_SOURCE_ADJ] = "adjacency", \
* The prefix/address is local to this device
*/
FIB_ENTRY_ATTRIBUTE_LOCAL,
+ /**
+ * The prefix/address is a multicast prefix.
+ * this aplies only to MPLS. IP multicast is handled by mfib
+ */
+ FIB_ENTRY_ATTRIBUTE_MULTICAST,
/**
* The prefix/address exempted from loose uRPF check
* To be used with caution
FIB_ENTRY_ATTRIBUTE_LAST = FIB_ENTRY_ATTRIBUTE_URPF_EXEMPT,
} fib_entry_attribute_t;
-/**
- * The maximum number of sources
- */
-#define FIB_ENTRY_ATTRIBUTE_MAX (FIB_ENTRY_ATTRIBUTE_LAST+1)
-
#define FIB_ENTRY_ATTRIBUTES { \
[FIB_ENTRY_ATTRIBUTE_CONNECTED] = "connected", \
[FIB_ENTRY_ATTRIBUTE_ATTACHED] = "attached", \
[FIB_ENTRY_ATTRIBUTE_DROP] = "drop", \
[FIB_ENTRY_ATTRIBUTE_EXCLUSIVE] = "exclusive", \
[FIB_ENTRY_ATTRIBUTE_LOCAL] = "local", \
- [FIB_ENTRY_ATTRIBUTE_URPF_EXEMPT] = "uRPF-exempt" \
+ [FIB_ENTRY_ATTRIBUTE_URPF_EXEMPT] = "uRPF-exempt", \
+ [FIB_ENTRY_ATTRIBUTE_MULTICAST] = "multicast", \
}
#define FOR_EACH_FIB_ATTRIBUTE(_item) \
for (_item = FIB_ENTRY_ATTRIBUTE_FIRST; \
- _item < FIB_ENTRY_ATTRIBUTE_MAX; \
+ _item <= FIB_ENTRY_ATTRIBUTE_LAST; \
_item++)
typedef enum fib_entry_flag_t_ {
FIB_ENTRY_FLAG_LOCAL = (1 << FIB_ENTRY_ATTRIBUTE_LOCAL),
FIB_ENTRY_FLAG_IMPORT = (1 << FIB_ENTRY_ATTRIBUTE_IMPORT),
FIB_ENTRY_FLAG_LOOSE_URPF_EXEMPT = (1 << FIB_ENTRY_ATTRIBUTE_URPF_EXEMPT),
+ FIB_ENTRY_FLAG_MULTICAST = (1 << FIB_ENTRY_ATTRIBUTE_MULTICAST),
} __attribute__((packed)) fib_entry_flag_t;
/**
/**
* A vector of path extensions
*/
- struct fib_path_ext_t_ *fes_path_exts;
+ fib_path_ext_list_t fes_path_exts;
/**
* The path-list created by the source
};
} fib_entry_src_t;
+/**
+ * FIB entry flags.
+ * these are stored in the pad space within the fib_node_t
+ */
+typedef enum fib_entry_node_attribute_t_
+{
+ /**
+ * FIB entry has multiple sources, so the fe_srcs union
+ * uses the vector
+ */
+ FIB_ENTRY_NODE_ATTR_MULTIPLE_SRCS,
+} fib_entry_node_attribute_t;
+
+#define FIB_ENTRY_NODE_FLAG_NAMES { \
+ [FIB_ENTRY_NODE_ATTR_MULTIPLE_SRCS] = "multiple-srcs", \
+}
+
+typedef enum fib_entry_node_flags_t_
+{
+ FIB_ENTRY_NODE_FLAG_MULTIPLE_SRCS = (1 << FIB_ENTRY_NODE_ATTR_MULTIPLE_SRCS),
+} fib_entry_node_flags_t;
+
+
/**
* An entry in a FIB table.
*
* paint the header straight on without the need to check the packet
* type to derive the EOS bit value.
*/
- dpo_id_t fe_lb; // [FIB_FORW_CHAIN_MPLS_NUM];
+ dpo_id_t fe_lb;
+
/**
- * Vector of source infos.
- * Most entries will only have 1 source. So we optimise for memory usage,
- * which is preferable since we have many entries.
+ * Source info.
+ * in the majority of cases a FIB entry will have only one source.
+ * so to save the extra memory allocation of the source's vector, we
+ * store space for one source inline. When two sources are present,
+ * we burn extra memory.
+ * The union is switched based on the FIB_ENTRY_NODE_FLAG_MULTIPLE_SRCS
*/
- fib_entry_src_t *fe_srcs;
+ union {
+ fib_entry_src_t *fe_srcs;
+ fib_entry_src_t fe_src;
+ } fe_u_src;
+
/**
* the path-list for which this entry is a child. This is also the path-list
* that is contributing forwarding for this entry.
#define FIB_ENTRY_FORMAT_DETAIL2 (0x2)
extern u8 *format_fib_entry (u8 * s, va_list * args);
+extern u8 *format_fib_source (u8 * s, va_list * args);
extern fib_node_index_t fib_entry_create_special(u32 fib_index,
const fib_prefix_t *prefix,
fib_source_t source);
extern fib_node_index_t fib_entry_get_path_list(fib_node_index_t fib_entry_index);
+extern int fib_entry_is_resolved(fib_node_index_t fib_entry_index);
+extern void fib_entry_set_flow_hash_config(fib_node_index_t fib_entry_index,
+ flow_hash_config_t hash_config);
extern void fib_entry_module_init(void);