Commit Graph

870 Commits

Author SHA1 Message Date
Dario Lombardo 57fee051c6 wsutil: rename wsjsmn to wsjson.
This puts more distance between the caller and the underlying
library. At the moment we're using libjsmn, but other libraries
(like json-glib) could be used.

Change-Id: I1431424a998fc8188ad47b71d6d95afdc92a3f9e
Reviewed-on: https://code.wireshark.org/review/27055
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-04-21 07:13:31 +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
Joerg Mayer 10134e9453 glib-compat is no longer used - it provided only code for versions < 2.32
Change-Id: I17e2c221cc40dbe9328458db9f17480c05bdc276
Reviewed-on: https://code.wireshark.org/review/26972
Petri-Dish: Jörg Mayer <jmayer@loplof.de>
Tested-by: Petri Dish Buildbot
Reviewed-by: Jörg Mayer <jmayer@loplof.de>
2018-04-16 17:47:08 +00:00
Gerald Combs ffe2f138ab ws_pipe: Zero an array.
Make sure we zero-initialize pipeinsts, otherwise ConnectNamedPipe will
have indeterminate behavior according to the MSDN documentation for the
OVERLAPPED structure.

Change-Id: I38d9680cf01b0a8f9e566a85a7a330f6c0aa9a48
Ping-Bug: 14532
Reviewed-on: https://code.wireshark.org/review/26784
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-04-08 22:31:56 +00:00
Darius Davis 5c2eade45d Tweak ws_cpuid so that Valgrind is happy.
Valgrind considers the "cpuid" instruction to always depend on inputs from eax
and ecx, even though it's only a subset of values of eax for which ecx is
relevant.  If ecx is undefined when cpuid is executed, the outputs of cpuid
will be considered undefined.

Instead of suppressing the resulting uninitialised-value warning (the
suppression for which is now out-of-date anyway, now that
register_all_protocols is moved to a worker thread), let's simply set ecx to
zero in ws_cpuid.

Testing done: Built Wireshark on Linux amd64.  Before this change, running
   "tools/valgrind-wireshark.sh ./test/captures/dhcp.pcap" with
   valgrind-3.12.0.SVN on Debian 9.4 amd64 would yield the following Valgrind
   error:

   ==2416== Thread 2:
   ==2416== Conditional jump or move depends on uninitialised value(s)
   ==2416==    at 0xACB8B22: ws_mempbrk_sse42_compile (ws_mempbrk_sse42.c:58)
   ==2416==    by 0x74F4960: register_all_protocols_worker (register.c:37)
   ==2416==    by 0xB1403D4: g_thread_proxy (gthread.c:784)
   ==2416==    by 0xD438493: start_thread (pthread_create.c:333)
   ==2416==    by 0xB4CAACE: clone (clone.S:97)

   With the change, the above message is gone.  Inspected the disassembly of
   function ws_cpuid, and it looks sane -- just an added "xor ecx, ecx" at the
   top.

Change-Id: I2fb382309cac234c400286a6e9fac7d922912c63
Reviewed-on: https://code.wireshark.org/review/26733
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-04-05 07:34:01 +00:00
Guy Harris 494508f2d0 Clean up REPORT_DISSECTOR_BUG().
Have it take a format and argument list as arguments, and have the
formatting done inside the reporting code.  That way, we're not relying
on any particular wmem scope working.

If WIRESHARK_ABORT_ON_DISSECTOR_BUG is set, try to add the message to
the crash information (currently only supported in macOS), and print it
to the standard error, before crashing.  We won't necessarily have a
usable crash dump to analyze, so we can't rely on that to find the cause
of the crash.

Ping-Bug: 14490
Change-Id: I2b39169c45c84f2ada31efa1d413bd28c140f8f4
Reviewed-on: https://code.wireshark.org/review/26643
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-03-25 23:49:35 +00:00
Guy Harris d12a41b17a Include alloca.h if we have it.
Bug: 14552
Change-Id: I799691f7f33ca56748ed4e51d7d548f37769837b
Reviewed-on: https://code.wireshark.org/review/26611
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-03-23 22:39:07 +00:00
Peter Wu ca9976bec9 rsa: fix memleak and accept keys from certain PKCS#12 files
The "bag" was not deallocated when the key is successfully loaded.
Parse all bag elements rather than clearing the bag after the first
iteration (this restores previous behavior).

Change-Id: Ib52da6586f7435d18fa5b0660e7771436544b634
Fixes: v2.5.0rc0-613-gf63b68f707 ("Further cleanups.")
Reviewed-on: https://code.wireshark.org/review/26481
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2018-03-21 10:36:23 +00:00
Gerald Combs 4c750d98a2 Windows: Conditionally set CREATE_BREAKAWAY_FROM_JOB.
Set CREATE_BREAKAWAY_FROM_JOB only on Windows 7 and earlier. It's not
needed otherwise and might fail in some cases.

