Hello, all I need to add some control functions for trasit TCP sessions. Could you please help me to determine the correct way to implement such feature? At now I plan to write the VPP node wich will push all of transit TCP connections into the sessions main table in following manner:
tcon0 = session_lookup_connection4(fib_index0, > &ip40->src_address, &ip40->dst_address, > tcp0->src_port, tcp0->dst_port, TRANSPORT_PROTO_TCP); > if (tcon0 == 0) { > // Allocate fake session and connection > pool_get (mm->sess_main->sessions[0], s0); > memset (s0, 0, sizeof (*s0)); > s0->session_index = s0 - mm->sm_main->sessions[0]; > pool_get (mm->tcp_main->connections[0], tc0); > memset (tc0, 0, sizeof (*tc0)); > tc0->connection.c_index = tc0 - mm->tcp_main->connections[0]; > tc0->connection.s_index = s0->session_index; > s0->connection_index = tc0->connection.c_index; > s0->thread_index = thread_index; > > tc0->connection.lcl_ip.ip4.as_u32 = ip40->src_address.as_u32; > tc0->connection.rmt_ip.ip4.as_u32 = ip40->dst_address.as_u32; > tc0->connection.proto = TRANSPORT_PROTO_TCP; > tc0->connection.is_ip4 = 1; > tc0->connection.fib_index = fib_index0; > tc0->connection.thread_index = thread_index; > tc0->connection.lcl_port = tcp0->src_port; > tc0->connection.rmt_port = tcp0->dst_port; > tcon0 = &_tcon0; > clib_memcpy (tcon0, &tc0->connection, sizeof (*tcon0)); > } else { > tc0 = tcp_get_connection_from_transport(tcon0); > s0 = session_get(tcon0->s_index, thread_index); > } > session_lookup_add_connection (tcon0, session_handle(s0)); > Is this the correct way? Thank you in advance, Aleksander
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#10278): https://lists.fd.io/g/vpp-dev/message/10278 Mute This Topic: https://lists.fd.io/mt/24943132/21656 Group Owner: vpp-dev+ow...@lists.fd.io Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-