Commit Graph

295 Commits

Author SHA1 Message Date
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
João Valverde c5782e0d41 Replace and remove host_ip_af() function
Change-Id: I932c156cbc6883d1d63bf0457fd62cfb67c3340e
Reviewed-on: https://code.wireshark.org/review/14750
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2016-04-08 20:49:22 +00:00
João Valverde e005bc819c Remove synchronous DNS name resolution
Change-Id: Ie5e670b769eb0674950f3679ef511047641c2873
Reviewed-on: https://code.wireshark.org/review/14751
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2016-04-04 06:49:55 +00:00
João Valverde 51984de040 Remove more missed ADNS code
Fixup for 7a1d3f67ac.

Change-Id: Idb8d68a3cc114545f24738cead4968804d831346
Reviewed-on: https://code.wireshark.org/review/14548
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>
2016-03-22 02:16:02 +00:00
João Valverde 7a1d3f67ac Remove ADNS support
Relevant mailing list message:

  https://www.wireshark.org/lists/wireshark-dev/201503/msg00007.html

Change-Id: I0cff6d4d64fb52a651bcf6b28c183e43653b1cc2
Reviewed-on: https://code.wireshark.org/review/14519
Reviewed-by: João Valverde <j@v6e.pt>
2016-03-21 19:32:00 +00:00
Uli Heilmeier e1d54cfc3e IEEE 802.1Q/VLAN: Resolve ID to a describing name
A vlans file in the personal preference directory add an option to resolve
VLAN IDs to a describing name.

Format of vlan file is
123\tName of VLAN

To enable the resolving the preference nameres.vlan_name must be set
to TRUE.

Bug: 11209
Change-Id: I3f00b4897aace89c03c57b68b6c4b6c8b7d4685a
Reviewed-on: https://code.wireshark.org/review/14471
Reviewed-by: Michael Mann <mmann78@netscape.net>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2016-03-18 05:41:36 +00:00
Guy Harris 0e5a73fa4e Only say we have a new resolved MAC address if it's actually *new*.
If we aren't changing the resolved name, it's not new.

This prevents us from perpetually "resolving" the address.  If we have
ARP packets that cause us to map a MAC address to a host name, based on
the ARP packet saying the MAC address corresponds to a given resolved IP
address, then each time we dissect the packet, the address will be
"resolved" - and each time we have new resolved addresses as a result of
that, we'll redissect the displayed packets so that they show the
resolved address, and we'll forever be redissecting.

Change-Id: I445e92f407d52a4ed5986721ffcc472f86e99431
Reviewed-on: https://code.wireshark.org/review/14236
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-02-29 11:20:14 +00:00
João Valverde 8bee8bad81 Add inet_pton/inet_ntop interface to libwsutil
Change-Id: Ifc344ed33f2f7ca09a6912a5adb49dc35f07c81f
Reviewed-on: https://code.wireshark.org/review/13881
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-02-19 15:55:09 +00:00
João Valverde 2e85975fee Just #include wsutil/inet_aton.h
No need for platform-specific system header boilerplate.

Change-Id: I5387a0005ddb0d7aab3c5b9f28d6282053c1b0fd
Reviewed-on: https://code.wireshark.org/review/13865
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-02-13 23:51:53 +00:00
João Valverde 15862fd326 Change some constness qualifications
Change-Id: I0ece488f43aae27e7c055c2edacbf09ff11ce16d
Reviewed-on: https://code.wireshark.org/review/13889
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: João Valverde <j@v6e.pt>
2016-02-11 19:21:08 +00:00
Guy Harris 72a9968fab Don't use IP address strings as "names" for MAC addresses.
Have a flag for addresses indicating whether the address is resolved to
a name or whether its "name" is just a printable version of the address.
If the name corresponding to an IP address isn't really a name, don't
assign it to a MAC address.

Clean up some code a bit (have a fill_dummy_ip6() corresponding to
fill_dummy_ip4()).

Bug: 10212
Change-Id: I9d0ffa2706be17842f832c64cea7acc5c1dc6536
Reviewed-on: https://code.wireshark.org/review/13412
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-19 07:23:53 +00:00
moshekaplan cd7026951b Fix a lot of typos and misspellings
Change-Id: I8512cfa1d424f82a873a0e0e1d22c7b075fdd7f3
Reviewed-on: https://code.wireshark.org/review/13069
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2016-01-08 20:04:56 +00:00
Guy Harris fa7cf8737c Rename ipv6-utils.h to ipv6.h.
By analogy to ipv4.h.

