diff options
author | Neale Ranns <nranns@cisco.com> | 2018-12-20 03:01:49 -0800 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2018-12-20 15:00:30 +0000 |
commit | 775f73c6baaf9bc2283e7ab9752c81984823be99 (patch) | |
tree | 7c2496d34a590fae15f917f9e51867fa14aafec5 /src/vnet/fib/fib_api.c | |
parent | a3aaa61e2f2fd81f9653cb678b38519e96e6c6cd (diff) |
FIB: encode the label stack in the FIB path during table dump
Change-Id: I28e8a99b980ad343a4209e673201791b91ceab4e
Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/vnet/fib/fib_api.c')
-rw-r--r-- | src/vnet/fib/fib_api.c | 58 |
1 files changed, 52 insertions, 6 deletions
diff --git a/src/vnet/fib/fib_api.c b/src/vnet/fib/fib_api.c index d46b9e23b04..98f92c3e73f 100644 --- a/src/vnet/fib/fib_api.c +++ b/src/vnet/fib/fib_api.c @@ -17,6 +17,7 @@ #include <vlibmemory/api.h> #include <vnet/fib/fib_api.h> #include <vnet/fib/fib_table.h> +#include <vnet/mfib/mfib_table.h> #include <vnet/bier/bier_disp_table.h> #include <vnet/dpo/ip_null_dpo.h> @@ -207,6 +208,8 @@ void fib_api_path_encode (const fib_route_path_encode_t * api_rpath, vl_api_fib_path_t *out) { + int ii; + clib_memset (out, 0, sizeof (*out)); switch (api_rpath->dpo.dpoi_type) { @@ -246,12 +249,20 @@ fib_api_path_encode (const fib_route_path_encode_t * api_rpath, if ((DPO_PROTO_IP6 == api_rpath->rpath.frp_proto) || (DPO_PROTO_IP4 == api_rpath->rpath.frp_proto)) { - fib_table_t *fib; - - fib = fib_table_get (api_rpath->rpath.frp_fib_index, - dpo_proto_to_fib(api_rpath->rpath.frp_proto)); - - out->table_id = htonl (fib->ft_table_id); + if (api_rpath->rpath.frp_flags & FIB_ROUTE_PATH_RPF_ID) + { + out->table_id = + htonl(mfib_table_get_table_id( + api_rpath->rpath.frp_fib_index, + dpo_proto_to_fib(api_rpath->rpath.frp_proto))); + } + else + { + out->table_id = + htonl(fib_table_get_table_id( + api_rpath->rpath.frp_fib_index, + dpo_proto_to_fib(api_rpath->rpath.frp_proto))); + } } } @@ -264,6 +275,41 @@ fib_api_path_encode (const fib_route_path_encode_t * api_rpath, out->is_udp_encap = 1; out->next_hop_id = api_rpath->rpath.frp_udp_encap_id; } + if (api_rpath->rpath.frp_flags & FIB_ROUTE_PATH_INTF_RX) + { + out->is_interface_rx = 1; + } + if (api_rpath->rpath.frp_flags & FIB_ROUTE_PATH_LOCAL) + { + out->is_local = 1; + } + if (api_rpath->rpath.frp_flags & FIB_ROUTE_PATH_RESOLVE_VIA_HOST) + { + out->is_resolve_host = 1; + } + if (api_rpath->rpath.frp_flags & FIB_ROUTE_PATH_RESOLVE_VIA_ATTACHED) + { + out->is_resolve_attached = 1; + } + /* if (api_rpath->rpath.frp_flags & FIB_ROUTE_PATH_ATTACHED) { */ + /* out->is_attached = 1; */ + /* } */ + /* if (api_rpath->rpath.frp_flags & FIB_ROUTE_PATH_CONNECTED) { */ + /* out->is_connected = 1; */ + /* } */ + if (api_rpath->rpath.frp_label_stack) + { + for (ii = 0; ii < vec_len(api_rpath->rpath.frp_label_stack); ii++) + { + out->label_stack[ii].label = + htonl(api_rpath->rpath.frp_label_stack[ii].fml_value); + out->label_stack[ii].ttl = + api_rpath->rpath.frp_label_stack[ii].fml_ttl; + out->label_stack[ii].exp = + api_rpath->rpath.frp_label_stack[ii].fml_exp; + } + out->n_labels = ii; + } } fib_protocol_t |