Punt: socket register for exception dispatched/punted packets based on reason
[vpp.git] / src / vpp / api / custom_dump.c
index fa7091d..32354e7 100644 (file)
@@ -42,7 +42,6 @@
 #include <vlibmemory/api.h>
 #include <vnet/lisp-cp/lisp_types.h>
 #include <vnet/qos/qos_types.h>
-#include <vpp/oam/oam.h>
 
 #include <vnet/ethernet/ethernet.h>
 #include <vnet/ethernet/ethernet_types_api.h>
@@ -112,7 +111,7 @@ static void *vl_api_sw_interface_set_flags_t_print
 
   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
 
-  if (ntohl (mp->flags) & IF_STATUS_API_FLAG_ADMIN_UP)
+  if (mp->admin_up_down)
     s = format (s, "admin-up ");
   else
     s = format (s, "admin-down ");
@@ -159,12 +158,12 @@ static void *vl_api_sw_interface_event_t_print
 
   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
 
-  if (ntohl (mp->flags) & IF_STATUS_API_FLAG_ADMIN_UP)
+  if (mp->admin_up_down)
     s = format (s, "admin-up ");
   else
     s = format (s, "admin-down ");
 
-  if (ntohl (mp->flags) & IF_STATUS_API_FLAG_LINK_UP)
+  if (mp->link_up_down)
     s = format (s, "link-up");
   else
     s = format (s, "link-down");
@@ -179,18 +178,17 @@ static void *vl_api_sw_interface_add_del_address_t_print
   (vl_api_sw_interface_add_del_address_t * mp, void *handle)
 {
   u8 *s;
-  ip46_address_t address;
 
   s = format (0, "SCRIPT: sw_interface_add_del_address ");
 
   s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
 
-  if (ip_address_decode (&mp->prefix.address, &address) == IP46_TYPE_IP6)
+  if (mp->is_ipv6)
     s = format (s, "%U/%d ", format_ip6_address,
-               (ip6_address_t *) & address.ip6, mp->prefix.address_length);
+               (ip6_address_t *) mp->address, mp->address_length);
   else
     s = format (s, "%U/%d ", format_ip4_address,
-               (ip4_address_t *) & address.ip4, mp->prefix.address_length);
+               (ip4_address_t *) mp->address, mp->address_length);
 
   if (mp->is_add == 0)
     s = format (s, "del ");
@@ -613,12 +611,10 @@ static void *vl_api_virtio_pci_create_t_print
   if (memcmp (mp->mac_address, null_mac, 6))
     s = format (s, "mac-address %U ",
                format_ethernet_address, mp->mac_address);
-  if (mp->tx_ring_sz)
-    s = format (s, "tx-ring-size %u ", ntohs (mp->tx_ring_sz));
-  if (mp->rx_ring_sz)
-    s = format (s, "rx-ring-size %u ", ntohs (mp->rx_ring_sz));
   if (mp->features)
     s = format (s, "features 0x%llx ", clib_net_to_host_u64 (mp->features));
+  if (mp->gso_enabled)
+    s = format (s, "gso-enabled");
   FINISH;
 }
 
@@ -1061,15 +1057,15 @@ static void *vl_api_create_vlan_subif_t_print
   FINISH;
 }
 
-#define foreach_create_subif_flag              \
-_(0, "no_tags")                                        \
-_(1, "one_tag")                                        \
-_(2, "two_tags")                               \
-_(3, "dot1ad")                                 \
-_(4, "exact_match")                            \
-_(5, "default_sub")                            \
-_(6, "outer_vlan_id_any")                      \
-_(7, "inner_vlan_id_any")
+#define foreach_create_subif_bit                \
+_(no_tags)                                      \
+_(one_tag)                                      \
+_(two_tags)                                     \
+_(dot1ad)                                       \
+_(exact_match)                                  \
+_(default_sub)                                  \
+_(outer_vlan_id_any)                            \
+_(inner_vlan_id_any)
 
 static void *vl_api_create_subif_t_print
   (vl_api_create_subif_t * mp, void *handle)
@@ -1088,8 +1084,8 @@ static void *vl_api_create_subif_t_print
   if (mp->inner_vlan_id)
     s = format (s, "inner_vlan_id %d ", ntohs (mp->inner_vlan_id));
 
-#define _(a,b) if (mp->sub_if_flags & (1 << a)) s = format (s, "%s ", b);
-  foreach_create_subif_flag;
+#define _(a) if (mp->a) s = format (s, "%s ", #a);
+  foreach_create_subif_bit;
 #undef _
 
   FINISH;
@@ -1106,26 +1102,6 @@ static void *vl_api_delete_subif_t_print
   FINISH;
 }
 
