diff options
author | Neale Ranns <nranns@cisco.com> | 2020-10-20 07:20:17 +0000 |
---|---|---|
committer | Ole Tr�an <otroan@employees.org> | 2020-10-21 14:22:59 +0000 |
commit | 990f69450781f1110056738707e3fed565262554 (patch) | |
tree | 1566100be2de81611d4d2dd6a29125f11e79dff8 /src/vnet | |
parent | ec112e5a9eb708c1ee85faf569fef6fa40178294 (diff) |
ip: convert u32 entry_flags to vl_api_mfib_entry_flags_t on mroute API
Type: fix
This is not an API change, it's the same values, just a different named
type.
also use VppEnum values in tests
Signed-off-by: Neale Ranns <nranns@cisco.com>
Change-Id: I3a18b529514f3cc9467ae4e8ac3e88d067fc776b
Diffstat (limited to 'src/vnet')
-rw-r--r-- | src/vnet/fib/fib_api.h | 4 | ||||
-rw-r--r-- | src/vnet/ip/ip.api | 2 | ||||
-rw-r--r-- | src/vnet/ip/ip_api.c | 4 | ||||
-rw-r--r-- | src/vnet/mfib/mfib_api.c | 20 | ||||
-rw-r--r-- | src/vnet/mfib/mfib_api.h | 7 | ||||
-rw-r--r-- | src/vnet/mfib/mfib_types.api | 9 |
6 files changed, 40 insertions, 6 deletions
diff --git a/src/vnet/fib/fib_api.h b/src/vnet/fib/fib_api.h index 2492c899502..caa993b78d0 100644 --- a/src/vnet/fib/fib_api.h +++ b/src/vnet/fib/fib_api.h @@ -30,8 +30,8 @@ struct _vl_api_fib_prefix; * Encode and decode functions from the API types to internal types */ extern void fib_api_path_encode(const fib_route_path_t * api_rpath, - struct _vl_api_fib_path *out); -extern int fib_api_path_decode(struct _vl_api_fib_path *in, + vl_api_fib_path_t *out); +extern int fib_api_path_decode(vl_api_fib_path_t *in, fib_route_path_t *out); extern int fib_api_table_id_decode(fib_protocol_t fproto, diff --git a/src/vnet/ip/ip.api b/src/vnet/ip/ip.api index 42371c492ac..7ac9de783bb 100644 --- a/src/vnet/ip/ip.api +++ b/src/vnet/ip/ip.api @@ -304,7 +304,7 @@ define ip_mtable_details typedef ip_mroute { u32 table_id; - u32 entry_flags; + vl_api_mfib_entry_flags_t entry_flags; u32 rpf_id; vl_api_mprefix_t prefix; u8 n_paths; diff --git a/src/vnet/ip/ip_api.c b/src/vnet/ip/ip_api.c index 3f593c6d3ce..448b36c6acc 100644 --- a/src/vnet/ip/ip_api.c +++ b/src/vnet/ip/ip_api.c @@ -745,6 +745,7 @@ api_mroute_add_del_t_handler (vl_api_ip_mroute_add_del_t * mp, { fib_route_path_t *rpath, *rpaths = NULL; fib_node_index_t mfib_entry_index; + mfib_entry_flags_t eflags; mfib_prefix_t pfx; u32 fib_index; int rv; @@ -769,10 +770,11 @@ api_mroute_add_del_t_handler (vl_api_ip_mroute_add_del_t * mp, goto out; } + eflags = mfib_api_path_entry_flags_decode (mp->route.entry_flags); mfib_entry_index = mroute_add_del_handler (mp->is_add, mp->is_add, fib_index, &pfx, - ntohl (mp->route.entry_flags), + eflags, ntohl (mp->route.rpf_id), rpaths); diff --git a/src/vnet/mfib/mfib_api.c b/src/vnet/mfib/mfib_api.c index 1066a9d3b62..4743d889aef 100644 --- a/src/vnet/mfib/mfib_api.c +++ b/src/vnet/mfib/mfib_api.c @@ -92,6 +92,26 @@ mfib_api_path_itf_flags_decode (vl_api_mfib_itf_flags_t in, *out |= MFIB_ITF_FLAG_DONT_PRESERVE; } +mfib_entry_flags_t +mfib_api_path_entry_flags_decode (vl_api_mfib_entry_flags_t in) +{ + mfib_entry_flags_t out; + + out = MFIB_ENTRY_FLAG_NONE; + in = clib_net_to_host_u32(in); + + if (in & MFIB_API_ENTRY_FLAG_SIGNAL) + out |= MFIB_ENTRY_FLAG_SIGNAL; + if (in & MFIB_API_ENTRY_FLAG_DROP) + out |= MFIB_ENTRY_FLAG_DROP; + if (in & MFIB_API_ENTRY_FLAG_CONNECTED) + out |= MFIB_ENTRY_FLAG_CONNECTED; + if (in & MFIB_API_ENTRY_FLAG_ACCEPT_ALL_ITF) + out |= MFIB_ENTRY_FLAG_ACCEPT_ALL_ITF; + + return (out); +} + int mfib_api_path_decode (vl_api_mfib_path_t *in, fib_route_path_t *out) diff --git a/src/vnet/mfib/mfib_api.h b/src/vnet/mfib/mfib_api.h index f9c0a74bedb..dc802b6ed15 100644 --- a/src/vnet/mfib/mfib_api.h +++ b/src/vnet/mfib/mfib_api.h @@ -17,6 +17,7 @@ #define __MFIB_API_H__ #include <vnet/mfib/mfib_types.h> +#include <vnet/ip/ip.api_types.h> /** * Forward declare the API type, no need to include the generated api headers @@ -27,10 +28,12 @@ struct _vl_api_mfib_path; * Encode and decode functions from the API types to internal types */ extern void mfib_api_path_encode(const fib_route_path_t *in, - struct _vl_api_mfib_path *out); -extern int mfib_api_path_decode(struct _vl_api_mfib_path *in, + vl_api_mfib_path_t *out); +extern int mfib_api_path_decode(vl_api_mfib_path_t *in, fib_route_path_t *out); +extern mfib_entry_flags_t mfib_api_path_entry_flags_decode (vl_api_mfib_entry_flags_t in); + extern int mfib_api_table_id_decode(fib_protocol_t fproto, u32 table_id, u32 *fib_index); diff --git a/src/vnet/mfib/mfib_types.api b/src/vnet/mfib/mfib_types.api index 118230680d1..515b6de36e3 100644 --- a/src/vnet/mfib/mfib_types.api +++ b/src/vnet/mfib/mfib_types.api @@ -16,6 +16,15 @@ import "vnet/fib/fib_types.api"; import "vnet/ip/ip_types.api"; +enum mfib_entry_flags +{ + MFIB_API_ENTRY_FLAG_NONE = 0, + MFIB_API_ENTRY_FLAG_SIGNAL = 0x1, + MFIB_API_ENTRY_FLAG_DROP = 0x2, + MFIB_API_ENTRY_FLAG_CONNECTED = 0x4, + MFIB_API_ENTRY_FLAG_ACCEPT_ALL_ITF = 0x8, +}; + enum mfib_itf_flags { MFIB_API_ITF_FLAG_NONE = 0, |