- u32 tci = va_arg (*args, u32);
- u32 thread_index = va_arg (*args, u32);
- tcp_connection_t *tc = tcp_connection_get (tci, thread_index);
- s = format (s, "[%s] %U:%d->%U:%d", "tcp", format_ip6_address,
- &tc->c_lcl_ip6, clib_net_to_host_u16 (tc->c_lcl_port),
- format_ip6_address, &tc->c_rmt_ip6,
- clib_net_to_host_u16 (tc->c_rmt_port));
+ tcp_connection_t *tc = va_arg (*args, tcp_connection_t *);
+ if (!tc)
+ return s;
+ if (tc->c_is_ip4)
+ {
+ s = format (s, "[#%d][%s] %U:%d->%U:%d", tc->c_thread_index, "T",
+ format_ip4_address, &tc->c_lcl_ip4,
+ clib_net_to_host_u16 (tc->c_lcl_port), format_ip4_address,
+ &tc->c_rmt_ip4, clib_net_to_host_u16 (tc->c_rmt_port));
+ }
+ else
+ {
+ s = format (s, "[#%d][%s] %U:%d->%U:%d", tc->c_thread_index, "T",
+ format_ip6_address, &tc->c_lcl_ip6,
+ clib_net_to_host_u16 (tc->c_lcl_port), format_ip6_address,
+ &tc->c_rmt_ip6, clib_net_to_host_u16 (tc->c_rmt_port));
+ }
+