Change-Id: I15843b5c1ae3c352fa267228b94b6933074a07f3
Reviewed-on: https://code.wireshark.org/review/26465
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-03-13 23:34:53 +00:00
Guy Harris 6dcd7a70a6 Get rid of trailing white space.
Change-Id: Ib03afc7a4d6203188828fdcfec2c7604365e4d0a
Reviewed-on: https://code.wireshark.org/review/26467
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-03-13 22:30:49 +00:00
Guy Harris 068dbc809f Expand a comment.
Change-Id: I154bce4901929c5f3eafa88cae2cd4ce53b28326
Reviewed-on: https://code.wireshark.org/review/26466
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-03-13 22:29:27 +00:00
Gerald Combs a2f9267615 Windows: Always assign newly-created processes to our job.
Move ws_pipe_kill_child_on_exit to win32-utils. Add win32_create_process,
which calls CreateProcess + AssignProcessToJobObject. Use
win32_create_process instead of CreateProcess everywhere.

Bug: 1419
Change-Id: I7a1f17dddf6a73f6973d54621f271b69311400d1
Reviewed-on: https://code.wireshark.org/review/26448
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 17:18:30 +00:00
Gerald Combs 0874b8bac6 Remove popcount in favor of ws_count_ones.
Remove our popcount implementation in favor of ws_count_ones, which
is our other popcount implementation. This required updating and
running process-x11-xcb.pl.

Change-Id: I8634c55242113b338c5b0173837c35f98b148b4f
Reviewed-on: https://code.wireshark.org/review/26454
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 17:18:01 +00:00
Gerald Combs 2519115695 Remove some unused or hard-coded header checks.
Remove some unused checks and code found using

grep -o 'HAVE_[A-Z0-9_]*' ConfigureChecks.cmake | sort -u \
| while read have_h ; do echo = $have_h ; git --no-pager grep -cl $have_h ; done

Change-Id: I86bfcfdc4f60d9d7de87017a7bb00f833a79bd2c
Reviewed-on: https://code.wireshark.org/review/26451
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-03-12 22:11:32 +00:00
Gerald Combs dcc3875847 Add ws_pipe_kill_child_on_exit.
Add ws_pipe_kill_child_on_exit, which associates a child process handle
with a job object that has the JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE
flag set.

Call it when we create a process in ws_pipe_spawn_sync and
ws_pipe_spawn_async. Note that we might want to use it elsewhere.

Change-Id: Ia0f6863ea4df0ab8623bb923a49da7776d83bd33
Reviewed-on: https://code.wireshark.org/review/26398
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-03-09 22:46:05 +00:00
Peter Wu a395a8b993 GeoIP: avoid closing random file descriptors
Previously there were three different pipe validity checks:
PID != WS_INVALID_PID, PID != 0 and stdin != 0. This resulted in
using/closing file descriptors which might be owned by something else.

When no GeoIP databases are defined, mmdb_resolve_stop would be called
to close the pipe and set PID to WS_INVALID_PID. stdin is however not
cleared and future invocations would try to close the previous fd.

Change-Id: I1d15da29208efb41098ee6a4edeeabf61f84c2b3
Fixes: v2.5.1rc0-466-ga1da75c554 ("Transition from GeoIP Legacy to MaxMindDB.")
Reviewed-on: https://code.wireshark.org/review/26391
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-03-09 16:10:32 +00:00
Dario Lombardo c9cb93acfc wsutil: add CR to license.
Change-Id: Ibef7761410cd4d653be0d87c2bd39c040da62e08
Reviewed-on: https://code.wireshark.org/review/26385
Reviewed-by: Dario Lombardo <lomato@gmail.com>
2018-03-09 08:52:17 +00:00
Dario Lombardo e7ab7a907c spdx: more licenses converted.
Change-Id: I8f6693108c43959e54911d35b4fbf730c59add60
Reviewed-on: https://code.wireshark.org/review/26361
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-03-09 04:50:23 +00:00
Dario Lombardo fdd426e410 spdx: more licenses converted.
Change-Id: Ia1650bc02511f7bd47fb90be91b623177f05bcbd
Reviewed-on: https://code.wireshark.org/review/26337
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-03-09 04:48:20 +00:00
Guy Harris e1790da88c Hack to fix ABI checking.
Change-Id: I20f0fd8c7dc6f5276c19735025d719a2043c803a
Reviewed-on: https://code.wireshark.org/review/26346
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-03-07 21:09:41 +00:00
Gerald Combs 80d652f06e More spawned process handling updates.
Document ws_pipe.h. Define invalid PIDs in one place.

Extcap didn't use stdin before 1a0987904f. Make sure we close it.

Change-Id: I7a69cd9b5137ae82435e64628a22e4d812d58f89
Reviewed-on: https://code.wireshark.org/review/26226
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-03-02 18:07:58 +00:00
Gerald Combs 1a0987904f Generalize our process spawning code.
Move the contents of extcap_spawn to ws_pipe. Rename various extcap_*
prefixes to ws_pipe_*. Open stdin when we spawn processes.

Change-Id: I9286295443ee955bb6328b0ed6f945ee0bb2a798
Reviewed-on: https://code.wireshark.org/review/26216
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-02 05:22:20 +00:00
Graham Bloice bf4c2fd82b Windows: Remove cruft for unsupported versons
Remove all the existing LoadDLL\GetProcAddress combinations
that allowed conditional Win32 API usage if supported on the
running OS version.

All the required functions are present in the versions we support.

