Commit Graph

335 Commits

Author SHA1 Message Date
Gerald Combs 095d897381 wmem: Use better terminology.
The scopes used by wmem_map_new_autoreset and wmem_tree_new_autoreset
store the metadata and data for each structure. Use those terms instead
of "master" and "slave".

Change-Id: I3b7c958b4caf3a1245e680f5ca960431b75ad5be
Reviewed-on: https://code.wireshark.org/review/37398
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-06-08 05:08:22 +00:00
Huang Qiangxiong 62101950f3 Protobuf: Add show_details preferences. Fix two bugs.
1. Add show_details preferences. Disable it will hidden names of
message/field/enum, field number, and other details.

2. Have only one popup message with all the errors listed,
that are found during parsing .proto files. (Buffer errors and print once)
Loading .proto files and checking message types of UDP port will
be done only when protobuf dissector has been called.

3. Support parsing .proto files in legacy MAC file format
(that newline is '\r') or mixed newline (\r + \n) file format.

Change-Id: I97bcde000957e4cd1cce98a7f61120d03027423e
Reviewed-on: https://code.wireshark.org/review/34736
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-10-14 06:47:30 +00:00
Guy Harris 20800366dd HTTPS (almost) everywhere.
Change all wireshark.org URLs to use https.

Fix some broken links while we're at it.

Change-Id: I161bf8eeca43b8027605acea666032da86f5ea1c
Reviewed-on: https://code.wireshark.org/review/34089
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-07-26 18:44:40 +00:00
Aurelien Aptel 0db39ae59a smb2: add support for decompression
The latest iteration of Microsoft updates to SMB3 added compression to
the protocol. This commit implements decompressing and dissecting
compressed payloads.

The compression algorithms that can be used are "Plain LZ77",
"LZ77+Huffman" and "LZNT1" which you can read more about in the
[MS-XCA] documentation. This set of algorithm is sometimes referred to
as XPRESS.

This commit reuses the existing uncompression API scheme already in
place with zlib and brotli and adds 3 tvb_uncompress_*() function
implemented in:
* epan/tvbuff_lz77.c
* epan/tvbuff_lz77huff.c
* epan/tvbuff_lznt1.c

A new function wmem_array_try_index() was added to the wmem_array API
to make bound checked reads that fail gracefully. New tests for it
have been added as well.

Since both reads (tvb) and writes (wmem_array) are bound checked the
risk for buffer overruns is drastically reduced. LZ77+Huffman has
decoding tables and special care was taken to bound check these.

Simplified versions of the implementations were succesfully tested
against AFL (American Fuzzy Lop) for ~150 millions executions each.

The SMB2/3 dissector was changed to deal with the new transform header
for compressed packets (new protocol_id value) and READ request
flags (COMPRESSED). Badly compressed or encrypted packets are now
reported as such, and the decryption test suite was changed to reflect
that.

This commit also adds a test capture with 1 packet compressed with
each algorithm as returned by Windows Server 2019, along with 3
matching tests in test/suite_dissection.py

Change-Id: I2b84f56541f2f4ee7d886152794b993987dd10e7
Reviewed-on: https://code.wireshark.org/review/33855
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2019-07-15 21:00:14 +00:00
Peter Wu 6866896ed1 Revert "Test: Disable a wmem compilation warning."
This reverts commit bdf26a35f6.

This caused a warning on AppleClang 9.1.0.9020039 on Travis CI:

  ../epan/wmem/wmem_test.c:692:1: warning: unknown warning group '-Wunsafe-loop-optimizations', ignored [-Wunknown-warning-option]

A better workaround is to globally disable the warning for broken GCC
versions.

