Commit Graph

380 Commits

Author SHA1 Message Date
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
Anders Broman f8a93562e0 [-Wmissing-prototypes]
Use explicit casts.

svn path=/trunk/; revision=48457
2013-03-21 17:52:43 +00:00
Anders Broman b7617b32eb From beroset:
remove C++ incompatibilities 
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416

svn path=/trunk/; revision=48383
2013-03-17 22:16:39 +00:00
Anders Broman 3e38475176 From beroset:
remove C++ incompatibilities 
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8416

svn path=/trunk/; revision=48356
2013-03-17 17:52:26 +00:00
Gerald Combs 24d67b60ab Add a ModulePreferencesScrollArea widget which builds a scrollable frame
for a preferences module. Use it to fill in the remaining preferences.
Don't show the printing preferences since they're not used here.

Change the titles and tooltips for some of the name resolution
preferences.

Disable the capture preferences if we can't capture. This is different
from the GTK+ version which hides it completely.

Thus concludes the preferences dialog (for the time being).

svn path=/trunk/; revision=47545
2013-02-08 01:16:46 +00:00
Evan Huus 17a05dfae0 Remove unused file handle that appears to have been left over by
accident after a refactor.

svn path=/trunk/; revision=46907
2013-01-02 23:16:03 +00:00
Guy Harris 8ed7a73e22 Fix a bunch of warnings.
Cast away some implicit 64-bit-to-32-bit conversion errors due to use of
sizeof.

Cast away some implicit 64-bit-to-32-bit conversion errors due to use of
strtol() and strtoul().

Change some data types to avoid those implicit conversion warnings.

When assigning a constant to a float, make sure the constant isn't a
double, by appending "f" to the constant.

Constify a bunch of variables, parameters, and return values to
eliminate warnings due to strings being given const qualifiers.  Cast
away those warnings in some cases where an API we don't control forces
us to do so.

Enable a bunch of additional warnings by default.  Note why at least
some of the other warnings aren't enabled.

randpkt.c and text2pcap.c are used to build programs, so they don't need
to be in EXTRA_DIST.

If the user specifies --enable-warnings-as-errors, add -Werror *even if
the user specified --enable-extra-gcc-flags; assume they know what
they're doing and are willing to have the compile fail due to the extra
GCC warnings being treated as errors.

svn path=/trunk/; revision=46748
2012-12-26 05:57:06 +00:00
Evan Huus fc1d83d924 Fix a double-free by setting the GSList back to NULL when we free it.
Part of https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8101

svn path=/trunk/; revision=46583
2012-12-18 03:31:25 +00:00
Gerald Combs bd19dcd8bf Add an add_hosts_file routine that adds a "hosts" path to an array and
use it in tshark.c instead of read_hosts_file. This lets us use "-H"
multiple times. Make read_hosts_file static.

svn path=/trunk/; revision=46273
2012-11-29 00:32:39 +00:00
Anders Broman e57bf90ebe From Bill Parker:
code fails to check/test return value from select() 
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7861

svn path=/trunk/; revision=45917
2012-11-05 09:18:43 +00:00
Jakub Zawadzki 829b2fc91f Make r45511 work also without HAVE_C_ARES.
svn path=/trunk/; revision=45674
2012-10-20 20:50:25 +00:00
Gerald Combs c91c1df500 Use seasonal allocation for name resolution. This effectively scrubs our
resolution information between capture files so that we don't leak host
entries from one file to another (e.g. embarassing-host-name.example.com
from file1.pcapng into a name resolution block in file2.pcapng).

host_name_lookup_cleanup and host_name_lookup_init must now be called
after each call to se_free_all. As a result we now end up reading our
various name resolution files much more than we should.

svn path=/trunk/; revision=45511
2012-10-12 21:37:02 +00:00
Guy Harris 6cfc6b1539 Fix indentation.
svn path=/trunk/; revision=45270
2012-10-02 21:15:54 +00:00
Guy Harris 73dd0321ea Get rid of the always-null and unused argument to
host_name_lookup_process().  If, in the future, we find that we need an
argument for changes we're making, we can add it then.

svn path=/trunk/; revision=45269
2012-10-02 21:13:59 +00:00
Jeff Morriss 3729335973 We always HAVE_CONFIG_H so don't bother checking whether we have it or not.
svn path=/trunk/; revision=45016
2012-09-20 01:48:30 +00:00
Chris Maynard ff63dcfa8e Jeff Morriss indicated the following and I obliged:
Actually I suppose what was meant is more about whether tp->name[0] is the NULL character (that is, that the name is empty).

But since the result of the lookup is already there in 'found' the whole condition can probably be taken out.


svn path=/trunk/; revision=43701
2012-07-13 21:20:00 +00:00
Chris Maynard 86b2f69672 tp->name can't be NULL, but perhaps tp can be?
Fixes Coverity CID 709597: Array compared against 0.

svn path=/trunk/; revision=43695
2012-07-13 20:09:29 +00:00
Anders Broman 0a27ca29b2 Add a new preference to make it possible to only use the hosts file
for a profile for name resolution.

svn path=/trunk/; revision=43659
2012-07-11 08:52:51 +00:00
Jeff Morriss 9ece26aee9 Obey the new use-external-resolvers preference when translating IP
addresses into host names (in get_host_ipaddr() and get_host_ipaddr6()).

