dataplane: copy buffer returned by pypcap
When reading packets pypcap always returns a pointer to the same statically
allocated memory, which will be overwritten the next time a packet is read. I
believe this is a bug in pypcap. The workaround is to make a copy immediately.
diff --git a/src/python/oftest/dataplane.py b/src/python/oftest/dataplane.py
index 12dcfce..740e6aa 100644
--- a/src/python/oftest/dataplane.py
+++ b/src/python/oftest/dataplane.py
@@ -126,7 +126,7 @@
def recv(self):
(timestamp, pkt) = next(self.pcap)
- return (pkt, timestamp)
+ return (pkt[:], timestamp)
def send(self, packet):
return self.pcap.inject(packet, len(packet))