Change-Id: I3d878c4dccd5afc28e4bf8394f9adae2e6c35deb
Reviewed-on: https://code.wireshark.org/review/32903
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-04-20 06:06:14 +00:00
Gerald Combs bdf26a35f6 Test: Disable a wmem compilation warning.
Disable the following warning:

    ../epan/wmem/wmem_test.c:690:9: warning: missed loop optimization, the loop counter may overflow [-Wunsafe-loop-optimizations]
             for (j=0; j<=i; j++, k++) {
             ^~~

Change-Id: If1ea004d6b0fc2aa5450a810dd400245afd1a490
Reviewed-on: https://code.wireshark.org/review/32709
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>
2019-04-04 03:59:35 +00:00
Gerald Combs 19d54ac364 TSDNS: Add more wmem_strsplit return checks.
wmem_strsplit might return NULL, or it might return fewer tokens than
requested. Add checks accordingly. Update the API documentation while
we're here.

Bug: 15619
Change-Id: I55ae05a36d05252cf57e5c7047a441ef1b438a81
Reviewed-on: https://code.wireshark.org/review/32494
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>
2019-03-21 05:04:29 +00:00
Guy Harris cd58292160 Don't cast away constness if you don't have to.
Change-Id: I7f20939353a953c6feca02047d608d0ad0147edb
Reviewed-on: https://code.wireshark.org/review/32467
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2019-03-18 06:09:42 +00:00
Dario Lombardo 3b2204e127 wmem: fix a comment.
Change-Id: Ie8e4eac95a4db64c376c38c2207667c38788dac5
Reviewed-on: https://code.wireshark.org/review/32411
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2019-03-14 18:11:56 +00:00
Michael Mann e797e75174 Include epan header files in VS solution.
Add header files lists to add_library() so that Visual Studio can pick them
up and include them in a "Header Files" folder for easier navigation within
Visual Studio.

Change-Id: I7cd8e39550f4db67eed8205593060ae8b4a5b1b9
Reviewed-on: https://code.wireshark.org/review/31289
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2019-02-18 00:49:51 +00:00
João Valverde c2eddffb84 CMake: Fix DOCDIR on Unix
User guides are installed to doc/Wireshark. Use doc/wireshark instead.

Remove leftover variable CPACK_PACKAGE_NAME.

Change-Id: I9a1d6bdc7d8f0b48c61e43679285d5ba83904a63
Reviewed-on: https://code.wireshark.org/review/31851
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
2019-02-02 16:53:49 +00:00
João Valverde 65c13f9b90 Install development headers on all platforms
Install headers to support plugins development on Windows.

Change-Id: I3161bd2f730edf62ab44fee6ce4fedbb9aee0d31
Reviewed-on: https://code.wireshark.org/review/30776
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
2018-11-24 13:48:16 +00:00
Peter Wu f4be16aa45 wmem_tree: fix crash with wmem_tree_destroy and NULL scope
The function was documented for use with a NULL scope, but it actually
crashes since callbacks are not available for NULL scopes. git master
is unaffected, but the GTK+ protocol dialog in 2.4 and 2.6 do crash.

Bug: 14349
Change-Id: I54350e112192394797cf85eaac4f30194178d7c4
Fixes: v2.3.0rc0-2597-gb7d6cca4ae ("Add wmem_tree_destroy")
Reviewed-on: https://code.wireshark.org/review/30126
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-10-12 05:08:18 +00:00
Gerald Combs 8f08a4e74e Try to discourage the use of APIs via counting.
Add the ability to specify maximum function counts for each group to
checkAPIs. Add maximum counts for the "termoutput" and "abort" groups
where needed. Show summaries in various checkAPI targets.

Switch uses of ws_g_warning back to plain g_warning.

Change-Id: I5cbddc8c671729e424eed8551f69116d16491976
Reviewed-on: https://code.wireshark.org/review/29721
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-09-19 16:07:03 +00:00
Alexis La Goutte 8eb0ff5e31 wmem_test: fix no previous prototype for ‘check_val_map’ [-Wmissing-prototypes]
Change-Id: I9473e3d4fd6dffbbed6921770d8bd26e4104647b
Reviewed-on: https://code.wireshark.org/review/29438
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-09-05 19:59:25 +00:00
Alexis La Goutte d0b2096075 wmem_interval_tree: fix no previous prototype for ‘update_edges_after_rotation’ [-Wmissing-prototypes]
Change-Id: I60085243d0e57ac072246bf3374ed3b7f6078497
Reviewed-on: https://code.wireshark.org/review/28889
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-07-31 15:38:35 +00:00
Peter Wu 3d1e3023d2 wmem: make wmem_strsplit behave more like g_strsplit
In the past "g_strsplit" users were converted to use "wmem_strsplit" to
avoid memory leaks when dissection fails. The semantics were slightly
different though. When the DNS dissector tried to split the string "."
using delimiter ".", it would previously (unexpectedly) receive an empty
vector (and crash). Now it will receive a vector with one element.

Additionally, suggest that users of wmem_strsplit with a NULL allocator
use g_strsplit instead, otherwise it will leak the elements.

Bug: 14980
Change-Id: I408dfdb0ffa9e24ccdba69c8ee095abea72f6feb
Reviewed-on: https://code.wireshark.org/review/28724
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-07-17 09:03:22 +00:00
Matthieu Coudron 4f7c8503b0 wmem_tree: describe tree traversal order
it is an inorder traversal (left/parent/right).

Change-Id: Ia83efdfd45dab8c8386d84b3050af081312fde85
Reviewed-on: https://code.wireshark.org/review/28688
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-07-14 06:49:40 +00:00
Matthieu Coudron e5478f9e84 wmem_itree:update children max_edge after rotation
After a rotation, the post_rotation callback was just updating the root
tree max_edge when it should also update its children since some of them
might have lost or changed children.
Any change in max_edge will bubble up/propagate to the parent.

Change-Id: Ia6705d71de5c85847d51f97f86fd35f4da20c03a
Reviewed-on: https://code.wireshark.org/review/28687
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-07-14 06:49:03 +00:00
Matthieu Coudron dac91db65e mptcp: Correctly find mappings and reinjections
- removed mptcp.duplicated_dsn in favor of mptcp.reinjection_of/mptcp.reinjected_in
reinjected_in lists the packets where the DSN was later reinjected in.
reinjection_of lists the packets in which this DSN was already transmitted.
- There was a bug where the max_edge property of the interval tree was not
correctly updated. Right now wireshark gives a dsn for every TCP frame (even
empty packets).
- Now displays mappings only for packets with data (seglen > 0).
- Renamed dsn_map to dsn2packet_map and mappings to ssn2dsn_mappings.
- precises the complexity of enabling certain MPTCP options so that the user
better understand their impact on processing speed.

Change-Id: I24adc3161021b7f6a084763a74dc580f1c1f2c2e
Reviewed-on: https://code.wireshark.org/review/28326
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-07-14 06:45:55 +00:00
chinarulezzz ec0f8e6c36 fix missing parentheses in 'if' statement
Change-Id: I47f8566c4410d6aac1111b35fff3b044c14bc70b
Reviewed-on: https://code.wireshark.org/review/27079
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-05-03 04:09:42 +00:00
Dario Lombardo 4a156da068 Remove autotools build system.
It has been replaced by cmake.

Change-Id: I83a5eddb8645dbbf6bca9f026066d2e995d8e87a
Reviewed-on: https://code.wireshark.org/review/26969
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-04-18 03:46:17 +00:00
Peter Wu acba178546 wmem: ensure wmem_memdup(..., NULL, 0) returns NULL
Rather than requiring all callers to pass a non-null source argument,
explicitly allow a NULL source when the size is zero. This is consistent
with g_memdup behavior.

While at it, fix a memleak and avoid memset(0,0,0) in tests.

Change-Id: I86a092625a508544d180da959e4afdd0366539f4
Reviewed-on: https://code.wireshark.org/review/26496
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Mališa Vučinić <malishav@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Evan Huus <eapache@gmail.com>
2018-03-19 16:15:35 +00:00
Peter Wu 859c5bf836 wmem: fix random test failure due to key collision
Fixes sporadic test failure in buildbot:

    ERROR:epan/wmem/wmem_test.c:1170:wmem_test_tree: assertion failed: (wmem_tree_count(tree) == CONTAINER_ITERS)

Change-Id: Ia33b54d8f0a7afc37fa9356aa868c4a7b896e7da
Test: wmem_test --seed R02S674cddedb75a1db84fb9698ac51213c0
Reviewed-on: https://code.wireshark.org/review/26501
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Evan Huus <eapache@gmail.com>
2018-03-19 16:14:27 +00:00
Gerald Combs da05837004 CMake: Exclude wmem_test from the default build
Exclude wmem_test from the default Wireshark.sln build similar to our
other test programs.

Change-Id: If9a16944823bb3a928260c5e1307870253f1da8f
Reviewed-on: https://code.wireshark.org/review/26456
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>
2018-03-13 05:33:15 +00:00
Dario Lombardo fe71e26af2 spdx: more licenses converted.
Change-Id: I3861061ec261e63b23621799e020e811ed78a343
Reviewed-on: https://code.wireshark.org/review/26333
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-03-07 15:56:44 +00:00
Guy Harris d4ef22db8f Make sure CAPACITY() doesn't shift the 1 out of range.
Make the 1 we shift left the size of a size_t, so it'll only go out of
range if the result couldn't possibly fit in a size_t.  (That should
also make the object of the shift unsigned, which may squelch some other
complaints.)