This may resolve
http://ask.wireshark.org/questions/12542/what-is-use-external-network-name-resolver-setting

svn path=/trunk/; revision=43647
2012-07-10 15:02:23 +00:00
Jeff Morriss 7a8a40946a host_lookup() and host_lookup6() are both called even when network-name
resolution is NOT enabled (it's always been like this and I'm not sure why
and I was hesitant to change that).  So: don't use the external name resolver
unless both network-name resolution AND use-external-resolvers are enabled.

svn path=/trunk/; revision=43645
2012-07-10 14:33:19 +00:00
Anders Broman 8762bd56a3 Group the network name resolution boxes together and make a more verbose explanation on the intended use.
svn path=/trunk/; revision=43638
2012-07-10 07:24:01 +00:00
Jeff Morriss 8f12c9d7d7 First phase of fixing https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7380 :
Add a new name resolution option: whether or not use the configured (in the OS)
name resolver (e.g., DNS) to resolve network names.  When this option is disabled
but network name resolution is enabled then Wireshark will resolve only those
names that it can from local sources.  This includes (at least, AFAIK):

- name resolutions that Wireshark picks up on from DNS packets it decodes
- the "user hosts file" (~/.wireshark/hosts on *NIX)
- what Wireshark reads out of capture file (the PCAPNG name resolution block)

This new preference defaults to "use external resolvers" for backward
compatibility (so people turning on network name resolution will get the old
behavior).

This option can be set via Edit->Preferences and on the command line; there
remain several UIs (e.g., the "open capture file" dialog, the
View->Name Resolution menu, etc.) that don't have the new option yet.


Also expand on the "description" for the name resolution preferences: these
are used not only in the tooltips but are also written to the preferences
file.  The previous text didn't include enough context when written do the
preferences file.

svn path=/trunk/; revision=43605
2012-07-08 01:31:48 +00:00
Jakub Zawadzki 88cb14dda3 - remove no longer used #defines
- prefs.name_resolve_concurrency is now just 'name_resolve_concurrency'
- add notes about possible (?) integer overflows.

svn path=/trunk/; revision=43586
2012-07-06 07:55:58 +00:00
Jakub Zawadzki f31b3943c0 - e_addr_resolve is structure so pass it by pointer.
- name_resolve_concurrency must be only defined when used.

svn path=/trunk/; revision=43584
2012-07-06 07:34:08 +00:00
Anders Broman c19583b72c From Michael Mann:
Generic preferences implementation - Printing and Name Resolution.

svn path=/trunk/; revision=43579
2012-07-06 04:48:36 +00:00
Jakub Zawadzki bf81b42e1e Update Free Software Foundation address.
(COPYING will be updated in next commit)

svn path=/trunk/; revision=43536
2012-06-28 22:56:06 +00:00
Guy Harris 7f8d3e24e3 Add uint_get_manuf_name() and uint_get_manuf_name_if_known() routines,
which take an OUI, presumably fetched with a routine such as
tvb_get_ntoh24(), as an argument and attempt to look it up in the manuf
file.

Fix up the comments for all the get_manuf_name routines.

Get rid of "extern"s in definitions of functions (definitions, not
declarations).

svn path=/trunk/; revision=42054
2012-04-13 22:23:04 +00:00
Guy Harris 937e25c375 Attempt to squelch some compiler warnings.
svn path=/trunk/; revision=37678
2011-06-16 06:55:11 +00:00
Jeff Morriss da8ec2c2d6 Use proto_tree_add_item() instead of proto_tree_add_xxx() with a pointer into
the TVB.

Introduce and start using tvb_get_manuf_name() and tvb_get_manuf_name_if_known()
which do the same as the non-tvb versions but take a tvb and an offset instead
of (commonly) a pointer into a TVB.

svn path=/trunk/; revision=37317
2011-05-20 02:42:14 +00:00
Guy Harris f153eb070b Cast away some warnings about alignment; ep_alloc() guarantees
sufficient alignment for all types of data.

svn path=/trunk/; revision=37190
2011-05-16 21:42:49 +00:00
Alexis La Goutte 7d317e553b Add FT_EUI64 Field Type
* Remove proto_tree_add_eui64 function from 802.15.4 Dissector 
* Replace print_eui64/print_eui64 by eui64_to_str/get_eui64_name
* Update Documentation (README.dev)
* Add new function in libwireshark.def
* Support of encoding for tvb_eui64_to_str
* Use FT_EUI64 for ICMPv6, CAPWAP, Zbee ... dissector

svn path=/trunk/; revision=37015
2011-05-08 10:23:53 +00:00
Jakub Zawadzki 453d0a8568 Introduce ip6_to_str_buf_len (little cleaner version of inet_ntop6 from wsutil/inet_ntop.c)
and use it instead of inet_ntop(AF_INET6, ...)

- Add MAX_IP6_STR_LEN define.
- use MAX_IP6_STR_LEN as a buffer size when ip6_to_str_buf() is used.

svn path=/trunk/; revision=37000
2011-05-05 20:48:21 +00:00
Gerald Combs b223e99e5a get_host_ipaddr() was returning numeric addresses in host byte order
and hostnames in network byte order. Have it return everything in
network byte order.

