aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap
AgeCommit message (Collapse)AuthorFilesLines
2020-10-22Use wtap_uses_interface_ids() to check if IDBs are necessary.Guy Harris1-1/+1
Use that, rather than specifically checking for pcapng.
2020-10-22editcap, tshark: process IDBs in the middle of input files.Guy Harris5-27/+113
Instead of grabbing the set of IDBs found at open time, have a loop using wtap_get_next_interface_description() to read all unread IDBs run after opening the input file, after reading a packet from the input file, and after getting an EOF on the input file. Add a routine wtap_uses_interface_ids() to check whether the file type and subtype for a dump file uses interface IDs and requires IDBs. If so, in the aforementioned loop, add the IDBs to the dump stream. Add a routine wtap_dump_add_idb() to add IDBs to a dump stream. Have it call a file-format-specific routine to add the IDBs; the only file type that supports it is pcapng, and it 1) writes out the IDB and 2) adds it to the set of IDBs for the stream. Add a wtap_dump_params_init_no_idbs() routine that prevents the IDBs from the input file from being used to initialize the output file; use it in cases where we're using the aforementioned loop to copy over IDBs. Don't require any IDBs to be present when opening a pcapng file for writing; 1) the simplest pcapng file has just an SHB in it, 2) that requirement causes dumps that don't provide IDBs at open time to fail, and 3) the real issue is that we don't want packets with an interface ID not corresponding to a known IDB, and we already have a check for that. (There are some hacks here; eventually, when everything processes the IDBs in such a loop, we may be able to get rid of the "two favors of dump parameter initialization" hack.) Fixes #15844. Addresses the same issue in #15502, but there are other issues there that also need to be addressed. In addition, the merge code also needs to be changed to handle this.
2020-10-21Add a routine to make a newly-allocated copy of a block.Guy Harris4-8/+19
It currently wraps wtap_block_create() and wtap_block_copy(); if there are no remaining use cases for wtap_block_copy() at some point, it can just *replace* wtap_block_copy().
2020-10-21Add a routine to get the next as-yet-unfetched interface description.Guy Harris4-0/+41
In a wtap, keep track of the first interface description not yet fetched with wtap_get_next_interface_description() and, when wtap_get_next_interface_description() is called, have it return that description, as a wtap_block_t for its IDB. If there are no as-yet-unfetched interface descriptions, return NULL; there may, in the future, be more interface descriptions for the file, so this should be called: * after the file is opened; * after wtap_read() returns TRUE, indicating that it's returned a record (and *before* you process the record that wtap_read() returns, as it might be the interface description for the interface on which the packet in that record arrived); * after wtap_read() returns FALSE, indicating an EOF or an error return (as there might have been interfaces at the end of the file or before the error point). At each of those points, the caller should loop until wtap_get_next_interface_description() returns NULL. Not used yet (but tested with capinfos, which found a reason why you have to wait until the end of the file before processing the interface information - there's now a comment in the code giving that reason). This will probably be used in the future.
2020-10-20Add an API to determine whether a file type uses interface IDs.Guy Harris3-1/+26
Currently, the only file types that use them are pcapng and IBM's iptrace; we don't support writing the latter, so this is mainly of interest for pcapng. This makes it a bit more obvious what some "is this pcapng?" tests are really trying to determine, and allows them to automatically support any new file types that use them. (With regard to interface descriptions, tere are three types of file: 1) files that contain no interface information; 2) files that contain "just FYI" interface information but that don't tie packets or other records to particular interfaces; 3) files that contain interface information and tie all packets (and possibly other records) to an interface. This tests for files of type 3.)
2020-10-19Include <stdint.h> in YACC/Bison parsers if necessary.Guy Harris1-0/+14
MSVC doesn't, by default, define __STDC_VERSION__, which means that the code generated by newer versions of winflexbison3's Bison end up defining YYPTRDIFF_T as long, which is wrong on 64-bit Windows, as that's an LLP64 platform, not an LP64 platform, and causes warnings to be generated. Those warnings turn into errors. With MSVC, if __STDC_VERSION__ isn't defined, Forcibly include <stdint.h> here to work around that. Fixes #16924.
2020-10-19CMake: Configure our .y files for different Bison/YACC flavors.Gerald Combs1-5/+5
Bison 3.4 and later generate deprecation warnings for the "%pure-parser" directive. As https://git.savannah.gnu.org/cgit/bison.git/tree/NEWS says, ---- ** Deprecated features The %pure-parser directive is deprecated in favor of '%define api.pure' since Bison 2.3b (2008-05-27), but no warning was issued; there is one now. Note that since Bison 2.7 you are strongly encouraged to use '%define api.pure full' instead of '%define api.pure'. ---- Rename our .y files to .y.in, and modify FindYACC.cmake to detect newer versions of Bison and configure our .y files with "%pure-parser" or "%define api.pure" as needed. Squelches warnings from Bison in #16924.
2020-10-14Have WTAP_ERR_INTERNAL include an err_info string giving details.Guy Harris49-157/+194
That way, users won't just see "You got an internal error", the details will be given, so they can report them in a bug.
2020-10-11Fix many spelling errorsРоман Донченко22-48/+48
2020-10-03Update URLs pointing to the bug database.Guy Harris4-5/+6
Switch from bugs.wireshark.org to the GitLab issues list.
2020-10-03Nettrace: Fix fix to calculation of changetimeGuy Harris1-1/+1
A long time ago, in a galaxy far far away, C had arithmetic/logical- plus-assignment operators, so that a = a {op} x; could be written as a ={op} x; Unfortunately, if {op} is -, that meant that you could have, for example: a =- 17; which could be interpreted as a = -17; so they changed the operators to be a {op}= x; I.e., if you want to subtract 1000 from a variable, do elapsed_ms -= 1000; not elapsed_ms =- 1000;
2020-10-03Nettrace: Fix calculation of changetimeAnders Broman1-11/+17
Closes #16869 (closed)
2020-10-02Clean up URLs.Guy Harris1-1/+1
Add ui/urls.h to define some URLs on various of our websites. Use the GitLab URL for the wiki. Add a macro to generate wiki URLs. Update wiki URLs in comments etc. Use the #defined URL for the docs page in WelcomePage::on_helpLabel_clicked; that removes the last user of topic_online_url(), so get rid of it and swallow it up into topic_action_url().
2020-09-07Yet more spelling fixes.Martin Mathieson1-1/+1
Includes small updates to the script and wireshark dictionary. Probably the last spelling fixes from me for a while.
2020-09-05Tools: Clean up checkAPI and add ui/qt.Gerald Combs1-1/+0
Remove the --check-addtext and --build flags. They were used for checkAddTextCalls, which was removed in e2735ecfdd. Add the sources in ui/qt except for qcustomplot.{cpp,h}. Fix issues in main.cpp, rtp_audio_stream.cpp, and wireshark_zip_helper.cpp. Rename "index"es in packet-usb-hid.c.
2020-08-24wiretap: add Z-Wave Serial API frame type and pcap link-layer headerMikhail Gusarov3-0/+7
This header type was added to pcap registry a year ago: https://lists.sandelman.ca/pipermail/tcpdump-workers/2019-July/001268.html
2020-08-10Bluetooth: simple HCI ISO Data packet dissectorJakub Pawlowski1-0/+1
Change-Id: I2da85d4ebe069a566943896fddb31e9a095d67b5 Reviewed-on: https://code.wireshark.org/review/38007 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-08-09wiretap: have wtap_dump_flush(), and its callers, check for errors.Guy Harris2-5/+12
Change-Id: Ibcddf1a949f775afa49d36a2d165c3685556035d Reviewed-on: https://code.wireshark.org/review/38104 Petri-Dish: Guy Harris <gharris@sonic.net> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <gharris@sonic.net>
2020-08-07netmon: handle non-monitor-mode 802.11 packets differently.Guy Harris2-2/+9
Microsoft Network Monitor lets you capture on an 802.11 adapter either in monitor mode or in non-monitor mode; frames captured in non-monitor mode may have the Protected bit set in the 802.11 header, but are decrypted and don't incclude encryption information, and may have the A-MSDU Present flag set in the QoS Control field, but have just a regular frame payload, not a sequence of A-MSDUs, in the payload field. Dissect those frames correctly. Bug: 16758 Change-Id: I42b7e9ce52faa80222692403fa7276c039644343 Reviewed-on: https://code.wireshark.org/review/38082 Petri-Dish: Guy Harris <gharris@sonic.net> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <gharris@sonic.net>
2020-08-04wiretap: fix an internal routine's name.Guy Harris1-5/+5
generate_merged_idb() can generate multiple IDBs, so rename it to generate_merged_idbs(). Change-Id: I4c54326f69ff0de16f0a716b7c82beefdda99cbd Reviewed-on: https://code.wireshark.org/review/38040 Reviewed-by: Guy Harris <gharris@sonic.net>
2020-08-03wiretap: Adjust the pcapng systemd Journal length check.Gerald Combs2-4/+9
Reduce the minimum systemd journal block size from 212 to 35. The larger minimum was based on the Journal Export Format file reader, but we don't need to be as strict here. Update some comments. Bug: 16734 Change-Id: Iad7227f29ff22f908e2fd49be0f11c9ad03fa7b9 Reviewed-on: https://code.wireshark.org/review/38035 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-07-29wiretap: have the file's time stamp resolution be a dump parameter.Guy Harris3-1/+33
Add a tsprec value to the wtap_dump_params structure, giving the per-file time stamp precision. In wtap_dump_init_dumper(), when constructing a dummy IDB for files that don't have one, fill in the tsprecision and time_units_per_second values based on the tsprec value in the wtap_dump_params structure. Change-Id: I3708b144d4d0ac0dfbe32bd1c16768a75c942141 Reviewed-on: https://code.wireshark.org/review/37979 Petri-Dish: Guy Harris <gharris@sonic.net> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-07-29wiretap: generate fake IDBs for more capture file types.Guy Harris37-6/+317
That makes them work as input to a mergecap that writes pcapng files. File types that don't have a single per-file encapsulation type need more work, with multiple fake IDBs, one for each packet encapsulation type seen in the file, unless we can generate real IDBs. Change-Id: I2859e4f7fb15ec0c0f31a4044dc15638e5db7826 Reviewed-on: https://code.wireshark.org/review/37983 Petri-Dish: Guy Harris <gharris@sonic.net> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <gharris@sonic.net>
2020-07-29wiretap: add a routine to add a "fake" IDB.Guy Harris3-18/+106
It generates a fake IDB for files that don't have interface information and that have a per-file encapsulation type, snapshot length, and time stamp precision, and adds it to the file's list of IDBs. Use it for libpcap. We will use it later for other file formats, so that code such as the mergecap code to merge into a pcapng file can handle input files that don't have interface information. (We should have a way to indicate whether the IDBs are real or fake, so that capinfos and Statistics > Capture File Properties don't report meaningless IDB information and make it look as if it's known that the capture was done on one interface with the properties in question.) Change-Id: Iec124bf3c7cbd4c69ec2ac7d0dd776e5287f8576 Reviewed-on: https://code.wireshark.org/review/37982 Petri-Dish: Guy Harris <gharris@sonic.net> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <gharris@sonic.net>
2020-07-27iptrace: supply packet direction.Guy Harris1-2/+10
Change-Id: If28f04a34be6ec35e4fc60b2add129ca916d5ebd Reviewed-on: https://code.wireshark.org/review/37976 Petri-Dish: Guy Harris <gharris@sonic.net> Tested-by: Petri Dish Buildbot Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl>
2020-07-27iptrace: generate IDBs.Guy Harris1-18/+195
The packet information for a packet includes an interface name prefix and an interface unit number (e.g., "en0", with a prefix of "en" and a unit number of 0). Keep a hash table of prefixes, unit numbers, and link-layer header types (as an interface must have only one link-layer header type), and, for each packet, look up that information from the packet information to get the interface ID; if that fails, construct a new entry, with a new interface ID, and an IDB for the interface. Change-Id: I3f2dafcc8926fe96fe4ffd6875f583397b1582b6 Reviewed-on: https://code.wireshark.org/review/37975 Petri-Dish: Guy Harris <gharris@sonic.net> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <gharris@sonic.net>
2020-07-27iptrace: various cleanups.Guy Harris1-85/+136
Call the "iptrace X.Y" string we read in the version string, rather than the name. Get rid of the structures defining various parts of the file format. Instead, have #defines for offsets. Read the record header - the first 8 octets - first. Check the record length, to make sure it's large enough to include the packet information structure, before we try to read that structure. Note that one octet in the packet information structure is the unit number for the interface on which the packet arrived, the field that was called the name is the prefix of the name (in the sense that, for example, in "en0", "en" is the prefix and "0" is the unit number), and that what was called the "description" isn't as simple as a description of the interface on which the packet arrived. Pass the field that was called the "description" to fill_in_pseudo_header(), as, for ATM PDUs, it contains, among other things, an indication of the VPI and VCI for the PDU, as well as a direction indication. Change-Id: I8703b046142dd41ca96bda00c2fa3d2edb66b837 Reviewed-on: https://code.wireshark.org/review/37974 Petri-Dish: Guy Harris <gharris@sonic.net> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <gharris@sonic.net>
2020-07-25ISDN, LAPD: clean up the way they connect to other dissectors.Guy Harris1-34/+1
Have the ISDN dissector take the ISDN pseudo-header through its data argument, rather than assuming it's in pinfo->pseudo_header, so it can be used if the link-layer type of the capture isn't ISDN. Have it add the direction to its protocol tree, so it's there for all ISDN packets. Have more versions of the LAPD dissector: one where the ISDN direction information is available through an ISDN pseudo-header passed as its data argument; one for use when the link-layer type *is* LAPD, where the ISDN direction information may be available through the direction part of the packet flags. Pass more flags to the routine that does LAPD dissection to indicate the direction (user->network or network->user) and whether the user or network side is on another machine; set those appropriately in the dissector routines that call it. To set those flags: in the routine that handles WTAP_ENCAP_LAPD, check the direction flags in pinfo->rec->rec_header.packet_header.pack_flags; in the routine that handles WTAP_ENCAP_LINUX_LAPD, check the SLL header; in the routine that's called from the ISDN dissector and other dissectors that can supply an ISDN pseudo-header, check the struct isdn_phdr passed to it via the data argument; for the routine that's to be called from L2TP pseudowire type and SCTP dissector tables, pass nothing, as there's currently no direction indication supplied - if that information is available from the encapsulating protocol in some fashion, we should make changes to supply that information. Have the AudioCodes Trunk trace protocol dissector call the LAPD-with-pseudoheader dissector, handing it an ISDN pseudo-header with a direction indication from the direction field (and a channel of 0 to indicate the D channel). Have the Ascend text dump reader in libwiretap use WTAP_ENCAP_ASCEND for all packets, even Ethernet and ISDN packets, and have the Ascend text dump dissector handle that, calling the "no FCS" version of the Ethernet dissector and calling the LAPD-with-pseudoheader dissector with a pseudo-header filled in with the direction (and a channel of 0). Have the Catapult DCT 2000 text dump dissector call the LAPD-with-pseudoheader dissector with the pseudo-header supplied by libwireshark. Have the V5 envelope function frame get its ISDN pseudo-header from its data argument, and call the LAPD-with-pseudoheader dissector with that pseudo-header. Have the ISDN dissector treat its data argument as pointing to the ISDN pseudo-header, rather than assuming it's the one in pinfo->pseudo_header->isdn - the latter is the one supplied by libwiretap, but there's no guarantee that an ISDN pseudo-header was supplied by libwiretap, as the lowest-level protocol layer might not have been ISDN. Change-Id: I9f702b879bbc3fb42bcb43c28f797bfc327562c6 Reviewed-on: https://code.wireshark.org/review/37953 Petri-Dish: Guy Harris <gharris@sonic.net> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <gharris@sonic.net>
2020-07-22ascend: update a comment.Guy Harris1-1/+8
Change-Id: I652a033132a90b10421e763cfbe4b47ae4e6087a Reviewed-on: https://code.wireshark.org/review/37924 Reviewed-by: Guy Harris <gharris@sonic.net>
2020-07-21nettl: user IDs are 32-bit in HP-UX.Guy Harris2-4/+5
Also note that the record header might have additional stuff at the end, although not all record headers do (the header length will indicate what's there). Change-Id: I5a9ff1f9cd592448bcc45d18808f4b651cdb2f0d Reviewed-on: https://code.wireshark.org/review/37921 Petri-Dish: Guy Harris <gharris@sonic.net> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <gharris@sonic.net>
2020-07-14Systemd journal: Fix timestamp conversions.Gerald Combs1-3/+6
Use ws_strtou64 to convert __REALTIME_TIMESTAMP= and other timestamps, which should work across platforms. Bug: 16664 Change-Id: I371f2b60e1957e57dbbdbbc3ded5ad49e8eb79d1 Reviewed-on: https://code.wireshark.org/review/37849 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-07-06Nettrace: Try to fix -Wpointer-sign warnings.Anders Broman1-9/+9
Change-Id: Ib2fe089939513f2fa32235312cdc70c9148cdfc3 Reviewed-on: https://code.wireshark.org/review/37723 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-07-05mplog: increase the max packet length to 4096Martin Kaiser1-1/+1
iso14443 packets can now be up to 4k long. Change-Id: I120e18146cc40c0e9230c654cc31072e03ad3489 Reviewed-on: https://code.wireshark.org/review/37691 Reviewed-by: Martin Kaiser <wireshark@kaiser.cx> Petri-Dish: Martin Kaiser <wireshark@kaiser.cx> Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-07-02Packetlogger: check for more packet types in the libwiretap heuristics.Guy Harris1-1/+36
As we're now checking the first *few* packets of the file, we must allow *all* Packetlogger packet types when checking whether the purported packet type is valid. Put a note in the Packetlogger dissector so that, if anybody adds a new packet type, they know that they have to add it to the reader code as well. Bug: 16670 Change-Id: Id83493f678182fd3e1b5537f4dfa295fe26dfcb1 Reviewed-on: https://code.wireshark.org/review/37675 Petri-Dish: Guy Harris <gharris@sonic.net> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <gharris@sonic.net>
2020-06-21pcapng: add support for new Enhanced Packet Block optionsEelco Chaudron3-1/+225
Add support to read/write the new EPB options, epb_packetid, epb_queue and epb_verdict, from/to pcap files. In addition, it updates the packet-frame dissector to dissect these new fields. More details on the options can be found in the PcapNG specification: https://github.com/pcapng/pcapng An application using these new fields can be found here: https://github.com/chaudron/xdp-tools/tree/dev/pcapngII/xdp-dump Change-Id: I761b8114b437fe573dd2c750e35586ad88494938 Signed-off-by: Eelco Chaudron <echaudro@redhat.com> Reviewed-on: https://code.wireshark.org/review/37412 Petri-Dish: Anders Broman <a.broman58@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-06-17ascend: add a couple of comments.Guy Harris1-3/+5
Change-Id: I92a84087122e3997f7d2481f82f955987cf8f8dd Reviewed-on: https://code.wireshark.org/review/37494 Reviewed-by: Guy Harris <gharris@sonic.net>
2020-06-02Squelch a Coverity warning.Guy Harris1-1/+3
I guess Coverity gets upset because, the way GUINT32_TO_BE() works when building with Coverity, there's at least one test done the result of which is always the same. Calculate the "native" value of the direction, and then put it into big-endian order, in two separate statements. This should squelch Coverity CID 1457345. Change-Id: I1ccd6fd848e6abc91f16fa375c98efcab9c5bf60 Reviewed-on: https://code.wireshark.org/review/37370 Petri-Dish: Guy Harris <gharris@sonic.net> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <gharris@sonic.net>
2020-06-01editcap: fix time adjustment for ERFMinh Phan1-0/+20
The erf_dump function in erf.c keeps the header intact and ignores the adjusted time. This adds a section for checking if the timestamp is changed and updating the header accordingly. Bug: 16578 Change-Id: I14468a302e746c7a84cf5619b73b94850142d930 Reviewed-on: https://code.wireshark.org/review/37301 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
2020-05-27ieee80211: Add datarate for 802.11AX packetsGlenden Lee1-0/+16
Bug: 16255 - support HE MCS to rate conversion Change-Id: I4a4a6c3d62c167b654d150c397047a55f287e6c8 Reviewed-on: https://code.wireshark.org/review/37255 Petri-Dish: Guy Harris <gharris@sonic.net> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <gharris@sonic.net>
2020-05-09sll: add support for LINKTYPE_LINUX_SLL2.Guy Harris3-2/+9
Different header, with a different size, an additional field, and with fields being in a different order. Distinguish between V1 and V2 by giving the version. That means we can no longer use the "ethertype" dissector as it stands, because the packet type field isn't at the end of the header, right before the payload; pull the "add the type field to the protocol tree" functionality out of the "ethertype" dissector and leave it up to the dissector calling it. Change-Id: I72b8a2483c0a539919fbe5d35fd7e60bff4bf75a Reviewed-on: https://code.wireshark.org/review/37169 Petri-Dish: Guy Harris <gharris@sonic.net> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <gharris@sonic.net>
2020-05-08Add an encapsulation table entry for WTAP_ENCAP_MP4.Guy Harris1-0/+3
Change-Id: Ia156359e68fbf543f00e8106ad76f9cf9532d3d8 Reviewed-on: https://code.wireshark.org/review/37166 Reviewed-by: Guy Harris <gharris@sonic.net>
2020-05-02wiretap: move the "fake an IDB for pcap files" code to libpcap.c.Guy Harris2-23/+41
That can just be done at the end of libpcap_open(), rather than in wtap_open_offline() immediately after the open routine - which, in this case, would be libpcap_open() - returns. That's cleaner, as it puts capture-file-type-dependent code in the capture-file-type-specific code. Note, though, that it's a bit weird for LINKTYPE_ERF files (and it was equally weird before this change), and that other capture file types should be doing this as well. Change-Id: Ida94779a2e1021c81314f82655ec1d0f2f14e960 Reviewed-on: https://code.wireshark.org/review/37022 Petri-Dish: Guy Harris <gharris@sonic.net> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <gharris@sonic.net>
2020-05-02ERF: split wiretap/erf.h into three files.Guy Harris6-347/+424
wiretap/erf_record.h has declarations for records in ERF files and in LINKTYPE_ERF packets in pcap and pcapng files. wiretap/erf-common.h has declarations of routines to be called by pcap/pcapng reader code when processing LINKTYPE_ERF packets. wiretap/erf.h is what's left, for use by wiretap/erf.c and the code with the tables of file readers and writers. Change-Id: Ia982e79b14a025a80dcbc7c812fb3b2cdb9c6aaa Reviewed-on: https://code.wireshark.org/review/37021 Petri-Dish: Guy Harris <gharris@sonic.net> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <gharris@sonic.net>
2020-05-02wiretap/erf: Get rid of no-longer-used routine.Guy Harris2-49/+0
I guess the "replace" part of "TODO: Replace uses in pcapng and pcap with erf_read_header() and/or erf_populate_interface_from_header() and delete." has been done, so we do the "delete" part. Change-Id: Icd691aa8c3defdd68c306ad9eaf1379a8ba6ec0f Reviewed-on: https://code.wireshark.org/review/37020 Petri-Dish: Guy Harris <gharris@sonic.net> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <gharris@sonic.net>
2020-05-02wiretap: add a routine that adds a wtap_block_t for an IDB to a wtap.Guy Harris5-4/+15
Change-Id: I0a2e09bc3d1a858a304ded0c42be6bf09034812e Reviewed-on: https://code.wireshark.org/review/37019 Petri-Dish: Guy Harris <gharris@sonic.net> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <gharris@sonic.net>
2020-05-01wiretap: combine common code into a common routine.Guy Harris1-13/+14
Change-Id: I7329bea02e2264ffb70515b681609bff91575267 Reviewed-on: https://code.wireshark.org/review/37012 Petri-Dish: Guy Harris <gharris@sonic.net> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <gharris@sonic.net>
2020-05-01mpeg: make sure the presence flags are set.Guy Harris1-1/+2
The time stamps are calculated by sequential processing, not read from a value in the packet record, so we don't supply them when reading randomly. Make sure the presence flags are 0 in that case (our callers currently don't look at time stamps when reading randomly, because some other file formats also don't supply time stamps for random reads, but we should make it clean). Change-Id: I494acc5bdf60e0a1de5cf002c3ea8403afce8a07 Reviewed-on: https://code.wireshark.org/review/37008 Reviewed-by: Guy Harris <gharris@sonic.net>
2020-05-01camins: make sure the presence flags are set.Guy Harris1-0/+1
The time stamps are calculated by sequential processing, not read from a value in the packet record, so we don't supply them when reading randomly. Make sure the presence flags are 0 in that case (our callers currently don't look at time stamps when reading randomly, because some other file formats also don't supply time stamps for random reads, but we should make it clean). Change-Id: Ic035cc7d4eb36f76beefcfd98a389af09365d363 Reviewed-on: https://code.wireshark.org/review/37004 Reviewed-by: Guy Harris <gharris@sonic.net>
2020-05-01Remove some single-SHB assumptions.Guy Harris2-8/+24
Make wtap_file_get_shb() take a section number argument, and update code that called it. In most cases, we convert the code to iterate over sections; in cases where a big code change would be required, we temporarily pass it 0 and mark the code as "needs to be updated for multiple sections". Eliminate cf_read_section_comment(); in calls outside file.c, other code directly calls the libwiretap routines it calls and, inside file.c, we just transplant the code and then fix it not to assume a single SHB. Change-Id: I85e94d0a4fc878e9d937088759be04cb004e019b Reviewed-on: https://code.wireshark.org/review/37000 Petri-Dish: Guy Harris <gharris@sonic.net> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <gharris@sonic.net>
2020-04-30pcapng: have per-section interface tables rather than per-file.Guy Harris1-21/+34
This moves us closer to fixing bug 16531; it addresses the second issue there, as the right snapslen is used for packets in the second section, so we no longer get errors reading the file. It still doesn't fix the *names* of the interfaces, and it doesn't - and *shouldn't* - show the interfaces with different interface numbers, as the numbers are per-section rather than global. Change-Id: Ia3aa3309b75a4bcd9f229048ddce6a981b9409b1 Ping-Bug: 16531 Reviewed-on: https://code.wireshark.org/review/36985 Petri-Dish: Guy Harris <gharris@sonic.net> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <gharris@sonic.net>