Commit Graph

380 Commits

Author SHA1 Message Date
Michael Mann 55de46f317 Replace ep_address_to_str with address_to_str.
Change-Id: I4f1078b20f41800f72a751612703ad0d4c2ae87b
Reviewed-on: https://code.wireshark.org/review/6323
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>
2015-01-06 07:38:18 +00:00
Michael Mann 22b4ec91c0 Replace ep_display_to_address with wmem equivalent display_to_address.
Almost all instances require using "manual" memory management, but it gets some ep_ calls out of the GUI.

Change-Id: Ifa7303766b08d09442ccf3d7063cbe061578ecd9
Reviewed-on: https://code.wireshark.org/review/6318
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-05 13:55:04 +00:00
Hadriel Kaplan fac8356610 Make all Lua code use wmem not emem
Changed all remaining code in wslua that was using emem, to use wmem or
simpler methods.

Bug: 9927
Change-Id: I3d19a770e0fd77d996bdb6b61a76a722cc2bcd55
Reviewed-on: https://code.wireshark.org/review/6109
Petri-Dish: Michael Mann <mmann78@netscape.net>
Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com>
Petri-Dish: Hadriel Kaplan <hadrielk@yahoo.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2015-01-04 21:02:38 +00:00
Guy Harris 0e57ff2ca1 We no longer do anything signal-related, so don't include <signal.h>.
Update a comment pertaining to that, while we're at it.

Change-Id: Ic0a3f8575f8e98ca6032ed3e06e3dd76055d65a1
Reviewed-on: https://code.wireshark.org/review/6192
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-12-31 22:47:37 +00:00
Pascal Quantin bd19532bfb Do not use packet scope memory outside packet dissectors
Otherwise it will trigger an assert
Fixes a regression introduced in gf002332

