aboutsummaryrefslogtreecommitdiffstats
path: root/file.c
AgeCommit message (Collapse)AuthorFilesLines
2014-03-27Fix bug9931 'Encapsulated ethernet packets sometimes show invalid FCS'Hadriel Kaplan1-1/+1
This fixes part-1 of bug9931: the uninitialized use of a wtap_pkthdr struct. The second part of the bug deals with dissectors calling the Ethernet dissector for ecnapsulated Ethernet packets but using the wrong dissector handle to do so. That's unrelated to the issue this commit addresses, so I'm splitting them up. Change-Id: I87be7b736f82dd74d8c261062f88143372b5344c Reviewed-on: https://code.wireshark.org/review/848 Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com> Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-21Fix Bug 9903: 'Clicking reload-file ignores selected file format reader'Hadriel Kaplan1-1/+17
There's a relatively new feature in 1.11.3 to select a specific file format reader, instead of relying on magics or heuristics. If you select a file reader and open a file, open it, and then click the reload-file button or go to View->Reload or press the ctrl-R keymap, the file is reloaded but using the magic/heuristics again instead of the file format reader you previously chose. Likewise, the Lua relaod() function has the same issue (which is how I found this problem). I have tested this change by hand, using a Lua script, but I didn't add it to the testsuite because I need another change for my test script to work correctly. (an enhancement rather than a bug fix, which I'll submit separately) Change-Id: I48c2d9ea443e37fd9d41be43d6b6cd5a866d5b01 Reviewed-on: https://code.wireshark.org/review/764 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-20Revert "Allow pcapng interface options to be available to dissectors."Anders Broman1-1/+0
This patch causes Wireshark/tshark to segfault if the file is reread(open a file and press reload). The test suite also fails on 2.1.1 Step: Exit status for existing file: "/home/wireshark/builders/trunk/sol10sparc/build/test/captures/dhcp.pcap" must be 0/home/wireshark/builders/trunk/sol10sparc/build/test/suite-clopts.sh: line 149: 6646 Segmentation Fault (core dumped) $TSHARK -r "${CAPTURE_DIR}dhcp.pcap" > ./testout.txt 2>&1 OSX build bot chokes on pcapng.c: In function 'pcapng_destroy_option_value': pcapng.c:377: warning: implicit declaration of function 'g_byte_array_unref' pcapng.c:379: warning: implicit declaration of function 'g_array_unref' pcapng.c: In function 'pcapng_collect_block_option': pcapng.c:419: warning: implicit declaration of function 'g_byte_array_new_take' pcapng.c:419: warning: initialization makes pointer from integer without a cast these functions are glib 2.22 This reverts commit 7b13a3b0f6a5617e0e352f87cc5a20afea226aa8. Change-Id: Ia82fdb2d08287bc2cd2841e1e941ae68cbc2e009 Reviewed-on: https://code.wireshark.org/review/749 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-20Allow pcapng interface options to be available to dissectors.Christopher Kilgour1-0/+1
Interface options[1], and more generally pcapng options[2], are useful information that can provide improved dissector output. Prior to this change, only certain pcapng interface options were interpreted and made available to dissectors, e.g. the interface name or description. This change augments the situation by providing epan_get_interface_option( ), which returns an array of byte arrays if the option code exists (otherwise NULL). Each element of the array is a byte buffer containing the raw data of the option. An array-of-buffers is used because pcapng allows for multiple instances of the same option to be present in the file. All interface options found in a pcapng file are thus made available to the dissector. The implementation also provides infrastructure to collect options from other pcapng blocks such as the section header. Currently these options are discarded, but could be retained in the future to support more features. [1] http://www.winpcap.org/ntar/draft/PCAP-DumpFileFormat.html#sectionidb [2] http://www.winpcap.org/ntar/draft/PCAP-DumpFileFormat.html#sectionopt Change-Id: I944b6f0f03dde9b8e7d1348b76acde6f9d312f37 Reviewed-on: https://code.wireshark.org/review/331 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-04Remove all $Id$ from top of fileAlexis La Goutte1-2/+0
(Using sed : sed -i '/^ \* \$Id\$/,+1 d') Fix manually some typo (in export_object_dicom.c and crc16-plain.c) Change-Id: I4c1ae68d1c4afeace8cb195b53c715cf9e1227a8 Reviewed-on: https://code.wireshark.org/review/497 Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-02-25Fix file.c: Dereference of null pointer (clang analyzer)Hadriel Kaplan1-4/+4
Change-Id: Ib96e5ffb284234562c2883c13e93109173e22179 Reviewed-on: https://code.wireshark.org/review/368 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2014-02-25Wireshark: Add option to choose format type of capture fileMichal Labedzki1-5/+5
The best heuristic can fail, so add possibility to manually choose capture file format type, so not correctly recognize file format can be loaded in Wireshark. On the other side now it is possible to open capture file as file format to be dissected. Change-Id: I5a9f662b32ff7e042f753a92eaaa86c6e41f400a Reviewed-on: https://code.wireshark.org/review/16 Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com> Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com> Reviewed-by: Evan Huus <eapache@gmail.com> Tested-by: Evan Huus <eapache@gmail.com>
2014-02-07Replace "svn" with "git" all over the place.Gerald Combs1-1/+1
Rename "SVNPATH" to "GITBRANCH" since that seems more appropriate. Rename "svnversion.h" to "version.h" as Evan suggested. Update some URLs. In make-version.pl, make sure we don't set an improper upstream branch name. Use the number of commits + short hash from `git describe` for package names by default. Change-Id: I922bba8d83eabdf49284a119f55b4076bc469b96 Reviewed-on: https://code.wireshark.org/review/139 Reviewed-by: Gerald Combs <gerald@wireshark.org>
2014-01-22Don't write out packets that have a "captured length" bigger than we'reGuy Harris1-4/+31
willing to read or that's bigger than will fit in the file format; instead, report an error. For the "I can't write a packet of that type in that file type" error, report the file type in question. svn path=/trunk/; revision=54882
2014-01-21Check the return of wtap_dump_close() even if we've gotten a read error;Guy Harris1-3/+10
the only reason not to check it is if we've already gotten a write error and another write error would be superfluous (either "you got two of the same error" or "you got an I/O error *and* you ran out of disk space/disk quota" is of limited interest). Discard the return value of wtap_dump_close() in the case where we've already gotten a write error, in the hopes of squelching a Coverity warning. svn path=/trunk/; revision=54872
2014-01-13Fix crash when exporting to CSV filePascal Quantin1-1/+1
svn path=/trunk/; revision=54722
2014-01-02No seek-read routines use the length argument, so eliminate it fromGuy Harris1-2/+1
wtap_seek_read(). svn path=/trunk/; revision=54570
2013-12-05int -> gbooleanMartin Kaiser1-1/+1
svn path=/trunk/; revision=53800
2013-11-24Rmove packet_info argument from packet_list_append(), never used.Jakub Zawadzki1-1/+1
Part of attachment 12060, from Didier Gautheron (bug #9419). svn path=/trunk/; revision=53544
2013-11-17Move the epan/filesystem.c routines to wsutil; they're not specific toGuy Harris1-1/+1
packet dissection, they're specific to the entire Wireshark suite of programs. svn path=/trunk/; revision=53377
2013-11-10Add missing includes in order to remove exceptions.h from proto.h (next commit).Jakub Zawadzki1-0/+1
svn path=/trunk/; revision=53230
2013-11-08The "file types" we have are actually combinations of types andGuy Harris1-11/+12
subtypes, e.g. Network Monitor version 1 and Network Monitor version 2 are separate "file types", even though they both come from Network Monitor. Rename various functions, #defines, and variables appropriately. svn path=/trunk/; revision=53166
2013-10-20Try to fix recent test failures (wild guess, can't reproduce).Jakub Zawadzki1-8/+6
svn path=/trunk/; revision=52717
2013-10-20wireshark: use epan_dissect_reset(), rawshark: fix missing ↵Jakub Zawadzki1-101/+156
epan_dissect_cleanup() svn path=/trunk/; revision=52711
2013-10-11cf_start_tail() is (now) just a wrapper around cf_open(). Get rid of it and ↵Jeff Morriss1-9/+0
just call cf_open(). svn path=/trunk/; revision=52553
2013-10-09g_list_prepend() is faster.Anders Broman1-1/+1
svn path=/trunk/; revision=52475
2013-09-22Get rid of struct addrinfo, use the hastables for name resolution instead.Anders Broman1-5/+4
svn path=/trunk/; revision=52176
2013-09-05Try to fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9106 :Pascal Quantin1-0/+1
Intialize phdr structure to avoid an invalid access to phdr->opt_comment svn path=/trunk/; revision=51791
2013-08-14Global variables considered harmful.Guy Harris1-53/+41
svn path=/trunk/; revision=51352
2013-08-13Only rescan packets if we have packets to rescan. Fixes at least the surfaceEvan Huus1-1/+3
problem in https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9033 The underlying scoping issues may not be fully resolved yet. svn path=/trunk/; revision=51327
2013-08-07It's not necessary to call epan_free() in cf_open(): cf_close() (which isJeff Morriss1-2/+3
called by cf_open()) already calls epan_free(). svn path=/trunk/; revision=51188
2013-08-01use explicit cast to squelch compiler warningMartin Kaiser1-1/+1
svn path=/trunk/; revision=51093
2013-08-01Remove fdata->opt_comment, add pkt_comment to pinfoJakub Zawadzki1-20/+106
Original (read from file) comments can be accessed by pkthdr->opt_comment Keep user comments in seperated BST, add new method for epan session to get it. svn path=/trunk/; revision=51090
2013-07-30Remove interface_id, pack_flags from frame_data structure.Jakub Zawadzki1-4/+4
This patch assumes that wtap_phdr interface_id, pack_flags both from initial read and seek read will contain same values. Please fix if it's not. svn path=/trunk/; revision=51041
2013-07-23Make a routine not used outside file.c static.Guy Harris1-1/+1
svn path=/trunk/; revision=50857
2013-07-22Abuse epan_t more: add callback to get interface name.Jakub Zawadzki1-1/+2
svn path=/trunk/; revision=50794
2013-07-21Fix file.c:112:1: error: ‘static’ is not at beginning of declarationEvan Huus1-1/+1
[-Werror=old-style-declaration] svn path=/trunk/; revision=50775
2013-07-21Replace relative timestamp with reference frame number. Saves 16B per frame.Jakub Zawadzki1-15/+15
svn path=/trunk/; revision=50772
2013-07-21Add helper function to epan_session which can be used to get absolute ↵Jakub Zawadzki1-4/+36
timestamp of given frame. Remove ->prev_cap, for testing purpose also replace ->prev_dis with number of previously displayed frame number. This patch reduce size of frame_data by 8B (amd64) This is what (I think) was suggested by Guy in comment 13 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5821#c13) svn path=/trunk/; revision=50765
2013-07-21Some work on multi file dissectionJakub Zawadzki1-22/+21
- make init_dissection/cleanup_dissection private for libwireshark - implement epan_new(), epan_free() - pass epan_t to epan_dissect* svn path=/trunk/; revision=50761
2013-07-16Move merge.{h,c} into wiretap: these modules use wiretap to merge files.Jeff Morriss1-13/+14
svn path=/trunk/; revision=50656
2013-07-12Move the print modules into epan.Jeff Morriss1-2/+3
svn path=/trunk/; revision=50526
2013-07-11Move some more modules into epan.Jeff Morriss1-1/+0
svn path=/trunk/; revision=50517
2013-07-11packet dissection now takes pointer to tvb instead of guint8 dataJakub Zawadzki1-13/+14
implement frame_tvbuff, right now almost a copy of 'real' tvb. svn path=/trunk/; revision=50497
2013-06-29Fix some Dead Store (Dead assignement/Dead increment) Warning found by ClangAlexis La Goutte1-4/+0
svn path=/trunk/; revision=50232
2013-06-26Move tempfile.{h,c} into wsutil.Jeff Morriss1-1/+1
svn path=/trunk/; revision=50163
2013-06-25Fix build with packet editor enabled. (Fix a typo while we're at it.)Guy Harris1-1/+2
svn path=/trunk/; revision=50153
2013-06-20inform expert info layer about the current number of packet commentsMartin Kaiser1-0/+3
when the last comment is removed and we have no other expert info, the maximum severity is changed from comment to none svn path=/trunk/; revision=50091
2013-06-19Allow for column headers not to be printed in order to make it possible to ↵Chris Maynard1-3/+7
export packets as plain text in a format that could then have a chance of being imported again (assuming other factors such as packet bytes were printed, etc.) in order to recover the original pcap file. Fixes https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=1636 svn path=/trunk/; revision=50036
2013-06-16Have the seek-read routines take a Buffer rather than a guint8 pointerGuy Harris1-19/+39
as the "where to put the packet data" argument. This lets more of the libwiretap code be common between the read and seek-read code paths, and also allows for more flexibility in the "fill in the data" path - we can expand the buffer as needed in both cases. svn path=/trunk/; revision=49949
2013-04-13Don't take the shortcut of moving/copying the existing file if we have a nameEvan Huus1-14/+44
resolution block to write (which isn't necessarily in the existing file). Fixes at least part of https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8317 svn path=/trunk/; revision=48842
2013-04-02Rename cf_not_saved() to cf_has_unsaved_data() to clarify what itGuy Harris1-1/+1
indicates. (Note: "unsaved data" is more than just "unsaved changes"; it could also mean "temporary file that hasn't been saved anywhere".) svn path=/trunk/; revision=48709
2013-04-01Add routines to file.c to indicate whether:Guy Harris1-5/+93
a save can be done ("can" in the sense of "there's something to save" and in the sense of "we can write that something out"); a "save as" can be done (in the sense of "we can write what we have out"); there's unsaved data to save (which might be unsaved changes or might be a temporary file full of packets); and use them as appropriate. This means that the "unsaved data" indicator in the UI will be turned on for temporary files full of packets as well as for files with unsaved changes; that's what we want. svn path=/trunk/; revision=48693
2013-04-01Add a wtap_dump_can_write() routine that indicates whether WiretapGuy Harris1-14/+8
supports writing files with a given set of encapsulations and comment types. Use it, rather than asking for a list of file formats that support the given set of encapsulation and comment types and checking whether we got back such a list, or duplicating its logic. Having file.c use it means that nobody's using wtap_dump_can_write_encaps() any more; get rid of it. Instead, have a private routine that checks whether a given file format supports a given set of encapsulations *and* comment types, and use that internally. svn path=/trunk/; revision=48690
2013-04-01Define a collection of bits for different types of capture file comments.Guy Harris1-4/+10
For each capture file type, have a bitset of comment types supported by that capture file type. Add a Wiretap routine that, for a given file type, returns the bitset of comment types it supports. Have wtap_get_savable_file_types() take a bitset of comment types that need to be supported by the file types it returns. Replace cf_has_comments() with a routine that returns a bitset of capture file comment types in the capture file. Use those routines in the capture file dialogs; don't wire in the notion that pcap-NG supports all comment types and no other file formats support any comment types. (That's currently true, but we don't want to wire that in as being forever true.) svn path=/trunk/; revision=48689