Commit Graph

1659 Commits

Author SHA1 Message Date
Guy Harris 9dc26776e4 Add support for writing WTAP_ENCAP_PER_PACKET files; they are written
out in version 2.1 of the file format (the minimum version to support
that).

Change some data types to avoid having file offsets that are before the
beginning of the file.

Clean up some other data types and some comments.

svn path=/trunk/; revision=39898
2011-11-17 09:03:09 +00:00
Guy Harris f3a88d4084 Return *some* error if we end up trying to seek before the beginning of
the file, so you don't get weird random errors.  EINVAL is as good as
anything.

svn path=/trunk/; revision=39896
2011-11-17 06:36:32 +00:00
Guy Harris eacdf1d46f Put back the check for dates that can be represented in DOS format the
way it was *supposed* to be done, rather than backwards.

svn path=/trunk/; revision=39895
2011-11-17 02:29:26 +00:00
Chris Maynard 6f2dc712b9 Revert part of r39883 to avoid dereferencing a NULL pointer. Thanks Clang.
svn path=/trunk/; revision=39894
2011-11-17 02:17:57 +00:00
Guy Harris 8281a7d28e Support nanosecond-resolution time for NetMon 2.x format (it's only
100-nanosecond resolution, but that's still better than microsecond
resolution).

For NetMon 1.x format, only claim to support millisecond resolution, as
that's all you get.

Fix handling of negative time deltas in NetMon 2.x format.

When writing a NetMon file, trim the time of the first packet to
millisecond precision to get the capture start time, so that the start
time written to the file (which has millisecond precision) is the same
as the start time used to calculate the deltas written to the packet
headers.

svn path=/trunk/; revision=39886
2011-11-16 17:54:44 +00:00
Guy Harris 234d0b9614 OK, this should do it.
svn path=/trunk/; revision=39885
2011-11-16 17:13:37 +00:00
Guy Harris 8be474f776 Fix build on Windows.
svn path=/trunk/; revision=39884
2011-11-16 17:12:47 +00:00
Guy Harris 163edbb507 Another place where we have to protect against MSVC's time-conversion
routines blowing up if handed a too-large time_t.

While we're at it, also check for dates that can't be represented in DOS
format (pre-1980 dates).

svn path=/trunk/; revision=39883
2011-11-16 17:08:00 +00:00
Guy Harris 5ceeb22529 Another place where we have to protect against MSVC's time-conversion
routines blowing up if handed a too-large time_t.

svn path=/trunk/; revision=39882
2011-11-16 16:48:02 +00:00
Guy Harris f5d4a4c7ba Clean up white space.
Note that we don't need to set the FCS length, but might as well do so
anyway.

svn path=/trunk/; revision=39816
2011-11-13 00:04:49 +00:00
Bill Meier 3227cade47 Add entries for WTAP_ENCAP_NETANALYZER... to encap_table_base[]
svn path=/trunk/; revision=39810
2011-11-12 20:27:32 +00:00
Anders Broman af25c3e77b From Holger Pfrommer:
Enhancement of Hilscher Analyzer Dissector.

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6082

svn path=/trunk/; revision=39804
2011-11-12 18:01:38 +00:00
Bill Meier d1d9cf61c7 Add (missing) "mime" entry to encap_table_base[].
svn path=/trunk/; revision=39796
2011-11-11 22:21:06 +00:00
Guy Harris bc3796b7ac Updates based on stuff seen in a new capture.
I'm leaving debug messages in, but #if 0'ed out, for now.

svn path=/trunk/; revision=39736
2011-11-04 23:59:07 +00:00
Guy Harris 42c2e1c57b It appears that the "packet" records are actually "stuff from the ISDN
link" records, including stuff that's from a G.704 PRI frame but not
from a D or H channel in that frame.  Handle them (currently, we ignore
them).

The low-order bit of the flags field for "packet" records" is "network
to user" (NT->TE), not "user to network" (TE->NT).

svn path=/trunk/; revision=39663
2011-10-28 22:57:33 +00:00
Guy Harris 83aed00fac The version string field isn't followed by 20 bytes of stuff; the last 8
bytes of what we thought was a version string appears to be an 8-byte
record of some sort in the captures we originally looked at, and appears
to be a non-8-byte record in another capture.  If we treat that as a
record, the version string field appears to be null-padded and 41 bytes
long.

svn path=/trunk/; revision=39645
2011-10-28 02:48:52 +00:00
Guy Harris c0db24bf4d Fix cut-and-pasteo that happened not to cause a problem on *P64
platforms but failed on *P32 platforms.

Remove the debugging code (the above was the problem in question).