-static void *vl_api_oam_add_del_t_print
-  (vl_api_oam_add_del_t * mp, void *handle)
-{
-  u8 *s;
-
-  s = format (0, "SCRIPT: oam_add_del ");
-
-  if (mp->vrf_id)
-    s = format (s, "vrf %d ", ntohl (mp->vrf_id));
-
-  s = format (s, "src %U ", format_ip4_address, mp->src_address);
-
-  s = format (s, "dst %U ", format_ip4_address, mp->dst_address);
-
-  if (mp->is_add == 0)
-    s = format (s, "del ");
-
-  FINISH;
-}
-
 static void *
 vl_api_reset_fib_t_print (vl_api_reset_fib_t * mp, void *handle)
 {
@@ -1839,6 +1815,55 @@ static void *vl_api_vxlan_tunnel_dump_t_print
   FINISH;
 }
 
+static void *vl_api_vxlan_gbp_tunnel_add_del_t_print
+  (vl_api_vxlan_gbp_tunnel_add_del_t * mp, void *handle)
+{
+  u8 *s;
+  s = format (0, "SCRIPT: vxlan_gbp_tunnel_add_del ");
+
+  if (mp->is_add)
+    s = format (s, "add ");
+  else
+    s = format (s, "del ");
+
+  s = format (s, "instance %d ", ntohl (mp->tunnel.instance));
+  s = format (s, "src %U ", format_vl_api_address, &mp->tunnel.src);
+  s = format (s, "dst %U ", format_vl_api_address, &mp->tunnel.dst);
+  s =
+    format (s, "mcast_sw_if_index %d ", ntohl (mp->tunnel.mcast_sw_if_index));
+  s = format (s, "encap_table_id %d ", ntohl (mp->tunnel.encap_table_id));
+  s = format (s, "vni %d ", ntohl (mp->tunnel.vni));
+  s = format (s, "sw_if_index %d ", ntohl (mp->tunnel.sw_if_index));
+
+  FINISH;
+}
+
+static void *vl_api_vxlan_gbp_tunnel_dump_t_print
+  (vl_api_vxlan_gbp_tunnel_dump_t * mp, void *handle)
+{
+  u8 *s;
+
+  s = format (0, "SCRIPT: vxlan_gbp_tunnel_dump ");
+
+  s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
+
+  FINISH;
+}
+
+static void *vl_api_sw_interface_set_vxlan_gbp_bypass_t_print
+  (vl_api_sw_interface_set_vxlan_gbp_bypass_t * mp, void *handle)
+{
+  u8 *s;
+
+  s = format (0, "SCRIPT: sw_interface_set_vxlan_gbp_bypass ");
+
+  s = format (s, "sw_if_index %d ", ntohl (mp->sw_if_index));
+  s = format (s, "%s ", (mp->is_ipv6 != 0) ? "ipv6" : "ipv4");
+  s = format (s, "%s ", (mp->enable != 0) ? "enable" : "disable");
+
+  FINISH;
+}
+
 static void *vl_api_geneve_add_del_tunnel_t_print
   (vl_api_geneve_add_del_tunnel_t * mp, void *handle)
 {
@@ -1883,28 +1908,26 @@ static void *vl_api_geneve_tunnel_dump_t_print
   FINISH;
 }
 
-static void *vl_api_gre_add_del_tunnel_t_print
-  (vl_api_gre_add_del_tunnel_t * mp, void *handle)
+static void *vl_api_gre_tunnel_add_del_t_print
+  (vl_api_gre_tunnel_add_del_t * mp, void *handle)
 {
   u8 *s;
-  ip46_address_t src = to_ip46 (mp->is_ipv6, mp->src_address);
-  ip46_address_t dst = to_ip46 (mp->is_ipv6, mp->dst_address);
 
-  s = format (0, "SCRIPT: gre_add_del_tunnel ");
+  s = format (0, "SCRIPT: gre_tunnel_add_del ");
 
-  s = format (s, "dst %U ", format_ip46_address, &dst, IP46_TYPE_ANY);
-  s = format (s, "src %U ", format_ip46_address, &src, IP46_TYPE_ANY);
+  s = format (s, "dst %U ", format_vl_api_address, &mp->tunnel.dst);
+  s = format (s, "src %U ", format_vl_api_address, &mp->tunnel.src);
 
-  s = format (s, "instance %d ", ntohl (mp->instance));
+  s = format (s, "instance %d ", ntohl (mp->tunnel.instance));
 
-  if (mp->tunnel_type == GRE_TUNNEL_TYPE_TEB)
+  if (mp->tunnel.type == GRE_TUNNEL_TYPE_TEB)
     s = format (s, "teb ");
 
-  if (mp->tunnel_type == GRE_TUNNEL_TYPE_ERSPAN)
-    s = format (s, "erspan %d ", ntohs (mp->session_id));
+  if (mp->tunnel.type == GRE_TUNNEL_TYPE_ERSPAN)
+    s = format (s, "erspan %d ", ntohs (mp->tunnel.session_id));
 
-  if (mp->outer_fib_id)
-    s = format (s, "outer-fib-id %d ", ntohl (mp->outer_fib_id));
+  if (mp->tunnel.outer_fib_id)
+    s = format (s, "outer-fib-id %d ", ntohl (mp->tunnel.outer_fib_id));
 
   if (mp->is_add == 0)
     s = format (s, "del ");
@@ -3259,22 +3282,62 @@ static void *vl_api_lisp_eid_table_map_dump_t_print
   FINISH;
 }
 
