The Most Efficient Gnutella Client
gtk-gnutella is a server/client for Gnutella. It runs on Microsoft Windows and every Unix-like system which supports GTK+ (1.2 or above). The GNOME desktop environment is not required. It is currently developed and tested under Linux (Debian) as well as NetBSD. It is known to run at least on Linux, FreeBSD, NetBSD, Darwin, Solaris, Tru64 UNIX (OSF/1), SGI IRIX, BeOS whereas CPU architectures include x86, AMD64, PowerPC, SPARC, MIPS. And of course Microsoft Windows (XP at least).
gtk-gnutella is free open-source software and released under the GNU General Public License (GPL).
gtk-gnutella is not finished yet, but it is fully functional: you may share, search, and download. And it is stable too, users usually just leave it run unattended for days.
All ideas and comments are welcome to the gtk-gnutella-devel mailing list. Bugs should be reported to the SourceForge.net Bug Tracker
21 March 2015, Version 1.1.2 Released
This is mainly a bug-fixing release, addressing rare crashes that have been happening in production. It also contains several improvements.
It fixes a user-reported bug whreby it was not possible to properly configure the download paths using the GUI -- that led to application crashes due to the incomplete support for discovered threads (which GTK is using underneath to manage the dialog box).
Another bug was caused by the HTTP header parsing logic which did not allow "." in header names. That made it refuse to parse headers sent by some UPnP devices, such as "BOOTID.UPNP.ORG" or "CONFIGID.UPNP.ORG", prevening UPnP mappings from being installed.
Hapening rarely but still annoying, there was a bug on the error handling path of write errors to the TX network stack, leading to assertion failures in the mq_tcp_putq() routine. That was because the qrt_compressed() routine was not handling task cancellation properly. The likelyhood of hitting that bug when running as a leaf node was very low.
On the improvement side, the search list is now highlighting searches for which we have associated downloads by displaying the text in green. Further tweaks were made to our GTK2 code to make sure the changes are reported "real time" when the state changes, which was not always the case before (one needed to go over a search by explicitly clicking on it to update the display in the search list).
The SHA1 computation code was also further optimized to be as fast as possible, reducing file hashing time by two! Since SHA1 hashing happens regularily in gtk-gnutella to collect entropy, optimizing the SHA1 computation affects more than just file verification.
- [GTK2] Added translation URL in the "About" GUI dialog.
- [GTK2] Highlight searches with registered downloads by using green text.
- [GTK2] Added tri-state column sorting to the "upload history" panel.
- FAQ: added new entry explaining how to get the magnet of a shared file.
- Map the "collection" G2 query tag to the Windows / Linux "archive" file set.
- Map the "torrent" G2 query tag to the "torrent" file set.
- Added support for "rom", "wordprocessing" and "subtitle" G2 query media types.
- Further optimized SHA1 computation, now going about twice faster for files.
- page_cache_insert_pages(): fixed incorrect write-lock upgrade logic.
- pmap_insert_region(): must recompute insertion index if we extend the pmap!
- tmalloc: fixed thread magazine accounting in the depots.
- Did not commit back to database after updating the DHT key request count.
- routing_chunk_move(): must check messages carefully when chunk was moved.
- route_message(): beware of check_duplicate() which can remove the node.
- thread_element_matches(): pay more attention to discovered threads.
- thread_find_tid(): skip thread elements not marked as being valid!
- node_shutdown_mode(): must correctly account for shutdowning G2 nodes!
- bogons_changed(): forgot to close opened file descriptor
- upload_stats_load_history(): added missing break in switch.
- qrt_compressed(): was not handling QRP compression task cancellation properly.
Under the Hood
- Added hostile ranges.
- Updated GeoIP databases for IPv4 and IPv6.
- Throttle the amount of PUSH messages we can send for a given remote server.
- Legitimate Shareaza nodes cannot be flagging themselves as ultrapeers.
- Windows: stack unwinding made safer with more memory checks to avoid faults.
- UPNP: attempt rediscovery of port mapping devices every hour, if missing one.
- UPNP: attempt rediscovery of port mapping devices every hour, if missing one.
- Added new TSIG_OVFLOW signal sent when a thread overflows its stack.
- Fixed race condition between concurrent waiter_refcnt_dec() calls.
- Added logging of layer which reports a TX error in case of assert failure.
- Track the last seen time (activity) of discovered threads other than main.
- Prevent glade-2 from outputting support files now, since we patched them.
- Added tracing of funny X-Falt lines we are seeing when demsh_debug is set.
- Added tracing of funny X-Alt lines we are seeing when dmesh_debug is set.
- Added tracing of funny X-Nalt lines we are seeing when dmesh_debug is set.
- Added crash hook for the thread layer.
- Added TX layer write-fault mechansim to help detect user error handling bugs.
- Syntaxic adjustments to make the latest guile happy with definitions.
- The GUI will now display current bandwidth by default, instead of the average.
- mingw_exception(): write shorter messages in case of stack overflows.
- thread_element_reset(): forgot to reset te->stack_base to NULL.
- header_append(): allow "." in header names.
- thread_join_internal(): no thread_cancel_test_element() on foreign thread!
- thread_find_element(): avoid leaving routine without unlocking mutex!
- cond_wait_until(): now correctly handle underlying cond variable mutation.
- thread_block_timeout(): don't panic if main thread already unblocked.
- dir_entry_filename(): made the Windows version thread-safe.
- hfield_dump(): fixed formatting of continuation lines.
- dmesh_collect_locations(): only parse the last timestamp when many given.
- xmalloc_thread_free(): always handle blocks in the cross-thread free list.
- Hide strtok_free(), forcing clients to use new strtok_free_null().
2 September 2014, Version 1.1.1 Released
This is mostly a bug-fixing release.
- Share Opus files by default, added opus and webm to search filters.
- No longer automagically unshare directories that do exist currently.
- Revamped peek/poke functions because GCC generated unoptimized code for these.
- Avoid crash when we cannot parse the remotely supplied push-proxy URL.
- Fixed crash when entering "local:" as search term.
- Fixed crash when gtk-gnutella was stopped from terminal and put to background.
- Fixed crash on "Reverse DNS lookup" queries from the GUI node pane.
- Fixed GtkSpinButton "adjustment with non-zero page size" deprecation message.
- Handle G_SEARCHPATH_SEPARATOR in shared base directory correctly.
Under the Hood
- shared_file_get_index(): fixed lower boundary of assertion.
- fi_find_aggressive_candidate(): prevent division by 0 if no starving download.
- Fixed possible race condition between bg_task_wakeup() and bg_sched_sleep().
- Regenerated Configure to allow BFD library detection for newest versions.
- teq_post_rpc(): use linearily increasing timeouts to limit logging.
- str_vncatf(): made recursion checks before calling s_minicarp() thread-safe.
- ut_frag_pmsg_free(): avoid SIGSEGV when fragment was already acknowledged.
- deflate_add(): refuse further data when the TX deflate layer had an error.
- search_dequeue_all_nodes(): must also iterate on G2 nodes.
- cq_heartbeat(): only log delay adjustements when running with cq_debug > 0.
- g2_node_handle(): silence warnings when not debugging.
- Allow xfl_find_freelist_index() to work with gcc 4.9 and optimizations.
- keys_offload(): do not process if the key layer was shutdown.
2 July 2014, Version 1.1.0 Released
This is a major release introducing new features and making gtk-gnutella a multi-threaded application with drastic performance boosts for background tasks like file hashing or library rescanning.
Another major feature is the added support for the G2 search protcol: we are connecting to G2 hubs as a leaf, answer to search / browse requests from G2 hosts. We also use G2 to issue our own searches. Finally, we freely exchange files with G2 hosts (downloading and uploading).
The G2 protocol was further extended to make sure G2 query hits convey as much information as Gnutella query hits, in particular for alt-loc propagation and TLS support. The G2 semi-reliable UDP layer is also leveraging the new features designed for the corresponding Gnutella layer (cumulative and extended acknowledgments), gracefully falling back to legacy features if the remote host is not able to understand the new features.
A critical bug was fixed: reception of carefully crafted invalid DHT messages would lead to an immediate crash, an open door for Denial of Service (DoS) attacks. That bug has been present since 0.97 (release of August 2011).
Last but not least, the code base has now been checked by Coverity. There was a very low defect rate of 0.26 (amount of true defects per thousand lines of code) and all problems were fixed.
- Multi-threading support (file hashing, library rescan, DNS, etc...)
- Added support for the G2 search protocol, connecting as leaf mode to G2.
- Turned gtk-gnutella into a random number server through the "random" command.
- Removed Bitzi support since the service has shutdown.
- Added the --no-dbus command-line option to prevent D-BUS notifications.
- [GTK] Added GUI enabling of the G2 protocol for searches.
- [GTK] Added spin-button to set the amount of G2 hub connections to maintain.
- [GTK] Report amount of G2 hubs to which we are connected.
- [GTK] Show amount of G2 host browsing served, in the upload stats pane.
- [GTK2] Added tri-state column sorting to "Downloads" and "Uploads" panes.
- Better entropy collection to initialize the pseudo random number generators.
- Externally visible randomness (e.g. GUIDs) is now cryptographically strong.
- We now pick random DHT nodes to send back from the whole routing table
- Some entropy collected is persisted, for better reseeding in next session.
- Added time change detection when switching from/to Daylight Saving Time.
- QRP query routing now uses LimeWire's logic, less strict than the GTKG one.
- The shell "status" command now reports the amount of G2 hub connections.
- Detect OOB proxy MUID conflicts for leaf queries.
- Added the "stats drop" shell command to show dropped message statistics.
- Improved random selection of files being matched in the library (local hits).
- When a PUSH request fails to connect back, ban target IP:port for 5 minutes.
- Configure: correctly detect the BFD library even if no -liberty.
- Crash handler now records and logs the ID and name of crashing thread.
- Updated gtk-gnutella.appdata.xml to the latest specifications.
- Updated the FAQ, along with translations to French and Turkish.
- DHT bucket merging was incorrectly handling removal of nodes from table.
- Reception of improper DHT messages could lead to an immediate crash (DoS).
- ut_frag_pmsg_free(): rescheduling of expire event was in wrong block.
- base16_encode(): would cause buffer overflow when destination too small.
- Rotate OOB token keys less often, to avoid expiration whilst in transit.
- socket_udp_event(): ignore empty datagrams.
- Fixed host cache updates to avoid setting "out of bounds" property values.
- hcache_find_nearby(): was missing a "break" in the case for HOST_GUESS.
- Scheduled static checking by Coverity, found 81 problems requring a fix.
- Fixed TCP message size computing bug, which could corrupt the TCP stream.
- Configure: fixed endianess detection of IEEE-754 floats on Solaris.
- Was never configuring TCP quick ACKs due to a missing "break" statement.
- omalloc() could crash when configuring read-only objects.
- Ensure we never insert any "unusable host" in the push-proxy set.
- keys_update_value(): forgot to persist back updated expiration timestamp.
- Properly flag UDP route as deflatable when GGEP "Z" is seen in queries.
- Flag UDP route as supporting semi-reliable UDP when query flags are parsed.
Under the Hood
- GUESS now avoids querying hosts to which we are connected via TCP
- GUESS: count the amount of hosts reached by query, since G2 queries a cluster.
- GUESS: increased cached lifetime of query keys to a little less than 1 day.
- GUESS: defer hosts we cannot requery to avoid constantly looping over them.
- GUESS: fixed host atom leak when message is synchronously dropped.
- GUESS: invalidate cached query keys on IP or listening port change.
- Added a thread management layer on top of the POSIX thread layer.
- Added support for safe inter-thread signals, handled by our thread layer.
- Expanded the set of atomic operations we can perform.
- Added read-write locks, now used by the VMM layer.
- Addded multi-threaded goodies: barriers, dams, event queues, cond variables.
- VMM: closed race condition during allocations.
- Added support for permanent thread-private data.
- Added primitive fork() handling in a multi-threaded environment.
- Made float formatting code thread-safe, removing need for funnelling.
- The ADNS now always runs in a separate thread.
- Provide both thread-private (hashtable) and thread-local (array) variables.
- Added new "thread list" shell command to monitor running threads.
- Added "task list" shell command to list currently defined background tasks.
- Added the "thread stats" shell command to dump thread statistics.
- Added "lib show callout" shell command to display callout queue information.
- Added "lib show files" to show opened files via file_object_xxx().
- Made sure PROTECT_ATOMS and ATOMS_HAVE_MAGIC are orthogonal settings.
- Moved the reference count of atoms to the tracking hash table.
- Callout queue runs the idle callbacks if not scheduled in the last 30 secs.
- Logging timestamps are now emitted with a millisecond accuracy.
- Improved g_assert_not_reached() to propagate the routine name as well.
- Re-architected file_objects to allow permission checking on opened files.
- Introducing tqsort(), a multi-threaded quicksort for sorting large arrays.
- Do not mark SIGPROF as harmful to allow profiling.
- Added a thread-magazine allocator, used by walloc() and vmm_alloc().
- Allow execution of some shell commands in a separate thread.
- Added our own plain one-way and two-way list implementation.
- Added optimized item freeing for embedded lists holding walloc()'ed objects.
- Added thread-local ARC4 random streams for increased throughput.
- Added global and per-thread WELL and CMWC random number generators.
- Added Fortuna-like algorithm (AJE -- Alea Jacta Est) for gathering entropy.
- Added support for fixed-size hash tables, entirely held in a static buffer.
- hash_table_replace(): optimized to avoid two hash_table_find() calls.
- Protect query hit generation against concurrent library rescans.
- No longer close all file descriptors in main, since threads use them.
- Semi-reliable UDP: only send last fragment of large message to unknown hosts.
- Semi-reliable UDP: make sure remote side is ACK-ing sent fragments only.
- Semi-reliable UDP: avoid endless loops if unsent ACK message is dropped.
- Semi-reliable UDP: added TX accounting for dropped and physically sent ACKs.
- Semi-reliable UDP: was not releasing data structure for dropped ACKs.
- QRP support for generation of 1-bit patches, and optimized 1-bit handling.
- make_room_internal(): removed bug catcher from 2006, which never triggered.
- Cleaned up Gnutella handshaking to emit an Accept if the remote sent one.
- search_results_process(): do not record last hop as hostile on relayed hits.
- Do not attempt to OOB-proxy queries in search_request()!
- host_timer(): fixed wrong cut-off by "quick connect pool".
- Added script to auto-generate enums along with symbolic and English text.
- options_parse(): fixed parsing of values immediately following the option.
- Shuffling of large arrays now performed using PRNGs with greater period.
- Renamed "struct mutex" as "struct lmutex" to avoid conflicts on Solaris.
- st_search(): randomly shuffle results only when we have more than we can send.
- Windows: added emulated clock_gettime() and clock_getres().
- Dispatch entropy to PRNGs only once every 30 seconds at most.
- Simplified rand31(), restoring its full period, and redesigned rand31_u32().
- sdbm_rebuild(): was not properly catching errors during copy.
- prop_get_def(): switched to HCOPY_ARRAY() to avoid any size problems
- kmsg_handle(): avoid dereferencing a potentially NULL pointer.
- route_max_forward_ttl(): take a reference instead of a by-value parameter.
- parq_upload_remove(): fixed assertion, which was always evaluating to TRUE.
- Report errors if we cannot set a file non-blocking or request close on exec().
- Base32 decoding could fail spotting bad input due to short base32_map array.
- search_matched(): was not counting the amount of skipped results in a search.
- getgateway(): properly fallback to netstat parsing when socket() fails.
- roots_fill_closest(): avoid memory leak on the error path.
- Fixed UDP TX schedulers to allow both IPv4 and IPv6 message sending.
- Make sure only developers will use autogen to regenerate the property files.
- dh_route(): only compress UDP query hits when GUESS queryier supports them.
- dh_route(): do not attempt UDP compression if message sent via reliable UDP.
- Count UDP compression attempts and failures, including in semi-reliable UDP.