summaryrefslogtreecommitdiffstats
path: root/src/vnet/vxlan-gpe/vxlan_gpe.c
diff options
context:
space:
mode:
authorJohn Lo <loj@cisco.com>2018-01-12 17:15:25 -0500
committerDave Barach <openvpp@barachs.net>2018-01-13 15:24:15 +0000
commit4478d8edc35757c1da66e1c3c108af24940fbdd3 (patch)
tree52386c505384f9f3ee1a4de1dd224dcbf5459465 /src/vnet/vxlan-gpe/vxlan_gpe.c
parentaf0ff5af0cd471033169e63c6111d23cd801928c (diff)
Improve "show xxx tunnel" and "show int addr" output
Improve "show xxx tunnel" output functions format_xxx_tunnel() for GRE, VXLAN, VXLAN-GPE, GENEVE and GTPU tunnels to make their output more consistent and provide better information. Improved the output of "show int addr" to make its info more consistent with tunnels and provide fib-index info. Change-Id: Icd4b5b85a5bec417f8ee19afea336c770ad3b4c5 Signed-off-by: John Lo <loj@cisco.com>
Diffstat (limited to 'src/vnet/vxlan-gpe/vxlan_gpe.c')
-rw-r--r--src/vnet/vxlan-gpe/vxlan_gpe.c67
1 files changed, 39 insertions, 28 deletions
diff --git a/src/vnet/vxlan-gpe/vxlan_gpe.c b/src/vnet/vxlan-gpe/vxlan_gpe.c
index b0c6a682ef7..918a982d70d 100644
--- a/src/vnet/vxlan-gpe/vxlan_gpe.c
+++ b/src/vnet/vxlan-gpe/vxlan_gpe.c
@@ -44,51 +44,62 @@
vxlan_gpe_main_t vxlan_gpe_main;
-/**
- * @brief Tracing function for VXLAN GPE tunnel packets
- *
- * @param *s formatting string
- * @param *args
- *
- * @return *s formatted string
- *
- */
-u8 *
-format_vxlan_gpe_tunnel (u8 * s, va_list * args)
+static u8 *
+format_decap_next (u8 * s, va_list * args)
{
vxlan_gpe_tunnel_t *t = va_arg (*args, vxlan_gpe_tunnel_t *);
- vxlan_gpe_main_t *ngm = &vxlan_gpe_main;
-
- s = format (s, "[%d] local: %U remote: %U ",
- t - ngm->tunnels,
- format_ip46_address, &t->local, IP46_TYPE_ANY,
- format_ip46_address, &t->remote, IP46_TYPE_ANY);
-
- s = format (s, " vxlan VNI %d ", t->vni);
switch (t->protocol)
{
case VXLAN_GPE_PROTOCOL_IP4:
- s = format (s, "next-protocol ip4");
+ s = format (s, "protocol ip4 fib-idx %d", t->decap_fib_index);
break;
case VXLAN_GPE_PROTOCOL_IP6:
- s = format (s, "next-protocol ip6");
+ s = format (s, "protocol ip6 fib-idx %d", t->decap_fib_index);
break;
case VXLAN_GPE_PROTOCOL_ETHERNET:
- s = format (s, "next-protocol ethernet");
+ s = format (s, "protocol ethernet");
break;
case VXLAN_GPE_PROTOCOL_NSH:
- s = format (s, "next-protocol nsh");
+ s = format (s, "protocol nsh");
break;
default:
- s = format (s, "next-protocol unknown %d", t->protocol);
+ s = format (s, "protocol unknown %d", t->protocol);
}
- if (ip46_address_is_multicast (&t->remote))
- s = format (s, "mcast_sw_if_index %d ", t->mcast_sw_if_index);
+ return s;
+}
+
+/**
+ * @brief Format function for VXLAN GPE tunnel
+ *
+ * @param *s formatting string
+ * @param *args
+ *
+ * @return *s formatted string
+ *
+ */
+u8 *
+format_vxlan_gpe_tunnel (u8 * s, va_list * args)
+{
+ vxlan_gpe_tunnel_t *t = va_arg (*args, vxlan_gpe_tunnel_t *);
+ vxlan_gpe_main_t *ngm = &vxlan_gpe_main;
- s = format (s, " fibs: (encap %d, decap %d)",
- t->encap_fib_index, t->decap_fib_index);
+ s = format (s, "[%d] lcl %U rmt %U vni %d fib-idx %d sw-if-idx %d ",
+ t - ngm->tunnels,
+ format_ip46_address, &t->local, IP46_TYPE_ANY,
+ format_ip46_address, &t->remote, IP46_TYPE_ANY,
+ t->vni, t->encap_fib_index, t->sw_if_index);
+
+#if 0
+ /* next_dpo not yet used by vxlan-gpe-encap node */
+ s = format (s, "encap-dpo-idx %d ", t->next_dpo.dpoi_index);
+ */
+#endif
+ s = format (s, "decap-next-%U ", format_decap_next, t);
+
+ if (PREDICT_FALSE (ip46_address_is_multicast (&t->remote)))
+ s = format (s, "mcast-sw-if-idx %d ", t->mcast_sw_if_index);
return s;
}