api: sr - Mark old message versions as deprecated
[vpp.git] / src / vnet / udp / udp_cli.c
index 9787eed..1e72392 100644 (file)
@@ -38,6 +38,33 @@ format_udp_connection_id (u8 * s, va_list * args)
   return s;
 }
 
+static const char *udp_cfg_flags_str[] = {
+#define _(sym, str) str,
+  foreach_udp_cfg_flag
+#undef _
+};
+
+static u8 *
+format_udp_cfg_flags (u8 *s, va_list *args)
+{
+  udp_connection_t *tc = va_arg (*args, udp_connection_t *);
+  int i, last = -1;
+
+  for (i = 0; i < UDP_CFG_N_FLAG_BITS; i++)
+    if (tc->cfg_flags & (1 << i))
+      last = i;
+  if (last >= 0)
+    s = format (s, " cfg: ");
+  for (i = 0; i < last; i++)
+    {
+      if (tc->cfg_flags & (1 << i))
+       s = format (s, "%s, ", udp_cfg_flags_str[i]);
+    }
+  if (last >= 0)
+    s = format (s, "%s", udp_cfg_flags_str[last]);
+  return s;
+}
+
 static const char *udp_connection_flags_str[] = {
 #define _(sym, str) str,
   foreach_udp_connection_flag
@@ -68,10 +95,13 @@ format_udp_vars (u8 * s, va_list * args)
 {
   udp_connection_t *uc = va_arg (*args, udp_connection_t *);
 
-  s = format (s, " index %u flags: %U", uc->c_c_index,
-             format_udp_connection_flags, uc);
+  s = format (s, " index %u%U flags: %U\n", uc->c_c_index,
+             format_udp_cfg_flags, uc, format_udp_connection_flags, uc);
+  s = format (s, " fib_index: %u next_node: %u opaque: %u ", uc->c_fib_index);
   if (!(uc->flags & UDP_CONN_F_LISTEN))
-    s = format (s, " \n sw_if_index: %d, mss: %u\n", uc->sw_if_index, uc->mss);
+    s = format (s, " sw_if_index: %d mss: %u\n", uc->sw_if_index, uc->mss);
+  else
+    s = format (s, "\n");
 
   return s;
 }
@@ -106,6 +136,8 @@ udp_config_fn (vlib_main_t * vm, unformat_input_t * input)
        um->default_mtu = tmp;
       else if (unformat (input, "icmp-unreachable-disabled"))
        um->icmp_send_unreachable_disabled = 1;
+      else if (unformat (input, "no-csum-offload"))
+       um->csum_offload = 0;
       else
        return clib_error_return (0, "unknown input `%U'",
                                  format_unformat_error, input);
@@ -179,16 +211,21 @@ static void
 table_format_udp_port_ (vlib_main_t *vm, udp_main_t *um, table_t *t, int *c,
                        int port, int bind, int is_ip4)
 {
-  const udp_dst_port_info_t *pi = udp_get_dst_port_info (um, port, is_ip4);
-  if (!pi)
+  const udp_dst_port_info_t *pi;
+
+  if (bind && !udp_is_valid_dst_port (port, is_ip4))
     return;
-  if (bind && ~0 == pi->node_index)
+
+  pi = udp_get_dst_port_info (um, port, is_ip4);
+  if (!pi)
     return;
+
   table_format_cell (t, *c, 0, "%d", pi->dst_port);
   table_format_cell (t, *c, 1, is_ip4 ? "ip4" : "ip6");
   table_format_cell (t, *c, 2, ~0 == pi->node_index ? "none" : "%U",
                     format_vlib_node_name, vm, pi->node_index);
   table_format_cell (t, *c, 3, "%s", pi->name);
+
   (*c)++;
 }