[ovs-dev] [PATCH] ofp-print: Omit timestamp when printing packets in ofp_packet_to_string().

Ben Pfaff blp at nicira.com
Mon Mar 14 16:46:30 UTC 2011


There's no value in the timestamp here, because it will always be the
same.  Printing it just makes results less reproducible because output
then depends on the time zone.

This fixes a test failure in California due to yesterday's DST change,
and presumably a test failure almost everywhere else all the time.

Reported-by: Andrew Evans <aevans at nicira.com>
---
 lib/ofp-print.c    |    2 +-
 tests/ofp-print.at |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/ofp-print.c b/lib/ofp-print.c
index d4f33da..b4e6918 100644
--- a/lib/ofp-print.c
+++ b/lib/ofp-print.c
@@ -82,7 +82,7 @@ ofp_packet_to_string(const void *data, size_t len, size_t total_len OVS_UNUSED)
     }
     rewind(pcap);
 
-    snprintf(command, sizeof command, "/usr/sbin/tcpdump -e -n -r /dev/fd/%d 2>/dev/null",
+    snprintf(command, sizeof command, "/usr/sbin/tcpdump -t -e -n -r /dev/fd/%d 2>/dev/null",
              fileno(pcap));
     tcpdump = popen(command, "r");
     fclose(pcap);
diff --git a/tests/ofp-print.at b/tests/ofp-print.at
index af5249b..d9ec6e8 100644
--- a/tests/ofp-print.at
+++ b/tests/ofp-print.at
@@ -230,7 +230,7 @@ dnl so trim off the end of the line where differences appear.
 AT_CHECK([sed 's/\(length 60:\).*/\1 .../' stdout], [0], [dnl
 OFPT_PACKET_IN (xid=0x0): total_len=60 in_port=3 data_len=60 buffer=0x00000111
 tunnel0:in_port0003:tci(0) mac50:54:00:00:00:05->50:54:00:00:00:06 type0800 proto6 tos0 ip192.168.0.1->192.168.0.2 port10031->0
--8:00:00.000000 50:54:00:00:00:05 > 50:54:00:00:00:06, ethertype IPv4 (0x0800), length 60: ...
+50:54:00:00:00:05 > 50:54:00:00:00:06, ethertype IPv4 (0x0800), length 60: ...
 ])
 AT_CLEANUP
 
-- 
1.7.1




More information about the dev mailing list