summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/stl/examples/stl_simple_burst.py2
-rwxr-xr-xscripts/automation/regression/unit_tests/functional_tests/pkt_builder_test.py2
-rw-r--r--scripts/automation/regression/unit_tests/functional_tests/stl_basic_tests.py1
-rw-r--r--src/rpc-server/commands/trex_rpc_cmd_stream.cpp24
-rw-r--r--src/stateless/cp/trex_stream.h2
5 files changed, 16 insertions, 15 deletions
diff --git a/api/stl/examples/stl_simple_burst.py b/api/stl/examples/stl_simple_burst.py
index 49355890..ff159289 100644
--- a/api/stl/examples/stl_simple_burst.py
+++ b/api/stl/examples/stl_simple_burst.py
@@ -27,7 +27,7 @@ def simple_burst ():
pkt_bld.set_layer_attr("l4_tcp", "flags", 0)
pkt_bld.set_layer_attr("l4_tcp", "win", 32768)
pkt_bld.set_layer_attr("l4_tcp", "seq", 0)
- pkt_bld.set_pkt_payload("abcdefgh")
+ #pkt_bld.set_pkt_payload("abcdefgh")
pkt_bld.set_layer_attr("l3_ip", "len", len(pkt_bld.get_layer('l3_ip')))
diff --git a/scripts/automation/regression/unit_tests/functional_tests/pkt_builder_test.py b/scripts/automation/regression/unit_tests/functional_tests/pkt_builder_test.py
index b8831c04..c2946798 100755
--- a/scripts/automation/regression/unit_tests/functional_tests/pkt_builder_test.py
+++ b/scripts/automation/regression/unit_tests/functional_tests/pkt_builder_test.py
@@ -251,7 +251,7 @@ class CTRexPktBuilder_Test(pkt_bld_general_test.CGeneralPktBld_Test):
self.print_packet(self.pkt_bld.get_packet())
assert_equal(self.pkt_bld.dump_pkt(), {
- 'binary': [224, 95, 185, 105, 233, 34, 0, 21, 23, 167, 117, 163, 8, 0, 69, 0, 0, 39, 0, 0, 0, 0, 64, 1, 79, 201, 21, 0, 0, 2, 22, 0, 0, 12, 8, 0, 217, 134, 95, 208, 44, 218, 104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100],
+ 'binary': '4F+5aekiABUXp3WjCABFAAAnAAAAAEABT8kVAAACFgAADAgA2YZf0CzaaGVsbG8gd29ybGQ=',
'meta': '',
})
diff --git a/scripts/automation/regression/unit_tests/functional_tests/stl_basic_tests.py b/scripts/automation/regression/unit_tests/functional_tests/stl_basic_tests.py
index ab4a8a87..125866ba 100644
--- a/scripts/automation/regression/unit_tests/functional_tests/stl_basic_tests.py
+++ b/scripts/automation/regression/unit_tests/functional_tests/stl_basic_tests.py
@@ -13,7 +13,6 @@ import os
import subprocess
# should be set to run explicitly, not as part of all regression tests
-@nottest
class CStlBasic_Test(functional_general_test.CGeneralFunctional_Test):
def setUp (self):
self.test_path = os.path.abspath(os.getcwd())
diff --git a/src/rpc-server/commands/trex_rpc_cmd_stream.cpp b/src/rpc-server/commands/trex_rpc_cmd_stream.cpp
index dc8a9ccd..69e5dd18 100644
--- a/src/rpc-server/commands/trex_rpc_cmd_stream.cpp
+++ b/src/rpc-server/commands/trex_rpc_cmd_stream.cpp
@@ -65,17 +65,27 @@ TrexRpcCmdAddStream::_run(const Json::Value &params, Json::Value &result) {
const Json::Value &pkt = parse_object(section, "packet", result);
std::string pkt_binary = base64_decode(parse_string(pkt, "binary", result));
+ /* check packet size */
+ if ( (pkt_binary.size() < TrexStream::MIN_PKT_SIZE_BYTES) || (pkt_binary.size() > TrexStream::MAX_PKT_SIZE_BYTES) ) {
+ std::stringstream ss;
+ ss << "bad packet size provided: should be between " << TrexStream::MIN_PKT_SIZE_BYTES << " and " << TrexStream::MAX_PKT_SIZE_BYTES;
+ delete stream;
+ generate_execute_err(result, ss.str());
+ }
+
/* fetch the packet from the message */
- stream->m_pkt.len = pkt_binary.size();
- stream->m_pkt.binary = new uint8_t[pkt_binary.size()];
+ stream->m_pkt.len = std::max(pkt_binary.size(), 60UL);
+
+ /* allocate and init to zero ( with () ) */
+ stream->m_pkt.binary = new uint8_t[pkt_binary.size()]();
if (!stream->m_pkt.binary) {
generate_internal_err(result, "unable to allocate memory");
}
- /* copy the packet */
const char *pkt_buffer = pkt_binary.c_str();
+ /* copy the packet - if less than 60 it will remain zeroes */
for (int i = 0; i < pkt_binary.size(); i++) {
stream->m_pkt.binary[i] = pkt_buffer[i];
}
@@ -306,14 +316,6 @@ TrexRpcCmdAddStream::parse_vm(const Json::Value &vm, TrexStream *stream, Json::V
void
TrexRpcCmdAddStream::validate_stream(const TrexStream *stream, Json::Value &result) {
- /* check packet size */
- if ( (stream->m_pkt.len < TrexStream::MIN_PKT_SIZE_BYTES) || (stream->m_pkt.len > TrexStream::MAX_PKT_SIZE_BYTES) ) {
- std::stringstream ss;
- ss << "bad packet size provided: should be between " << TrexStream::MIN_PKT_SIZE_BYTES << " and " << TrexStream::MAX_PKT_SIZE_BYTES;
- delete stream;
- generate_execute_err(result, ss.str());
- }
-
/* add the stream to the port's stream table */
TrexStatelessPort * port = get_stateless_obj()->get_port_by_id(stream->m_port_id);
diff --git a/src/stateless/cp/trex_stream.h b/src/stateless/cp/trex_stream.h
index 6bb30cf9..80d64ec5 100644
--- a/src/stateless/cp/trex_stream.h
+++ b/src/stateless/cp/trex_stream.h
@@ -125,7 +125,7 @@ public:
virtual ~TrexStream();
/* defines the min max per packet supported */
- static const uint32_t MIN_PKT_SIZE_BYTES = 60;
+ static const uint32_t MIN_PKT_SIZE_BYTES = 14;
static const uint32_t MAX_PKT_SIZE_BYTES = MAX_PKT_SIZE;
/* provides storage for the stream json*/