Commit Graph

204 Commits

Author SHA1 Message Date
Jakub Zawadzki c9b2ee3768 include <wsutil/pint.h> only when needed.
svn path=/trunk/; revision=53196
2013-11-09 15:44:29 +00:00
Anders Broman b8003ea06e g_slist_free_full() is glib 2.28
Fix spelling.

svn path=/trunk/; revision=52787
2013-10-23 14:04:19 +00:00
Anders Broman e717ca06bd Make manual address resolution work again by putting the addresses
in a separate list and add that list when address resolution is rebuilt
during rescan of packets.

svn path=/trunk/; revision=52785
2013-10-23 12:02:15 +00:00
Anders Broman d038be780b Flag the addresses used in the trace which has been resolved and only add those to the list used to create the NRB.
svn path=/trunk/; revision=52504
2013-10-10 19:17:48 +00:00
Jörg Mayer 07a5c7442f Invert NEED_INET_ATON_H to HAVE_INET_ATON_H
Remove unused NEED_G_ASCII_STRTOULL_H

svn path=/trunk/; revision=52385
2013-10-05 21:56:23 +00:00
Evan Huus d158983d7e Fix some typos, indentation. Don't try to write the NRB if the pointer to our
two lists is itself NULL.

svn path=/trunk/; revision=52181
2013-09-22 20:18:25 +00:00
Evan Huus 1210a335ab Fix -Wshadow, indentation
svn path=/trunk/; revision=52179
2013-09-22 20:01:32 +00:00
Anders Broman 20108d7950 Get rid of struct addrinfo, use the hastables for name resolution instead.
svn path=/trunk/; revision=52176
2013-09-22 19:40:02 +00:00
Anders Broman e7290ae53e Don't call gethostbyaddr() we have already read the local hosts file, settle for that.
svn path=/trunk/; revision=52115
2013-09-17 04:55:29 +00:00
Anders Broman 038d3b0a56 Read the local services file.
svn path=/trunk/; revision=52104
2013-09-16 18:36:50 +00:00
Anders Broman 1821ed0404 Don't call getservbyport() on unresolved ports - it's expensive.
We should read the services file in initialize_services instead.

svn path=/trunk/; revision=52103
2013-09-16 17:53:41 +00:00
Anders Broman ae83d08f30 Revert revision=51577.
Ref https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9082
Since this commit the IP (source and destination) address in the GUI will be
replaced with some date after I click on the entry, reverting this commit fixes
the problem.


This looks like a memory corruption. I imported an older pcap file.

svn path=/trunk/; revision=51579
2013-08-29 22:08:23 +00:00
Anders Broman 39a61a1680 Don't store address in the hastable when name resolution is off.
svn path=/trunk/; revision=51577
2013-08-29 18:59:49 +00:00
Evan Huus 21ad5c11b2 Clean-up ipxnet hash table in host_name_lookup_cleanup. Should fix the buildbot
test suite failures.

svn path=/trunk/; revision=51447
2013-08-20 22:41:49 +00:00
Jörg Mayer 0f74dff2f9 Fix for
[  6%] Building C object epan/CMakeFiles/epan.dir/addr_resolv.c.o
/home/jmayer/work/wireshark/svn/trunk/epan/addr_resolv.c:1927:1: error: unused function
      'get_ipxnetbyname' [-Werror,-Wunused-function]
get_ipxnetbyname(const gchar *name)
^
/home/jmayer/work/wireshark/svn/trunk/epan/addr_resolv.c:2009:1: error: unused function
      'add_ipxnet_name' [-Werror,-Wunused-function]

by #if 0/#endif the functions. If they really are not needed any more
they should be removed.

svn path=/trunk/; revision=51438
2013-08-20 06:35:45 +00:00
Anders Broman cb1bd182f2 Mark an unused parameter.
svn path=/trunk/; revision=51437
2013-08-20 05:27:48 +00:00
Anders Broman 4e63bb5ec5 Use g_hash_table() for ipxnet name resolution.
svn path=/trunk/; revision=51436
2013-08-20 05:06:26 +00:00
Anders Broman ccb96fd73a Use g_hastable() for IPv6 name reslution.
svn path=/trunk/; revision=51415
2013-08-18 19:02:48 +00:00
Evan Huus 2048ac8ae1 Split the code to convert an ethernet address into an int64 into a function
since it's used in several places. Don't allocate a key just to do a hash-table
lookup, we only need to do that if we're actually inserting. Fixes another ~1KB
of leaks.

