summaryrefslogtreecommitdiff
path: root/toxcore/LAN_discovery.c
AgeCommit message (Collapse)Author
2018-02-24Fix a bunch of compiler warnings and remove suppressions.iphydf
2018-02-14Get rid of the only GNU extension we used.iphydf
2018-02-08Reject discovery packets coming from outside the LAN.iphydf
Even if that means rejecting packets from ourselves if our IP is not a "LAN" IP.
2018-02-08Fix LAN discovery on FreeBSD.iphydf
Also, add an auto-test for bootstrap and for LAN discovery. Bootstrap is never tested otherwise, and LAN discovery is a prerequisite for everything else. Having these two tests lets us rule out or identify LAN discovery as a possible cause for test failures.
2018-01-30Use nullptr as NULL pointer constant instead of NULL or 0.iphydf
This changes only code, no string literals or comments.
2018-01-16Make DHT a module-private type.iphydf
2018-01-16Use apidsl to generate LAN_discovery.h.iphydf
2018-01-14Filter out annoying log statements in unit tests.iphydf
These may be useful when debugging toxcore locally, but are not useful in unit tests.
2018-01-11Move Networking_Core struct into the .c file.iphydf
To make it an abstract type everywhere except in network.c.
2017-10-04Add log info message, when someone found client with LAN discoveryDiadlo
2017-08-24Add loopback and broadcast constantsDiadlo
2017-08-24AF_INET -> TOX_AF_INETDiadlo
2017-04-12Added missing includes: <netinet/in.h> and <sys/socket.h>Yuri
Found these missing includes while compiling on FreeBSD 11.
2017-02-26Add part of platform-independent network API implementationDiadlo
socket -> net_socket htons -> net_htons htonl -> net_htonl connect -> net_connect sendto -> net_sendto_ip4 getaddrinfo -> net_getipport sa_family_t -> Family
2017-01-26Add platform-independent Socket and IP implementationDiadlo
2017-01-21reduce thread-unsafe use of static variableszugz
- rework ip_ntoa() to avoid use of static variables - rework sort_client_list() to avoid use of static variables - move static 'lastdump' into Messenger struct - rework ID2String() to avoid use of static variables; rename to id_to_string() - fetch_broadcast_info(): attempt to mitigate risks from concurrent execution - current_time_monotonic(): attempt to mitigate risks from concurrent execution - comment on non-thread-safety of unix_time_update
2017-01-19Update license headers and remove redundant file name comment.iphydf
"All rights reserved" was incorrect. The project was licensed under GPL3, which means a lot of rights are licensed to everybody in the world, i.e. not reserved to the "Tox Project".
2016-12-22Wrap all sodium/nacl functions in crypto_core.c.iphydf
2016-11-02Compile as C++ for windows builds.iphydf
Compiling as C++ changes nothing semantically, but ensures that we don't break C++ compatibility while also retaining C compatibility. C++ compatibility is useful for tooling and additional diagnostics and analyses.
2016-09-24Make toxcore code C++ compatible.iphydf
It is still C code, so still compatible with C compilers as well. This change lets us see more clearly where implicit conversions occur by making them explicit.
2016-09-16Ensure that all TODOs have an owner.iphydf
In the future, all TODOs added either need a bug number (TODO(#NN)) or a person's github user name. By default, I made irungentoo the owner of all toxcore TODOs, mannol the owner of toxav TODOs, and myself the owner of API TODOs.
2016-09-13Use <stdbool.h> and replace _Bool with bool.iphydf
This header is a requirement for the public API, therefore is assumed to exist. It is a C99 standard library header, and _Bool is not intended to be used directly, except in legacy code that defines bool (and true/false) itself. We don't use or depend on such code. None of our client code uses or depends on such code. There is no reason to not use bool.
2016-09-13Group #include directives in 3-4 groups.iphydf
1. Current module (if C file). 2. Headers from current library. 3. Headers from other library (e.g. toxcore includes in toxav). 4. System headers.
2016-09-06Allocate sizeof(IP_ADAPTER_INFO) bytes instead of sizeof(T*).iphydf
https://msdn.microsoft.com/en-gb/library/windows/desktop/aa365917(v=vs.85).aspx shows an example use of GetAdaptersInfo that does it this way.
2016-09-02Do not use `else` after `return`.iphydf
http://llvm.org/docs/CodingStandards.html#use-early-exits-and-continue-to-simplify-code
2016-09-01Sort #includes in all source files.iphydf
2016-08-31Add braces to all if statements.iphydf
2016-08-18Make tox_callback_friend_name stateless.iphydf
See #27 and #40 for details.
2015-05-18If we get the ip/port of a relay on a local ip, assume that our friendirungentoo
is hosting a relay on his ip.
2015-04-27Move LAN discovery from Messenger to friend_connection.irungentoo
2015-01-22Zero broadcast ips are invalid.irungentoo
2014-11-21Cleaned up packet length types in toxcore.irungentoo
They are now all uint16_t instead of sometimes being uint32_t. Replaced some other uint32_t with unsigned ints.
2014-11-11Prevent connection ips from switching on LAN.irungentoo
2014-10-17Merge branch 'master' of https://github.com/xor2003/toxcoreirungentoo
2014-10-17forgotten to free memory in pAdapterInfoxor2003
2014-08-03remove unneeded printf's/prevent stdout spamJfreegman
2014-07-20LAN discovery should now work on windows machines with multipleirungentoo
ethernet devices. Added some code to get real adapter broadcast addresses on windows.
2014-06-13Const correctness for various packet callbacksMarc Schütz
2014-06-07Toxcore closer to building correctly with gcc -std=c99.irungentoo
2014-04-26Fixed minor issue.irungentoo
Socket used to find the broadcast ip was not closed when there was more than 16 broadcast interfaces.
2014-01-17Incorporated onion into Tox.irungentoo
Fixed a couple of issues related to that.
2013-12-05Shared address space for stacking NAT (CGN) is, just like 'regular' private ↵Coren[m]
address space, LAN.
2013-11-19Fixed possible issue.irungentoo
2013-11-13IPv6 address of ::1 is local.Coren[m]
2013-10-24Move unix_time(), id_cpy()/id_eq(), is_timeout() to util.*Coren[m]
unix_time(): - returns local value for current epoch - value is updated explicitly with unix_time_update() called at new_DHT()/doMessenger()/do_DHT() is_timeout(): - uses the local value for current epoch id_cpy()/id_eq() => id_copy()/id_equal(): - centralized duplicate definitions - replaced (most) memcpy()/memcmp() of (*, *, CLIENT_ID_SIZE) with id_copy()/id_equal()
2013-10-20Fixed possible bug.irungentoo
2013-10-20Main: Eliminate TOX_ENABLE_IPV6 (then always on), CLIENT_ONETOONE_IP (then ↵Coren[m]
always off). Additionally (besides cleanups): network.h/tox.h: - WIN32: fix a strange sa_family_t definition - WIN32: define EWOULDBLOCK to WSAEWOULDBLOCK - WIN32: kill macro for an existing function (IN6_ADDR_EQUAL) network.c: - use EWOULDBLOCK instead of EAGAIN (same value, but EWOULDBLOCK is more "popular") - new_networking(): only try to enable IPv4-in-IPv6 if it's not already enabled per default - inet_ntop()/inet_pton(): WIN32: remove partial initializers in favor of a simple memset() - ip_equal(): WIN32: use an existing function - logging: networking_wait_execute(): only dump result if not timeout - logging: loglogdata(): kill an unused variable LAN_discovery.c: - send_broadcasts(): re-enabled, can only support IPv4 by principle, split into fetch_broadcast_info() (to fetch the addresses once) and send_broadcasts() (actual sending) DHT.c: - DHT_load_state_callback(): enclosed a fprintf(stderr, ...) into #ifdef DEBUG Lossless_UDP.c: - change_handshake(): harden against strange sa_family_t definitions Messenger.c: - logging: fix ID to string conversion util.c: - logging: eliminate a signed-warning
2013-09-27don't lose globally valid addresses for locally valid onesCoren[m]
2013-09-15Fixed portability problems.irungentoo
2013-09-15Fixed portablity problems.irungentoo
struct in6_addr member names can differ per platform.