Commit Graph

337 Commits

Author SHA1 Message Date
Guy Harris e1ef732c11 Get rid of MAX_IP_STR_LEN and MAX_IP6_STR_LEN.
We have WS_INET_ADDRSTRLEN and WS_INET6_ADDRSTRLEN; use them.

Change-Id: Idade0da9fae70d891901acd787b06d21e2ddbc5f
Reviewed-on: https://code.wireshark.org/review/24156
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-10-29 05:51:25 +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
Guy Harris 4dc02b2fcf We're using inet_pton(), so we don't need to worry about non-dotted-quad addresses.
inet_pton(), and thus ws_inet_pton(), won't accept hex or
fewer-than-four-component IPv4 addresses, at least on Single UNIX
Specification-compliant systems - the SUSv4 explicitly says

	The inet_pton() function does not accept other formats (such as
	the octal numbers, hexadecimal numbers, and fewer than four
	numbers that inet_addr() accepts).

so we don't need to check for "inet_atons that accept strings such as -
"130.230" as valid addresses".

That also means that, "if there are any places where this needs to
support the hex-address form for IPv4 addresses, or to support fewer
than 4 components for a network address", those places were hosed even
before we stopped using inet_aton(), so there are presumably no such
places.  (Itojun's comment was probably just an expression of general
concern, rather than a note of a known problem.)

Change-Id: Id16b6ebd3550dc3bf5a0fc283898a99b7abc163c
Reviewed-on: https://code.wireshark.org/review/24057
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-10-25 19:59:30 +00:00
Guy Harris 14080744db Get rid of a no-longer-needed variable.
We don't need a temporary IPv4 address variable in get_host_ipaddr(), we
can just use the pointer we've been handed.

Change-Id: Id7cbd0c14b2eeb3efde5a556f3414bd635411908
Reviewed-on: https://code.wireshark.org/review/24056
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-10-25 19:52:05 +00:00
Guy Harris 6537c996a6 Clean up and expand comments.
Note the dropping of support for hex IPv4 addresses and addresses with
fewer than four components, and indicate that, if there are any places
where that support is expected, we should change those places (i.e.,
don't just change get_host_ipaddr() and, if there aren't any such
places, just leave everything as it is).

It's not clear that get_host_ipaddr() is "Used more in the dfilter
parser rather than in packet dissectors"; that may depend on whether
you're counting number of calls executed from those places or the number
of lines of code making those calls.  Just drop the claim, which is
absent in the comment for get_host_ipaddr6().

Also ask whether we're using get_host_ipaddr{6}() in any places where it
should *only* support numeric addresses rather than names.

Change-Id: Ib5d8730ca703339342f308081a68309479f842c5
Reviewed-on: https://code.wireshark.org/review/24055
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-10-25 19:36:34 +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 b5a54c3416 manuf.tmpl: mark comments
Comments were discarded based on a fourth column using tab separators.
Use a pound sign instead.

Change-Id: Icb5dd33c4a2c9c441eebda74bc8d813443efe1b6
Reviewed-on: https://code.wireshark.org/review/23351
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: João Valverde <j@v6e.pt>
2017-09-02 19:41:49 +00:00
João Valverde 5870352d8f Fix comment in addr_resolv.c
Fixes g55724db3db.

Change-Id: Idf9d5293fcd0e91698305da1cec5b8771c0a6a91
Reviewed-on: https://code.wireshark.org/review/23345
Reviewed-by: João Valverde <j@v6e.pt>
2017-09-01 00:07:05 +00:00
Michael Mann 274bbd5fab Extract the "long name" out of the manuf file and use it for some resolution
Some places (like MAC resolution) want to keep a fixed length, but for places
that want to display "full organization name", save the long name that is
treated as a comment in the manuf file.

Have make-manuf convert companies with all caps to mixed case so we're not
screaming the company name at the user.

Convert the manuf.tmpl to be tab delimited without a comment for the "long name"
so it can match the format now created by make-manuf.

Remove uint_get_manuf_name as it was unnecessary.

