summaryrefslogtreecommitdiffstats
path: root/src/vnet/dhcp/dhcp4_proxy_node.c
diff options
context:
space:
mode:
authorKlement Sekera <ksekera@cisco.com>2019-02-13 11:01:32 +0100
committerDamjan Marion <dmarion@me.com>2019-02-25 19:30:18 +0000
commitf883f6a1132ad4bb7aa9d9a79d420274fbcf3b64 (patch)
treecf6867cd2eb1867a75cf2e5b4f27ab4f29e23b98 /src/vnet/dhcp/dhcp4_proxy_node.c
parentb0789106cb4f4c7ac529c02a5ff1ac346f0913dd (diff)
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 <ksekera@cisco.com>
Diffstat (limited to 'src/vnet/dhcp/dhcp4_proxy_node.c')
-rw-r--r--src/vnet/dhcp/dhcp4_proxy_node.c13
1 files changed, 10 insertions, 3 deletions
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;