Change-Id: Ibc43e51cefcd1c7562d4e251784362509f224ed6
Reviewed-on: https://code.wireshark.org/review/26215
Petri-Dish: Graham Bloice <graham.bloice@trihedral.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
2018-03-01 22:32:04 +00:00
Guy Harris 9f2dff98f6 Include <config.h> so UNICODE is defined.
All other files should do so; this file should, so that we're using the
Unicode versions of Windows APIs (especially given that other files that
include wsutil/unicode-utils.h will be doing so and expecting UTF-16
strings from utf_8to16_snprintf()).

Change-Id: I7eccf580ab0dc504aa78b345e36e2fcda818a7c5
Reviewed-on: https://code.wireshark.org/review/26170
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-02-28 17:26:29 +00:00
Guy Harris fe363c540e Make sure GetModuleHandle(_T("kernel32.dll") succeeds.
If it doesn't, we're living in the Twilight Zone - that's like not
finding libc/libSystem/whatever-your-UN*X-calls-it on a UN*X - but this
should at least remove one complaint from Visual Studio Code Analyzer.

Change-Id: Iccb568ea022ac28be962ab3fec5bccdfdf69ac13
Reviewed-on: https://code.wireshark.org/review/26165
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-02-28 05:08:40 +00:00
Gerald Combs e73e3580f6 Rename airpdcap to dot11decrypt.
Our 802.11 decryption code isn't tied to any specific product. Change
the file and API names to dot11decrypt.

Change-Id: I14fd951be3ae9b656a4e1959067fc0bdcc681ee2
Reviewed-on: https://code.wireshark.org/review/26058
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2018-02-24 11:56:18 +00:00
Guy Harris 5aaf741c81 And systemd weighs in on how to find out the distribution you're on....
Change-Id: I84e957617b81b6cfad815dc84439e166c0f936b6
Reviewed-on: https://code.wireshark.org/review/25980
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-02-22 02:50:50 +00:00
Guy Harris dc6b9dfcd6 Define macros to calculate (2^N)^M, and use them in more places.
Change-Id: I4df1b35d8d2233c301f0ba9e119d012aebe9cd17
Reviewed-on: https://code.wireshark.org/review/25913
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-02-20 05:27:38 +00:00
Guy Harris 8b9dfbaba9 The CRC8 routines don't modify the buffer; make the pointers to it const.
This lets us get rid of some casts that provoke "drops const qualifier"
warnings.

Change-Id: Ia7e0863bd97bc20dbbb810e13778ec78d0cf3c91
Reviewed-on: https://code.wireshark.org/review/25837
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-02-17 19:30:35 +00:00
Guy Harris 5bf8da8a4c Fix casts.
A gconstpointer is a "pointer to const void", so it should be cast to
"pointer to const XXX".  A "pointer to const pointer to plugin" is a
"plugin *const *".

C's declaration syntax is not one of its strong points.  There's a
reason why the cdecl program, and the Web site that uses it,
http://cdecl.org, exists (as the tag line says, "C gibberish <->
English"), and why I used it to make sure I got this working.

Change-Id: Ia29bb25d17a1255a06b4ace542643c4b494d4977
Reviewed-on: https://code.wireshark.org/review/25835
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-02-17 18:41:23 +00:00
Gerald Combs a9823dddf3 Qt: Replace the toolbar extension icon.
The QToolBar extension button icon is ugly, particularly on HiDPI
displays.  Replace it with a RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK.

Change-Id: I8822252ff5c328acd23aad345313e7cfafdffa47
Reviewed-on: https://code.wireshark.org/review/25821
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-02-17 08:26:46 +00:00
Guy Harris 459bd4646d Don't have CLEAN_FILES variables for the "clean" source files.
Except for the one directory that (currently) has "not yet clean" files,
epan/dissectors, we don't need a separate variable to keep track of the
"clean" source files.

In the cases where not all files were in CLEAN_FILES, put them into the
variable used to enable -Werror or its equivalent.

Change-Id: Ic4119861c1d9e381adfe31e9977e1ac71d623f5b
Reviewed-on: https://code.wireshark.org/review/25830
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-02-17 02:50:24 +00:00
Peter Wu d45bd7cb24 Move hkdf_extract to wsgcrypt.h
HKDF-Extract is not used in TLS, but in QUIC. For reuse in OSCORE, move
it to wsutil. Adjust comments slightly to emphasize precondition.

Change-Id: I5105e7416037697b383ad58f62be285c2b7ab8b7
Reviewed-on: https://code.wireshark.org/review/25802
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Mališa Vučinić <malishav@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2018-02-15 16:19:35 +00:00
Peter Wu ae91f43155 Extract HKDF-Expand from TLS 1.3 dissector
HKDF (RFC 5869) is a standard construct used in TLS 1.3, QUIC and
OSCORE, generalize it for use outside the TLS dissector.

Since none of the users need the "context" (formerly "hash_value")
field, remove the parameter.

Change-Id: Id952de8cb3000f6f6eda844d17c78bbd3906a84d
Reviewed-on: https://code.wireshark.org/review/25723
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-12 08:37:48 +00:00
Dan Robertson 9ff64c8d7c musl: compile with musl libc
Ensure that wsutil/ws_pipe.c includes <sys/select.h> as as both
the timeval struct and the select function are used.

Change-Id: Idbd9e9a5b9cbee9977a423c32e55be81bb6425c3
Reviewed-on: https://code.wireshark.org/review/25616
Petri-Dish: Jaap Keuter <jaap.keuter@xs4all.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-02-10 17:40:50 +00:00
Dario Lombardo 8cd389e161 replace SPDX identifier GPL-2.0+ with GPL-2.0-or-later.
The first is deprecated, as per https://spdx.org/licenses/.

Change-Id: I8e21e1d32d09b8b94b93a2dc9fbdde5ffeba6bed
Reviewed-on: https://code.wireshark.org/review/25661
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-08 14:57:36 +00:00
Guy Harris 600b84f4c1 Clean up the null pointer check in profile_exists().
Check only in the if (global) case, and note that it's necessary in that
case; in the !global case, note why we don't have to check for a null
pointer.

Change-Id: I80322204ec94eb3901f7bceabccb29351794adc8
Reviewed-on: https://code.wireshark.org/review/25674
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-02-07 22:21:03 +00:00
Stig Bjørlykke 22824478d1 wsutil: Allow NULL as profile name
Using NULL as profile name indicates the Default profile and
profile_exists() must not return FALSE for the Default profile.

This is a regression from ge0d04a75.

Change-Id: I2463a7d3e12dda794f3391d999442a303d80621c
Reviewed-on: https://code.wireshark.org/review/25659
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2018-02-07 14:03:44 +00:00
Dario Lombardo 71844ed50a wsutil: use SPDX identifiers.
Change-Id: I4863416ddc425b9138ffa47621eee823db9e7fda
Reviewed-on: https://code.wireshark.org/review/25557
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-02-07 05:34:22 +00:00
Stig Bjørlykke d25e7885e6 base64: Adjust whitespace for readability
Change-Id: Ibf72dddceac925521a0fec3ab0bed7ed360e7c06
Reviewed-on: https://code.wireshark.org/review/25547
Petri-Dish: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2018-02-01 16:57:04 +00:00
Dario Lombardo d3e50fedf7 buffer: add g_assert to all functions.
This pacify clang warnings as well.

Change-Id: I5d61a82bfc43b93281f0d0caabcb7109c849788b
Reviewed-on: https://code.wireshark.org/review/25518
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2018-02-01 07:21:11 +00:00
João Valverde 38c0ffe4c6 Avoid #ifdef'ing out translation units
Change-Id: Ibef0120184ae577f11059fcaf0eaa24a32820273
Reviewed-on: https://code.wireshark.org/review/25502
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
2018-01-29 10:55:02 +00:00
Jakub Zawadzki 3d94f624d1 wsutil/filesystem.c: fix memory leak in init_progfile_dir()
If file wasn't found in PATH, there is a leak of path.
Don't break the loop after reaching NUL character.
Check for NUL character will be done in while() start condition.
Found by clang.

Change-Id: I0111a71853ffd485ee1096296f92de4472409c66
Reviewed-on: https://code.wireshark.org/review/25445
Petri-Dish: Jakub Zawadzki <darkjames-ws@darkjames.pl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2018-01-28 21:49:42 +00:00
João Valverde 1b467b11ad Minor Makefile.am cleanup.
Change-Id: I3670c86a695cbea00be39d0c274a5bef0ef31cbf
Reviewed-on: https://code.wireshark.org/review/25501
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
2018-01-28 21:34:32 +00:00
João Valverde 66f85c65d5 plugins: Remove nordic_ble.dll exception
This should no longer be necessary with the sub-version directory
struture. If the user is installing a DLL for a built-in plugin, an
error message is appropriate.

Change-Id: I80842f1ea03a08594321a674650a1373aaa48712
Reviewed-on: https://code.wireshark.org/review/25500
Reviewed-by: João Valverde <j@v6e.pt>
2018-01-28 21:34:22 +00:00
João Valverde 5d1687e449 Rename plugins_scan_dir()
This makes it more obvious that it is a static function.

Change-Id: I7348c4326b1e388870cb6657d9c67bd1086357b0
Reviewed-on: https://code.wireshark.org/review/25499
Reviewed-by: João Valverde <j@v6e.pt>
2018-01-28 21:34:12 +00:00
João Valverde 285a0f5a96 Use g_str_has_suffix()
Change-Id: Ida335462efdfeef88a7afb3f27caf274632ca879
Reviewed-on: https://code.wireshark.org/review/25498
Reviewed-by: João Valverde <j@v6e.pt>
2018-01-28 21:34:05 +00:00
João Valverde 15d9ab22c3 plugins: Use per-library data structures
This is cleaner and allows the "duplicate plugin name check" to be
performed correctly (per module and not globally).

Change-Id: I2b2122495dc047af5b7043dcf020a525766b7c30
Reviewed-on: https://code.wireshark.org/review/25496
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
2018-01-28 17:56:05 +00:00
João Valverde 5352ef42f9 plugins: Add source tree subfolder for plugin library
This allows some simplification and makes things more consistent,
particularly for loading plugins from the build dir.

Also fixes the issue reported here:

https://www.wireshark.org/lists/wireshark-dev/201801/msg00061.html

Change-Id: I0d8a000ee679172bccad546a3b0c47a79486f44d
Reviewed-on: https://code.wireshark.org/review/25329
Petri-Dish: João Valverde <j@v6e.pt>
Reviewed-by: João Valverde <j@v6e.pt>
2018-01-16 08:51:37 +00:00
Guy Harris c721763858 Update a comment to reflect current reality.
All plugin types now have plugin_register() as the registration
function, so it's an entry point for the plugin registration function,
not the particular plugin type.

Clean up white space while we're at it.

Change-Id: I166359deac57512cb6e87b2c7388c4b25cc54e10
Reviewed-on: https://code.wireshark.org/review/25254
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2018-01-11 04:08:02 +00:00
Gerald Combs 5639b8014a Use an enum for plugin types.
Make plugins.c the source of truth for plugin names. Where plugins
reside and what they do are two different things, so split the plugin
directory and description into two separate elements.

CMake creates portable[1] builds on Windows and macOS. That is, the
build-time directory layout is the same as the installation directory
layout. Adjust various plugin paths macOS accordingly.

[1] You have to run osx-app.sh on macOS to prepare the application
bundle, but the goal is to create a directory/bundle that can be moved
or copied to a different system and run in the new location.

Change-Id: Icf9d02e61918fdf1404468baf52542910edf2743
Reviewed-on: https://code.wireshark.org/review/25166
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2018-01-11 00:58:43 +00:00
Dario Lombardo e80b40adbe extcap: remove conditional compilation.
Change-Id: Ia54bba388755cf27a343fe6d69d244bf1ab897f9
Reviewed-on: https://code.wireshark.org/review/25186
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2018-01-08 05:50:15 +00:00
Dario Lombardo e0d04a752a wsutil: return false if NULL is asked as profile name (CID: 1405202).
Better not rely on the fact that the caller won't pass NULL. A NULL
profile would be lead to a wrong behaviour.

Change-Id: I281f0d2364af9f7b78268580dd73024b07bcba83
Reviewed-on: https://code.wireshark.org/review/25124
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Dario Lombardo <lomato@gmail.com>
2018-01-03 16:00:52 +00:00
Uli Heilmeier 5dc7ce6ccc ws_pipe: fix format error for size_t buffer_size
Fix error: format '%ld' expects argument of type 'long int', but argument 4 has type 'size_t'

Change-Id: I86ec4076bb7e8c11d5cf82187a46a528bf43c514
Reviewed-on: https://code.wireshark.org/review/25109
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Dario Lombardo <lomato@gmail.com>
2018-01-02 14:47:33 +00:00
Roland Knall 07e8707d73 wsutil: Add missing include
Otherwise gboolean is undeclared in files depending on the functionality,
like extcap.c for instance

Change-Id: I329715b2bb7bfd5d12ce3f1a035ecda6dff16a2d
Reviewed-on: https://code.wireshark.org/review/25110
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
2018-01-02 13:30:08 +00:00
Dario Lombardo 098fbc70ee ws_pipe: provide a null terminated string anyway (CID: 1364684).
Change-Id: I4143b499986cbd31db524db73dde72ddbe26077d
Reviewed-on: https://code.wireshark.org/review/25072
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2018-01-02 03:38:16 +00:00
Stig Bjørlykke 564a3fae12 Happy New Year 2018!
Change-Id: I61ece8256384786c718fe2c1bc8813560fa372eb
Reviewed-on: https://code.wireshark.org/review/25094
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
2018-01-01 11:25:19 +00:00
Peter Wu bad83f249f Fix build and thread runtime compat with older GLib
CentOS 6 ships with glib 2.28.8 which do not support
g_ptr_array_new_full (make-taps/make-dissectors) and need to link with
wsutil for glib-compat.

g_thread_new was only introduced with GLib 2.32 (not 2.31), so adjust
the check accordingly. Abort in case thread creation fails (as
documented). Properly initialize threads or it will abort on runtime
(this also requires linking epan with gthreads in CMake, autotools
already includes it with GLIB_LIBS).

Change-Id: Ie81d6df7b3b26aaa4eb25e23719a220755e2c13c
Reviewed-on: https://code.wireshark.org/review/24978
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-12-24 20:22:58 +00:00
Guy Harris 6a949ed155 Put special pipe-handling code into libwsutil.
Ask, in a comment, why we're doing PeekNamedPipe() when we're trying
to read everyting in the pipe, up to the EOF, into a string.

On UN*X, do the same "read up to an EOF and then NUL-terminate the
result" stuff that we did on Windows; nothing guarantees that, on all
UN*Xes, in all circumstances, until the end of time, world without end,
amen, we can do one read and get the entire string.

Change-Id: I578802b23fec1051139eaefd9a09fe2a6de06a11
Reviewed-on: https://code.wireshark.org/review/24959
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-12-23 20:43:32 +00:00
Gerald Combs 6a5e90f2d9 Log output updates.
Add a Qt message handler that calls g_log. Add milliseconds to the
g_log_message_handler timestamp.

Change-Id: I5b1c1d902b6b05cd8daa01741b19d6c2048dfb9a
Reviewed-on: https://code.wireshark.org/review/24865
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-12-17 02:30:40 +00:00
João Valverde 995812c5f1 Refactor plugin registration and loading
Put different types of plugins (libwiretap, libwireshark) in different
subdirectories, give libwiretap and libwireshark init routines that
load the plugins, and have them scan the appropriate subdirectories
so that we don't even *try* to, for example, load libwireshark plugins
in programs that only use libwiretap.

Compiled plugins are stored in subfolders of the plugin folders, with
the subfolder name being the Wireshark minor version number (X.Y). There is
another hierarchical level for each Wireshark library (libwireshark, libwscodecs
and libwiretap).

The folder names are respectively plugins/X.Y/{epan,codecs,wiretap}.

Currently we only distribute "epan" (libwireshark) plugins.

Change-Id: I3438787a6f45820d64ba4ca91cbe3c8864708acb
Reviewed-on: https://code.wireshark.org/review/23983
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
2017-12-14 08:43:57 +00:00
Michael Mann 3d673da88c Convert to using use SPDX identifier on wsutil directory
Change-Id: Id73e641499e75bc1afc1dea29682418156f461fe
Reviewed-on: https://code.wireshark.org/review/24751
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-12-10 04:36:29 +00:00
Dario Lombardo 42b191a657 wsjsmn: use SPDX identifier.
Change-Id: Iefdfd06b3b063a0d497587142996f2cd986d413f
Reviewed-on: https://code.wireshark.org/review/24724
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-12-07 19:25:18 +00:00
AndersBroman 290fd76af6 [glib-compat] #include "ws_attributes.h" needed to handle _U_
Change-Id: Ie7aa8ef0a2ec8e65947e214488809d0df0ee015b
Reviewed-on: https://code.wireshark.org/review/24670
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-12-01 12:02:16 +00:00
Gerald Combs 67ffa3cf7d Threads: Set lifetimes and add a compatibility routine.
Join the protocol registration threads so that they call g_thread_unref
which in turn detaches/terminates the thread. This gets rid of many TSan
and DRD errors here. The remaining ones appear to be false positives.

Add g_thread_new to glib-compat (untested).

Change-Id: I4beb6746ed08656715cf7870ac63ff80cf1ef871
Reviewed-on: https://code.wireshark.org/review/24619
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>
2017-11-29 04:43:41 +00:00
AndersBroman 243fa8c441 [glib-compat] g_async_queue_timeout_pop() needed for older glibs
(2.31.18)

Change-Id: I727c8548c29b3409fab819dce072e86153232911
Reviewed-on: https://code.wireshark.org/review/24550
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-11-23 14:46:20 +00:00
AndersBroman db811a699d [glib-compat] Add g_ptr_array_new_full().
Change-Id: Ic0e054cbb28106cc02f229ad4f2476b39e544378
Reviewed-on: https://code.wireshark.org/review/24544
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-11-23 11:41:37 +00:00
João Valverde 262a84c384 Fix (and chop) static build option
This sets the scope of the static build option to Wireshark support
libraries only.

Before the patch:

Static plugins don't work with CMake and autotools.

autotools static build is broken, and most likely will always be, as
building Wireshark all-static is difficult and time-consuming.

After the patch:

For CMake Wireshark will be built with static or shared libraries and
dynamic plugins. Everything just works. CMake apparently doesn't want
you building static and shared libraries at the same time.

For autotools Wireshark will be built with shared libraries by default.
--disable-shared and --enable-static options work as usual. Dlopened
plugins are not built if --disable-shared is given to configure (to
disable shared libraries). This is a limitations imposed by libtool.

Tested on Linux. This removes broken support for building plugins
statically.

Change-Id: Ib8e8176976f136eea93a2ce8f9857b6cf9bec64c
Reviewed-on: https://code.wireshark.org/review/24241
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
2017-11-19 20:16:50 +00:00
João Valverde 3996701183 Replace inet_addr() with our inet_pton() wrapper
Error checking omitted like in original code.

Change-Id: If8b4181d30ddf5717951aaf7ec61db25c0bc5322
Reviewed-on: https://code.wireshark.org/review/24309
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
2017-11-09 16:08:25 +00:00
João Valverde 9a464fd9bd Avoid asserting with EAFNOSUPPORT
We require support for AF_INET/AF_INET6 to run and assume this is available
on all supported platforms. If and when reality clashes with that assumption just
avoid aborting. Errors are to be expected as long as they don't produce a crash.

Change-Id: I5c107b1a8fd64441eb96f48381412e180b66feb7
Reviewed-on: https://code.wireshark.org/review/24187
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
2017-10-30 19:38:37 +00:00
Guy Harris 39ba9d4e7f Add wsutil/inet_ipv4.h.
It defines a ws_in4_addr type, which is intended to hold IPv4 addresses
in network byte order, and some macros to test for IPv4 addresses in the
local network control block and multicast IPv4 addresses.

Use those macros in places where dissectors had their own code for that
purpose.

Change-Id: I4252b410e37207157be85119a332e2a6913b332f
Reviewed-on: https://code.wireshark.org/review/24178
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-10-30 02:11:22 +00:00
João Valverde 62b870a722 Do not assert in ws_inet_ntop()
Change-Id: I9d420c5f6bc29ce94855017739169dc8e8ce4d48
Reviewed-on: https://code.wireshark.org/review/24173
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
2017-10-29 21:10:23 +00:00
João Valverde de1b26a3c6 More ws_inet_ntop() tweaks.
Change-Id: I8f77f189337f9299e566a4149ae6ea481d3dbed6
Reviewed-on: https://code.wireshark.org/review/24162
Reviewed-by: João Valverde <j@v6e.pt>
2017-10-29 15:15:20 +00:00
Guy Harris ce25b358a9 Go with the RFC 2133-and-successors values for IPv4 and IPv6 address strings.
Add a comment explaining why Windows has different, larger values for
INET_ADDRSTRLEN and INET6_ADDRSTRLEN.

Change-Id: I4ad53c6cffae46d108f778460ce653dcc9343c64
Reviewed-on: https://code.wireshark.org/review/24155
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-10-29 05:31:31 +00:00
João Valverde ac804b59e2 Improve our inet_ntop() wrapper
Also fix buffer length define, as it is not guaranteed to be 46 on
Windows (it never was guaranteed anyway for the libc implementation,
but the likelyhood of being greater was small).

Change-Id: I2db705d86f825765ed32ec70b8d22058b5d629e8
Reviewed-on: https://code.wireshark.org/review/24074
Reviewed-by: João Valverde <j@v6e.pt>
2017-10-26 14:39:00 +00:00
Guy Harris b1147a6033 Rename some IPv6 address test functions.
They test where the address is XXX, for various values of XXX, so name
them accordingly.

Change-Id: I437175f02b3f97fecee77e8bb9416bb5b71cd0d0
Reviewed-on: https://code.wireshark.org/review/24075
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-10-26 09:24:06 +00:00
Guy Harris 458c3c026e Add a ws_in6_addr typedef for struct e_in6_addr.
That allows a parallel typedef of ws_in4_addr for guint32.

Change-Id: I03b230247065e0e3840eb87635315a8e523ef562
Reviewed-on: https://code.wireshark.org/review/24073
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-10-26 08:50:34 +00:00
Gerald Combs bfad9c56f9 CMake: Don't check for windows.h or winsock2.h.
If we're building on Windows we're going to have windows.h and
winsock2.h. Don't bother checking for them.

Change-Id: I0004c44d7364ab3f41682f34b8c84cd8617c9603
Reviewed-on: https://code.wireshark.org/review/24068
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>
2017-10-26 07:08:41 +00:00
João Valverde eae216ef1d Remove replacement inet_pton/inet_ntop
Should be available on every platform we support.

Change-Id: Ib65d78e351d22d581b427e5e93fc8d5e5348b260
Reviewed-on: https://code.wireshark.org/review/24047
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-10-25 21:03:56 +00:00
João Valverde 90644c8372 Remove inet_aton() usage everywhere
Including where it says not to in comments. Use IPv4 dotted-decimal
notation.

Change-Id: Iafe1f6fbd2bd5867c41642dc27411f47dff8ce6a
Reviewed-on: https://code.wireshark.org/review/24044
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
2017-10-25 19:10:57 +00:00
João Valverde e1ef8e5f75 Test g_printf() thousands grouping flag at runtime
This tests the runtime environment so avoid hard-coding it during the build.

For now we avoid messing with locales for the test, unless it turns out to
be necessary (ISO C printf behaviour with invalid conversion specifier is
undefined).

Change-Id: I341c2ab5e716973689cf9002f13435404a41369f
Reviewed-on: https://code.wireshark.org/review/24038
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
2017-10-24 22:00:46 +00:00
João Valverde 14e687c1dd Make plugin support a runtime property
Keep the option to disable at compile-time but use AC_ARG_ENABLE instead.

Change-Id: Ie8c3f5ba0db1eb6d9d4ffd742cd3aa049ead5007
Reviewed-on: https://code.wireshark.org/review/24026
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
2017-10-23 20:04:14 +00:00
Pascal Quantin c23e3761a5 file_util.c: do not leak service handle
Follow-up of gd64c30052

Change-Id: I620b3fb44fe3090120f2d29809961623e00d55a4
Reviewed-on: https://code.wireshark.org/review/23999
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2017-10-20 10:25:16 +00:00
Pascal Quantin d64c300522 Do not add Npcap path if npf.sys service is found
Otherwise you can end with 2 Packet.dll (the one from WinPcap and the one
from Npcap) being loaded at the same time, which can create incompatibilities.

Bug: 14134
Change-Id: Ia06066fd54b60296e55dbfce6c6f2ddd99367479
Reviewed-on: https://code.wireshark.org/review/23969
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-10-20 04:18:09 +00:00
João Valverde 2196fcb008 Refresh wsutil/Makefile.am
Change-Id: I6a70a2dc45257826c930f57a59cdd9bf5b4c3c73
Reviewed-on: https://code.wireshark.org/review/23973
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
2017-10-18 18:37:26 +00:00
João Valverde 45fbb287b4 autotools: Remove abi-compliance-checker code
It's been broken for over a year, needs to be modernized and as
implemented it's a maintenance nightmare. Get rid of it.

Ping-Bug: 13036
Change-Id: I34a6e4c28b6d3b96dd6550dd21e9cbeaf050d58f
Reviewed-on: https://code.wireshark.org/review/23967
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
2017-10-18 17:19:18 +00:00
João Valverde 55b0c251a0 autotools: remove macOS Frameworks support
This treats macOS/OSX like any other Unix-like build target (Darwin),
thus removing autotools support for macOS-specific build options.

Anyone needing that is advised to use the fully-supported-on-macOS CMake
build.

Change-Id: I88e2fa7a8eea42241efcf84223ac2362d38b1e12
Reviewed-on: https://code.wireshark.org/review/23951
Petri-Dish: João Valverde <j@v6e.pt>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
2017-10-17 18:50:09 +00:00
João Valverde a8a0d5ff98 autotools: Fix bogus checkAPI targets
Change-Id: Ifc8884fc0f0e4548db79a68e3fbc35c7e5fb9be9
Reviewed-on: https://code.wireshark.org/review/23947
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
2017-10-17 15:33:52 +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
Ahmad Fatoum 9d49e13166 Remove superfluous null-checks before strdup/free
NULL checks were removed for following free functions:

- g_free "If mem is NULL it simply returns"
  https://developer.gnome.org/glib/stable/glib-Memory-Allocation.html#g-free

- g_slist_free(_full)? "NULL is considered to be the empty list"
  https://developer.gnome.org/glib/stable/glib-Singly-Linked-Lists.html

- g_strfreev "If str_array is NULL, this function simply returns."
  https://developer.gnome.org/glib/stable/glib-String-Utility-Functions.html#g-strfreev

- g_slice_free "If mem is NULL, this macro does nothing."
  https://developer.gnome.org/glib/stable/glib-Memory-Slices.html#g-slice-free

- g_match_info_free "not NULL... otherwise does nothing"
  https://developer.gnome.org/glib/stable/glib-Perl-compatible-regular-expressions.html#g-match-info-free

- dfilter_free defined in Wireshark code. Returns early when passed NULL
  epan/dfilter/dfilter.c

They were also removed around calls to g_strdup where applicable:

- g_strdup "If str is NULL it returns NULL."
  https://developer.gnome.org/glib/stable/glib-String-Utility-Functions.html#g-strdup

Change-Id: Ie80c2db89bef531edc3aed7b7c9f654e1d654d04
Reviewed-on: https://code.wireshark.org/review/23406
Petri-Dish: Roland Knall <rknall@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
2017-10-15 12:38:51 +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 2777003e12 Add version check for plugin compatibility
Only plugins built for the same feature release (X.Y) are assured binary
compatibility. Make sure we don't try to run unsuitable code and, if so,
warn the user. This might happen for example if the user manually copies
a binary plugin to the wrong folder, intentionally or by accident.

I'm using "release version" to loosely mean not a patch release
(i.e: a feature release).

Change-Id: I896e9cbbd2d3843623fff6af8ef51002ec06f1f8
Reviewed-on: https://code.wireshark.org/review/23807
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-03 10:09:24 +00:00
João Valverde 5c2a5dbdcd plugins: Improve output format
And some minor code style changes.

Change-Id: I97e53848db42c3981af69152b171b3a77f831da5
Reviewed-on: https://code.wireshark.org/review/23806
Reviewed-by: João Valverde <j@v6e.pt>
2017-10-01 21:13:45 +00:00
João Valverde 0e63979730 plugins: Move the build dir scanning code to a separate function
Change-Id: Iee476ac84d530810e5b70547c462050f1c03ee1b
Reviewed-on: https://code.wireshark.org/review/23755
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-26 20:56:03 +00:00
João Valverde a1969dd6f6 plugins: No need to allocate a new struct
Change-Id: Ic39cf1c7f199dc5e4879d954a649d21453dcc5e5
Reviewed-on: https://code.wireshark.org/review/23753
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-26 19:52:30 +00:00
João Valverde f2404376f8 plugins: Build the description string while loading
Change-Id: Ia67133c1c9d005fc4a81b0727a7b1849571ab29c
Reviewed-on: https://code.wireshark.org/review/23742
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-26 11:33:09 +00:00
João Valverde 0b76a4957d plugins: Sort the descriptions
Change-Id: I8113ba9782962856ce86475cddf40d69ed267fb4
Reviewed-on: https://code.wireshark.org/review/23733
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-26 09:50:14 +00:00
João Valverde f022a629f1 plugins: Use hash table for book-keeping
Avoid having to walk the list to check for existence on every file
load.

Now the binary plugin description list in About Wireshark is randomized
instead of sorted by load order. We may want to change that.

Add missing "const" to plugin->version.

Fix an apparent trivial leak where the GModule handle was not closed on
exit.

Change-Id: I774215a84b080bbe889f88cc6a9b777bcf60b335
Reviewed-on: https://code.wireshark.org/review/23732
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-09-26 04:11:07 +00:00
João Valverde 8615081a09 plugins: Fix crash loading binary module twice
If a plugin is repeated we destroy the GModuleHandle in plugins_scan_dir()
but we have already added the entry points to the list of registered
plugins.

Check for repeated plugins before adding it to the list of registered
plugins, not after.

Don't check for both name and version, check only for repeated names.

Give the plugin callback a more descriptive name.

Change-Id: I22cbbb059b8029877580fc33517310496c93e5d5
Reviewed-on: https://code.wireshark.org/review/23726
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-25 16:45:23 +00:00
João Valverde d7ec2cbc38 autotools: Use package flags to configure libpcap
Change-Id: Icd64014b597a8e60d2aff9d180c441c6ffccff26
Reviewed-on: https://code.wireshark.org/review/23329
Reviewed-by: João Valverde <j@v6e.pt>
2017-09-24 12:58:06 +00:00