-static void *vl_api_ipsec_gre_add_del_tunnel_t_print
-  (vl_api_ipsec_gre_add_del_tunnel_t * mp, void *handle)
+static void *vl_api_ipsec_tunnel_if_add_del_t_print
+  (vl_api_ipsec_tunnel_if_add_del_t * mp, void *handle)
 {
   u8 *s;
 
-  s = format (0, "SCRIPT: ipsec_gre_add_del_tunnel ");
+  s = format (0, "SCRIPT: ipsec_tunnel_if_add_del ");
+
+  if (mp->esn)
+    s = format (s, "esn");
+  if (mp->anti_replay)
+    s = format (s, "anti-replay");
+  if (mp->udp_encap)
+    s = format (s, "udp-encap");
 
-  s = format (s, "dst %U ", format_ip4_address,
-             (ip4_address_t *) & (mp->dst_address));
+  s = format (s, "local-ip %U ", format_vl_api_address, &mp->remote_ip);
 
-  s = format (s, "src %U ", format_ip4_address,
-             (ip4_address_t *) & (mp->src_address));
+  s = format (s, "remote-ip %U ", format_vl_api_address, &mp->local_ip);
+  s = format (s, "tx-table-id %d ", ntohl (mp->tx_table_id));
 
-  s = format (s, "local_sa %d ", ntohl (mp->local_sa_id));
+  s = format (s, "local-spi %d ", ntohl (mp->local_spi));
 
-  s = format (s, "remote_sa %d ", ntohl (mp->remote_sa_id));
+  s = format (s, "remote-spi %d ", ntohl (mp->remote_spi));
+
+  s = format (s, "local-crypto-key-len %d ", mp->local_crypto_key_len);
+  s = format (s, "local-crypto-key %U ", format_hex_bytes,
+             mp->local_crypto_key, mp->local_crypto_key_len, 0);
+  s = format (s, "remote-crypto-key-len %d ", mp->remote_crypto_key_len);
+  s = format (s, "remote-crypto-key %U ", format_hex_bytes,
+             mp->remote_crypto_key, mp->remote_crypto_key_len, 0);
+  s = format (s, "local-integ-key-len %d ", mp->local_integ_key_len);
+  s = format (s, "local-integ-key %U ", format_hex_bytes,
+             mp->local_integ_key, mp->local_integ_key_len, 0);
+  s = format (s, "remote-integ-key-len %d ", mp->remote_integ_key_len);
+  s = format (s, "remote-integ-key %U ", format_hex_bytes,
+             mp->remote_integ_key, mp->remote_integ_key_len, 0);
+
+  if (mp->is_add == 0)
+    s = format (s, "del ");
+
+  FINISH;
+}
+
+static void *vl_api_ipsec_gre_tunnel_add_del_t_print
+  (vl_api_ipsec_gre_tunnel_add_del_t * mp, void *handle)
+{
+  u8 *s;
+
+  s = format (0, "SCRIPT: ipsec_gre_tunnel_add_del ");
+
+  s = format (s, "dst %U ", format_vl_api_ip4_address, mp->tunnel.dst);
+
+  s = format (s, "src %U ", format_vl_api_ip4_address, mp->tunnel.src);
+
+  s = format (s, "local_sa %d ", ntohl (mp->tunnel.local_sa_id));
+
+  s = format (s, "remote_sa %d ", ntohl (mp->tunnel.remote_sa_id));
 
   if (mp->is_add == 0)
     s = format (s, "del ");
@@ -3341,13 +3404,17 @@ vl_api_set_punt_t_print (vl_api_set_punt_t * mp, void *handle)
 
   s = format (0, "SCRIPT: punt ");
 
-  if (mp->punt.ipv != (u8) ~ 0)
-    s = format (s, "ip %d ", mp->punt.ipv);
+  switch (clib_net_to_host_u32 (mp->punt.type))
+    {
+    case PUNT_API_TYPE_L4:
+      s = format (s, "%U", format_vl_api_address_family, mp->punt.punt.l4.af);
 
-  s = format (s, "protocol %d ", mp->punt.l4_protocol);
+      s = format (s, "protocol %d ", mp->punt.punt.l4.protocol);
 
-  if (mp->punt.l4_port != (u16) ~ 0)
-    s = format (s, "port %d ", ntohs (mp->punt.l4_port));
+      if (mp->punt.punt.l4.port != (u16) ~ 0)
+       s = format (s, "port %d ", ntohs (mp->punt.punt.l4.port));
+      break;
+    }
 
   if (!mp->is_add)
     s = format (s, "del ");
@@ -3717,7 +3784,6 @@ _(SW_INTERFACE_SET_UNNUMBERED, sw_interface_set_unnumbered)             \
 _(IP_NEIGHBOR_ADD_DEL, ip_neighbor_add_del)                             \
 _(CREATE_VLAN_SUBIF, create_vlan_subif)                                 \
 _(CREATE_SUBIF, create_subif)                                           \
-_(OAM_ADD_DEL, oam_add_del)                                             \
 _(RESET_FIB, reset_fib)                                                 \
 _(DHCP_PROXY_CONFIG, dhcp_proxy_config)                                 \
 _(DHCP_PROXY_SET_VSS, dhcp_proxy_set_vss)                               \
@@ -3758,7 +3824,7 @@ _(VXLAN_TUNNEL_DUMP, vxlan_tunnel_dump)                                 \
 _(VXLAN_OFFLOAD_RX, vxlan_offload_rx)                                   \
 _(GENEVE_ADD_DEL_TUNNEL, geneve_add_del_tunnel)                         \
 _(GENEVE_TUNNEL_DUMP, geneve_tunnel_dump)                               \
-_(GRE_ADD_DEL_TUNNEL, gre_add_del_tunnel)                               \
+_(GRE_TUNNEL_ADD_DEL, gre_tunnel_add_del)                               \
 _(GRE_TUNNEL_DUMP, gre_tunnel_dump)                                     \
 _(L2_FIB_CLEAR_TABLE, l2_fib_clear_table)                               \
 _(L2_INTERFACE_EFP_FILTER, l2_interface_efp_filter)                     \
@@ -3778,6 +3844,9 @@ _(SHOW_VERSION, show_version)                                           \
 _(L2_FIB_TABLE_DUMP, l2_fib_table_dump)                                 \
 _(VXLAN_GPE_ADD_DEL_TUNNEL, vxlan_gpe_add_del_tunnel)                  \
 _(VXLAN_GPE_TUNNEL_DUMP, vxlan_gpe_tunnel_dump)                         \
+_(VXLAN_GBP_TUNNEL_ADD_DEL, vxlan_gbp_tunnel_add_del)                  \
+_(VXLAN_GBP_TUNNEL_DUMP, vxlan_gbp_tunnel_dump)                         \
+_(SW_INTERFACE_SET_VXLAN_GBP_BYPASS, sw_interface_set_vxlan_gbp_bypass) \
 _(INTERFACE_NAME_RENUMBER, interface_name_renumber)                    \
 _(IP_PROBE_NEIGHBOR, ip_probe_neighbor)                                 \
 _(IP_SCAN_NEIGHBOR_ENABLE_DISABLE, ip_scan_neighbor_enable_disable)     \
@@ -3850,7 +3919,8 @@ _(SHOW_LISP_RLOC_PROBE_STATE, show_lisp_rloc_probe_state)               \
 _(SHOW_LISP_MAP_REGISTER_STATE, show_lisp_map_register_state)           \
 _(LISP_RLOC_PROBE_ENABLE_DISABLE, lisp_rloc_probe_enable_disable)       \
 _(LISP_MAP_REGISTER_ENABLE_DISABLE, lisp_map_register_enable_disable)   \
-_(IPSEC_GRE_ADD_DEL_TUNNEL, ipsec_gre_add_del_tunnel)                   \
+_(IPSEC_TUNNEL_IF_ADD_DEL, ipsec_tunnel_if_add_del)                     \
+_(IPSEC_GRE_TUNNEL_ADD_DEL, ipsec_gre_tunnel_add_del)                   \
 _(IPSEC_GRE_TUNNEL_DUMP, ipsec_gre_tunnel_dump)                         \
 _(DELETE_SUBIF, delete_subif)                                           \
 _(L2_INTERFACE_PBB_TAG_REWRITE, l2_interface_pbb_tag_rewrite)           \