pcap files with nanosecond resolution use a different magic number in
the pcap header than those with microsecond resolution.

Signed-off-by: Mark Michelson <mmich...@redhat.com>
---
 utilities/ovs-pcap.in | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/utilities/ovs-pcap.in b/utilities/ovs-pcap.in
index fc1532110..7bebc0795 100755
--- a/utilities/ovs-pcap.in
+++ b/utilities/ovs-pcap.in
@@ -34,13 +34,14 @@ class PcapReader(object):
             raise PcapException("end of file reading pcap header")
         magic, version, thiszone, sigfigs, snaplen, network = \
             struct.unpack(">6I", header)
-        if magic == 0xa1b2c3d4:
+        if magic == 0xa1b2c3d4 or magic == 0xa1b23c4d:
             self.header_format = ">4I"
-        elif magic == 0xd4c3b2a1:
+        elif magic == 0xd4c3b2a1 or magic == 0x4d3cb2a1:
             self.header_format = "<4I"
         else:
             raise PcapException("bad magic %u reading pcap file "
-                        "(expected 0xa1b2c3d4 or 0xd4c3b2a1)" % magic)
+                        "(expected 0xa1b2c3d4, 0xa1b23c4d, 0x4d3cb2a1 or "
+                        "0xd4c3b2a1)" % magic)
 
     def read(self):
         header = self.file.read(16)
-- 
2.14.4

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to