+static udp_connection_t *
+udp_connection_accept (udp_connection_t * listener, session_dgram_hdr_t * hdr,
+ u32 thread_index)
+{
+ udp_connection_t *uc;
+
+ uc = udp_connection_alloc (thread_index);
+ ip_copy (&uc->c_lcl_ip, &hdr->lcl_ip, hdr->is_ip4);
+ ip_copy (&uc->c_rmt_ip, &hdr->rmt_ip, hdr->is_ip4);
+ uc->c_lcl_port = hdr->lcl_port;
+ uc->c_rmt_port = hdr->rmt_port;
+ uc->c_is_ip4 = hdr->is_ip4;
+ uc->c_fib_index = listener->c_fib_index;
+ uc->mss = listener->mss;
+ uc->flags |= UDP_CONN_F_CONNECTED;
+
+ if (session_dgram_accept (&uc->connection, listener->c_s_index,
+ listener->c_thread_index))
+ {
+ udp_connection_free (uc);
+ return 0;
+ }
+ udp_connection_share_port (clib_net_to_host_u16
+ (uc->c_lcl_port), uc->c_is_ip4);
+ return uc;
+}