Commit Graph

628 Commits

Author SHA1 Message Date
Guy Harris e09b03e9b1 Add get_ routines to get a guint32, and use them.
By analogy to get_natural_int() and get_positive_int(), add routines to
get a guint32 and to get a non-zero guint32, doing all the necessary
error checks, and use it.

Change-Id: I65a9ac8a3d136886df3588806ae7af5bdc7b8cb6
Reviewed-on: https://code.wireshark.org/review/17586
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-09-08 18:27:21 +00:00
Guy Harris c7fc280222 Make the ws_strto* routines more like the strto* routines.
Not all uses of atoi() or various strto* routines in Wireshark expect
the string to contain *only* a number, so not all uses should require
that the byte after the number be a '\0'.  Have the ws_strto* routines
take a "pointer a pointer set to point to the character after the
number" argument, and have the callers do the appropriate checks of the
character after that.

This fixes the VMS trace reading code so that it can read those files
again.

The get_ routines are handed command-line arguments, so they *do* expect
the string to contain only a number; have them check to make sure the
byte after the number is a '\0'.

Change-Id: I46fc1bea7912b9278e385fe38491a0a2ad60d697
Reviewed-on: https://code.wireshark.org/review/17560
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-09-07 20:41:53 +00:00
Guy Harris 595610f9cc Always set *cint before returning.
Change-Id: I333aef7d3fe4ad3bf7c2a4d7318766fcbd2e4cd2
Reviewed-on: https://code.wireshark.org/review/17539
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-09-06 18:01:34 +00:00
Guy Harris 295dbc609d Suppress another warning if told not to report failures.
That's another failure that can occur if you're trying to load a
libwireshark plugin in a program that doesn't use libwireshark if, for
example, references to an undefined symbol don't prevent the module from
being loaded in the first place.

Change-Id: I21629c0094fdca7dfbd88f39b7e6c10fb600b401
Reviewed-on: https://code.wireshark.org/review/17537
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-09-06 17:14:45 +00:00
Alexis La Goutte 36c8065cc3 strtoi(.c): fix extra ';' outside of a function [-Wextra-semi]
Change-Id: I2d92678b2117da732be309c2d430d0c97c7a7eed
Reviewed-on: https://code.wireshark.org/review/17528
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-09-06 12:41:19 +00:00
Guy Harris 5eb9170227 Use ws_strtoi32() in get_natural_int().
Change-Id: I9a95239de8db18cff0f6c62cb526f3ef0cb29f01
Reviewed-on: https://code.wireshark.org/review/17513
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-09-06 02:24:24 +00:00
Guy Harris 9ef70fce3c Return the maximum or minimum value for ERANGE.
That way, for signed values, the caller knows whether ERANGE means "too
large" or "too small"; this is analogous to what the C routines return.

Change-Id: Ifc1fc4723733be606487093f8aa77ae2d89d2c40
Reviewed-on: https://code.wireshark.org/review/17512
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-09-06 02:05:41 +00:00
Guy Harris 97103d40e3 Check for signs in unsigned numbers and fail if we see one.
-1 is not an unsigned number.  For that matter, neither is +1;
"unsigned" means "without a sign", and they both have signs.

ANSI C's strto{whatever} routines - even the ones that supposedly are
for "unsigned" values - and the GLib routines modeled after them allow a
leading sign, so we have to check ourselves.

Change-Id: Ia0584bbf83394185cde88eec48efcdfa316f1c92
Reviewed-on: https://code.wireshark.org/review/17511
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-09-06 01:08:42 +00:00
Guy Harris 2a38dc74ed Have scan_plugins() take an argument specify what to do on load failures.
That's a less gross hack to suppress load failures due to not having
libwiretap than providing a no-op failure-message routine, as it at
least allows other code using a failure-message routine, such as
cmdarg_err() and routines that call it, to be used.

We really should put libwiretap and libwireshark plugins into separate
subdirectories of the plugin directories, and avoid even looking at
libwireshark plugins in programs that don't use libwireshark.

