title: scapy PcapReader cut short
body: <p>I'm trying to rewrite a pcap file with different IP and IPv6 addresses. But after I extract a packt by PcapReader and change its IP adresses, the packets in the output pcap file is cut short (that is to say the payload of the packet is lost).
  Here's the example code:</p>
  
  <pre><code>from scapy.all import PcapReader
  from scapy.all import PcapWriter
  
  def test():
      f = "input.pcap"
      writers = PcapWriter("output.pcap")
  
      with PcapReader(f) as pcap_reader:
          for pkt in pcap_reader:
              # somehow change the IP address
              writers.write(pkt=pkt)
  
  test()
  </code></pre>
  
  <p>When I open the .pcap file with WireShark, it shows "The capture file appears to have been cut short in the middle of a packet". 
  Is there any solution in scapy to maintain the payload or is there any other python packets to recommand?</p>
  
  <p>here I did not change anything and the results are like this:
  input file:
  <a href="https://i.stack.imgur.com/qxfuA.png" rel="nofollow noreferrer">enter image description here</a></p>
  
  <p>output file:
  <a href="https://i.stack.imgur.com/nwkU9.png" rel="nofollow noreferrer">enter image description here</a></p>