svn path=/trunk/; revision=36873
2011-04-26 17:13:37 +00:00
Gerald Combs aa5349924a Minor whitespace fix.
svn path=/trunk/; revision=36536
2011-04-10 16:40:29 +00:00
Bill Meier ede51600c7 Don't assign to a variable if the value won't be used: Coverity 817-821.
svn path=/trunk/; revision=36446
2011-04-04 15:31:33 +00:00
Gerald Combs fcf51fc73b Add initial pcapng name resolution record support. Wireshark has read
support; TShark has read+write support. Additionally TShark can read a
"hosts" file and write those records to a capture file.

This uses "struct addrinfo" in many places and probably won't compile on
some platforms.

svn path=/trunk/; revision=36318
2011-03-24 22:47:57 +00:00
Guy Harris d36684f364 Can we reassure Microsoft's static analyzer that 0 <= mask <= 48?
svn path=/trunk/; revision=35977
2011-02-17 09:08:11 +00:00
Gerald Combs 7b254f46fb Fix some Visual C++ static analyzer complaints.
svn path=/trunk/; revision=35971
2011-02-17 01:11:05 +00:00
Jaap Keuter fe8f565a89 Fix fo bug 5616:
Remove the filters on IPv6 Link Local and Multicast addresses, since 
these _can_ be resolved through the hosts file and manual entry.

svn path=/trunk/; revision=35651
2011-01-25 22:11:59 +00:00
Jeff Morriss 7009bfc740 Fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4102 :
Limit the length of manuf names to 8 characters in make-manuf (this matches
the (old) limit in addr_resolv.c).

Dynamically allocate memory to store the manuf name in epan/addr_resolv.c so
that we don't end up corrupting the UTF-8 if/when we need to truncate the
string.

svn path=/trunk/; revision=35082
2010-11-30 22:28:34 +00:00
Bill Meier c78221d4ce Rename g_resolv_flags --> gbl_resolv_flags; Also: cleanup some whitespace & indentation.
svn path=/trunk/; revision=34487
2010-10-12 13:15:08 +00:00
Gerald Combs a0b284c5db Add more information to the Info column for some ICMPv6 messages. Add a
small comment to addr_resolv.c.

svn path=/trunk/; revision=34384
2010-10-05 17:57:23 +00:00
Stig Bjørlykke 6f5b3e381c Make it compile without HAVE_C_ARES and HAVE_GETHOSTBYNAME2.
svn path=/trunk/; revision=33742
2010-08-09 11:19:15 +00:00
Bill Meier f1c540a54c Rework ethernet address resolution: step 3 of 3:
- Primarily: ethernet name lookup returns either
   unresolved or resolved ethernet name depending upon whether 
   MAC Name resolution is disabled or enabled.
   Previously: Unresolved or resolved name cached at first reference
   and then always returned for future references no matter whether
   MAC Name Resolution was enabled or disabled. 
- Also: Refactor ethernet, manuf & well-known-addr related code;

ToDo: (separately): Redisplay when 'MAC name resolution' enabled/disabled. 

svn path=/trunk/; revision=33401
2010-07-01 15:11:02 +00:00
Bill Meier 14a209b03a Rework ethernet address resolution: step 2:
- Use a new hashwka_t struct (instead of hashether_t) for 
   "well-known-address" hash entries (saves some space);
- Remove unused variable from hashether_t;
- Reorder variables within hashether_t and hashmanuf_t to minimize padding in the structures;
- Rename some variables for clarity;
- Misc whitespace changes.

svn path=/trunk/; revision=33364
2010-06-29 02:53:17 +00:00
Bill Meier 0a785ddea8 (Trivial): Whitespace revisions.
svn path=/trunk/; revision=33360
2010-06-28 22:43:13 +00:00
Bill Meier 3af757c875 Rework ethernet address resolution: step 1: simplify 'get_ether_name_if_known()'
svn path=/trunk/; revision=33359
2010-06-28 22:29:49 +00:00
Jeff Morriss 47e2d75820 Move some code (including the optional objects) into libwsutil
svn path=/trunk/; revision=33012
2010-05-28 20:19:55 +00:00
Stig Bjørlykke eb279458fa Rewrite: strcpy -> g_strlcpy.
svn path=/trunk/; revision=32637
2010-05-02 20:21:39 +00:00
Jeff Morriss 0791f7beb8 Make the indentation consistent.
svn path=/trunk/; revision=32601
2010-04-29 18:17:29 +00:00
Bill Meier d99e90b2e2 Fix a gcc -Wshadow warning; Fix a comment;
Use consistent indentation.

svn path=/trunk/; revision=32581
2010-04-27 22:46:39 +00:00
Stig Bjørlykke 32ce531601 Added Manual IP address resolve functions.
This can later be extended with ethernet and probably other addresses.

svn path=/trunk/; revision=32571
2010-04-27 06:51:16 +00:00
Bill Meier 6812b68eb1 From Yaniv Kaul: constify parameters
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4422

 From me: Fix a number of instances where the function prototype or
  the function definition wasn't changed so there was a mismatch 
  thus causing Windows (but not gcc) compilation errors.