svn path=/trunk/; revision=51364
2013-08-15 02:45:58 +00:00
Evan Huus 4577d39122 Free the old name before we add the new one in case the services file has
duplicates (it does). Fixes about 2KB of leaks.

svn path=/trunk/; revision=51363
2013-08-15 02:38:00 +00:00
Evan Huus 7292140b9c Fix name resolution tests:
- if we find a name during lookup, return it even if it's not a dummy
- read personal hosts after global hosts so that they take precedence

Neither of these problems appear to be new - the recent work did not change this
logic, so I have no idea how come name resolution wasn't failing before, but I
guess the old hash table was weirder than I thought...

svn path=/trunk/; revision=51326
2013-08-13 01:41:51 +00:00
Anders Broman 1ef4ba5e32 Move initalisation of IPv4 hastable to the host_name_lookup_init() rotine.
svn path=/trunk/; revision=51319
2013-08-12 18:33:08 +00:00
Anders Broman 93c9c4b0ff Use g_hashtable for IPv4 name resolution.
svn path=/trunk/; revision=51301
2013-08-11 19:02:26 +00:00
Evan Huus 1176e2f3d7 Modelines and consistent indentation.
Also tweak some ifdefs of function signatures. The multiple braces were
confusing my folder and my indenter, so ifdef *only* the changed parameters and
leave the bracing alone. This has the benefit of being a bit clearer too, I
think.

svn path=/trunk/; revision=51291
2013-08-11 00:50:51 +00:00
Evan Huus f75302817b Fix 130KB of leaked memory exposed (or caused?) by the conversion to glib hash
tables.

svn path=/trunk/; revision=51290
2013-08-11 00:35:22 +00:00
Anders Broman fd4a111149 Don't call eth_addr_resolve() unconditionally.
svn path=/trunk/; revision=51207
2013-08-08 04:32:19 +00:00
Jeff Morriss 2c81a97d55 Ensure we have both _initialize() and a corresponding _cleanup() routines for
the various name resolvers; put those two routines next to each other.

Add generic addr_resolv_init() and addr_resolv_cleanup() routines which call
all of those internal routines.

Call the generic init/cleanup routine from epan_init() and epan_cleanup().

Create the hash tables for each name resolver in those initialization routines
in order to avoid having to repeatedly check if the table is already created
or not (and to avoid glib warnings if we neglected to perform that check):

http://www.wireshark.org/lists/wireshark-dev/201308/msg00012.html


Don't clean up   hostnames in init_dissection():    it's done already in cleanup_dissection().
Don't initialize hostnames in cleanup_dissection(): it's done already in init_dissection().

svn path=/trunk/; revision=51191
2013-08-07 16:46:08 +00:00
Anders Broman cc7c777f55 Store the port number as a string for the unresolved ports to avoid repeated calls to getservbyport() for all unresolved ports.
svn path=/trunk/; revision=51170
2013-08-06 17:07:20 +00:00
Guy Harris 6a1626f907 Make sure serv_proto is set to the appropriate string value in all
cases; set it before we do the hash table lookup.  Don't initialize
serv_proto to null when we declare it - that covers up cases where we
fail to set it correctly.

Clean up indentation.

svn path=/trunk/; revision=51164
2013-08-05 20:23:45 +00:00
Martin Kaiser 0048fbc0d4 it's and, not or ;-)
this fixes
  CC     libwireshark_la-addr_resolv.lo
addr_resolv.c: In function 'serv_name_lookup':
addr_resolv.c:666:3: error: logical 'or' of collectively exhaustive tests is always true [-Werror=logical-op]

svn path=/trunk/; revision=51160
2013-08-05 19:40:22 +00:00
Anders Broman 9999016855 Try to make the OSX build bot happy.
svn path=/trunk/; revision=51155
2013-08-05 18:06:14 +00:00
Anders Broman 21d5a76a68 Use a hastable for port resolution. Currently one table for the 4 protocols with resolution. SCTP and DCCP should perhaps be splited out to their own tables.
svn path=/trunk/; revision=51153
2013-08-05 16:36:24 +00:00
Michael Mann 14dd5e8e34 Ensure eth_hashtable exists when doing a lookup. Not sure I'm running into the same situation as Jeff (http://www.wireshark.org/lists/wireshark-dev/201308/msg00012.html), but tshark is complaining so I can't do fuzz-testing.
Also corrected copy/pasteo when cleaning up eth_hashtable.

svn path=/trunk/; revision=51133
2013-08-04 10:22:10 +00:00
Jeff Morriss b06ebbb17b Add some casts to keep C++ happy.
Mark an unused parameter as such.