Bug: 3666
Change-Id: If2af5a1ce64e2784fe3941eeae8d8093d4f1467b
Reviewed-on: https://code.wireshark.org/review/23150
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-08-24 05:00:06 +00:00
Guy Harris 01f2e2b201 We really only need one range_foreach routine.
Rename range_foreach_r() to range_foreach(), getting rid of the old
range_foreach().

If your callback doesn't require an additional argument, just pass NULL
when calling range_foreach(), and declare the argument as unused.

Change-Id: I49a56f90610e39cf2ddc398c9e30ed11a6ca90db
Reviewed-on: https://code.wireshark.org/review/23025
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-08-08 22:06:27 +00:00
Ahmad Fatoum e63db3ce0e Rename reentrant range_foreach2 to range_foreach_r
to avoid mistaking it for a range function that operates on pairs.

Change-Id: If9117c195ba21d55a476c3b9deb2a2ca7a1056ed
Reviewed-on: https://code.wireshark.org/review/22994
Reviewed-by: João Valverde <j@v6e.pt>
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-08-07 22:53:07 +00:00
João Valverde 733c19a072 Optimize the "services" dictionary
Remove assignee and other miscellaneous information that changes more
frequently than service name and can be consulted directly in the IANA
registry.

Allow merging identical transports into a single line for convenience
and size/speed optimization (a backward-compatible change).

Remove obsolete make-services.pl.

Change-Id: I3ecbd1a6a68d87c084d77498a0eeb44b7afdab67
Reviewed-on: https://code.wireshark.org/review/22872
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-08-04 05:55:08 +00:00
João Valverde 14d94e174a Put the well-known addresses into a separate file from OUIs
Having two distinct logical concepts (OUI and Well Known Address)
concatenated to a single "manuf" file is needlessly obfuscating
the WKA feature.

Have a distinct "wka" file instead and just skip the cat.

Change-Id: I46f53b0015a37331d65f8cfac7cbbd499dd0c5b8
Reviewed-on: https://code.wireshark.org/review/22742
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-07-23 17:14:19 +00:00
João Valverde d238160a22 Require c-ares >= 1.5
Version 1.5 was released on 21-nov-2007. RHEL, Suse, etc supported versions
are all above c-ares v1.5.

We don't bother testing for it at build time for now, because it's non-trivial
(times two build systems).

Change-Id: I9253256d8d905da0c75d80b2b0fa4527df2b1420
Reviewed-on: https://code.wireshark.org/review/22741
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-07-21 08:33:13 +00:00
João Valverde 55724db3db Remove dead code for address reverse-mapping
Removed get_ipxnet_addr(), get_ether_addr(). If this feature is desired at
a minimum it should use an efficent data structure (and no disk-based
lookups mid-dissection).

Change-Id: Ie72449c631f21f4a3d82ec435bb5e1d7892f122c
Reviewed-on: https://code.wireshark.org/review/22729
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-07-20 19:07:13 +00:00
João Valverde 279a2762dc Extend enterprises.tsv to accept spaces as separators
We can do so easily because the format is so simple. This makes it
more convenient for a user to hand-edit a dictionary in the personal
config folder. We still use tabs in the system file for a small space
gain.

Also add a brief description of the format as a comment.

Change-Id: If3f741bff16f1f42c8ef07d643dc6463caaad1a5
Reviewed-on: https://code.wireshark.org/review/22678
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2017-07-18 04:41:12 +00:00
Gerald Combs 76efb096d4 Rename enterprises to enterprises.tsv and ship it.
Rename "enterprises" to "enterprises.tsv" so that its format is a bit more
obvious and so that double-clicking the file might do something useful.

Add it to the Windows packages.

Change-Id: I5ef54a04ce1b4926aa4535e756e04b3e2a56d463
Reviewed-on: https://code.wireshark.org/review/22616
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>
2017-07-15 06:20:34 +00:00
João Valverde caa06ddeab Replace and remove enterprises_lookup_format()
Change-Id: I27517bdfc4d00ee758d3795bd74e54968e70efad
Reviewed-on: https://code.wireshark.org/review/22497
Reviewed-by: João Valverde <j@v6e.pt>
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-07-03 20:07:37 +00:00
João Valverde 7466880e8a Parse enterprise-numbers at run time
"enterprise-numbers" is converted to tab-separated values and renamed
"enterprises". Unused fields are stripped.

