diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/plugins/gtpu/gtpu.c | 14 | ||||
-rw-r--r-- | src/vnet/geneve/geneve.c | 14 | ||||
-rw-r--r-- | src/vnet/gre/interface.c | 30 | ||||
-rw-r--r-- | src/vnet/interface_cli.c | 110 | ||||
-rw-r--r-- | src/vnet/vxlan-gpe/vxlan_gpe.c | 67 | ||||
-rw-r--r-- | src/vnet/vxlan/vxlan.c | 29 |
6 files changed, 118 insertions, 146 deletions
diff --git a/src/plugins/gtpu/gtpu.c b/src/plugins/gtpu/gtpu.c index 80069a77b09..96399f38579 100755 --- a/src/plugins/gtpu/gtpu.c +++ b/src/plugins/gtpu/gtpu.c @@ -75,18 +75,18 @@ format_gtpu_tunnel (u8 * s, va_list * args) gtpu_tunnel_t *t = va_arg (*args, gtpu_tunnel_t *); gtpu_main_t *ngm = >pu_main; - s = format (s, "[%d] src %U dst %U teid %d sw_if_index %d ", + s = format (s, "[%d] src %U dst %U teid %d fib-idx %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->sw_if_index); + t->teid, t->encap_fib_index, t->sw_if_index); - if (ip46_address_is_multicast (&t->dst)) - s = format (s, "mcast_sw_if_index %d ", t->mcast_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); + + if (PREDICT_FALSE (ip46_address_is_multicast (&t->dst))) + s = format (s, "mcast-sw-if-idx %d ", t->mcast_sw_if_index); - s = format (s, "encap_fib_index %d fib_entry_index %d decap_next %U\n", - t->encap_fib_index, t->fib_entry_index, - format_decap_next, t->decap_next_index); return s; } diff --git a/src/vnet/geneve/geneve.c b/src/vnet/geneve/geneve.c index 56db5ee775e..6bc4b67d10d 100644 --- a/src/vnet/geneve/geneve.c +++ b/src/vnet/geneve/geneve.c @@ -60,18 +60,18 @@ format_geneve_tunnel (u8 * s, va_list * args) geneve_tunnel_t *t = va_arg (*args, geneve_tunnel_t *); geneve_main_t *ngm = &geneve_main; - s = format (s, "[%d] local %U remote %U vni %d sw_if_index %d ", + 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->sw_if_index); + t->vni, t->encap_fib_index, t->sw_if_index); - if (ip46_address_is_multicast (&t->remote)) - s = format (s, "mcast_sw_if_index %d ", t->mcast_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); + + if (PREDICT_FALSE (ip46_address_is_multicast (&t->remote))) + s = format (s, "mcast-sw-if-idx %d ", t->mcast_sw_if_index); - s = format (s, "encap_fib_index %d fib_entry_index %d decap_next %U\n", - t->encap_fib_index, t->fib_entry_index, - format_decap_next, t->decap_next_index); return s; } 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; } diff --git a/src/vnet/interface_cli.c b/src/vnet/interface_cli.c index 0debdb4d0b7..5509e3ffa57 100644 --- a/src/vnet/interface_cli.c +++ b/src/vnet/interface_cli.c @@ -365,11 +365,7 @@ show_sw_interfaces (vlib_main_t * vm, ip_lookup_main_t *lm4 = &im4->lookup_main; ip_lookup_main_t *lm6 = &im6->lookup_main; ip_interface_address_t *ia = 0; - ip4_address_t *r4; - ip6_address_t *r6; u32 fib_index4 = 0, fib_index6 = 0; - ip4_fib_t *fib4; - ip6_fib_t *fib6; if (vec_len (im4->fib_index_by_sw_if_index) > si->sw_if_index) fib_index4 = vec_elt (im4->fib_index_by_sw_if_index, @@ -379,85 +375,69 @@ show_sw_interfaces (vlib_main_t * vm, fib_index6 = vec_elt (im6->fib_index_by_sw_if_index, si->sw_if_index); - fib4 = ip4_fib_get (fib_index4); - fib6 = ip6_fib_get (fib_index6); + ip4_fib_t *fib4 = ip4_fib_get (fib_index4); + ip6_fib_t *fib6 = ip6_fib_get (fib_index6); if (si->flags & VNET_SW_INTERFACE_FLAG_UNNUMBERED) vlib_cli_output (vm, "%U (%s): \n unnumbered, use %U", - format_vnet_sw_if_index_name, - vnm, si->sw_if_index, + format_vnet_sw_if_index_name, vnm, si->sw_if_index, (si->flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP) ? "up" : "dn", format_vnet_sw_if_index_name, vnm, si->unnumbered_sw_if_index); - else - { - vlib_cli_output (vm, "%U (%s):", - format_vnet_sw_if_index_name, - vnm, si->sw_if_index, - (si->flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP) - ? "up" : "dn"); - } + vlib_cli_output + (vm, "%U (%s):", + format_vnet_sw_if_index_name, vnm, si->sw_if_index, + (si->flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP) ? "up" : "dn"); /* Display any L2 info */ l2_input_config_t *l2_input = l2input_intf_config (si->sw_if_index); if (l2_input->bridge) { + bd_main_t *bdm = &bd_main; u32 bd_id = l2input_main.bd_configs[l2_input->bd_index].bd_id; - vlib_cli_output (vm, " l2 bridge bd_id %d%s%d", bd_id, - l2_input->bvi ? " bvi shg " : " shg ", - l2_input->shg); + vlib_cli_output (vm, " L2 bridge bd-id %d idx %d shg %d %s", + bd_id, bd_find_index (bdm, bd_id), l2_input->shg, + l2_input->bvi ? "bvi" : " "); } else if (l2_input->xconnect) - { - vlib_cli_output (vm, " l2 xconnect %U", - format_vnet_sw_if_index_name, - vnm, l2_input->output_sw_if_index); - } + vlib_cli_output (vm, " L2 xconnect %U", + format_vnet_sw_if_index_name, vnm, + l2_input->output_sw_if_index); + /* *INDENT-OFF* */ /* Display any IP4 addressing info */ - /* *INDENT-OFF* */ - foreach_ip_interface_address (lm4, ia, si->sw_if_index, - 1 /* honor unnumbered */, - ({ - r4 = ip_interface_address_get_address (lm4, ia); - if (fib4->table_id) - { - vlib_cli_output (vm, " %U/%d table %d", - format_ip4_address, r4, - ia->address_length, - fib4->table_id); - } - else - { - vlib_cli_output (vm, " %U/%d", - format_ip4_address, r4, - ia->address_length); - } - })); - /* *INDENT-ON* */ - + foreach_ip_interface_address (lm4, ia, si->sw_if_index, + 1 /* honor unnumbered */, + ({ + ip4_address_t *r4 = ip_interface_address_get_address (lm4, ia); + if (fib4->table_id) + vlib_cli_output (vm, " L3 %U/%d ip4 table-id %d fib-idx %d", + format_ip4_address, r4, ia->address_length, + fib4->table_id, + ip4_fib_index_from_table_id (fib4->table_id)); + else + vlib_cli_output (vm, " L3 %U/%d", + format_ip4_address, r4, ia->address_length); + })); + /* *INDENT-ON* */ + + /* *INDENT-OFF* */ /* Display any IP6 addressing info */ - /* *INDENT-OFF* */ - foreach_ip_interface_address (lm6, ia, si->sw_if_index, - 1 /* honor unnumbered */, - ({ - r6 = ip_interface_address_get_address (lm6, ia); - if (fib6->table_id) - { - vlib_cli_output (vm, " %U/%d table %d", - format_ip6_address, r6, - ia->address_length, - fib6->table_id); - } - else - { - vlib_cli_output (vm, " %U/%d", - format_ip6_address, r6, - ia->address_length); - } - })); - /* *INDENT-ON* */ + foreach_ip_interface_address (lm6, ia, si->sw_if_index, + 1 /* honor unnumbered */, + ({ + ip6_address_t *r6 = ip_interface_address_get_address (lm6, ia); + if (fib6->table_id) + vlib_cli_output (vm, " L3 %U/%d ip6 table-id %d fib-idx %d", + format_ip6_address, r6, ia->address_length, + fib6->table_id, + ip6_fib_index_from_table_id (fib6->table_id)); + else + vlib_cli_output (vm, " L3 %U/%d", + format_ip6_address, r6, ia->address_length); + })); + /* *INDENT-ON* */ } } else 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; } diff --git a/src/vnet/vxlan/vxlan.c b/src/vnet/vxlan/vxlan.c index 5926062b8c6..edd8733741b 100644 --- a/src/vnet/vxlan/vxlan.c +++ b/src/vnet/vxlan/vxlan.c @@ -44,15 +44,10 @@ static u8 * format_decap_next (u8 * s, va_list * args) { u32 next_index = va_arg (*args, u32); - switch (next_index) - { - case VXLAN_INPUT_NEXT_DROP: - return format (s, "drop"); - case VXLAN_INPUT_NEXT_L2_INPUT: - return format (s, "l2"); - default: - return format (s, "index %d", next_index); - } + if (next_index == VXLAN_INPUT_NEXT_DROP) + return format (s, "drop"); + else + return format (s, "index %d", next_index); return s; } @@ -61,18 +56,20 @@ u8 * format_vxlan_tunnel (u8 * s, va_list * args) vxlan_tunnel_t * t = va_arg (*args, vxlan_tunnel_t *); vxlan_main_t * ngm = &vxlan_main; - s = format (s, "[%d] src %U dst %U vni %d sw_if_index %d ", + s = format (s, "[%d] src %U dst %U vni %d fib-idx %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->vni, t->sw_if_index); + t->vni, t->encap_fib_index, t->sw_if_index); + + s = format (s, "encap-dpo-idx %d ", t->next_dpo.dpoi_index); + + if (PREDICT_FALSE (t->decap_next_index != VXLAN_INPUT_NEXT_L2_INPUT)) + s = format (s, "decap-next-%U ", format_decap_next, t->decap_next_index); - if (ip46_address_is_multicast (&t->dst)) - s = format (s, "mcast_sw_if_index %d ", t->mcast_sw_if_index); + if (PREDICT_FALSE (ip46_address_is_multicast (&t->dst))) + s = format (s, "mcast-sw-if-idx %d ", t->mcast_sw_if_index); - s = format (s, "encap_fib_index %d fib_entry_index %d decap_next %U\n", - t->encap_fib_index, t->fib_entry_index, - format_decap_next, t->decap_next_index); return s; } |