diff options
author | Jon Loeliger <jdl@netgate.com> | 2018-02-01 11:19:29 -0600 |
---|---|---|
committer | Neale Ranns <nranns@cisco.com> | 2018-02-01 19:23:49 +0000 |
commit | 735f8793bf3e8ad37c7e608663283b7d89b7101d (patch) | |
tree | c2ab3c258d0968fc46b173605f756422c9d730aa /src/vnet/fib | |
parent | 5c42f50d2da0c1f32440d149abe246ad6498d273 (diff) |
FIB: Consolidate several copies of fib_ip_proto() into one.
Rather than having multiple copies of the same function
scattered around, promote the function into the FIB
PROTOCOL definitions in fib_types.h.
Change-Id: I11c4d85931167d3a5f3dc1278afecc8845b23cd7
Signed-off-by: Jon Loeliger <jdl@netgate.com>
Diffstat (limited to 'src/vnet/fib')
-rw-r--r-- | src/vnet/fib/fib_types.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/vnet/fib/fib_types.h b/src/vnet/fib/fib_types.h index e3aef7a58df..75ed7799f12 100644 --- a/src/vnet/fib/fib_types.h +++ b/src/vnet/fib/fib_types.h @@ -16,6 +16,7 @@ #ifndef __FIB_TYPES_H__ #define __FIB_TYPES_H__ +#include <stdbool.h> #include <vlib/vlib.h> #include <vnet/ip/ip6_packet.h> #include <vnet/mpls/packet.h> @@ -72,6 +73,16 @@ typedef enum fib_protocol_t_ { _item++) /** + * @brief Convert from boolean is_ip6 to FIB protocol. + * Drop MPLS on the floor in favor of IPv4. + */ +static inline fib_protocol_t +fib_ip_proto(bool is_ip6) +{ + return (is_ip6) ? FIB_PROTOCOL_IP6 : FIB_PROTOCOL_IP4; +} + +/** * @brief Convert from a protocol to a link type */ vnet_link_t fib_proto_to_link (fib_protocol_t proto); |