Change-Id: I0a6ec01ecb4e718ed36233cfaf638a317f839a73
Reviewed-on: https://code.wireshark.org/review/17506
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-09-05 23:27:02 +00:00
Dario Lombardo ba981aced8 wsutil: add string to integer conversion utilities.
In the current code many functions have been used for convertion
(strtol, atoi, g_ascii_strtoll, etc). Those utilities want to be
the only, shared, way to convert integers.

Change-Id: I22ba1bf54e144e73a4728612a4437de5a2d339e2
Reviewed-on: https://code.wireshark.org/review/17414
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Roland Knall <rknall@gmail.com>
Reviewed-by: Dario Lombardo <lomato@gmail.com>
2016-09-05 09:54:12 +00:00
Peter Wu a892c90367 time_util: fix -Wshadow issue
time_util.c was already fixed, but the header was missing the change,
breaking the build on a very old compiler.

Change-Id: I95685c9a3e25dcb7567f2551b92f20c8792a6e47
Reviewed-on: https://code.wireshark.org/review/17384
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2016-08-30 10:35:33 +00:00
Dario Lombardo 139170c6c6 wsutil: add enumeration of local ip addresses in Windows.
Routine used by ssh-based extcaps.

Change-Id: I06d8e1e1444cd03a0508dc0c7cb91d340a451c58
Reviewed-on: https://code.wireshark.org/review/17308
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Roland Knall <rknall@gmail.com>
Reviewed-by: João Valverde <j@v6e.pt>
Reviewed-by: Dario Lombardo <lomato@gmail.com>
2016-08-26 21:04:40 +00:00
Dario Lombardo a1af188aed wsutil: fix indentation of interface.c
Change-Id: Icf0c0c4ce1e3763eb385de24dc608a120e0f4af2
Reviewed-on: https://code.wireshark.org/review/17307
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-08-25 00:29:54 +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
Guy Harris 66711eb261 Avoid colliding with the (old) UNIX stime() system call.
Rename "stime" to "sys_time", and, for consistency, do the same with
"utime".  This failed when I tried a build on an Ubuntu 12.04 LTS
machine.

Change-Id: Ib955b723506346aa742db0de4d26dc157bcd4fc8
Reviewed-on: https://code.wireshark.org/review/16935
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-08-07 03:07:38 +00:00
Gerald Combs 183d7f3b78 Add string function times to wmem_test.
The system, GLib, and wmem string functions can perform differently,
particularly on Windows. Start adding performance tests to wmem_test so
that we can see the differences.

With this change applied "wmem_test --verbose" prints out the following
on a Windows 7 x64 VM here. wmem_test is linked against GLib 2.4.20.

(MINPERF:g_printf_string_upper_bound (via g_snprintf) 1 string: u 327.602 ms s 0
.000 ms)
(MINPERF:g_printf_string_upper_bound (via g_snprintf) 5 strings: u 1419.609 ms s
 0.000 ms)
(MINPERF:g_printf_string_upper_bound (via g_snprintf) mixed args: u 1606.810 ms
s 0.000 ms)
(MINPERF:_snprintf_s upper bound 1 string: u 124.801 ms s 0.000 ms)
(MINPERF:_snprintf_s upper bound 5 strings: u 140.401 ms s 0.000 ms)
(MINPERF:_snprintf_s upper bound mixed args: u 124.801 ms s 0.000 ms)
(MINPERF:g_strdup_printf 2 strings: u 702.005 ms s 0.156 ms)
(MINPERF:g_strconcat 2 strings: u 78.000 ms s 0.000 ms)
(MINPERF:g_strdup_printf 5 strings: u 1419.609 ms s 0.156 ms)
(MINPERF:g_strconcat 5 strings: u 93.601 ms s 0.156 ms)
(MINPERF:wmem_strdup_printf 2 strings: u 343.202 ms s 0.312 ms)
(MINPERF:wmem_strconcat 2 strings: u 93.601 ms s 0.468 ms)
(MINPERF:wmem_strdup_printf 5 strings: u 327.602 ms s 8.268 ms)
(MINPERF:wmem_strconcat 5 strings: u 62.400 ms s 3.432 ms)