svn path=/trunk/; revision=32365
2010-04-03 18:18:50 +00:00
Bill Meier d32b4c0758 Revert SVN #32360 until Windows compilation errors corrected.
svn path=/trunk/; revision=32361
2010-04-02 15:18:03 +00:00
Bill Meier 049f9eac85 From Yaniv Kaul: constify parameters
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4422

svn path=/trunk/; revision=32360
2010-04-02 14:37:49 +00:00
Anders Broman 4e66c899d1 From Jakub Zawadzki:
Optimizations.
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4303

svn path=/trunk/; revision=31967
2010-02-23 19:28:38 +00:00
Bill Meier 21179f68bd Fix gcc -Wshadow warnings.
svn path=/trunk/; revision=31717
2010-01-28 16:03:03 +00:00
Gerald Combs fadae76f0c Fix a potential compilation problem with older versions of c-ares.
svn path=/trunk/; revision=31579
2010-01-19 23:18:23 +00:00
Gerald Combs ad69bdd7ea Have get_host_ipaddr and get_host_ipaddr6 return FALSE if network name
resolution is disabled. Fix some indentation.

svn path=/trunk/; revision=31361
2009-12-24 17:21:02 +00:00
Gerald Combs b7702fd6d7 If we're using c-ares, have get_host_ipaddr and get_host_ipaddr6 time
out after 250ms. This should fix the annoying freeze in bug 658.

svn path=/trunk/; revision=31360
2009-12-24 00:58:31 +00:00
Gerald Combs 4f30c2170e Change host_name_lookup_process to return TRUE if anything new has been
resolved since the last time it was called. Use this to redraw the packet
list and detail any time we have newly-resolved objects.

svn path=/trunk/; revision=31350
2009-12-22 20:01:06 +00:00
Jaap Keuter a529270519 Let c-ares actually resolve IPv6 addresses.
svn path=/trunk/; revision=31181
2009-12-06 08:45:52 +00:00
Jaap Keuter b30247cccb Prepare for c-ares 1.6.1 release.
svn path=/trunk/; revision=30773
2009-10-30 21:57:43 +00:00
Kovarththanan Rajaratnam f48e1b1574 Add null pointer guard
svn path=/trunk/; revision=30340
2009-10-05 18:12:16 +00:00
Stig Bjørlykke a1aee8c660 Put caqm inside INET6 guard in host_lookup6().
Removed unused functions:
- get_hostip()
- get_hostip6()
- name_resolution_changed()
- get_ether_hexa()

svn path=/trunk/; revision=30190
2009-09-29 09:49:43 +00:00
Anders Broman b61ea82d55 From Didier Gautheron:
optimizations patch http://wiki.wireshark.org/Development/Optimization
'patch.29854.diff.gz"

Clean up addr_resolv.c

svn path=/trunk/; revision=29880
2009-09-13 17:24:51 +00:00
Kovarththanan Rajaratnam c629dde8b6 Constify some functions
svn path=/trunk/; revision=29773
2009-09-07 16:17:58 +00:00
Kovarththanan Rajaratnam 98d18343c8 Whitespace changes
svn path=/trunk/; revision=29772
2009-09-07 16:07:04 +00:00
Kovarththanan Rajaratnam 72c9662da6 ntroduce some seasonal address name lookup functions which we use when NEW_PACKET_LIST is defined. This change partially reverts some parts of r29768, which didn't seem to work because it assumed that get_addr_name() would always return a seasonal string. This wasn't the case if the adddress type was AT_STRINGZ.
svn path=/trunk/; revision=29771
2009-09-07 16:05:37 +00:00
Kovarththanan Rajaratnam ea0ab046e0 Tigthen scope of local variables
svn path=/trunk/; revision=29770
2009-09-07 15:49:14 +00:00
Anders Broman 3abd049a9b Use constant strings for Addresses saves some memory.
svn path=/trunk/; revision=29768
2009-09-07 14:03:05 +00:00
Anders Broman a4ce0d3d69 Put back
http://anonsvn.wireshark.org/viewvc?view=rev&revision=29656
http://anonsvn.wireshark.org/viewvc?view=rev&revision=29658
http://anonsvn.wireshark.org/viewvc?view=rev&revision=29661
Reverted by my previous checkin.

svn path=/trunk/; revision=29749
2009-09-06 14:53:21 +00:00
Kovarththanan Rajaratnam 8c48c6835f Rename address_to_str() to ep_address_to_str() because:
1) This indicates that the string has ephemeral lifetime
2) More consistent with its existing seasonal counterpart, se_address_to_str().

svn path=/trunk/; revision=29747
2009-09-06 14:25:47 +00:00
Anders Broman 137b886960 From Didier Gautheron:
Extracted from optimizations patch http://wiki.wireshark.org/Development/Optimization
Optimize address handling.
The address hash should be possible to use from the new_packet_list.

svn path=/trunk/; revision=29735
2009-09-06 08:59:30 +00:00
Anders Broman f0ea776605 From : Didier Gautheron
Addresse hash is slow on little endian CPU.
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3973

svn path=/trunk/; revision=29692
2009-09-04 10:53:37 +00:00
Guy Harris 5dd678f0a7 Check whether "size" points to something positive, not whether "size"
itself is positive (which makes no sense for a pointer).