PENs are stored in a hash table loaded at run-time.

User "enterprises" file is loaded from the personal config dir.

Misc make-sminmpec.pl improvements and fixes.
Note: names of type "Entity (formerly ...)" have the formerly part commented out for a cleaner output.

Change-Id: I60c533afbe3e399077fbf432088064471ad3e1e2
Reviewed-on: https://code.wireshark.org/review/22246
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: João Valverde <j@v6e.pt>
2017-06-26 22:40:50 +00:00
Anthony Coddington 193cef0bcb Attempt to clean up addr_resolv flags by removing DUMMY_ADDRESS_ENTRY
Replace with easier to understand and already present NAME_RESOLVED given dummy address is always filled.

Change-Id: If8464f89e88722aac70689749fe0d4a31c119db2
Bug: 13798
Reviewed-on: https://code.wireshark.org/review/22110
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-06-19 14:33:09 +00:00
Anthony Coddington f3267f17a3 Fix automatic name resolution not saved to NRB
Clear DUMMY_ADDRESS_ENTRY when add_ipv4_name/add_ipv6_name. This flag is checked in ipv4_hash_table_resolved_to_list().
TODO: clean up these flags as they are confusing and DUMMY appears somewhat redundant.

Change-Id: I81d40cc778cbe5c36314631d3fa0997cee409368
Bug: 13798
Reviewed-on: https://code.wireshark.org/review/22109
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-06-13 21:07:57 +00:00
Jakub Zawadzki b9edacecaf Fix memleak of g_pservices_path.
Change-Id: Iaee6f3773bc3b4164935092f2c9c9c888171a5b7
Reviewed-on: https://code.wireshark.org/review/21117
Petri-Dish: Jakub Zawadzki <darkjames-ws@darkjames.pl>
Reviewed-by: Jakub Zawadzki <darkjames-ws@darkjames.pl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
2017-04-15 22:48:34 +00:00
Guy Harris 2c44a7f930 Clean up handling of enabled/disabled protocols/heuristic dissectors.
Add a "report a warning message" routine to the "report_err" code in
libwsutil, and rename files and routines appropriately, as they don't
only handle errors any more.

Have a routine read_enabled_and_disabled_protos() that reads all the
files that enable or disable protocols or heuristic dissectors, enables
and disables them based on the contents of those files, and reports
errors itself (as warnings) using the new "report a warning message"
routine.  Fix that error reporting to report separately on the disabled
protocols, enabled protocols, and heuristic dissectors files.

Have a routine to set up the enabled and disabled protocols and
heuristic dissectors from the command-line arguments, so it's done the
same way in all programs.

If we try to enable or disable an unknown heuristic dissector via a
command-line argument, report an error.

Update a bunch of comments.

Update the name of disabled_protos_cleanup(), as it cleans up
information for disabled *and* enabled protocols and for heuristic
dissectors.

Support the command-line flags to enable and disable protocols and
heuristic dissectors in tfshark.

Change-Id: I9b8bd29947cccdf6dc34a0540b5509ef941391df
Reviewed-on: https://code.wireshark.org/review/20966
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-04-08 20:40:08 +00:00
Guy Harris 357cfd3b03 A bunch of "{Mac} OS X" -> "macOS" changes.
Avoid anachronisms, however; there was no "macOS 10.0" or even "OS X
10.0", for example.  It was "Mac OS X" until 10.8 (although 10.7 was
sometimes called "OS X" and sometimes called "Mac OS X"), and it was "OS
X" from 10.8 to 10.11.

