summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2023-02-14 19:12:30 -0800
committerDave Barach <vpp@barachs.net>2023-02-16 01:51:55 +0000
commit5b704f4fa1280b5603ed1cbf8ae9be4b2b1cb016 (patch)
treeeb758120b95ab0b4338d27fc82cd3d5d67ee25b4 /src
parent7d7ab1008a0f13a464e7f4c3628b48832172d0b3 (diff)
session: ignore zero length dgrams
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I70596ffcf90fa4cd57092584cb7a454f44208943
Diffstat (limited to 'src')
-rw-r--r--src/vnet/session/session_node.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c
index 7a630715591..c67d63fea80 100644
--- a/src/vnet/session/session_node.c
+++ b/src/vnet/session/session_node.c
@@ -1226,6 +1226,13 @@ session_tx_set_dequeue_params (vlib_main_t * vm, session_tx_context_t * ctx,
svm_fifo_peek (ctx->s->tx_fifo, 0, sizeof (ctx->hdr),
(u8 *) & ctx->hdr);
+ /* Zero length dgrams not supported */
+ if (PREDICT_FALSE (ctx->hdr.data_length == 0))
+ {
+ svm_fifo_dequeue_drop (ctx->s->tx_fifo, sizeof (ctx->hdr));
+ ctx->max_len_to_snd = 0;
+ return;
+ }
ASSERT (ctx->hdr.data_length > ctx->hdr.data_offset);
len = ctx->hdr.data_length - ctx->hdr.data_offset;
@@ -1253,12 +1260,13 @@ session_tx_set_dequeue_params (vlib_main_t * vm, session_tx_context_t * ctx,
{
svm_fifo_peek (ctx->s->tx_fifo, offset, sizeof (ctx->hdr),
(u8 *) & hdr);
- ASSERT (hdr.data_length > hdr.data_offset);
dgram_len = hdr.data_length - hdr.data_offset;
if (offset + sizeof (hdr) + hdr.data_length >
ctx->max_dequeue ||
first_dgram_len != dgram_len)
break;
+ /* Assert here to allow test above with zero length dgrams */
+ ASSERT (hdr.data_length > hdr.data_offset);
len += dgram_len;
offset += sizeof (hdr) + hdr.data_length;
}
ob'>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# Copyright (c) 2018 Huawei Technologies Co.,Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

*** Settings ***
| Library | resources.libraries.python.NodePath
| Library | resources.libraries.python.Trace
| Library | resources.libraries.python.TrafficScriptExecutor
| Library | resources.libraries.python.DMM.SingleCliSer
| Resource | resources/libraries/robot/shared/default.robot
| Resource | resources/libraries/robot/shared/interfaces.robot
| Resource | resources/libraries/robot/shared/counters.robot
| Resource | resources/libraries/robot/dmm/dmm_utils.robot
| Force Tags | 3_NODE_SINGLE_LINK_TOPO | VM_ENV | FUNCTEST | DMM
| Documentation | *DMM vs epoll test suite.*
| ...
| ... | Test suite uses 3-node topology TG - DUT1 - DUT2 - TG with single link
| ... | between nodes. From this topology only DUT1 and DUT2 nodes are used.
| ... | here we test the 1. test the vs_epool and vc_epoll

*** Variables ***
| ${dut1_ip}= | 172.28.128.3
| ${dut2_ip}= | 172.28.128.4
| ${prefix_len}= | 24

*** Test Cases ***
| TC01: DMM Single Client Server Test Case
| | Given DMM Basic Test Setup
| | ${total_count} | ${pass_count}= | When Run DMM Func Test Cases
| | ... | ${dut1_node} | ${dut2_node} | ${dut1_to_dut2_if_name}
| | ... | ${dut2_to_dut1_if_name} | ${dut1_ip} | ${dut2_ip} | ${prefix_len}
| | Then Should Be Equal As Integers | ${total_count} | ${pass_count}

*** Keywords ***
| DMM Basic Test Setup
| | Path for 2-node testing is set | ${nodes['DUT1']} | ${nodes['DUT2']}
| | Pick out the port used to execute test