Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-commits: [Wireshark-commits] master 3aec5e1: Catch attempts to write multiple encapsulati

From: Wireshark code review <code-review-do-not-reply@xxxxxxxxxxxxx>
Date: Wed, 14 Nov 2018 03:38:50 +0000
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=3aec5e1a2882a04aae33207750e9053d5f73174b
Submitter: "Guy Harris <guy@xxxxxxxxxxxx>"
Changed: branch: master
Repository: wireshark

Commits:

3aec5e1 by Guy Harris (guy@xxxxxxxxxxxx):

    Catch attempts to write multiple encapsulation types if unsupported.
    
    If, in the process of opening the input file, we determine that it has
    packets of more than one link-layer type, we can catch attempts to write
    that file to a file of a format that doesn't support more than one
    link-layer type at the time we try to open the output file.
    
    If, however, we don't discover that the file has more than one
    link-layer type until we've already created the output file - for
    example, if we have a pcapng file with a new IDB, with a different
    link-layer type from previous IDBs, after packet blocks for the earlier
    interfces - we can't catch that until we try to write the packet.
    
    Currently, that causes the packet's data to be written out as is, so the
    output file claims it's of the file's link-layer type, causing programs
    reading the file to misdissect the packet.
    
    Report WTAP_ERR_ENCAP_PER_PACKET_UNSUPPORTED on the write attempt
    instead, and have a nicer error message for
    WTAP_ERR_ENCAP_PER_PACKET_UNSUPPORTED on a write.
    
    Change-Id: Ic41f2e4367cfe5667eb30c88cc6d3bfe422462f6
    Reviewed-on: https://code.wireshark.org/review/30617
    Reviewed-by: Guy Harris <guy@xxxxxxxxxxxx>
    

Actions performed:

    from  25bbbd7   Give an error if an output file isn't specified.
     add  3aec5e1   Catch attempts to write multiple encapsulation types if unsupported.


Summary of changes:
 ui/alert_box.c                | 11 +++++++++++
 ui/failure_message.c          | 11 +++++++++++
 wiretap/5views.c              |  9 +++++++++
 wiretap/btsnoop.c             | 19 +++++++++++++++++++
 wiretap/k12.c                 |  9 +++++++++
 wiretap/lanalyzer.c           |  9 +++++++++
 wiretap/libpcap.c             |  9 +++++++++
 wiretap/logcat.c              |  9 +++++++++
 wiretap/logcat_text.c         |  9 +++++++++
 wiretap/network_instruments.c |  9 +++++++++
 wiretap/netxray.c             | 18 ++++++++++++++++++
 wiretap/ngsniffer.c           |  9 +++++++++
 wiretap/snoop.c               |  9 +++++++++
 wiretap/visual.c              |  9 +++++++++
 14 files changed, 149 insertions(+)