Change-Id: Ie4a848997dcc6c45c2245c1fb84ec526032375c3
Reviewed-on: https://code.wireshark.org/review/20933
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2017-04-05 19:16:22 +00:00
Michael Mann 4a703e01f4 Check profile directory before personal directory for services and subnets file
Bug: 11228
Change-Id: Id8bcc51ff694ef9f2019bc7509e440021d049d22
Reviewed-on: https://code.wireshark.org/review/19735
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: Peter Wu <peter@lekensteyn.nl>
2017-03-03 23:45:36 +00:00
Dario Lombardo f792625b1d epan/wsutil: free memory on exit.
Change-Id: I1cf3a4ce3b21b2e10887cbef5576e5e028e55bab
Reviewed-on: https://code.wireshark.org/review/20052
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-02-18 14:11:45 +00:00
Dario Lombardo 523c09f31f addr_resolv: remove leak.
Change-Id: If4676b2982efae593084dbe951d8e0bb97189917
Reviewed-on: https://code.wireshark.org/review/19966
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Dario Lombardo <lomato@gmail.com>
2017-02-08 15:36:51 +00:00
Michael Mann 6a6d7ea34f Convert range API to always use wmem memory.
This is mostly to address memory leaks in range preferences (the biggest
user of range functionality) on shutdown.
Now range preferences must use epan scoped memory when referencing
internal preference structures to keep consistency.

Change-Id: Idc644f59b5b42fa1d46891542b53ff13ea754157
Reviewed-on: https://code.wireshark.org/review/19387
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2017-01-07 00:44:10 +00:00
Jaap Keuter ba67963fd4 Improve name resolution preference tooltips.
Change the tooltips texts to make them better describe the preference.

Bug: 13130
Bug: 13131
Change-Id: Ie753e3703a702bdafed91cf0f41b306347088526
Reviewed-on: https://code.wireshark.org/review/18878
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-11-22 16:47:11 +00:00
Jaap Keuter bf7db022c3 Resolv: various code / comment cleanups
Various cleanups and corrections regarding MAC address handling.

Change-Id: I31e2e377bc1c73705a89517c776d51bbb19b9ce3
Reviewed-on: https://code.wireshark.org/review/18836
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-11-16 05:15:52 +00:00
Jaap Keuter f773e6cbf4 Really return manufacturer name if it's known.
Bug: 13126
Change-Id: I56e935cea7aa323941ac612d4954875a01910684
Reviewed-on: https://code.wireshark.org/review/18752
Petri-Dish: Jaap Keuter <jaap.keuter@xs4all.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-11-12 18:00:04 +00:00
Jeff Morriss d38ed8e55f Put the SS7 PC name resolution feature in the release notes.
Fix the casing of the preference while at it (it now matches other name
resolution preferences).

Change-Id: Ibfecbc94f9eccefa7d3b1a50ae2598dfefb707a2
Reviewed-on: https://code.wireshark.org/review/18330
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-10-20 05:00:55 +00:00
Alexis La Goutte 133a7e99b7 addr_resolv(.c): no previous prototype for ‘add_ss7pc_name/ss7pc_name_lookup_init’ [-Wmissing-prototypes]
Change-Id: Ice8c901e41e1881210c0f4bf70851810ca480e81
Reviewed-on: https://code.wireshark.org/review/18222
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-10-16 22:17:35 +00:00
Binh Trinh 5ace3b9405 MTP3: Added SS7 Point Code Name Resolution
bug: 7592

Change-Id: I1af2c5d6664e172c358cd19bc20e9352c2582eae
Reviewed-on: https://code.wireshark.org/review/17677
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-10-12 21:34:42 +00:00
Dario Lombardo 8d2016da97 addr_resolv: use ws_strtou8 function.
This change prevents to accept netmasks as /24x. The
mask must be an clean integer.

Change-Id: I46aeb089dd6538b5cc4bde7efd4dc317621a5245
Reviewed-on: https://code.wireshark.org/review/17612
Reviewed-by: Dario Lombardo <lomato@gmail.com>
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2016-09-13 08:55:46 +00:00
Guy Harris c0f24bdf6c Allocate all the wmem maps with epan scope.
That doesn't seem to affect the performance negatively (or
positively...) to any noticeable degree with my simple "run tshark under
the time command with an empty file" tests, and it does appear to reduce
the amount of memory that valgrind thinks is leaked.

All the other maps were already allocated with epan scope, so do that
with these as well.

