summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorNick Zavaritsky <nick.zavaritsky@emnify.com>2020-03-05 17:24:37 +0000
committerDamjan Marion <dmarion@me.com>2020-03-21 12:13:36 +0000
commitdd73bd321e2718dd9afced36dad53bd624af4f32 (patch)
tree12da7a27342b80b70cf1e52327b6ef3649d5c898 /src/plugins
parent77a95cdce2f3d80dac2832b68310eb5b23769c0e (diff)
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 <nick.zavaritsky@emnify.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/gtpu/gtpu.c11
1 files 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 = &gtpu_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);