#if out a currently unused function.

svn path=/trunk/; revision=51121
2013-08-02 15:27:19 +00:00
Jeff Morriss 228fa705d8 g_int64_equal() and g_int64_hash() exist *after* glib 2.22, not before.
svn path=/trunk/; revision=51120
2013-08-02 15:19:05 +00:00
Anders Broman bcb5ff7532 - Use a hashtable for eth lookup.
Currently broken get_ether_addr().
- Show hastable content in address dlg.(temp solution).

svn path=/trunk/; revision=51119
2013-08-02 15:05:00 +00:00
Anders Broman 7891191c57 g_int64_hash() and g_int64_equal() first appear in GLib 2.22, make a local copy.
svn path=/trunk/; revision=51118
2013-08-02 14:53:12 +00:00
Guy Harris 91382394d6 Squelch a warning by explicitly casting to throw away the upper 32 bits
of a result.

svn path=/trunk/; revision=51088
2013-08-01 20:46:49 +00:00
Martin Kaiser 73444a24e0 remove unused function hash_eth_wka()
in order to fix the compile error
addr_resolv.c:1250:1: error: 'hash_eth_wka' defined but not used
[-Werror=unused-function]

svn path=/trunk/; revision=51085
2013-08-01 20:31:09 +00:00
Anders Broman 0105d538d2 Use glibs hastables rather than home grown variants for manuf an wka(well known addresses).
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=9000

svn path=/trunk/; revision=51084
2013-08-01 20:11:13 +00:00
Chris Maynard 91ecc2334f "man inet_pton" only says that it returns a negative value, zero or a postive value, and not specifically -1, 0, or 1, so even though we know that's what wsutil's inet_pton will return, we shouldn't test against those exact values.
svn path=/trunk/; revision=50670
2013-07-16 16:23:31 +00:00
Jeff Morriss 54bb2e7a5c Move report_err.{h,c} from epan into wsutil: there's nothing epan-specific there and moving it avoids having to recompile the file for use in editcap and capinfos (which don't link against libwireshark).
svn path=/trunk/; revision=50598
2013-07-15 02:48:26 +00:00
Jakub Zawadzki 7c9c79ca68 Move bitmask array from ipv4_addr_set_netmask_bits() to ip_get_subnet_mask()
Use it in subnet_mask_lookup_init().

svn path=/trunk/; revision=50527
2013-07-12 05:59:56 +00:00
Martin Mathieson b3ac3506e8 Add some comments around looking up names for port numbers.
(calling getservbyname() is really slow, but only called once per port
number...)

svn path=/trunk/; revision=49953
2013-06-16 01:53:43 +00:00
Guy Harris 5ea3858f53 Don't put zero-length names into our tables of resolved IPv4 and IPv6
addresses; they look weird, and can cause problems with existing
versions of Wireshark when written in a Name Resolution Block.

Should fix bug 8763.

svn path=/trunk/; revision=49852
2013-06-09 02:56:16 +00:00
Gerald Combs bfe9967fc8 nameres.hosts_file_handling shouldn't affect loading the profile "hosts"
file. That should be loaded no matter what if we have name resolution
enabled.

Add a name resolution test suite. Currently disabled until I can test it
on Windows.

svn path=/trunk/; revision=49657
2013-05-31 21:40:26 +00:00
Gerald Combs d98b0cc231 Fix and clarify name resolution preference tooltips. Print the
description before the name+type since that's presumably what people
are looking for.

svn path=/trunk/; revision=49622
2013-05-29 18:01:03 +00:00
Evan Huus 50acddcc97 Fix a memory leak by using seasonal memory for building all parts of one of
the address resolution tables.

Showed up with https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8670
although I doubt it's the cause of the crash.

svn path=/trunk/; revision=49413
2013-05-19 13:00:06 +00:00
Jeff Morriss c2ced4a2ab Don't try to open <home>/.wireshark on Windows: Wireshark hasn't written to
that directory since 2001 and reading from that directory was only left in for
backwards compatibility with versions prior to r4702.  I think it's now safe
to remove that backwards compatibility.

This eliminates the last argument of get_persconffile_path().

https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8437

svn path=/trunk/; revision=48797
2013-04-09 02:48:03 +00:00
Jeff Morriss 83558494fb Fix compilation with C++ warnings enabled: use enum values instead of raw
numbers in adns_init() and adns_submit().

(I haven't checked how long these enums have been there; hopefully for a long
time.)

svn path=/trunk/; revision=48549
2013-03-25 14:35:19 +00:00