diff options
author | John Lo <loj@cisco.com> | 2018-01-12 17:15:25 -0500 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2018-01-13 15:24:15 +0000 |
commit | 4478d8edc35757c1da66e1c3c108af24940fbdd3 (patch) | |
tree | 52386c505384f9f3ee1a4de1dd224dcbf5459465 /src/vnet/gre | |
parent | af0ff5af0cd471033169e63c6111d23cd801928c (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/gre')
-rw-r--r-- | src/vnet/gre/interface.c | 30 |
1 files changed, 7 insertions, 23 deletions
diff --git a/src/vnet/gre/interface.c b/src/vnet/gre/interface.c index 8b1ad6b7dbe..ce9685d55a3 100644 --- a/src/vnet/gre/interface.c +++ b/src/vnet/gre/interface.c @@ -28,34 +28,18 @@ static const char *gre_tunnel_type_names[] = GRE_TUNNEL_TYPE_NAMES; static u8 * -format_gre_tunnel_type (u8 * s, va_list * args) -{ - gre_tunnel_type_t type = va_arg (*args, gre_tunnel_type_t); - - return (format (s, "%s", gre_tunnel_type_names[type])); -} - -static u8 * format_gre_tunnel (u8 * s, va_list * args) { gre_tunnel_t *t = va_arg (*args, gre_tunnel_t *); gre_main_t *gm = &gre_main; - u8 is_ipv6 = t->tunnel_dst.fp_proto == FIB_PROTOCOL_IP6 ? 1 : 0; - if (!is_ipv6) - s = format (s, - "[%d] %U (src) %U (dst) payload %U outer_fib_index %d", - t - gm->tunnels, - format_ip4_address, &t->tunnel_src.ip4, - format_ip4_address, &t->tunnel_dst.fp_addr.ip4, - format_gre_tunnel_type, t->type, t->outer_fib_index); - else - s = format (s, - "[%d] %U (src) %U (dst) payload %U outer_fib_index %d", - t - gm->tunnels, - format_ip6_address, &t->tunnel_src.ip6, - format_ip6_address, &t->tunnel_dst.fp_addr.ip6, - format_gre_tunnel_type, t->type, t->outer_fib_index); + s = format (s, "[%d] src %U dst %U fib-idx %d sw-if-idx %d ", + t - gm->tunnels, + format_ip46_address, &t->tunnel_src, IP46_TYPE_ANY, + format_ip46_address, &t->tunnel_dst.fp_addr, IP46_TYPE_ANY, + t->outer_fib_index, t->sw_if_index); + + s = format (s, "payload %s", gre_tunnel_type_names[t->type]); return s; } |