summaryrefslogtreecommitdiffstats
path: root/src/vnet/fib
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2018-08-08 01:06:40 -0700
committerOle Trøan <otroan@employees.org>2018-08-10 08:26:00 +0000
commitd0df49f26eabf2f534b567f3370e50c4e804aeea (patch)
treeeea014e723f00b4e00e57937fc5f6e043e2162f9 /src/vnet/fib
parent404d88edce63a635b58ba54d21d91735ff933584 (diff)
Use IP address types on UDP encap API
Change-Id: I3c714c519b6d0009329b50947ce250c18ee2a85a Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/vnet/fib')
-rw-r--r--src/vnet/fib/fib_types.c34
-rw-r--r--src/vnet/fib/fib_types.h10
2 files changed, 44 insertions, 0 deletions
diff --git a/src/vnet/fib/fib_types.c b/src/vnet/fib/fib_types.c
index 1046e45b2f7..542cf1d7faf 100644
--- a/src/vnet/fib/fib_types.c
+++ b/src/vnet/fib/fib_types.c
@@ -282,6 +282,40 @@ fib_proto_to_link (fib_protocol_t proto)
return (0);
}
+ip46_type_t
+fib_proto_to_ip46 (fib_protocol_t fproto)
+{
+ switch (fproto)
+ {
+ case FIB_PROTOCOL_IP4:
+ return (IP46_TYPE_IP4);
+ case FIB_PROTOCOL_IP6:
+ return (IP46_TYPE_IP6);
+ case FIB_PROTOCOL_MPLS:
+ return (IP46_TYPE_ANY);
+ }
+ ASSERT(0);
+ return (IP46_TYPE_ANY);
+}
+
+fib_protocol_t
+fib_proto_from_ip46 (ip46_type_t iproto)
+{
+ switch (iproto)
+ {
+ case IP46_TYPE_IP4:
+ return FIB_PROTOCOL_IP4;
+ case IP46_TYPE_IP6:
+ return FIB_PROTOCOL_IP6;
+ case IP46_TYPE_ANY:
+ ASSERT(0);
+ return FIB_PROTOCOL_IP4;
+ }
+
+ ASSERT(0);
+ return FIB_PROTOCOL_IP4;
+}
+
fib_forward_chain_type_t
fib_forw_chain_type_from_dpo_proto (dpo_proto_t proto)
{
diff --git a/src/vnet/fib/fib_types.h b/src/vnet/fib/fib_types.h
index 7f186ac6f6a..805f8e1b964 100644
--- a/src/vnet/fib/fib_types.h
+++ b/src/vnet/fib/fib_types.h
@@ -83,6 +83,16 @@ fib_ip_proto(bool is_ip6)
}
/**
+ * @brief Convert from fib_protocol to ip46_type
+ */
+extern ip46_type_t fib_proto_to_ip46(fib_protocol_t fproto);
+
+/**
+ * @brief Convert from ip46_type to fib_protocol
+ */
+extern fib_protocol_t fib_proto_from_ip46(ip46_type_t iproto);
+
+/**
* @brief Convert from a protocol to a link type
*/
vnet_link_t fib_proto_to_link (fib_protocol_t proto);