Change-Id: Ib5ee85c8cf025e53455564a67cd1adbf28b47f78
Ping-Bug: 12656
Reviewed-on: https://code.wireshark.org/review/17040
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-08-13 23:42:35 +00:00
Dario Lombardo a7ab65df89 addr_resolv: change g_hash to wmem_map.
Change-Id: Ice7533fbeac700dae0a46766838818a32b0d5736
Reviewed-on: https://code.wireshark.org/review/15051
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-06-14 19:33:04 +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
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 82e39fc45f Don't mix g_malloc() and wmem_alloc().
Always allocate sub_net_hashipv4 structures with wmem.

Bug: 12386
Change-Id: Ibc4f09c267a2e651d9120ef67d4d5b77635172d6
Reviewed-on: https://code.wireshark.org/review/15152
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-04-28 21:53:49 +00:00
Guy Harris 65c6f79ddc Cleanups to issues found while investigating 12386.
Get rid of the printable-IP-address member of a sub_net_hashipv4; it's
not used.

Free hash buckets of those structures iteratively, not recursively.

Change-Id: I1ee8f46d3175a380e6a439fe71e7c06a0e939a3d
Reviewed-on: https://code.wireshark.org/review/15150
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-04-28 21:47:04 +00:00
Uli Heilmeier 83924c867d addr_resolv: async_dns_queue_head HAVE_C_ARES missing
async_dns_queue_head is only defined when HAVE_C_ARES is available.
Therefore we should call it also only if HAVE_C_ARES is set.

Change-Id: Iceb27096c188bb1b70ca89ee7782ca8d0990294d
Reviewed-on: https://code.wireshark.org/review/15106
Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
Petri-Dish: Jeff Morriss <jeff.morriss.ws@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2016-04-25 16:28:17 +00:00
Martin Kaiser 9fbd4e6fcd addr_resolv: don't free the same wmem_list entry twice
fetch the list head each time we iterate through the list

if we don't, we crash when the same entry is removed a second time

 #0  wmem_block_remove_from_block_list (block=0x7fffecd7b1c0, allocator=<optimized out>) at wmem_allocator_block.c:738
 #1  wmem_block_free_jumbo (chunk=0x7fffecd7b1d0, allocator=0x65c060) at wmem_allocator_block.c:822
 #2  wmem_block_free (private_data=0x65c060, ptr=0x7fffecd7b1e0) at wmem_allocator_block.c:913
 #3  0x00007ffff452eac1 in host_name_lookup_process () at addr_resolv.c:2466
 #4  0x000000000041733d in process_packet (cf=cf@entry=0x63fe20, edt=edt@entry=0xce08f0, offset=<optimized out>, whdr=0xc97c70,
    pd=pd@entry=0xc9f550 "", tap_flags=tap_flags@entry=0) at tshark.c:3699
 #5  0x000000000040f199 in load_cap_file (max_byte_count=13197776, max_packet_count=<optimized out>, out_file_name_res=0,
    out_file_type=2, save_file=0x0, cf=<optimized out>) at tshark.c:3483
 #6  main (argc=<optimized out>, argv=<optimized out>) at tshark.c:2192

Change-Id: I1ac813242188842130f4070ef326b12fe23b782f
Reviewed-on: https://code.wireshark.org/review/15068
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
2016-04-23 12:03:05 +00:00
Guy Harris 3db13c7bbb Don't fail in host_name_lookup_init() if manually resolved lists exist.
Those lists aren't destroyed by host_name_lookup_cleanup(), so don't
assume in host_name_lookup_init() that they don't exist; just create
them if they don't exist and leave them alone if they do.

(GSLists and GLists are different from wmem_lists - a pointer to a GLib
list is just a pointer to a list element, so an empty list is
represented by a null pointer, but a wmem_list has a structure
containing other information, so an empty list has null list pointers in
that structure, and a null wmem_list * means the list doesn't exist at
all.)

