From f883f6a1132ad4bb7aa9d9a79d420274fbcf3b64 Mon Sep 17 00:00:00 2001 From: Klement Sekera Date: Wed, 13 Feb 2019 11:01:32 +0100 Subject: buffer chain linearization Rewrite vlib_buffer_chain_linearize function so that it works as intended. Linearize buffer chains coming out of reassembly to work around some dpdk-tx issues. Note that this is not a complete workaround as a sufficiently large packet will still cause the resulting chain to be too long. Drop features from reassembly code which relies on knowing which and how many buffers were freed during linearization, buffer counts and tracing capabilities for these cases. Change-Id: Ic65de53ecb5c78cd96b178033f6a576ab4060ed1 Signed-off-by: Klement Sekera --- src/vnet/dhcp/dhcp4_proxy_node.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/vnet/dhcp') diff --git a/src/vnet/dhcp/dhcp4_proxy_node.c b/src/vnet/dhcp/dhcp4_proxy_node.c index a331b17e07e..d0def3f740d 100644 --- a/src/vnet/dhcp/dhcp4_proxy_node.c +++ b/src/vnet/dhcp/dhcp4_proxy_node.c @@ -181,7 +181,14 @@ dhcp_proxy_to_server_input (vlib_main_t * vm, goto do_trace; } - space_left = vlib_buffer_chain_linearize (vm, b0); + if (!vlib_buffer_chain_linearize (vm, b0)) + { + error0 = DHCP_PROXY_ERROR_PKT_TOO_BIG; + next0 = DHCP_PROXY_TO_SERVER_INPUT_NEXT_DROP; + pkts_too_big++; + goto do_trace; + } + space_left = vlib_buffer_space_left_at_end (vm, b0); /* cant parse chains... * and we need some space for option 82*/ if ((b0->flags & VLIB_BUFFER_NEXT_PRESENT) != 0 || @@ -530,8 +537,8 @@ dhcp_proxy_to_client_input (vlib_main_t * vm, if (1 /* dpm->insert_option_82 */ ) { /* linearize needed to "unclone" and scan options */ - int space_left = vlib_buffer_chain_linearize (vm, b0); - if ((b0->flags & VLIB_BUFFER_NEXT_PRESENT) != 0 || space_left < 0) + int rv = vlib_buffer_chain_linearize (vm, b0); + if ((b0->flags & VLIB_BUFFER_NEXT_PRESENT) != 0 || !rv) { error0 = DHCP_PROXY_ERROR_PKT_TOO_BIG; goto drop_packet; -- cgit 1.2.3-korg