Source VRF Select

match against a packet's source address to determine
the VRF for the subsequent destination address lookup.

Change-Id: I48ee0ef54dcb891f0ec7f879e4d3b925a0ed0081
Signed-off-by: Neale Ranns <nranns@cisco.com>
diff --git a/src/vnet/fib/fib_api.c b/src/vnet/fib/fib_api.c
index eca5e61..3c832eb 100644
--- a/src/vnet/fib/fib_api.c
+++ b/src/vnet/fib/fib_api.c
@@ -266,3 +266,34 @@
     }
 }
 
+fib_protocol_t
+fib_proto_from_api_address_family (int af)
+{
+    switch (clib_net_to_host_u32 (af))
+    {
+    case ADDRESS_IP4:
+        return (FIB_PROTOCOL_IP4);
+    case ADDRESS_IP6:
+        return (FIB_PROTOCOL_IP6);
+    }
+
+    ASSERT(0);
+    return (FIB_PROTOCOL_IP4);
+}
+
+int
+fib_proto_to_api_address_family (fib_protocol_t fproto)
+{
+    switch (fproto)
+    {
+    case FIB_PROTOCOL_IP4:
+        return (clib_net_to_host_u32 (ADDRESS_IP4));
+    case FIB_PROTOCOL_IP6:
+        return (clib_net_to_host_u32 (ADDRESS_IP6));
+    default:
+        break;
+    }
+
+    ASSERT(0);
+    return (clib_net_to_host_u32 (ADDRESS_IP4));
+}