From dd73bd321e2718dd9afced36dad53bd624af4f32 Mon Sep 17 00:00:00 2001 From: Nick Zavaritsky Date: Thu, 5 Mar 2020 17:24:37 +0000 Subject: [PATCH] gtpu: encap-vrf-id in show gtpu tunnels command Show encap-vrf-id instead of fib-idx. When a tunnel is created, you specify encap-vrf-id, hence it makes sense for the show command to present it the same way. Fib index, on the other hand, is the internal artifact of how IP tables are managed; showing it isn't helpful. Type: improvement Change-Id: I8d1713d6727dd8685d6c10c07f421c18edafa6e0 Signed-off-by: Nick Zavaritsky --- src/plugins/gtpu/gtpu.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/plugins/gtpu/gtpu.c b/src/plugins/gtpu/gtpu.c index baa4d2481e2..7aa374ff66a 100644 --- a/src/plugins/gtpu/gtpu.c +++ b/src/plugins/gtpu/gtpu.c @@ -87,12 +87,19 @@ format_gtpu_tunnel (u8 * s, va_list * args) { gtpu_tunnel_t *t = va_arg (*args, gtpu_tunnel_t *); gtpu_main_t *ngm = >pu_main; + ip4_main_t *im4 = &ip4_main; + ip6_main_t *im6 = &ip6_main; + u8 is_ipv6 = !ip46_address_is_ip4 (&t->dst); - s = format (s, "[%d] src %U dst %U teid %d fib-idx %d sw-if-idx %d ", + u32 encap_vrf_id = + is_ipv6 ? im6->fibs[t->encap_fib_index].ft_table_id : + im4->fibs[t->encap_fib_index].ft_table_id; + + s = format (s, "[%d] src %U dst %U teid %d encap-vrf-id %d sw-if-idx %d ", t - ngm->tunnels, format_ip46_address, &t->src, IP46_TYPE_ANY, format_ip46_address, &t->dst, IP46_TYPE_ANY, - t->teid, t->encap_fib_index, t->sw_if_index); + t->teid, encap_vrf_id, t->sw_if_index); s = format (s, "encap-dpo-idx %d ", t->next_dpo.dpoi_index); s = format (s, "decap-next-%U ", format_decap_next, t->decap_next_index); -- 2.16.6