session: avoid ct connects loop
[vpp.git] / src / vnet / session / application_local.c
index e061983..2152738 100644 (file)
@@ -403,7 +403,7 @@ ct_connect (app_worker_t * client_wrk, session_t * ll,
   ho->peer_index = ll->session_index;
   ho->c_proto = TRANSPORT_PROTO_NONE;
   ho->c_flags |= TRANSPORT_CONNECTION_F_NO_LOOKUP;
-  clib_memcpy (&ho->c_rmt_ip, &sep->ip, sizeof (&sep->ip));
+  clib_memcpy (&ho->c_rmt_ip, &sep->ip, sizeof (sep->ip));
   ho->flags |= CT_CONN_F_CLIENT;
   ho->c_s_index = ~0;
 
@@ -535,7 +535,8 @@ global_scope:
   table_index = session_lookup_get_index_for_fib (fib_proto, sep->fib_index);
   ll = session_lookup_listener_wildcard (table_index, sep);
 
-  if (ll)
+  /* Avoid connecting app to own listener */
+  if (ll && ll->app_index != app->app_index)
     return ct_connect (app_wrk, ll, sep_ext);
 
   /* Failed to connect but no error */