summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_packet_builder_scapy.py
diff options
context:
space:
mode:
authorYaroslav Brustinov <ybrustin@cisco.com>2016-03-04 17:10:33 +0200
committerYaroslav Brustinov <ybrustin@cisco.com>2016-03-04 17:10:33 +0200
commit2a3171f73e838fccbc82d2d8553e36c7c3820e28 (patch)
treeb9a77061079deeb96de9ce69958582fe27c4bce3 /scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_packet_builder_scapy.py
parent5650f2add4b03ef8d51d670af5db9fccade80f3f (diff)
add manual padding to 60 bytes with zeros
Diffstat (limited to 'scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_packet_builder_scapy.py')
-rw-r--r--scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_packet_builder_scapy.py14
1 files changed, 6 insertions, 8 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):