Change-Id: Id9b23918829db1719d141e7f830b9eba6245a25b
Reviewed-on: https://code.wireshark.org/review/14857
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-07-30 16:29:36 +00:00
João Valverde e3d78be0b4 Move IPv6 inet definitions to wsutil/inet_ipv6.h
Change-Id: I880adf7fc1e131639f318cdecf7d8e59262d89fb
Reviewed-on: https://code.wireshark.org/review/16784
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-07-30 13:14:43 +00:00
Michael Mann 916b26ecfe Cleanup some checkAPI warnings that were missed in previous patches.
Some search/replace of printf, g_warning and GTK APIs were changed to use a
ws_ prefix

Change-Id: I9beb763a975530a4006d1afbcad079a7d8d4ebf9
Reviewed-on: https://code.wireshark.org/review/16704
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-07-26 17:15:38 +00:00
Michael Mann 907d49483d Fix some of the checkAPIs.pl warnings for g_warning.
1. Create ws_g_warning for legitimate uses of g_warning
2. Use proto_tree_add_debug_text
3. Comment some out

Change-Id: Ida044bf40286b955fdd529c4f9907c8e09b3d7c5
Reviewed-on: https://code.wireshark.org/review/16678
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>
2016-07-26 04:08:50 +00:00
Michael Mann 1da1f945e2 Fix checkAPI.pl warnings about printf
Many of the complaints from checkAPI.pl for use of printf are when its embedded
in an #ifdef and checkAPI isn't smart enough to figure that out.
The other (non-ifdef) use is dumping internal structures (which is a type of
debug functionality)
Add a "ws_debug_printf" macro for printf to pacify the warnings.

Change-Id: I63610e1adbbaf2feffb4ec9d4f817247d833f7fd
Reviewed-on: https://code.wireshark.org/review/16623
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>
2016-07-25 04:26:50 +00:00
João Valverde a02e90da41 filesystem.c: Don't constify mallocated pointer
Change-Id: I8991682bda256c5e1c09a303b0243e240b276101
Reviewed-on: https://code.wireshark.org/review/16602
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-07-23 12:44:34 +00:00
Gerald Combs b2e4a7e21c Minimize allocations for frame tvbuffs and Buffers.
Try to minimize the number of times we allocate memory for Buffers and
Buffer data.

Change-Id: I738fdc64e571772ef4ba6335d49087277dd7b430
Reviewed-on: https://code.wireshark.org/review/16577
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-07-22 04:18:08 +00:00
Gerald Combs 913e0f408c Use Windows CRT string functions in some places.
Copy wsutil/wsprintf.h from change 16537. Update it to use functions
appropriate to Visual C++ >= 2015, < 2015, and everything else. Add
notes about specific API issues.

Update epan/expert.c to use ws_snprintf, since the VS profiler shows it
as a minor hot spot. This reduces load time for a large-ish capture from
~14s to ~12s here.

Migrate a previous column-utils change.

Change-Id: Id4064b7c06c35fd447b63c73f731afee181df4f9
Reviewed-on: https://code.wireshark.org/review/16483
Reviewed-by: Gerald Combs <gerald@wireshark.org>
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>
2016-07-21 20:09:03 +00:00
Gerald Combs 479caf15e7 Add resource usage logging.
Add log_resource_usage, which prints the current and elapsed user and
system times. Add a usage example in packet_list_model.cpp.

Change-Id: I747161c754a3731e540821715cc9bb10b3dc821d
Reviewed-on: https://code.wireshark.org/review/16383
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2016-07-12 15:04:43 +00:00
João Valverde a16d401b25 Remove Makefile.common files
Now that nmake build system has been removed they are not needed anymore.