Not that the map is *likely* to be bigger than 4GB, but it should
squelch some complaints from Visual Studio Code Analysis.

Change-Id: I489bfe6b1d9d4329c267936d9106dbba4388c492
Reviewed-on: https://code.wireshark.org/review/26163
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-02-28 02:52:03 +00:00
Craig Jackson d1ce1baf63 WMEM: Add strjoin routines.
Add wmem versions corresponding to g_strjoin() and g_strjoinv().

Modify packet-rtps.c to use wmem routines_ where it is now using g_ routines causing mallocs.

Change-Id: I92c890a8b8f29a973e103676d8e5a681ee5abd50
Reviewed-on: https://code.wireshark.org/review/25764
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-13 06:18:09 +00:00
Dario Lombardo fc082fa2a9 wmem: use SPDX identifiers.
Change-Id: Iad9a7a8a26bc6a7189a4578dfbcec1c2b3cc376e
Reviewed-on: https://code.wireshark.org/review/25692
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-08 19:29:02 +00:00
Moshe Kaplan b13678fd37 Added wmem_map_contains and wmem_map_lookup_extended
Change-Id: I2943c67238fb913258f0f1f15df968c17b1ea002
Reviewed-on: https://code.wireshark.org/review/25626
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-07 05:21:20 +00:00
João Valverde 1097e8020a autotools: Library build products don't need explicit cleaning
Change-Id: I5d68c05f2844d6c9ae486531b189dbf10bc09cff
Reviewed-on: https://code.wireshark.org/review/24484
Reviewed-by: João Valverde <j@v6e.pt>
2017-11-18 22:29:41 +00:00
João Valverde 9764cd0a83 autotools: make maintainer-clean should allow rerunning 'configure'
Change-Id: Iedae94ffefe27b13b1967d69cacb757b5aa4576d
Reviewed-on: https://code.wireshark.org/review/23928
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
2017-10-15 14:17:20 +00:00
João Valverde 9bba3866ff CMake: Allow user build flags to override default build flags
Autotools has the very useful feature by design of allowing the user
to override the default build flags (you break it you keep it).