svn path=/trunk/; revision=39628
2011-10-27 03:00:03 +00:00
Guy Harris a4e597b545 Add some debugging code; the current code doesn't work when compiled
with MSVC on Win32, and the fix will remove the debugging code as well.

svn path=/trunk/; revision=39624
2011-10-26 23:41:15 +00:00
Guy Harris 05269a7178 Put the magic number into the aethra_hdr structure, to avoid compiler
padding of the structure getting in the way (it should now not require
padding).

svn path=/trunk/; revision=39619
2011-10-26 20:53:27 +00:00
Guy Harris d7515bff87 Add the code to read Aethra files.
svn path=/trunk/; revision=39592
2011-10-26 04:31:06 +00:00
Guy Harris b4415758bf Ok, we found what appears to be the capture start time. Use it.
Also mark what appear to be strings in the file header.

svn path=/trunk/; revision=39591
2011-10-26 04:05:17 +00:00
Guy Harris 12e95e2cda It appears that the octet in the record header after the record length
might be a record type, with 0 being a "Stop Monitor" record and 1 being
a packet.  Ignore records other than packet records.

svn path=/trunk/; revision=39590
2011-10-26 03:14:21 +00:00
Guy Harris 72a96fc6a6 Avoid warnings.
svn path=/trunk/; revision=39589
2011-10-26 02:37:45 +00:00
Guy Harris e9ae3a0fd6 Initial support for .aps files from Aethra Telecommunications' PC108
software.  More work is needed:

	we don't know where the capture start time is yet;

	we aren't handling the "stop capture" record;

	we don't know where the ISDN channel is;

	there might be non-ISDN file formats;

but this at least is easier than trying to text2pcap hex dumps from that
software into pcap files.

svn path=/trunk/; revision=39588
2011-10-26 02:18:55 +00:00
Gerald Combs 666b58d408 From Huzaifa Sidhpurwala of Red Hat Security Response Team:
I found a heap-based buffer overflow, when parsing ERF file format.
The overflow seems to be controlled by the values read from the file, 
and hence seems exploitable to me.

svn path=/trunk/; revision=39508
2011-10-21 19:07:42 +00:00
Stig Bjørlykke 967b9086aa Removed newencap as it's unused.
svn path=/trunk/; revision=39419
2011-10-14 08:22:16 +00:00
Anders Broman 62ba07a8fc From Tobias Witek:
This patch extends the ATM parser so as to allow GPRS NS traffic encapsulated
in ATM AAL5.

Additionally, added support for this into the 'Meta' dissector.

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6447

svn path=/trunk/; revision=39394
2011-10-12 18:57:50 +00:00
Bill Meier 59e64cff77 From Robert Bullen: Fix for: Two minor bugs in Wiretap library:
First bug: The Network Instruments Observer file format abbreviation is
incorrect. It is "niobserverv" instead of "niobserver", which is probably a
vestige from 1.4 when the abbreviation was "niobserverv9".

Second bug: The packet header magic number field is correctly swapped the first
time when reading the entire packet header. It is incorrectly swapped yet again
when reporting an invalid value. Both swaps use GUINT_FROM_LE, which is a no-op
on little-endian platforms. But the error message that is displayed to users of
big-endian platforms will contain a byte-reversed value.

svn path=/trunk/; revision=39392
2011-10-12 18:04:58 +00:00
Anders Broman 6a847b1f30 From Andrew Kampjes:
Allows the saving of packets with snapped length to ERF. Prevents the adding of
automatic CRC and rounds down to the nearest 8 bytes instead of up, adding
zeros.
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6409

svn path=/trunk/; revision=39247
2011-10-04 05:27:14 +00:00
Bill Meier 781129806f Fix ex "modeline" so it works;
See https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5748

svn path=/trunk/; revision=39081
2011-09-21 17:49:11 +00:00
Martin Mathieson c5cfc416a1 Skip extra info if present (IP with LTE PDCP threading info).
svn path=/trunk/; revision=38983
2011-09-13 12:14:24 +00:00
Guy Harris d7af4e2037 Don't synthesize a CRC if the packet already has one.
svn path=/trunk/; revision=38905
2011-09-06 23:36:18 +00:00
Stig Bjørlykke 415533faaf Check return value from wtap_dump_file_write.
This fixes CID 1272.

svn path=/trunk/; revision=38876
2011-09-03 20:47:58 +00:00
Guy Harris 6ac265b512 Merge pcap_fill_in_pseudo_header() into pcap_read_post_process().
svn path=/trunk/; revision=38844
2011-09-01 19:58:25 +00:00
Guy Harris e9fc1b72aa Use guint8 rather than guchar for raw octets and pointers to arrays of
same.