Change-Id: I147565b332024b1bb88e9cd15889255773d04524
Reviewed-on: https://code.wireshark.org/review/13034
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-01-03 21:42:32 +00:00
João Valverde 4473c67646 Fix some constness issues [-Wcast-qual]
Change-Id: I111558df3d36436ddf5e2728f113b022cc48a713
Reviewed-on: https://code.wireshark.org/review/13013
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2016-01-03 01:27:47 +00:00
João Valverde fad15654b1 Remove configure --enable-ipv6 option
It's an ancient obsolete option with a confusing name.

Change-Id: Ib10330cf859cdea18fed2077c6539e56350ef380
Reviewed-on: https://code.wireshark.org/review/11967
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-11-23 04:07:37 +00:00
Guy Harris 0162e54075 Clean up includes of unistd.h, fcntl.h, and sys/stat.h.
Have wsutil/file_util.h include them on UN*X, just as it includes io.h
on Windows, so we can have a rule of "if you do file operations, include
<wsutil/file_util.h> and use the routines in it".

Remove includes of unistd.h, fcntl.h, and sys/stat.h that aren't
necessary (whether because of the addition of them to wsutil/file_util.h
or because they weren't needed in the first place).

Change-Id: Ie241dd74deff284e39a5f690a297dbb6e1dc485f
Reviewed-on: https://code.wireshark.org/review/11619
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-07 21:52:23 +00:00
Guy Harris 58431e2f6a Don't include libwireshark headers from libwiretap.
Move the definitions of hashipv4_t and hashipv6_t to wiretap/wtap.h, as
that's the main place they're used.  Change them a bit not to depend on
other stuff from libwireshark, and change the code as required by those
changes.

This should fix the Solaris build; apparently, the Sun^WOracle compiler
is generating code for static inline functions even if they're never
called, so that libwiretap ends up including code that calls tvbuff and
wmem functions.

There's probably further cleanup that could be done here, but this
should at least fix the build, as well as getting rid of a dependency
between two libraries that are at least somewhat independent (libwiretap
should *not* depend on libwireshark, as some programs use libwiretap but
not libwireshark, and, ultimately, we probably want it to be possible to
use libwireshark without libwiretap but that'd be more work).

Change-Id: I91c745282f17d7c8bff7809aa277eab2b3cf47c1
Reviewed-on: https://code.wireshark.org/review/11537
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-11-04 00:56:44 +00:00
Gerald Combs 86fe2be4dc Use address functions instead of ADDRESS macros in asn1 and epan
Replace CMP_ADDRESS, COPY_ADDRESS, et al with their lower-case
equivalents in the asn1 and epan directories.

Change-Id: I4043b0931d4353d60cffbd829e30269eb8d08cf4
Reviewed-on: https://code.wireshark.org/review/11200
Petri-Dish: Michal Labedzki <michal.labedzki@tieto.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-10-22 11:45:56 +00:00
João Valverde 48d46e67fd Don't parse services file twice, respect user settings
Platform file '/etc/services' is the same as Wireshark's
'/usr/share/wireshark/services', only Wireshark's is more recent
(on my system, same goes for other platforms I assume).

Use only Wireshark's IANA services files.

Other benefits would be removing some platform specific #ifdefs and making
service names more consistent.

Also respect user services settings by parsing $PERSCONFIG_DIR/services
after $SYSCONFIG_DIR/services.

Change-Id: I9890473af92763e02dabd2386eaa767aed2f2899
Reviewed-on: https://code.wireshark.org/review/10941
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-10-18 02:33:02 +00:00
João Valverde 5823e6e50b Remove duplicate transport ports from proto tree summary
Don't display duplicate ports if transport name resolution is not
enabled (for UDP/TCP/DCCP).

Also introduce col_append_port() to handle info column port display
with name resolution in a uniform format.

Change-Id: Icb8ac45f726b7c539b4534c62061473e9b582753
Reviewed-on: https://code.wireshark.org/review/10804
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-10-11 23:54:28 +00:00
João Valverde a459ac72a2 Add BASE_PT_ field display types
Avoid displaying duplicate port numbers with transport name resolution disabled and
make some dissector code simpler.

Introduces port_with_resolution_to_str_buf() function and amends UDP/TCP/DCCP/SCTP to
use the new field display type.

Change-Id: Ifb97810b9c669ccbb1a310a2c0ffd6e2b63af210
Reviewed-on: https://code.wireshark.org/review/10625
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-10-05 18:10:48 +00:00
Peter Wu 087afc80c0 addr_resolv: cosmetic change for flags
Reduce some magic numbers and add parentheses,
change ((flags & X) == X) to simply (flags * X),
change tp->flags = tp->flags | x to tp->flags |= x.

Change-Id: Ida2d1aa59a3efc20d5fe6910d7b757277eb7e627
Reviewed-on: https://code.wireshark.org/review/10659
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
2015-09-27 17:47:20 +00:00
Dario Lombardo 7a096c3844 Init values set (found by American Fuzzy Lop).
Change-Id: Iddd2b4a0ceb409db1afb1a412339134634de631c
Reviewed-on: https://code.wireshark.org/review/10104
Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
2015-08-18 18:29:58 +00:00
Hadriel Kaplan 190e313e9d DNS: move DNS name resolution pref to Name Resolution prefs
Move the boolean flag for using captured DNS packet info for name resolution
to the Name Resolution preferences settings, as it was rather surprising to
disable Name Resolution preferences and still have names being resolved. Also
disble them all if the '-n' command line switch is used, and re-enable it for
a 'd' character in the '-N' option.

Bug: 10337
Change-Id: Ie4d47bab0100db3360cc447cd3e446b2e39aa917
Reviewed-on: https://code.wireshark.org/review/9786
Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
2015-07-25 17:05:01 +00:00
Guy Harris df5a315048 Fix address resolution for columns.
Have address_to_name() be a routine that takes an address and returns a
string with a "sufficiently long" lifetime for use in columns, using the
address type's addr_name_res_str routine for most address types, rather
than having a too-small set of address types wired into it.  It replaces
both the internal solve_address_to_name() routine and get_addr_name(),
and can, for example, handle the special WLAN address types rather than
leaving them unresolved even with an ethers file.

Change-Id: Id09bc412adf5d2752155650a14a77c5378af2e42
Reviewed-on: https://code.wireshark.org/review/9475
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-07-03 02:21:20 +00:00
Evan Huus a2e2c1f997 Fix memory leak printing eui64s
The scope that is passed in should only be used for the return value - other
temporary buffers we must alloc/free ourselves, since if the scope is NULL they
will not be managed automatically.

Bug: 11293
Change-Id: I27be856f1c5cdf47f78e766192a29523664a543e
Reviewed-on: https://code.wireshark.org/review/9007
Reviewed-by: Evan Huus <eapache@gmail.com>
Petri-Dish: Evan Huus <eapache@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2015-06-21 18:40:01 +00:00
Evan Huus c4fbede67a Remove the executable bit from epan/addr_resolv.c
It was added (presumably by accident) in 41ac67c.

Change-Id: If9c2daae6d9f6a0f09fc04c5332faeaa69d355c2
Reviewed-on: https://code.wireshark.org/review/8855
Reviewed-by: Evan Huus <eapache@gmail.com>
2015-06-09 13:18:16 +00:00
Christopher Maynard 41ac67cbb2 Fix insertion of subnets read from the subnets file: append to the *end* of
the list.

The patch ensures that non-duplicate subnets are appended to the end of the
list rather than as the second element, which if there had been a second
element previously, the memory for it was effectively leaked.

It also allows /32 "subnets", even though arguably the hosts file should be
used instead, but now the test in read_subnets_file() matches the assert in
subnet_entry_set().

Bug: 11247
Change-Id: I54bf1cbb34edfcf410aa634043a377c27091df51
Reviewed-on: https://code.wireshark.org/review/8802
Petri-Dish: Jeff Morriss <jeff.morriss.ws@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-06-09 04:09:52 +00:00
Gerald Combs 9762c32709 Complete the fix from g6b5c71a.
Change-Id: I18360cbc50d790a22e69e85dcc16363f8c682c64
Reviewed-on: https://code.wireshark.org/review/7739
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-03-18 18:46:18 +00:00
Gerald Combs 6b5c71af0d Don't cache existing IPv4 and IPv6 hostnames.
In the Qt UI redrawing the packet list redissects our visible packets,
which might call add_ipv{4,6}_name, which sets new_resolved_objects =
TRUE, which emits the addressResolutionChanged signal, which redraws the
packet list, which ...

Break out of the loop by checking to see if we've already cached an IPv4
or IPv6 hostname.

Change-Id: Icb2841e3453fb98d4cf0ea06a0f49737e2b8f25e
Reviewed-on: https://code.wireshark.org/review/7738
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-03-18 18:40:46 +00:00
Jeff Morriss a308aef89d Look for and use gethostbyname() if we don't have getaddrinfo(). Fail to
configure if we can't find any name resolver (autotools only).

This puts back the gethostbyname()/gethostbyname2() code removed in
I3348179626e97daaddfbc89e3ed21e39915e3de4 and
If59ce8a038776eadd6cd1794ed0e2dad8bf8a22c but as a last-resort option (only
if we don't have a better or more modern name resolver).

As suggested/requested by Guy in https://code.wireshark.org/review/#/c/7423/

Change-Id: I706dbbd65135f47c67d3d8d88a61ad7273914c47
Reviewed-on: https://code.wireshark.org/review/7447
Petri-Dish: Jeff Morriss <jeff.morriss.ws@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
2015-03-03 15:02:08 +00:00
Michael Mann 1a54112c1d Add tvb_get_ether_name
This is mostly to reduce tvb_get_ptr calls that were used to pass into get_ether_name.

Some optimizations were made to packet-ieee80211.c in the process of conversion.

Change-Id: I81d3c65d4c09a15237fc287c2e989eb6e6936b1f
Reviewed-on: https://code.wireshark.org/review/7492
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-03-03 07:19:42 +00:00
Jeff Morriss f9f7ff2904 Don't read aliases from the personal hosts file.
We only store the last name added (i.e., the last alias) which is the
opposite of what the name resolver does (it returns the first name in the
hosts file).

Just comment the code out for now with a comment explaining why.  Maybe some
day we'll have a reason to store the aliases.

Change-Id: I560ac05868a429d31e9d41f3a34af36c4fca1f6c
Reviewed-on: https://code.wireshark.org/review/7466
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-03-02 06:58:26 +00:00
Jeff Morriss edb5e4b7ff Use getnameinfo() instead of gethostbyaddr().
Also fix up some formatting.

Change-Id: I3348179626e97daaddfbc89e3ed21e39915e3de4
Reviewed-on: https://code.wireshark.org/review/7423
Petri-Dish: Jeff Morriss <jeff.morriss.ws@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
2015-02-27 21:09:23 +00:00
Jeff Morriss e5e8af9c71 Restore synchronous name resolution (revert SVN rev52115).
These gethostbyaddr() calls should be changed to getaddrinfo() but only in
master.

Change-Id: I7e2d31ceb0e072beb7f324336d7b145c3adbe3a0
Reviewed-on: https://code.wireshark.org/review/7402
Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
2015-02-27 21:09:11 +00:00
Jeff Morriss 4e12b598eb Check whether we HAVE_GETADDRINFO before using it.
One spot was missing the check.

Change-Id: I72d1d3d2dec2cc71b02861ace59dc9e189721cfb
Reviewed-on: https://code.wireshark.org/review/7401
Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
2015-02-26 02:44:50 +00:00
Pascal Quantin 9fe9505b46 addr_resolv.c: fix a stack buffer overflow detected by ASAN
Issue reported by Alexis

Change-Id: I0ef19625b6844fbc2996b75d51e86f949e358c8d
Reviewed-on: https://code.wireshark.org/review/7273
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2015-02-20 11:50:14 +00:00
Alexis La Goutte f89edfd2df addr_resolv: Fix Dead Store (Dead assignement/Dead increment) warning found by Clang
Change-Id: I559151afab48892c51b702d008c1583570bd8754
Reviewed-on: https://code.wireshark.org/review/7262
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2015-02-20 07:40:47 +00:00
Michael Mann 8d16ac46d5 Add name resolution support to address type.
Add address_with_resolution_to_str API that returns address string + name resolution in the format %s (%s), first string is resolved name (if available) and second string is raw address string.

Convert AT_FCWWN to using proper name resolution format

First use of address_with_resolution_to_str with field types in proto.c

Change-Id: I2ae77c29a4ffc30bb919fbec00f06629830898c2
Reviewed-on: https://code.wireshark.org/review/7196
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-02-19 13:09:41 +00:00
Robert Cragie edf05db347 Corrected display format for EUI-64
Change-Id: I0913337a29efac5c39e30897cad7e90195fa984a
Reviewed-on: https://code.wireshark.org/review/7198
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-02-17 18:22:17 +00:00
Guy Harris 6331755029 Get rid of duplicate typedef.
Change-Id: I389132ec27405394ca73fb9c09950d8a91ea32a7
Reviewed-on: https://code.wireshark.org/review/7180
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2015-02-16 18:38:38 +00:00
Michael Mann b2c81bb9e8 Make get_manuf_name return a const string.
Model get_manuf_name after get_ether_name so that a string (either name resolved or colon-separated bytes) is always stored in a hash table.  This will make name resolution of addresses perform a little better because it doesn't have to worry about the wmem_allocator.

Change-Id: If976fe7b0c3f9cd053225096c2ac05418f061af6
Reviewed-on: https://code.wireshark.org/review/7081
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-02-16 12:47:02 +00:00
Gerald Combs 5cc0ad8672 Remove a duplicate typedef.
Change-Id: Ie26785cc3577bda84cb4d244aab5a607797b99fb
Reviewed-on: https://code.wireshark.org/review/7118
Reviewed-by: Gerald Combs <gerald@wireshark.org>
2015-02-14 17:01:21 +00:00