aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/fib
diff options
context:
space:
mode:
authorJakub Grajciar <jgrajcia@cisco.com>2020-03-19 08:03:55 +0100
committerJakub Grajciar <jgrajcia@cisco.com>2020-03-19 12:49:55 +0100
commit7dd63e5cc1b48adc4f912778ba79d67c71f94b83 (patch)
tree8d923e3337cb7dc5666c135b4898ad6c5f7adced /src/vnet/fib
parentf14578972a21fe10cd3ff72aaaaea43da4d74d20 (diff)
ip: change ip API enums address_family and ip_proto size to u8
Type: fix Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com> Change-Id: I73d27520726543d6375caad76a841339f68c3533 Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
Diffstat (limited to 'src/vnet/fib')
-rw-r--r--src/vnet/fib/fib_api.c25
-rw-r--r--src/vnet/fib/fib_api.h5
2 files changed, 16 insertions, 14 deletions
diff --git a/src/vnet/fib/fib_api.c b/src/vnet/fib/fib_api.c
index 64e288761ed..d626ae24502 100644
--- a/src/vnet/fib/fib_api.c
+++ b/src/vnet/fib/fib_api.c
@@ -215,7 +215,7 @@ fib_api_path_decode (vl_api_fib_path_t *in,
break;
case FIB_API_PATH_TYPE_CLASSIFY:
out->frp_flags |= FIB_ROUTE_PATH_CLASSIFY;
-
+
if (pool_is_free_index (cm->tables, ntohl (in->nh.classify_table_index)))
{
return VNET_API_ERROR_NO_SUCH_TABLE;
@@ -537,34 +537,35 @@ format_vl_api_fib_path (u8 * s, va_list * args)
return (s);
}
-fib_protocol_t
-fib_proto_from_api_address_family (int af)
+int
+fib_proto_from_api_address_family (vl_api_address_family_t af, fib_protocol_t * out)
{
- switch (clib_net_to_host_u32 (af))
+ switch (af)
{
case ADDRESS_IP4:
- return (FIB_PROTOCOL_IP4);
+ *out = (FIB_PROTOCOL_IP4);
+ return (0);
case ADDRESS_IP6:
- return (FIB_PROTOCOL_IP6);
+ *out = (FIB_PROTOCOL_IP6);
+ return (0);
}
- ASSERT(0);
- return (FIB_PROTOCOL_IP4);
+ return (VNET_API_ERROR_INVALID_ADDRESS_FAMILY);
}
-int
+vl_api_address_family_t
fib_proto_to_api_address_family (fib_protocol_t fproto)
{
switch (fproto)
{
case FIB_PROTOCOL_IP4:
- return (clib_net_to_host_u32 (ADDRESS_IP4));
+ return (ADDRESS_IP4);
case FIB_PROTOCOL_IP6:
- return (clib_net_to_host_u32 (ADDRESS_IP6));
+ return (ADDRESS_IP6);
default:
break;
}
ASSERT(0);
- return (clib_net_to_host_u32 (ADDRESS_IP4));
+ return (ADDRESS_IP4);
}
diff --git a/src/vnet/fib/fib_api.h b/src/vnet/fib/fib_api.h
index 27335211df7..2492c899502 100644
--- a/src/vnet/fib/fib_api.h
+++ b/src/vnet/fib/fib_api.h
@@ -18,6 +18,7 @@
#include <vnet/fib/fib_types.h>
#include <vnet/fib/fib_entry.h>
+#include <vnet/ip/ip.api_types.h>
/**
* Forward declare the API type, no need to include the generated api headers
@@ -50,7 +51,7 @@ extern int fib_api_route_add_del (u8 is_add,
extern u8* format_vl_api_fib_path(u8 * s, va_list * args);
-extern fib_protocol_t fib_proto_from_api_address_family (int af);
-extern int fib_proto_to_api_address_family (fib_protocol_t fproto);
+extern int fib_proto_from_api_address_family (vl_api_address_family_t af, fib_protocol_t *out);
+extern vl_api_address_family_t fib_proto_to_api_address_family (fib_protocol_t fproto);
#endif /* __FIB_API_H__ */