Change-Id: I88c00cc9ac0812ab71adc70e3300ab3829fee8ab
Reviewed-on: https://code.wireshark.org/review/15061
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-04-22 23:45:37 +00:00
Dario Lombardo 13dc91f5b6 addr_resolv: change g_slist to wmem_list.
Change-Id: Ifde09174e50bc2a9d695ac0a823e63f645284a10
Reviewed-on: https://code.wireshark.org/review/15050
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
2016-04-22 21:26:13 +00:00
Martin Kaiser 9de18e88f5 If you allocate with wmem, free with wmem.
This g_free() causes a crash on my system for every capture file where
names are resolved.

Program received signal SIGABRT, Aborted.
0x00007ffff0347125 in *__GI_raise (sig=<optimized out>) at
../nptl/sysdeps/unix/sysv/linux/raise.c:64
64 ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
 #0  0x00007ffff0347125 in *__GI_raise (sig=<optimized out>) at
../nptl/sysdeps/unix/sysv/linux/raise.c:64
 #1  0x00007ffff034a3a0 in *__GI_abort () at abort.c:92
 #2  0x00007ffff038135b in __libc_message (do_abort=<optimized out>,
fmt=<optimized out>)
    at ../sysdeps/unix/sysv/linux/libc_fatal.c:189
 #3  0x00007ffff038abb6 in malloc_printerr (action=3, str=0x7ffff0464532
"free(): invalid pointer", ptr=<optimized out>)
    at malloc.c:6312
 #4  0x00007ffff038f95c in *__GI___libc_free (mem=<optimized out>) at
malloc.c:3738
 #5  0x00007fffef8cca41 in ?? () from
/usr/lib/x86_64-linux-gnu/libcares.so.2
 #6  0x00007fffef8ccad2 in ?? () from
/usr/lib/x86_64-linux-gnu/libcares.so.2
 #7  0x00007fffef8cceea in ?? () from
/usr/lib/x86_64-linux-gnu/libcares.so.2
 #8  0x00007fffef8d501b in ?? () from
/usr/lib/x86_64-linux-gnu/libcares.so.2
 #9  0x00007fffef8d3a4a in ?? () from
/usr/lib/x86_64-linux-gnu/libcares.so.2
 #10 0x00007fffef8d4792 in ?? () from
/usr/lib/x86_64-linux-gnu/libcares.so.2
 #11 0x00007fffef8d49de in ?? () from
/usr/lib/x86_64-linux-gnu/libcares.so.2
 #12 0x00007fffef8d4cc7 in ?? () from
/usr/lib/x86_64-linux-gnu/libcares.so.2
 #13 0x00007ffff4329713 in host_name_lookup_process () at
addr_resolv.c:2485
 #14 0x000000000053fda9 in WiresharkApplication::refreshAddressResolution
(this=0x7fffffffe2f0) at wireshark_application.cpp:217
 #15 0x000000000059c42d in WiresharkApplication::qt_static_metacall
(_o=0x7fffffffe2f0, _c=<optimized out>, _id=<optimized out>,
    _a=0x7fffffffd7b0) at wireshark_application.moc.cpp:142
 #16 0x00007ffff140654f in QMetaObject::activate(QObject*, QMetaObject
const*, int, void**) ()
   from /usr/lib/x86_64-linux-gnu/libQtCore.so.4

Change-Id: I20586929463259f71f325225975eec241166f123
Reviewed-on: https://code.wireshark.org/review/15047
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
2016-04-21 21:12:03 +00:00
Guy Harris 14f2a654d4 If you allocate with wmem, free with wmem (more of same).
Change-Id: I10991dcb717a38936e2b7cf2f15885b5753378d0
Reviewed-on: https://code.wireshark.org/review/15034
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-04-21 06:52:03 +00:00
Guy Harris 661743e4da If you allocate with wmem, free with wmem.
Change-Id: I91476c825448cbeb8b96242236aae44d92244161
Reviewed-on: https://code.wireshark.org/review/15033
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-04-21 06:43:50 +00:00
Dario Lombardo d200b42265 addr_resolv: change g_malloc to wmem_alloc.
Change-Id: I25d4e82d6161c26d4f560bd495293c77671e00eb
Reviewed-on: https://code.wireshark.org/review/15021
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-04-21 04:37:39 +00:00