Apparently CMake applies COMPILE_OPTIONS target property after
CMAKE_{C,CXX}_FLAGS so that doesn't work here. Prepend our flags to those
variables instead to make it work then.

Specific target flag overrides can still be added with COMPILER_OPTIONS
(e.g: generated files with -Wno-warning) but this is less effective and
then we're back at the point where this overrides user flags. It's less
of a concern though.

Change-Id: I44761a79be4289238e02d4e781fef0099628817b
Reviewed-on: https://code.wireshark.org/review/23675
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2017-10-13 21:32:18 +00:00
João Valverde 21d2158a0b CMake: Initial work to install headers for the benefit of plugins
To be continued incrementally to fix gaps and omissions.

If we are willing to reorganize the source tree to have one or two header
include folders this could be simplified considerably.

It would also force developers to give more consideration to API issues,
which is a good thing.

See also e7ef19efc0.

Bug: 14062
Change-Id: I0759da2f9793cfb5cf92c9e231457bba43df4353
Reviewed-on: https://code.wireshark.org/review/23548
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
2017-09-17 07:22:16 +00:00
João Valverde e7ef19efc0 autotools: Initial work to install headers for the benefit of plugins
Install public headers required to build plugins for libwireshark (taps and
dissectors).

The source tree is organized to serve the CLI/GUI parts of wireshark.
Plugins are built in tree. This change is intende to allow plugins to be built
out-of-tree but we want to avoid dumping all headers into /usr/include.