Change-Id: I88075f955bb4349185859c1af4be22e53de5850f
Reviewed-on: https://code.wireshark.org/review/16050
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-06-30 11:04:17 +00:00
Roland Knall 79836fa23a wsutil: Move Win32 helper routines from capchild
Move error handling and argument quoting routines from
capchild to wsutil, as those methods will be used by
extcap_spawn as well.

Change-Id: I2c4515fefd5aecad317fcdaefa721734288f792c
Reviewed-on: https://code.wireshark.org/review/16123
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>
Reviewed-by: Roland Knall <rknall@gmail.com>
2016-06-25 15:06:27 +00:00
Gerald Combs d9fb7f9a5e Handle ENAMETOOLONG.
g_strerror doesn't appear to handle ENAMETOOLONG. Check for it ourselves.

Change-Id: Icd113a81e8d95bb3c84c91bb420a1a6a19bf5d40
Reviewed-on: https://code.wireshark.org/review/16041
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-06-22 23:53:00 +00:00
Pascal Quantin df231d9c52 libcodecs and libwsutil are DLLs, not static libraries
Change-Id: I4486f35e07c72d4ca35d5649de25d0c9abd2a964
Reviewed-on: https://code.wireshark.org/review/16057
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2016-06-21 14:31:16 +00:00
Yang Luo d50b981d38 pcap: Add support to "new" Npcap native mode without setting PATH
Npcap decided not to add "C:\Windows\System32\Npcap" to
system PATH in the installation any more (starting from
Npcap 0.07 r14). So this patch needs to be applied, otherwise
Wireshark will not find Packet.dll (the error message will
only say wpcap.dll is missing, but actually is Packet.dll
missing).

Change-Id: Ifd8b6e6d8ecf9866cd37c3368b604de210ff8c7b
Reviewed-on: https://code.wireshark.org/review/15959
Reviewed-by: Yang Luo <hsluoyz@gmail.com>
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2016-06-21 08:19:35 +00:00
Peter Wu dabbaaf418 filesystem: Fix build dir detection when using cmake
Fixes loading of plugins by detecting the build output directory of
cmake. This requires a "CMakeCache.txt" file to be present in the parent
directory (above run/).

Change-Id: I297432cdcd0981646058410f3eadf5f73b5248c8
Reviewed-on: https://code.wireshark.org/review/7453
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-06-16 04:40:55 +00:00
Pascal Quantin 60578aa16f file_util.c: do not search in Npcap installation folder when calling ws_load_library()
ws_load_library() is not used to load packet.dll or wpcap.dll (we use ws_module_open() for this).
Let's not lose time checking the folder content.

Change-Id: Ibd4a71b8b0c5ffc0c4c146eca51ad9f20964515b
Reviewed-on: https://code.wireshark.org/review/15938
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2016-06-16 01:59:15 +00:00
Pascal Quantin 6baa1b544c Remove Nmake build system
Change-Id: I3bd474f3cda9667dec66426b5729449953df3e61
Reviewed-on: https://code.wireshark.org/review/15777
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Jörg Mayer <jmayer@loplof.de>
Reviewed-by: Balint Reczey <balint@balintreczey.hu>
2016-06-15 19:21:57 +00:00
João Valverde 90fa55ddd2 Add missing const to inet_ipv6.h
Make it simpler too.

Change-Id: I97dc79d7ac536089c1fa6ec2c20f19754d47a9d4
Reviewed-on: https://code.wireshark.org/review/15866
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-06-13 22:50:26 +00:00
Gerald Combs e2e84563ee Use getc_unlocked in a few places.
Use getc_unlocked or _fgetc_nolock instead of getc in a few places. This
reduces startup time by about 100ms here.