Change-Id: I0cffa2c952b7eff085a1834ebabfec03342095bd
Reviewed-on: https://code.wireshark.org/review/5950
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-12-21 18:30:33 +00:00
Michael Mann f002332d88 Replace ether_to_str with either address_to_str or tvb_ether_to_str.
Change-Id: I8cce9fddbfe950e27e96ea8a5a6d2e0921ff4260
Reviewed-on: https://code.wireshark.org/review/5933
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-12-21 15:13:30 +00:00
Guy Harris 033f096ee9 Don't use ctype.h routines.
That avoids locale dependency and handles possibly-signed chars (which
we weren't always doing before).

Change-Id: Ieceb93029252f646397b6488f2df8a57c6d2a23d
Reviewed-on: https://code.wireshark.org/review/4794
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-10-17 23:11:18 +00:00
Pascal Quantin 6e83b38020 Get rid of g_hash_table_lookup asserts when loading an external host file
Only parse the host file syntax without trying to store the names in the hash tables (it will be done later in host_name_lookup_init())

Change-Id: I2b8c7b29220e6413c1b5c0a0fa238ecb5388c962
Reviewed-on: https://code.wireshark.org/review/4309
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
2014-09-27 15:55:07 +00:00
Evan Huus a4a94af0f7 Fix regression introduced by gf3b631668b
I made a stupid when simplifying the bit-twiddling, and accidentally reversed
two of the bytes which completely broke MAC address name resolution.

Bug: 10344
Change-Id: I0720755fb290423150e4d84da9d45cb0b76341e4
Reviewed-on: https://code.wireshark.org/review/3522
Reviewed-by: Michael Mann <mmann78@netscape.net>
2014-08-09 17:30:44 +00:00
Guy Harris 5bfc21cf9e Clean up handling of missing functions.
With autotools, CMake, and nmake, if we have a function, #define
HAVE_{function_name_in_all_caps}, otherwise don't #define it.

If we provide our own version of a function in libwsutil, make sure we
have a header that declares it, and *ONLY* include that header if
HAVE_{function_name_in_all_caps} is *NOT* defined, so that we don't have
the system declaration and our declaration colliding.

Check for inet_aton, strncasecmp, and strptime with CMake, just as we do
with autotools.

Simplify the addition of {function_name_in_all_caps}_LO to libwsutil in
autotools.

Change-Id: Id5be5c73f79f81919a3a865324e400eca7b88889
Reviewed-on: https://code.wireshark.org/review/2903
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-07-06 21:03:09 +00:00
Evan Huus a452d16f2c Optimize epan_new/init_dissection
As Anders correctly pointed out in I7d8f84b2e, constantly resetting state will
turn init_dissection into a bit of a hot path. Especially as we will already
bear the overhead of switching files, we don't want to fall any further behind
than we have to.

This change includes three unrelated optimizations that reduce the cost of
init_dissection by about 40% as measured by callgrind:
 - only initialize ares/ADNS if that preference is enabled (this of course only
   applies if you specify -n to tshark or otherwise disable the preference)
 - use memcpy instead of a loop in sigcomp UDVM init
 - use memcpy instead of a loop in bootp dissector

The only remaining obvious hot spot in this path is reassembly_table_init since
it is called by so many dissectors. Suggestions (perhaps to get rid of the
GPtrArray) welcome.

Oh, and one other change to use g_strerror instead of strerror as insisted
upon by the API pre-commit hook.

Change-Id: I18a74f2b64b25498116079bd4e7fc2b335c7703a
Reviewed-on: https://code.wireshark.org/review/2738
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-07-01 04:21:14 +00:00
Evan Huus 5d98ab793e Simplify IPv4 address hashing
Rather than allocate 4 bytes and use g_int_*, use GUINT_TO_POINTER and
g_direct_*. Should save some time/memory.

Change-Id: Ie03d234703f68bb76131c5ddf17953d23bb54a0d
Reviewed-on: https://code.wireshark.org/review/1582
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-05-11 15:50:46 +00:00
Evan Huus f3b631668b Use a strong hash function for ethernet addresses.
The capture for bug 10078 caused the buildbot to time out; callgrind revealed an
enourmous amount of time being spent looking up ethernet addresses. The previous
code cast each address (6 bytes) to a guint64 (8 bytes) then used the built-in
g_int64_hash. Unfortunately, g_int64_hash is an *awful* hash function - it
produces a 4-byte hash by simply discarding the upper 4 bytes of its input.

For the capture file in question this strategy (which effectively ignores the
upper two bytes of each ethernet address) produced an astounding number of
collisions, leading to the terrible running-time.

Use wmem_strong_hash directly on the 6-byte address instead, which saves us a
bunch of useless casting and bit-twiddling and produces a much better hash
distribution. This shaves 20% off the time to tshark-with-tree the capture file
in question *despite* a substantially more expensive hash function
(wmem_strong_hash is not exactly fast compared to g_int64_hash).

Bug:10078
Change-Id: I8e81cbc478e6394ec3a8efe39eec08f680a55609
Reviewed-on: https://code.wireshark.org/review/1543
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-05-07 09:00:29 +00:00
Gerald Combs 4628dc0118 Disable transport name resolution by default.
Modern hosts typically open many more TCP and UDP connections than in
years past.  For an example opening a popular news site in a web browser
can easily trigger dozens of separate connections. At the same time our
services file has accumulated a lot of cruft over time. As a result
transport name resolution is a bunch of lies.

Change-Id: Ibbca5b1c7ea1e800fc46dad63b9270128dacd721
Reviewed-on: https://code.wireshark.org/review/1240
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-04-21 22:13:49 +00:00
Guy Harris d0489f2a12 Clean up white space (replace tabs with 4 spaces).
Change-Id: Id253ddca497ca92272e7317177aae5e5570f4271
Reviewed-on: https://code.wireshark.org/review/1218
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-04-19 19:33:47 +00:00
Guy Harris 97869f2dec More name changes.
Add ep_ to routines that may return ephemeral strings.

Change "get_XXX" to "XXX_to_display" if the routine returns a formatted
string if it can't get a name.

Change-Id: Ia0e82784349752cf4285bf82788316c9588fdd88
Reviewed-on: https://code.wireshark.org/review/1217
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-04-19 19:30:17 +00:00
Guy Harris c8f7e16b57 Some routine name changes.
"get_addr_name()" -> "ep_address_to_display()", to 1) indicate that it
returns a string with ephemeral scope and 2) indicate that it maps an
address to a "displayable" form - a name if possible, an address string
if not.

