aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/udp/udp.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2022-12-19 10:55:18 -0800
committerDave Barach <vpp@barachs.net>2022-12-20 21:45:03 +0000
commit15952b261f92959ca14cf6679efc318c12e90de6 (patch)
tree3dfef937ffc510d5d0b8c3af15bcb1b2ce718d64 /src/vnet/udp/udp.c
parent8753180a80e03dd031fa7f470adbcbb4a611d1c9 (diff)
udp: fix tx handling of non-connected sessions
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I659b9914fcfa4619a68e9807ef241f88c96b3bd0
Diffstat (limited to 'src/vnet/udp/udp.c')
-rw-r--r--src/vnet/udp/udp.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/vnet/udp/udp.c b/src/vnet/udp/udp.c
index 710d1ac9e52..e095a66dcf2 100644
--- a/src/vnet/udp/udp.c
+++ b/src/vnet/udp/udp.c
@@ -223,9 +223,27 @@ 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,
udp_csum_offload (uc));
b->flags |= VNET_BUFFER_F_LOCALLY_ORIGINATED;
+
+ /* Handle ip header now as session layer overwrite connection details for
+ * non-connected udp. */
+ if (uc->c_is_ip4)
+ vlib_buffer_push_ip4_custom (vm, b, &uc->c_lcl_ip4, &uc->c_rmt_ip4,
+ IP_PROTOCOL_UDP, udp_csum_offload (uc),
+ 0 /* is_df */, uc->c_dscp);
+ else
+ vlib_buffer_push_ip6 (vm, b, &uc->c_lcl_ip6, &uc->c_rmt_ip6,
+ IP_PROTOCOL_UDP);
+
/* reuse tcp medatada for now */
vnet_buffer (b)->tcp.connection_index = uc->c_c_index;
+ /* Not connected udp session. Mark buffer for custom handling in
+ * udp_output */
+ if (PREDICT_FALSE (!(uc->flags & UDP_CONN_F_CONNECTED)))
+ vnet_buffer (b)->tcp.flags |= UDP_CONN_F_LISTEN;
+ else
+ vnet_buffer (b)->tcp.flags = 0;
+
return 0;
}