From 2a3171f73e838fccbc82d2d8553e36c7c3820e28 Mon Sep 17 00:00:00 2001 From: Yaroslav Brustinov Date: Fri, 4 Mar 2016 17:10:33 +0200 Subject: add manual padding to 60 bytes with zeros --- .../stl/trex_stl_lib/trex_stl_packet_builder_scapy.py | 14 ++++++-------- .../stl/trex_stl_lib/trex_stl_streams.py | 2 -- scripts/exp/pcap.pcap | Bin 476 -> 476 bytes scripts/exp/pcap_with_vm.pcap | Bin 2284 -> 2284 bytes scripts/exp/syn_attack.pcap | Bin 3824 -> 3824 bytes scripts/exp/udp_1pkt_range_clients_split_garp.pcap | Bin 3824 -> 3824 bytes 6 files changed, 6 insertions(+), 10 deletions(-) diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_packet_builder_scapy.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_packet_builder_scapy.py index a3430c79..6a2e268f 100644 --- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_packet_builder_scapy.py +++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_packet_builder_scapy.py @@ -950,20 +950,18 @@ class CScapyTRexPktBuilder(CTrexPktBuilderInterface): # for buffer, promote to a scapy packet if self.pkt_raw: self.pkt = Ether(self.pkt_raw) - if self.remove_fcs and self.pkt.lastlayer().name == 'Padding': - self.pkt.lastlayer().underlayer.remove_payload() - self.pkt.build() self.pkt_raw = None # regular scapy packet - elif self.pkt: - self.pkt.build() - - else: + elif not self.pkt: # should not reach here raise CTRexPacketBuildException(-11, 'empty packet') - + if self.remove_fcs and self.pkt.lastlayer().name == 'Padding': + self.pkt.lastlayer().underlayer.remove_payload() + if len(self.pkt) < 60: # simulator can write padding with non-zeros, set it explicit + self.pkt /= Padding('\x00' * (60 - len(self.pkt))) + self.pkt.build() self.is_pkt_built = True def _pkt_layer_offset (self,layer_name): diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_streams.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_streams.py index c41fa0c2..5aa544ab 100644 --- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_streams.py +++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_streams.py @@ -344,8 +344,6 @@ class STLStream(object): imports_arr = [] if 'MPLS(' in packet_command: imports_arr.append('from scapy.contrib.mpls import MPLS') - if 'VXLAN(' in packet_command: - imports_arr.append('from scapy.contrib.mpls import MPLS') imports = '\n'.join(imports_arr) if payload: diff --git a/scripts/exp/pcap.pcap b/scripts/exp/pcap.pcap index 34a2e9b6..b13275ee 100644 Binary files a/scripts/exp/pcap.pcap and b/scripts/exp/pcap.pcap differ diff --git a/scripts/exp/pcap_with_vm.pcap b/scripts/exp/pcap_with_vm.pcap index a278dd8e..a7a2d2ba 100644 Binary files a/scripts/exp/pcap_with_vm.pcap and b/scripts/exp/pcap_with_vm.pcap differ diff --git a/scripts/exp/syn_attack.pcap b/scripts/exp/syn_attack.pcap index aa420d2c..84da36a7 100644 Binary files a/scripts/exp/syn_attack.pcap and b/scripts/exp/syn_attack.pcap differ diff --git a/scripts/exp/udp_1pkt_range_clients_split_garp.pcap b/scripts/exp/udp_1pkt_range_clients_split_garp.pcap index dde0c6dd..627bcd54 100644 Binary files a/scripts/exp/udp_1pkt_range_clients_split_garp.pcap and b/scripts/exp/udp_1pkt_range_clients_split_garp.pcap differ -- cgit 1.2.3-korg