Change-Id: I59ceb09678457c871cce79fcc3ce71998fe4f5af
Reviewed-on: https://code.wireshark.org/review/14518
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>
2016-06-13 16:18:25 +00:00
Guy Harris 3f0c7091f7 Finish moving the parenthesis.
Change-Id: I02f099ef198e360663b03857bdf9538bb63a7de8
Reviewed-on: https://code.wireshark.org/review/15864
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-06-13 02:16:26 +00:00
Guy Harris 49db7287bf Fix a compile error.
(Perhaps the Petri dish buildbots should, if a build fails, immediately
mark the change as failing the Petri dish build, without waiting for the
other build(s), so that you don't have to, for example, wait for the
Ubuntu buildbot to finish doing a test build for a change that doesn't
affect code built on UN*X.)

Change-Id: I89ee1616d35c186fcabc0ec989936fa94116df70
Reviewed-on: https://code.wireshark.org/review/15863
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-06-13 01:49:38 +00:00
Guy Harris 010e55ccf4 Don't assume we can get a module handle for kernel32.dll.
A failure "shouldn't happen", but check anyway; if nothing else, that
squelches some complaining from the VS Code Analysis tool.

Change-Id: I9b06db399741176d0e9f859eb650bed8a2f96d9c
Reviewed-on: https://code.wireshark.org/review/15860
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-06-13 01:27:26 +00:00
João Valverde f1ff3208a0 Move ip6_to_str_buf() to to_str.c and make it take the buffer length.
Also make it use ws_inet_ntop6() (rather than implementing the string
conversion ourselves).

Remove ip6_to_str_buf_len().

Change-Id: I1eff3a8941e00987c2ff0c4dcfda13476af86191
Reviewed-on: https://code.wireshark.org/review/15692
Reviewed-by: João Valverde <j@v6e.pt>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-06-06 22:00:41 +00:00
Guy Harris a6618ffdc9 Move npf_sys_is_running() from wsutil to caputils.
It has nothing to do with controlling privileges; it only tests whether
the NPF or Npcap service (driver) is running, so it belongs in caputils.

While we're at it, fix its signature (in C, a function with no arguments
must have "void" as the argument list, for backwards compatibility with
pre-function-prototype C), and close the handles it opens, so we don't
have open handles leaked.

Change-Id: Ia99e99d81617ed2e8cda2c44e53061b4502a2b58
Reviewed-on: https://code.wireshark.org/review/15714
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-06-03 21:24:47 +00:00
Yang Luo 6a860e948d Add support for Npcap native mode:
1) Start Npcap service for capturing packets on
Windows if WinPcap service is unavailable.
2) Search Npcap DLLs (wpcap.dll, Packet.dll) also in
"system32\Npcap" folder after "system32" is searched.

Change-Id: I6810382db431a4e7fe309edd08757db60d8ade38
Reviewed-on: https://code.wireshark.org/review/15707
Reviewed-by: Yang Luo <hsluoyz@gmail.com>
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-06-03 19:31:55 +00:00
Joerg Mayer 1192798089 Fix compile error:
[  0%] Building C object wsutil/CMakeFiles/wsutil.dir/tempfile.c.o
/Users/jmayer/worktmp/wireshark/git/wsutil/tempfile.c:228:37: error: implicit conversion loses integer precision: 'unsigned long' to 'int'
      [-Werror,-Wshorten-64-to-32]
  fd = mkstemps(tf[idx].path, sfx ? strlen(sfx) : 0);
       ~~~~~~~~                     ^~~~~~~~~~~
1 error generated.

No idea whether this is the correct fix.

Change-Id: I80202d7eaad11fc3dcb5f9847f6e162caccb7e6e
Reviewed-on: https://code.wireshark.org/review/15672
Reviewed-by: Jörg Mayer <jmayer@loplof.de>
2016-06-01 07:01:47 +00:00
Michael Mann acc018b8d1 Allow create_tempfile to support a suffix.
Ping-Bug: 10203
Change-Id: Ifa24870d711449b87e9839dd46af614e4aa28fde
Reviewed-on: https://code.wireshark.org/review/15608
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
2016-06-01 06:24:05 +00:00
Guy Harris b831f251ef Include <sys/socket.h>, too.
The Single UNIX Spec says AF_INET and AF_INET6 are defined by
<sys/socket.h>, which means you *should* include it if you want those
defines, and it doesn't look as if DragonFly BSD's <netinet/in.h>
includes it.

