diff options
author | Florin Coras <fcoras@cisco.com> | 2022-10-17 11:52:34 -0700 |
---|---|---|
committer | Dave Wallace <dwallacelf@gmail.com> | 2022-10-19 01:00:52 +0000 |
commit | 8c1be054b90f113aef3ae27b52d7389271ce91c3 (patch) | |
tree | 9123e5efa00a953b08f4a1d2f330227714382ad7 /src/vnet/udp/udp.c | |
parent | 472d0da7a0590c4beb052ce70edee60b0fa5e98f (diff) |
udp: explicit udp output node
This allows for custom next node selection on output.
Type: feature
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: Ib0fee71a01847184e95c18097bbbfdadfbd9d030
Diffstat (limited to 'src/vnet/udp/udp.c')
-rw-r--r-- | src/vnet/udp/udp.c | 19 |
1 files changed, 7 insertions, 12 deletions
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 |