diff options
author | Steven <sluong@cisco.com> | 2016-11-02 10:40:09 -0700 |
---|---|---|
committer | Neale Ranns <nranns@cisco.com> | 2016-11-15 08:13:26 +0000 |
commit | 01b071222d99bea31e2846e95963c475262dd114 (patch) | |
tree | c41f2fae6ae74285557c604fe110384ec419ab00 /vnet/vnet/fib/fib_path.c | |
parent | d4895d54158a409124e59304b1b523ec4c2adab7 (diff) |
Dump routes (VPP-500)
Change-Id: I86e7382395a8b6471a0deaf57163718d41b71b83
Signed-off-by: Steven <sluong@cisco.com>
Diffstat (limited to 'vnet/vnet/fib/fib_path.c')
-rw-r--r-- | vnet/vnet/fib/fib_path.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/vnet/vnet/fib/fib_path.c b/vnet/vnet/fib/fib_path.c index 9fe653dc8d0..98669317b92 100644 --- a/vnet/vnet/fib/fib_path.c +++ b/vnet/vnet/fib/fib_path.c @@ -1818,6 +1818,49 @@ fib_path_is_looped (fib_node_index_t path_index) return (path->fp_oper_flags & FIB_PATH_OPER_FLAG_RECURSIVE_LOOP); } +int +fib_path_encode (fib_node_index_t path_list_index, + fib_node_index_t path_index, + void *ctx) +{ + fib_route_path_encode_t **api_rpaths = ctx; + fib_route_path_encode_t *api_rpath; + fib_path_t *path; + + path = fib_path_get(path_index); + if (!path) + return (0); + vec_add2(*api_rpaths, api_rpath, 1); + api_rpath->rpath.frp_weight = path->fp_weight; + api_rpath->rpath.frp_proto = path->fp_nh_proto; + api_rpath->rpath.frp_sw_if_index = ~0; + api_rpath->dpo = path->exclusive.fp_ex_dpo; + switch (path->fp_type) + { + case FIB_PATH_TYPE_RECEIVE: + api_rpath->rpath.frp_addr = path->receive.fp_addr; + api_rpath->rpath.frp_sw_if_index = path->receive.fp_interface; + break; + case FIB_PATH_TYPE_ATTACHED: + api_rpath->rpath.frp_sw_if_index = path->attached.fp_interface; + break; + case FIB_PATH_TYPE_ATTACHED_NEXT_HOP: + api_rpath->rpath.frp_sw_if_index = path->attached_next_hop.fp_interface; + api_rpath->rpath.frp_addr = path->attached_next_hop.fp_nh; + break; + case FIB_PATH_TYPE_SPECIAL: + break; + case FIB_PATH_TYPE_DEAG: + break; + case FIB_PATH_TYPE_RECURSIVE: + api_rpath->rpath.frp_addr = path->recursive.fp_nh; + break; + default: + break; + } + return (1); +} + void fib_path_module_init (void) { |