svn path=/trunk/; revision=29661
2009-09-01 19:31:41 +00:00
Kovarththanan Rajaratnam f8f4f0fb6b Remove superfluous NULL pointer checks wrt. g_malloc() and g_realloc()
svn path=/trunk/; revision=29658
2009-09-01 18:44:08 +00:00
Kovarththanan Rajaratnam 17f010119a From Jakub Zawadzki via. Bug 3330:
* Fix memleak (df->deprecated in dfilter_free())
* Free protocol hash tables on cleanup.
* Free protocols list on cleanup.
* Free memory allocated by fgetline() in parse_services_file()

From me:

* proto.c: set gmc_hfinfo to NULL after free
* proto.c: switch order of g_free() and g_list_remove() in proto_cleanup()

svn path=/trunk/; revision=29656
2009-09-01 18:16:55 +00:00
Anders Broman 3278582767 From Kovarththanan Rajaratnam:
Optimize column fill path.
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3701

svn path=/trunk/; revision=29130
2009-07-17 08:24:06 +00:00
Stig Bjørlykke e03ac6b82e From Kovarththanan Rajaratnam via bug 3555:
Cancel hostname lookup timers if c-ares is not initialized.

svn path=/trunk/; revision=28837
2009-06-24 19:10:50 +00:00
Gerald Combs 9c5ca83acf Only #undef inet_aton if we're using ADNS on Windows.
svn path=/trunk/; revision=27920
2009-04-01 00:30:45 +00:00
Stig Bjørlykke 62f60df6b4 From Jakub Zawadzki (bug 3331):
g_free() is NULL safe, so we don't need check against it.

svn path=/trunk/; revision=27718
2009-03-13 22:06:48 +00:00
Gerald Combs f5ee6caa67 From Frederic Leroy: Update c-ares version handling.
svn path=/trunk/; revision=27169
2009-01-06 18:31:57 +00:00
Gerald Combs dc3ed1f1e6 C-ares version check fix from Frederic Leroy, modified by me.
svn path=/trunk/; revision=27112
2008-12-24 18:12:07 +00:00
Gerald Combs 8f375871c1 Allow compilation with c-ares <= 1.4.0 (untested). While we're at it, fix
c-ares name resolution.

svn path=/trunk/; revision=27096
2008-12-23 18:15:09 +00:00
Jörg Mayer 4149a23cc5 Trivial warning fixes
svn path=/trunk/; revision=26899
2008-12-02 08:11:23 +00:00
Stig Bjørlykke 0a66244589 Do not leak the port range in parse_service_line().
svn path=/trunk/; revision=26240
2008-09-20 14:24:29 +00:00
Stig Bjørlykke a7e6165f15 Avoid an indefinite loop freeing the same data over and over again
in host_name_lookup_cleanup() when HAVE_C_ARES.

svn path=/trunk/; revision=25989
2008-08-12 16:47:54 +00:00
Gerald Combs 5906f69b88 On Windows, if we're running anything but plain Visual C++ 6 (including
VC6 plus a platform SDK), set INET6. Use that to figure out if we need
to define socklen_t for c-ares. This should fix bug 2797.

svn path=/trunk/; revision=25985
2008-08-11 21:59:59 +00:00
Gerald Combs 021a926793 Add support for the c-ares asynchronous DNS resolution library to the
Windows build. Add support for async IPv6 lookups. Update the ADNS
code slightly.

This is not supported (yet) on the UNIX side.

svn path=/trunk/; revision=25953
2008-08-07 21:41:48 +00:00
Bill Meier 44efa0ed2e Fix some simple cases of GTK2 deprecated API usage by using a renamed or equivalent API
gtk_timeout_add()     ==> g_timeout_add
   gtk_timeout_remove()  ==> g_source_remove()

Also: timer callback should return gboolean (not void or gint)

svn path=/trunk/; revision=25672
2008-07-08 02:25:30 +00:00
Guy Harris 83fc9d5e09 Constify a bunch of stuff, to squelch -Wwrite-strings warnings.
epan/dissectors/packet-ncp2222.inc is a bit hard to fix, so we're not
ready to enable that warning by default yet.