Add to wiretap/pcap-common.c a routine to fill in the pseudo-header for
ATM (by looking at the VPI, VCI, and packet data, and guessing) and
Ethernet (setting the FCS length appropriately).  Use it for both pcap
and pcap-ng files.

svn path=/trunk/; revision=38840
2011-09-01 09:43:10 +00:00
Guy Harris f16a746c63 Set eth.fcs_len in the pseudo-header for Ethernet packets.
Set the pseudo-header when doing the sequential read as well as when
doing random reads.

When writing packets to a CommView file, use a slightly less contorted
way to get the year/month/day/hour/minute/second values.

commview_dump() uses the pseudo_header argument; don't mark it as
unused.

svn path=/trunk/; revision=38833
2011-09-01 04:14:54 +00:00
Guy Harris 30ec5387fa Not ideal, but OK for now - alignbytes, at that point, is < 8, so we
know it'll fit in a gint16.  (alignbytes really shouldn't need to be 64
bits, as if we have 2^63-1 bytes of alignment, We Have A Problem; fixing
that may involve calculating it differently earlier in that routine.)

svn path=/trunk/; revision=38828
2011-08-31 22:22:40 +00:00
Stig Bjørlykke ff32408b0a Try using gint64 for alignbytes.
svn path=/trunk/; revision=38827
2011-08-31 21:16:18 +00:00
Stig Bjørlykke 141a830b9f From Andrew Kampjes via bug 6260:
Added support for saving ERF files.

From me:
Use crc routines from libwsutil.

svn path=/trunk/; revision=38826
2011-08-31 20:50:15 +00:00
Guy Harris 9756ac2904 Handle multiple extension headers when calculating the pseudo-header
length, and actually write out the extension headers when writing out
the pseudo-header.

Fixes bug 6265.

svn path=/trunk/; revision=38792
2011-08-30 08:09:40 +00:00
Guy Harris 4486bb9d85 A zero snaplen means "snaplen unknown", as in "the file format from
which we read the data to be written doesn't record the snapshot
length".  A snapshot length of 0 in a pcap or pcap-ng file is not
handled well by many programs reading those files; for pcap files, we
write out WTAP_MAX_PACKET_SIZE as the snapshot length in that case, so
do so for pcap-ng files as well.

svn path=/trunk/; revision=38790
2011-08-30 06:01:44 +00:00
Jeff Morriss 339136d1d0 Based on patch from Denis Ovsienko via
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6244 :

Fix typo: s/unkown/unknown/

svn path=/trunk/; revision=38561
2011-08-16 13:16:33 +00:00
Jeff Morriss 613ddfa1cc From Hanspeter via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6229 :
If an EnhancedPacketBlock in a pcapng file contains a comment option the
content isn't displayed. Instead "Malformed packet" is displayed with the
reason Exception occurred.

The reason for the problem is a bug in the pcapng.c, where for enhanced packet
blocks, interface description blocks and interface statistics blocks the wrong
union members are used to set the comment. This way required fields in the
structures are overwritten.

The attached patch solves the problem.

svn path=/trunk/; revision=38491
2011-08-11 21:42:37 +00:00
Martin Mathieson fe28dc854a Speed up (slightly) reading of long text lines.
svn path=/trunk/; revision=37989
2011-07-12 10:49:22 +00:00
Guy Harris 4c4b8f8891 Move the definitions of LANalyzer records to lanalyzer.c.
Use LA_RecordHeaderSize rather than sizeof, to squelch some compiler
complaints.

svn path=/trunk/; revision=37956
2011-07-10 22:57:59 +00:00
Guy Harris 5e5b778a67 Define a structure for the record header, and read into that, and then
extract values from it.

svn path=/trunk/; revision=37954
2011-07-10 22:10:07 +00:00
Guy Harris 41d53a1635 At that point in the code, bytes_read isn't the total number of record
header bytes read, as we're reading the two header fields separately and
checking the byte count for each read.  We *do*, however, know that the
record header is 4 bytes long, so we can just seek back 4 bytes.

svn path=/trunk/; revision=37953
2011-07-10 21:05:19 +00:00
Martin Mathieson ece553d8d0 Change the way we scan past characters before the direction indicator.
svn path=/trunk/; revision=37940
2011-07-08 16:08:32 +00:00
Guy Harris e02cd7707d Explain a bit more what this does.
svn path=/trunk/; revision=37884
2011-07-04 01:39:13 +00:00
Stig Bjørlykke 8443bbbf75 Replace all strerror() with g_strerror().
Remove our local strerror implementation.
Mark strerror as locale unsafe API.

This fixes bug 5715.

svn path=/trunk/; revision=37812
2011-06-28 09:00:11 +00:00