To be continued incrementally to fix errors and omissions.

Change-Id: Iaa0def0ba3de4b456a29114c315544d2d64fa748
Reviewed-on: https://code.wireshark.org/review/23374
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
2017-09-15 10:11:55 +00:00
João Valverde d0a91b27f2 plugins: config.h must not be included by public headers
For a sane plugin build environment. Include config.h as the first
header in the .c file instead.

Fix by moving required compiler attribute macros to a new
"ws_attributes.h" API header.

Change-Id: I34f58a927f68c1a0e59686c14d214825149749e1
Reviewed-on: https://code.wireshark.org/review/23400
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
2017-09-06 08:10:56 +00:00
Michael Mann e23676c999 wmem: Ensure callbacks are initialized and not accidentally unregistered
Start the "callback register ID" at 1, so that zeroed out callback IDs
are not found during unregister.

Change-Id: I1d7d70f53d89c40e07d1637e1e195dd027855ed3
Reviewed-on: https://code.wireshark.org/review/20385
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Evan Huus <eapache@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
2017-03-05 09:05:10 +00:00
Michael Mann b7d6cca4ae Add wmem_tree_destroy
Allows the cleanup of NULL scoped wmem trees

Change-Id: I7c49a224ca7e2f7ddfe0e38d3ea0e79aa2cb057c
Reviewed-on: https://code.wireshark.org/review/20382
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Evan Huus <eapache@gmail.com>
2017-03-05 03:39:00 +00:00
Michael Mann 9b4f325132 Add wmem_tree_count.
There are cases where wmem_tree needs to know its number of nodes.

Change-Id: I6411cf4275fd4d85a1d76382e1922d236be3b176
Reviewed-on: https://code.wireshark.org/review/20005
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-03-04 21:53:25 +00:00
Alexis La Goutte 0bf7ba3de5 wmem_list: Fix Dead Store (Dead assignement/Dead increment) Warning found by Clang
Change-Id: Ibbbe9fb0165eaa297c2b70bf7e478cf538e2cc33
Reviewed-on: https://code.wireshark.org/review/20040
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-02-10 15:33:34 +00:00
Michael Mann f8b69fb349 Add wmem_map_get_keys.
Mimic functionality of g_hash_table_get_keys

Change-Id: I7702854ed771a5b3bf7ea5295a67c42f0f477cdf
Reviewed-on: https://code.wireshark.org/review/20039
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-02-09 22:03:10 +00:00
Michael Mann e3128d9806 Add wmem_map_steal
Mimic functionality of g_hash_table_steal

