From 8c1be054b90f113aef3ae27b52d7389271ce91c3 Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Mon, 17 Oct 2022 11:52:34 -0700 Subject: udp: explicit udp output node This allows for custom next node selection on output. Type: feature Signed-off-by: Florin Coras Change-Id: Ib0fee71a01847184e95c18097bbbfdadfbd9d030 --- src/vnet/udp/udp.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'src/vnet/udp/udp.c') diff --git a/src/vnet/udp/udp.c b/src/vnet/udp/udp.c index 9b2ed886d0f..c919c958254 100644 --- a/src/vnet/udp/udp.c +++ b/src/vnet/udp/udp.c @@ -226,16 +226,9 @@ always_inline u32 udp_push_one_header (vlib_main_t *vm, udp_connection_t *uc, vlib_buffer_t *b) { vlib_buffer_push_udp (b, uc->c_lcl_port, uc->c_rmt_port, 1); - if (uc->c_is_ip4) - vlib_buffer_push_ip4_custom (vm, b, &uc->c_lcl_ip4, &uc->c_rmt_ip4, - IP_PROTOCOL_UDP, 1 /* csum offload */, - 0 /* is_df */, uc->c_dscp); - else - vlib_buffer_push_ip6 (vm, b, &uc->c_lcl_ip6, &uc->c_rmt_ip6, - IP_PROTOCOL_UDP); - vnet_buffer (b)->sw_if_index[VLIB_RX] = uc->sw_if_index; - vnet_buffer (b)->sw_if_index[VLIB_TX] = uc->c_fib_index; b->flags |= VNET_BUFFER_F_LOCALLY_ORIGINATED; + /* reuse tcp medatada for now */ + vnet_buffer (b)->tcp.connection_index = uc->c_c_index; return 0; } @@ -412,6 +405,8 @@ conn_alloc: clib_spinlock_init (&uc->rx_lock); uc->c_flags |= TRANSPORT_CONNECTION_F_CLESS; } + uc->next_node_index = rmt->next_node_index; + uc->next_node_opaque = rmt->next_node_opaque; return uc->c_c_index; } @@ -505,11 +500,11 @@ udp_init (vlib_main_t * vm) pi->format_header = format_udp_header; pi->unformat_pg_edit = unformat_pg_udp_header; - /* Register as transport with URI */ + /* Register as transport with session layer */ transport_register_protocol (TRANSPORT_PROTO_UDP, &udp_proto, - FIB_PROTOCOL_IP4, ip4_lookup_node.index); + FIB_PROTOCOL_IP4, udp4_output_node.index); transport_register_protocol (TRANSPORT_PROTO_UDP, &udp_proto, - FIB_PROTOCOL_IP6, ip6_lookup_node.index); + FIB_PROTOCOL_IP6, udp6_output_node.index); /* * Initialize data structures -- cgit 1.2.3-korg