Do the includes in the order in whcih dumpcap does them.

Change-Id: I2ee611fc08a5487d5b8ed48396aa2a49447c881a
Reviewed-on: https://code.wireshark.org/review/15542
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-05-23 02:22:51 +00:00
Guy Harris b07d5c73b6 Explicitly include <netinet/in.h>.
We use structures from it, and must not depend on <arpa/inet.h> or
<ifaddrs.h> to include it for us, as that doesn't necessarily happen on
all platforms (it doesn't happen on DragonFly BSD, for example).

Change-Id: Id0e6cc406b774efb076bb8e04827fdb7d502be16
Reviewed-on: https://code.wireshark.org/review/15541
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-05-23 02:08:13 +00:00
Gerald Combs d7cbea9428 TShark: Add a "-E bom=" option.
Add an option to print the UTF-8 BOM.

Change-Id: I3d30c67852b9b89d1548b0f957d97fd8e8741049
Reviewed-on: https://code.wireshark.org/review/15318
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2016-05-11 17:30:33 +00:00
Guy Harris ea1ba62aec Fix up the compare chain in nstime_delta().
The first case handles the two time stamps having the same seconds
value, so, in the subsequent cases, they're guaranteed not to have the
same seconds value; check for b->secs < a->secs, not for b->secs <= a->secs
(the two tests will always get the same value, as b->secs != a->secs),
to make it clearer what's being done.

Change-Id: I6d3806237dae0ea12af92ea0344a31a2c5322b12
Reviewed-on: https://code.wireshark.org/review/15325
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-05-09 23:52:33 +00:00
Gerald Combs ae4a912af0 TShark: Convert TTY output.
If we detect that we're writing to a TTY and that it doesn't support
UTF-8, convert our output to the current code page on UNIX/Linux or
to UTF-16LE on Windows. This helps to ensure that we don't fill users'
screens with mojibake, along with scrubbing invalid output.

Add a note about our output behavior to the TShark man page. Add a note
about the glyphs we should and shouldn't be using to utf8_entities.h.

Bug: 12393

Change-Id: I52b6dd240173b80ffb6d35b5950a46a565c97ce8
Reviewed-on: https://code.wireshark.org/review/15277
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-05-09 04:11:29 +00:00
Graham Bloice 2e23b506c7 Add checkAPI calls to CMake.
This generates a top level target, checkAPI, that is
excluded from the ALL build target, so must be run separately.

On Windows using a Visual Studio generator, call
msbuild /p:Configuration=RelWithDebInfo checkAPI.vcxproj

Change-Id: I44a57c564dcfc75499463b942436f4b920a82478
Reviewed-on: https://code.wireshark.org/review/14873
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Graham Bloice <graham.bloice@trihedral.com>
2016-05-02 12:01:24 +00:00
João Valverde a27fc11013 Fix wsutil/Makefile.nmake rule for ws_version_info.obj
Change-Id: I397da333b467d140613947fe49cd98338ab1d8f6
Reviewed-on: https://code.wireshark.org/review/15218
Tested-by: João Valverde <j@v6e.pt>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-05-01 23:53:16 +00:00
Gerald Combs 91b154236b Win32: Pass a mutable string to CreateProcess.
CreateProcess can modify its second (lpCommandLine) argument. Don't
pass it the output of utf_8to16.

Constify the return value of utf_8to16.

Change-Id: I0d4361396e90c88a4ab2a3f2f0e058230e897fdf
Reviewed-on: https://code.wireshark.org/review/15155
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2016-04-28 23:50:28 +00:00