Throw in some casts to handle GLib routines that take arbitrary
non-const pointers (they can later return the pointers, and some
callers might want to modify or free up those pointers in cases where
they're known to be writable or allocated).

Use ep_tvb_memdup() rather than a combination of ep_alloc() and
tvb_memcpy().

Clean up some indentation.

svn path=/trunk/; revision=25601
2008-06-25 09:12:35 +00:00
Anders Broman 36d89bb79c Fix some of the Errors/warnings detected by checkapi.
svn path=/trunk/; revision=25368
2008-05-23 05:55:34 +00:00
Jeff Morriss a5cee04fad Move the file utility functions from wiretap to libwsutil so that
libwireshark (and the plugins using those functions) do not depend on
wiretap on Windows.

While doing that, rename the eth_* functions to ws_*.

svn path=/trunk/; revision=25354
2008-05-22 15:46:27 +00:00
Stig Bjørlykke 74766c736a From Andrew Feren (bug 2433):
Add support for port ranges in services.

svn path=/trunk/; revision=24934
2008-04-12 14:08:19 +00:00
Stig Bjørlykke 51060a1b5c Removed C++ style comment.
svn path=/trunk/; revision=24178
2008-01-24 18:51:54 +00:00
Stig Bjørlykke a88efc9325 From Douglas Pratley (bug 1445):
Add a "subnets" file defining a named list of subnets.

svn path=/trunk/; revision=24154
2008-01-21 21:44:34 +00:00
Stig Bjørlykke a2d1e9005d This patch adds support for configuration profiles, which can be used to
configure and use more than one set of preferences and configuration files.

This can be found in the "Configuration Profiles..." menu item from the Edit
menu, or by pressing Shift-Ctrl-A.  It's also possible to start wireshark
and tshark with a named profile by using the "-C ProfileName" option.
A new status pane in the main window will show the current profile.

The configuration files currently stored in the Profiles are:
- Preferences
- Capture Filters
- Display Filters
- Coloring Rules
- Disabled Protocols
- User Accessible Tables

The recent data are by design not added to the profile.

Planned future enhancements:
- make a more convenient function to switch between profiles
- add a "clone profile" button to copy an existing profile
- make the profiles list active and accept return as OK
- save users "Decode as" in the profile
- make new, clone and deletion of profiles more secure
- make some of the recent values available in the profile

This patch also fixes:
- setting default status pane sizes
- a bug setting status pane for packets when not having main lower pane.

svn path=/trunk/; revision=24089
2008-01-14 16:40:23 +00:00
Stig Bjørlykke 8b4e80384a Fixed a few "statement not reached" warnings and a "assignment type mismatch" warning.
svn path=/trunk/; revision=24085
2008-01-14 09:39:55 +00:00
Anders Broman b325ef4878 Apply yet another set of the optimization patches:
Don't use g_snprintf for temporary unsigned int to ascii conversion.

svn path=/trunk/; revision=23409
2007-11-09 05:55:33 +00:00
Anders Broman 3a16fb20a3 Apply yet another set of the optimization patches:
Replace strncpy with g_strlcpy.
Add g_strlcat for GTK1 and don't use g_snprintf in GTK1 g_strlcpy
printf family is very slow.

svn path=/trunk/; revision=23273
2007-10-26 05:42:12 +00:00
Mike Duigou 6aeb75c3f0 Changes get_addr_name_buf() to use the more common convention where the provided buffer size is the entire size of the buffer including the space for the terminating \0
svn path=/trunk/; revision=23016
2007-09-28 18:23:59 +00:00
Jörg Mayer 4793614e27 Mask out only the bc/mc bit, not the locally assigned bit.
Update comment accordingly.

svn path=/trunk/; revision=22507
2007-08-15 13:21:23 +00:00
Ulf Lamping 60e81cd141 if the manuf address could not be resolved, strip off special bits (multicast, locally administered) and try again to find it
svn path=/trunk/; revision=22503
2007-08-14 23:52:51 +00:00
Ulf Lamping 1bab78bfdf remove an unused variable
svn path=/trunk/; revision=22458
2007-08-06 09:12:18 +00:00
Ulf Lamping 2aef54275a add a way to read a personal /etc/services file for TCP/UDP/... port service name resolution.
svn path=/trunk/; revision=22457
2007-08-06 08:44:26 +00:00
Bill Meier a6dab6d644 (Minor) Use _WIN32 (instead of WIN32) like the rest of Wireshark
svn path=/trunk/; revision=22030
2007-06-03 16:07:07 +00:00
Stephen Fisher 8fd3ee0560 Remove almost all of the casts I committed recently and in place of
them, add -Wno-pointer-sign to CFLAGS when gcc will accept it.


svn path=/trunk/; revision=21253
2007-03-28 21:55:11 +00:00
Stephen Fisher 46b8669566 Fix a bunch more warnings. Add -Werror when using --with-warnings-as-errors
under gcc to tools/lemon, plugins/mate and epan/


svn path=/trunk/; revision=21204
2007-03-26 06:10:52 +00:00
Gerald Combs 063621f11b Fix potential buffer overruns in address_to_str_buf() found by Andrej
Mikus.  Add a buf_len parameter to ip_to_str_buf(), and make sure it's 
enforced.  Copy the release notes over from the 0.99.5 trunk and add a
note about the ISUP dissector (which is affected by the overrun).

svn path=/trunk/; revision=20607
2007-01-29 20:25:26 +00:00
Jaap Keuter 05aa18b522 Fix for bug 795: handle CR as line end as well
svn path=/trunk/; revision=19075
2006-08-29 16:54:39 +00:00
Anders Broman 996d4db495 Ethereal->Wireshark
svn path=/trunk/; revision=18234
2006-05-28 19:49:07 +00:00
Ronnie Sahlberg 89f022b12b name change
svn path=/trunk/; revision=18197
2006-05-21 05:12:17 +00:00
Ulf Lamping b38db335d3 I don't see any reason why we should only have to look for a hosts file in the personal preferences file, but not in the datafile path, as we doing it for a lot of other config files at runtime.
Add a try to use a global hosts file if one is available ...

svn path=/trunk/; revision=17441
2006-03-02 00:06:15 +00:00
Anders Broman 0fc74ff335 From dider
file.c
time reference menu callback doesn't set  cf->filter, it dumps a core if 
you have a file big enough in find next/ find prev.

addr_resolv.c
leak memory, break list chain when snooping address.

svn path=/trunk/; revision=17419
2006-02-27 09:01:10 +00:00
Jörg Mayer 118e05db0b Ricardo Muggli:
The attached patch will fix ethereal so it will only do network address
resolution when network address resolution is enabled. Even when the
RESOLV_NETWORK flag was set ethereal would try to resolve addresses in
the add_ether_byip function.


svn path=/trunk/; revision=17227
2006-02-09 09:18:15 +00:00
Gerald Combs b3d0b97635 Make sure we don't use the ADNS version of inet_aton; it's broken.
This fixes bug 523, but exposes more of bug 658.

The TACACS and SDP dissectors don't call inet_aton(), so don't include it.

svn path=/trunk/; revision=17056
2006-01-19 23:01:24 +00:00
Ulf Lamping a9f4ae4f99 fix #648:
Win32 only: reading a pathname from an environment var requires us to read it in as unicode somehow and convert it to utf8. Using _wgetenv should work under all circumstances on NT, using getenv and g_locale_to_utf8 on Windows OT is the best we can do in this case.


svn path=/trunk/; revision=17024
2006-01-12 22:32:29 +00:00
Guy Harris db9fba20b4 Use <wiretap/file_util.h> to include "file_util.h"; otherwise, the
include fails as we don't do -Iwiretap.

If we have it, include <sys/stat.h> in epan/filesystem.c - we need it
for stat() and the macros and structures it uses.

svn path=/trunk/; revision=16410
2005-11-07 02:47:09 +00:00
Ulf Lamping c3187174bf replace *a lot* of file related calls by their GLib counterparts. This is necessary for the switch to GTK 2.6 (at least on WIN32).
to do this, I've added file_util.h to wiretap (would file_compat.h be a better name?), and provide compat_macros like eth_open() instead of open(). While at it, move other file related things there, like #include <io.h>, definition of O_BINARY and alike, so it's all in one place.

deleted related things from config.h.win32

As of these massive changes, I'm almost certain that this will break the Unix build. I'll keep an eye on the buildbot so hopefully everything is working again soon.

svn path=/trunk/; revision=16403
2005-11-06 22:43:25 +00:00
Jörg Mayer e6194537b3 Francesco Fondelli; Add dcp support
svn path=/trunk/; revision=15897
2005-09-20 15:18:28 +00:00
Guy Harris 39fd819fb4 Don't collide with the "regular" IPv6 defintions in at least some
platforms in ipv6-utils.h.

svn path=/trunk/; revision=15764
2005-09-12 06:21:35 +00:00
Ronnie Sahlberg e480a7c1e8 remove a bunch of sprintf that should be perfectly safe but for the principle of it
replace with g_snprintf()


svn path=/trunk/; revision=15621
2005-08-30 09:25:44 +00:00
Ronnie Sahlberg d4267d1272 replace some more silly rotating buffers with ep_alloc() calls
svn path=/trunk/; revision=15386
2005-08-17 09:36:20 +00:00
Ulf Lamping 0dc9fb3d4a various code cleanup:
-use g_snprintf instead of sprintf and snprintf
-use g_strdup_printf where appropriate
-remove #include "snprintf.h" (as only g_snprintf should be used)
-replace some more alloc/realloc/calloc/free with their glib pendants

svn path=/trunk/; revision=15264
2005-08-08 18:50:39 +00:00
Jörg Mayer 30a8557868 More 'char*' -> 'const char*' changes to fix warnings.
svn path=/trunk/; revision=15015
2005-07-23 11:41:25 +00:00
Gerald Combs 570d352948 Move Win32-specific variable declaration to the beginning of a function.
Fixes a recent buildbot failure.

svn path=/trunk/; revision=14962
2005-07-19 22:24:28 +00:00
Ulf Lamping 47d503303c from Graeme Hewson: "Fixes for ethereal config files"
svn path=/trunk/; revision=14956
2005-07-19 20:44:45 +00:00
Ulf Lamping d2233711d9 add get_manuf_name_if_known (returns NULL if unknown) in addition to get_manuf_name
svn path=/trunk/; revision=14405
2005-05-20 21:44:17 +00:00
Guy Harris 3a8d46d8e9 Always set "*success" in "ipxnet_addr_lookup()" before returning (thanks
and a tip of the hat to GCC 4.0's interprocedural data flow analysis for
catching this one!).

svn path=/trunk/; revision=14353
2005-05-12 02:50:27 +00:00
Guy Harris af2aab9ee1 Plug some more small leaks.
svn path=/trunk/; revision=13889
2005-03-24 03:10:31 +00:00
Luis Ontanon f0c8a7ab65 From Francisco Alcoba:
changed the behaviour of get_addr_name:
 - resolve to a name if the address supports it
 - call address_to_str if it does not, but the address is valid
 - return "NONE" if it is AT_NONE


svn path=/trunk/; revision=13463
2005-02-22 01:55:04 +00:00
Guy Harris 1f8699cca9 Fix a typo in the previous checkin.
svn path=/trunk/; revision=13090
2005-01-17 21:38:31 +00:00
Guy Harris 2aad197f9e Use WINDIR rather than SYSTEMROOT - WINDIR is apparently set on Windows
OT as well as NT, while SYSTEMROOT isn't.

If it's not set, don't bother looking for the hosts file, rather than
trying a path with a fixed drive letter.  If it is set, try the Windows
NT location first and, if that fails, the Windows OT location.

svn path=/trunk/; revision=13088
2005-01-17 19:30:31 +00:00
Guy Harris 5862d6546e Add support for a personal hosts file.
Clean up the description of the global and personal ethers and ipxnets
files.

svn path=/trunk/; revision=13017
2005-01-13 09:09:56 +00:00
Guy Harris f8b7622fd5 Put back the declaration of hostspath on Windows.
svn path=/trunk/; revision=12976
2005-01-07 11:22:18 +00:00
Guy Harris 081f202ae3 Move the open and close of the hosts file into "read_hosts_file()".
On Windows, if we don't get the SYSTEMROOT environment variable, try
various locations where the hosts file is known to exist.

svn path=/trunk/; revision=12972
2005-01-07 10:20:17 +00:00
Lars Roland 0a771e1c65 Check return value of getenv().
It can return NULL, which would lead here to strcpy(hostspath, NULL);
*Very* bad.

replace g_malloc(), strcpy() and strcat() with one single g_strconcat(). 

svn path=/trunk/; revision=12970
2005-01-07 03:19:39 +00:00
Guy Harris 0ccf418724 Add a "get_addr_name()" routine that takes an "address *" and attempts
to resolve it to a name.

Fix up some const-pointer-to-non-const-pointer, and
function-pointer-to-void-*, conversions.

Fix some comments.

svn path=/trunk/; revision=12863
2004-12-30 02:10:24 +00:00
Ulf Lamping 5bcad85d01 Again, some warnings removed.
svn path=/trunk/; revision=12842
2004-12-27 13:17:20 +00:00
Ulf Lamping 99576c146c removed an MSVC warning
svn path=/trunk/; revision=12561
2004-11-21 11:52:34 +00:00
Guy Harris 650ba47a9a Fix some problems when compiling on Windows and when compiling on
systems where INET6 isn't defined.

svn path=/trunk/; revision=12541
2004-11-17 19:46:34 +00:00
Guy Harris f33fdc05c2 Don't assume that IPv6 addresses are aligned on 32-bit boundaries.
svn path=/trunk/; revision=12540
2004-11-17 19:41:56 +00:00
Guy Harris 4469052ec3 Add a hash table for IPv6 addresses, and add an "add_ipv6_name()"
routine to add IPv6-address/name pairings to that table; use that when
reading the hosts file.

svn path=/trunk/; revision=12537
2004-11-17 09:44:41 +00:00
Guy Harris 366ff47474 Rename some routines and structures to reflect that they're specific to
IPv4; use different data structures for port numbers.

svn path=/trunk/; revision=12536
2004-11-17 08:53:20 +00:00
Guy Harris 3eb79de07d Based on code from Francisco Alcoba, read the hosts file on startup if
we're using ADNS, so that we can resolve host names from the hosts file
as well as from DNS.

"fgetline()" strips newlines from the line, so don't bother looking for
them when tokenizing the line.

svn path=/trunk/; revision=12534
2004-11-17 08:34:36 +00:00
Ulf Lamping 12aebd7634 fix a typo
svn path=/trunk/; revision=12502
2004-11-10 06:50:55 +00:00
Guy Harris 19aa464f56 Don't shut down GNU ADNS if it wasn't initialized.
svn path=/trunk/; revision=12501
2004-11-10 05:01:09 +00:00
Guy Harris 91e4d3bca3 Check for errors in "adns_init()", and don't enable ADNS if we get an
error in "adns_init()".  (I suspect this is what's causing the crashes
somebody's seeing when they run Ethereal on a Windows system with no
networking protocols installed - no networking protocols -> no Internet
protocols probably -> no ability to set ADNS up.)

svn path=/trunk/; revision=12500
2004-11-10 04:57:34 +00:00
Guy Harris f975d8c0b5 Give some more details on the hang in RH 9.
svn path=/trunk/; revision=12214
2004-10-06 07:25:38 +00:00
Guy Harris 08cedfee45 Turn off the longjmping stuff when doing name lookups - it appears to
cause problems on RH9 when using ADNS, too.

svn path=/trunk/; revision=12209
2004-10-05 22:48:36 +00:00
Guy Harris bbe7f89742 Move prefs.c and prefs.h into the epan subdirectory.
svn path=/trunk/; revision=12115
2004-09-27 22:55:15 +00:00
Guy Harris f23f4ecf04 Use _WIN32 rather than WIN32 to determine if we're compiling on Win32;
according to Gisle Vanem, WIN32 isn't a built-in in MSVC, but _WIN32 is.

svn path=/trunk/; revision=11972
2004-09-11 23:03:36 +00:00
Gerald Combs ed2befc8b7 Merge the "resolv" rename changes with the trunk.
svn path=/trunk/; revision=11638
2004-08-09 22:31:21 +00:00
Guy Harris 3a583aeb59 From Albert Chin: rename resolv.{ch} to addr_resolv.{ch}, so that an
include of <resolv.h> in any system header file gets the system
<resolv.h> (needed for builds on Tru64 with GTK+ 1.2[.x]).

svn path=/trunk/; revision=11615
2004-08-06 19:57:49 +00:00