"se_get_addr_name()" -> "get_addr_name()", to indicate that its strings
have the same scope as "get_ether_name()", "get_hostname()", and
"get_hostname6()".

Change-Id: If2ab776395c7a4a163fef031d92b7757b5d23838
Reviewed-on: https://code.wireshark.org/review/1216
Reviewed-by: Guy Harris <guy@alum.mit.edu>
2014-04-19 19:07:06 +00:00
Guy Harris 80011ec03c Don't se_ allocate strings when mapping addresses to column strings.
This should significantly reduce memory usage, without increasing the
CPU time required to process a capture file in TShark or Wireshark.

As a result, se_address_to_str() is no longer used; eliminate it.

Fixes bug #9949.

Change-Id: I65a112a426c82cc73a957b81384c765c3d14f2c3
Reviewed-on: https://code.wireshark.org/review/1213
Reviewed-by: Evan Huus <eapache@gmail.com>
2014-04-19 14:20:06 +00:00
Alexis La Goutte 296591399f Remove all $Id$ from top of file
(Using sed : sed -i '/^ \* \$Id\$/,+1 d')

Fix manually some typo (in export_object_dicom.c and crc16-plain.c)

Change-Id: I4c1ae68d1c4afeace8cb195b53c715cf9e1227a8
Reviewed-on: https://code.wireshark.org/review/497
Reviewed-by: Anders Broman <a.broman58@gmail.com>
2014-03-04 14:27:33 +00:00
Bill Meier 11b5c15fdb Remove trailing whitespace
Change-Id: I8116f63ff88687c8db3fd6e8e23b22ab2f759af0
Reviewed-on: https://code.wireshark.org/review/385
Reviewed-by: Bill Meier <wmeier@newsguy.com>
Tested-by: Bill Meier <wmeier@newsguy.com>
2014-02-25 20:46:49 +00:00
Jakub Zawadzki 3d6fdc55d0 New functions: str_to_ip6(), str_to_ip()
This way we can avoid including lot of system header files in some dissectors
and it might fix bug #9581

svn path=/trunk/; revision=54330
2013-12-21 16:16:56 +00:00
Guy Harris 1cf2e46426 bytes_to_hexstr_punct() does not add a null terminator, so we must add
it ourselves.

svn path=/trunk/; revision=54288
2013-12-20 10:08:35 +00:00
Anders Broman 5fbfa6c351 Fix [-Wmissing-prototypes]
svn path=/trunk/; revision=54280
2013-12-20 06:30:13 +00:00
Evan Huus 6be37815a1 Add bytestring_to_str() which takes a wmem scope and is otherwise identical to
bytestring_to_ep_str (now deprecated). Use the new one in a few obvious places.

Also just print directly to the buffer when loading ethernet addresses for
resolution. The straight-to-buffer bytes_to_hexstr seems useful, maybe it
shouldn't be in a private header...

svn path=/trunk/; revision=54270
2013-12-19 20:53:44 +00:00
Evan Huus a6415ece0a Rename a couple of to_str functions to have ep_ in the name. This makes it
obvious that the returned string is ephemeral, and opens up the original names
in the API for versions that take a wmem pool (and thus can work in any scope).

svn path=/trunk/; revision=54249
2013-12-19 15:49:09 +00:00
Guy Harris db25270df8 Move the epan/filesystem.c routines to wsutil; they're not specific to
packet dissection, they're specific to the entire Wireshark suite of
programs.

svn path=/trunk/; revision=53377
2013-11-17 02:55:14 +00:00
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
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