tap: add support for persistance
[vpp.git] / src / vnet / udp / udp.c
index 949c635..7fceab0 100644 (file)
@@ -58,9 +58,10 @@ udp_connection_alloc (u32 thread_index)
 void
 udp_connection_free (udp_connection_t * uc)
 {
-  pool_put (udp_main.connections[uc->c_thread_index], uc);
+  u32 thread_index = uc->c_thread_index;
   if (CLIB_DEBUG)
     clib_memset (uc, 0xFA, sizeof (*uc));
+  pool_put (udp_main.connections[thread_index], uc);
 }
 
 void
@@ -112,7 +113,7 @@ udp_session_bind (u32 session_index, transport_endpoint_t * lcl)
 
   node_index = lcl->is_ip4 ? udp4_input_node.index : udp6_input_node.index;
   udp_register_dst_port (vm, clib_net_to_host_u16 (lcl->port), node_index,
-                        1 /* is_ipv4 */ );
+                        lcl->is_ip4);
   return listener->c_c_index;
 }
 
@@ -393,6 +394,9 @@ udpc_connection_listen (u32 session_index, transport_endpoint_t * lcl)
     return -1;
   listener = udp_listener_get (li_index);
   listener->flags |= UDP_CONN_F_CONNECTED;
+  /* Fake udp listener, i.e., make sure session layer adds a udp instead of
+   * udpc listener to the lookup table */
+  ((session_endpoint_cfg_t *) lcl)->transport_proto = TRANSPORT_PROTO_UDP;
   return li_index;
 }