diff --git a/scapy/packet.py b/scapy/packet.py index bab03eef6838ce5203aa68cd62bcca5897a3890f..a4bbadd8a20e2e5d2e39f9154c94b15380ff867b 100644 --- a/scapy/packet.py +++ b/scapy/packet.py @@ -337,8 +337,10 @@ class Packet(BasePacket): for t in self.post_transforms: pkt = t(pkt) pay = self.do_build_payload() - p = self.post_build(pkt,pay) - return p + if self.raw_packet_cache is None: + return self.post_build(pkt, pay) + else: + return pkt + pay def build_padding(self): return self.payload.build_padding()