From 68ebd739646a27f1bb92ce8eacb5bb76f6399580 Mon Sep 17 00:00:00 2001 From: Hanoh Haim Date: Tue, 23 Feb 2016 15:30:41 +0200 Subject: fix ipv4 checksum error in case of pkt_size>128 and field offset less than ip-header (fd.io issue - Miro) --- .../unit_tests/functional_tests/stl_basic_tests.py | 6 ++- scripts/exp/udp_1pkt_simple_test.pcap | Bin 0 -> 1474 bytes scripts/exp/udp_1pkt_simple_test2.pcap | Bin 0 -> 1474 bytes scripts/stl/udp_1pkt_simple_test.py | 43 +++++++++++++++++++++ scripts/stl/udp_1pkt_simple_test2.py | 43 +++++++++++++++++++++ 5 files changed, 90 insertions(+), 2 deletions(-) create mode 100644 scripts/exp/udp_1pkt_simple_test.pcap create mode 100644 scripts/exp/udp_1pkt_simple_test2.pcap create mode 100644 scripts/stl/udp_1pkt_simple_test.py create mode 100644 scripts/stl/udp_1pkt_simple_test2.py (limited to 'scripts') 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 e6a82cf1..6fb012ca 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 @@ -181,13 +181,15 @@ class CStlBasic_Test(functional_general_test.CGeneralFunctional_Test): ["udp_1pkt_mac_step.py","-m 1 -l 20 ",True], ["udp_1pkt_mac_mask1.py","-m 1 -l 20 ",True] , ["udp_1pkt_mac_mask2.py","-m 1 -l 20 ",True], - ["udp_1pkt_mac_mask3.py","-m 1 -l 20 ",True] + ["udp_1pkt_mac_mask3.py","-m 1 -l 20 ",True], + ["udp_1pkt_simple_test2.py","-m 1 -l 10 ",True], # test split of packet with ip option + ["udp_1pkt_simple_test.py","-m 1 -l 10 ",True] ]; - p1 = [ ["udp_1pkt_mpls_vm.py","-m 1 ",True] ] + p1 = [ ["udp_1pkt_simple_test.py","-m 1 -l 10 ",True] ] for obj in p: diff --git a/scripts/exp/udp_1pkt_simple_test.pcap b/scripts/exp/udp_1pkt_simple_test.pcap new file mode 100644 index 00000000..2eeec462 Binary files /dev/null and b/scripts/exp/udp_1pkt_simple_test.pcap differ diff --git a/scripts/exp/udp_1pkt_simple_test2.pcap b/scripts/exp/udp_1pkt_simple_test2.pcap new file mode 100644 index 00000000..002d77dc Binary files /dev/null and b/scripts/exp/udp_1pkt_simple_test2.pcap differ diff --git a/scripts/stl/udp_1pkt_simple_test.py b/scripts/stl/udp_1pkt_simple_test.py new file mode 100644 index 00000000..eb11d4e3 --- /dev/null +++ b/scripts/stl/udp_1pkt_simple_test.py @@ -0,0 +1,43 @@ +from trex_stl_lib.api import * + +def generate_payload(length): + word = '' + alphabet_size = len(string.letters) + for i in range(length): + word += string.letters[(i % alphabet_size)] + return word + + +class STLS1(object): + + def create_stream (self): + fsize_no_fcs = 129 + base_pkt_a = Ether()/IP(dst="48.0.0.1",options=IPOption('\x01\x01\x01\x00'))/UDP(dport=12,sport=1025) + + vm1 = CTRexScRaw([ + STLVmFlowVar(name="src",min_value="10.0.0.1",max_value="10.0.0.10",size=4,op="inc"), + STLVmWrFlowVar(fv_name="src",pkt_offset= "IP.src"), + # checksum + STLVmFixIpv4(offset = "IP") + + ] + ) # split to cores base on the tuple generator + + # + pkt_a = STLPktBuilder(pkt=base_pkt_a/generate_payload(fsize_no_fcs-len(base_pkt_a)), vm=vm1) + + + return STLStream( packet = pkt_a , + mode = STLTXCont() ) + + def get_streams (self, direction = 0): + # create 1 stream + return [ self.create_stream() ] + + +# dynamic load - used for trex console or simulator +def register(): + return STLS1() + + + diff --git a/scripts/stl/udp_1pkt_simple_test2.py b/scripts/stl/udp_1pkt_simple_test2.py new file mode 100644 index 00000000..c8da758d --- /dev/null +++ b/scripts/stl/udp_1pkt_simple_test2.py @@ -0,0 +1,43 @@ +from trex_stl_lib.api import * + +def generate_payload(length): + word = '' + alphabet_size = len(string.letters) + for i in range(length): + word += string.letters[(i % alphabet_size)] + return word + + +class STLS1(object): + + def create_stream (self): + fsize_no_fcs = 129 + base_pkt_a = Ether()/IP()/IPv6()/IP(dst="48.0.0.1",options=IPOption('\x01\x01\x01\x00'))/UDP(dport=12,sport=1025) + + vm1 = CTRexScRaw([ + STLVmFlowVar(name="src",min_value="10.0.0.1",max_value="10.0.0.10",size=4,op="inc"), + STLVmWrFlowVar(fv_name="src",pkt_offset= "IP:1.src"), + # checksum + STLVmFixIpv4(offset = "IP:1") + + ] + ) # split to cores base on the tuple generator + + # + pkt_a = STLPktBuilder(pkt=base_pkt_a/generate_payload(fsize_no_fcs-len(base_pkt_a)), vm=vm1) + + + return STLStream( packet = pkt_a , + mode = STLTXCont() ) + + def get_streams (self, direction = 0): + # create 1 stream + return [ self.create_stream() ] + + +# dynamic load - used for trex console or simulator +def register(): + return STLS1() + + + -- cgit 1.2.3-korg