[Ns-bugs] [Bug 329] pcap files generated in native win32 (mingw) are always corrupt
code@nsnam.ece.gatech.edu
code at nsnam.ece.gatech.edu
Tue Jan 13 12:39:42 PST 2009
http://www.nsnam.org/bugzilla/show_bug.cgi?id=329
Guillaume Vu-Brugier <gvubrugier at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |gvubrugier at gmail.com
--- Comment #6 from Guillaume Vu-Brugier <gvubrugier at gmail.com> 2009-01-13 15:39:42 EDT ---
(In reply to comment #5)
> From ascii(7) manpage:
>
> 012 10 0A LF ’\n’ (new line) 112 74 4A J
> 013 11 0B VT ’\v’ (vertical tab) 113 75 4B K
> 014 12 0C FF ’\f’ (form feed) 114 76 4C L
> 015 13 0D CR ’\r’ (carriage ret) 115 77 4D M
>
> So the extra 0x0d's are carriage returns.
>
> I suspect this could be a result of the pcap file being opened in text mode by
> default, in particular in PcapWriter::Open. See
> http://www.cplusplus.com/doc/tutorial/files.html
>
> """
> Text file streams are those where we do not include the ios::binary flag in
> their opening mode. These files are designed to store text and thus all values
> that we input or output from/to them can suffer some formatting
> transformations, which do not necessarily correspond to their literal binary
> value.
> """
>
You are right, changing the following line in pcap-writer.cc gave me the
reference traces using ns-3.2 and MingW:
m_writer->open (name.c_str (),std::ios_base::binary|std::ios_base::out);
I can't provide a patch as I couldn't build a more recent release or ns-3-dev
on my machine, but it seems that opening files in binary mode is definitively
the solution.
Should ns-3-dev build with MingW ?
--
Configure bugmail: http://www.nsnam.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the Ns-bugs
mailing list