Change-Id: Iaf4aeef951b60934569143b2d119f782aeefe380
Reviewed-on: https://code.wireshark.org/review/20038
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-02-09 22:03:01 +00:00
Michael Mann cd38552259 Add wmem_tree_remove32
Change-Id: Ic79fd0a2a13341dd7ba563cf3a056c51e9d16960
Reviewed-on: https://code.wireshark.org/review/20037
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-02-09 22:02:25 +00:00
Dario Lombardo db5c8e1ae1 wmem_list: add wmem_list_insert_sorted.
This mimics the function g_list_insert_sorted.

Change-Id: I6f7ac01155588006662c8c0c138d88cea753868c
Reviewed-on: https://code.wireshark.org/review/19978
Reviewed-by: Dario Lombardo <lomato@gmail.com>
2017-02-08 12:44:26 +00:00
Michael Mann 120a1ebb22 wmem: Delay creation of map table until its needed
wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), ...)
doesn't have "file" scope ready at startup to create hash table
and will assert.

Change-Id: I3437f45ef42bf8635e4d504cf073fc3fb0c9a8cd
Reviewed-on: https://code.wireshark.org/review/19825
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Evan Huus <eapache@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
2017-01-28 18:48:33 +00:00
Michael Mann 6cff5c6776 Add wmem_map_new_autoreset
This can be used similarly to wmem_tree_new_autoreset for hash tables that need
reset after capture file change.

Change-Id: I3a2f0b0a0cad3eca46266523c594d3d7aac17489
Reviewed-on: https://code.wireshark.org/review/19794
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Evan Huus <eapache@gmail.com>
2017-01-28 12:59:52 +00:00
Jaap Keuter 4ff9bddc46 wmem: fix rb-tree data printer feed
When using a data printer for the red/black tree it is fed with the
nodes of the tree. But nodes can be either subtree or data nodes.
Don't feed the subtree nodes to the data printer. The data printer can't
recognize it as such, can't handle it, or worse, could break stuff.

Change-Id: Ibbc1311d901c0d0c52e710f951dd53620f2c3d0f
Reviewed-on: https://code.wireshark.org/review/19652
Reviewed-by: Evan Huus <eapache@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-01-22 10:40:34 +00:00
João Valverde 04761f220b Add wmem_list_find_custom()
Change-Id: I5c4f85df0a1899d629386581de2c2c3ec0812d54
Reviewed-on: https://code.wireshark.org/review/18440
Reviewed-by: João Valverde <j@v6e.pt>
Petri-Dish: João Valverde <j@v6e.pt>
Reviewed-by: Evan Huus <eapache@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Roland Knall <rknall@gmail.com>
2016-10-24 21:01:56 +00:00
Peter Wu 534787e402 cmake: make WERROR_COMMON_FLAGS a normal string
Instead of checking for the boolean "FALSE", just set an empty string.
This avoids the need to check for WERROR_COMMON_FLAGS before using it.

The transformation is the same for all files, remove
"if (WERROR_COMMON_FLAGS)" and "endif()", reindent and add quotes (since
we have a string here and not a list).

Modelines have been added where missing.

Change-Id: I0ab05ae507c51fa77336d49a99a226399cc81b92
Reviewed-on: https://code.wireshark.org/review/17997
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Tested-by: Dario Lombardo <lomato@gmail.com>
2016-09-30 20:08:02 +00:00
João Valverde 640382c743 CMake: Allow setting per target compiler warnings
Setting our compiler warning flags in CMAKE_C_FLAGS does not allow
using different flags per target.

Allow for that possibility by setting the internal WS_WARNINGS_{C,CXX}_FLAGS
and using the COMPILE_OPTIONS property to set them.

This change is just setting mechanism and there should be no difference
in generated warnings.

The check_X_compiler_flag cmake test is changed to test each flag individually.
We need a list, not a space separated string, and the aggregate test is not
significant.

Change-Id: I59fc5cd7e130c7a5e001c598e3df3e13f83a6a25
Reviewed-on: https://code.wireshark.org/review/17150
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
2016-08-23 21:33:09 +00:00