Commit Graph

130 Commits

Author SHA1 Message Date
arvidn 32b2de8f17 merged RC_1_1 into master 2018-04-04 20:48:07 +02:00
Arvid Norberg 49ae7858a8 fix potential fd leak in enum_net_interfaces 2018-04-03 13:44:33 +02:00
arvidn 9df4d4b7f8 replace typedef with using. replace NULL with nullptr. cleanup page_aligned_allocator 2018-03-23 11:19:46 +01:00
Alexandre Janniaux 4f7b683eb0 fix if defined TORRENT_ANDROID
Fix malformed TORRENT_ANDROID macroprocessor tests, related to #2831
2018-03-14 09:32:18 +01:00
Alexandre Janniaux 2bc2f3af0f Add missing define for old android sdk (#2831)
define NETLINK_NO_ENOBUFS and IFA_D_DADFAILED if they don't exist
2018-03-09 22:37:21 +01:00
Alden Torres 421709f67f added friendly_name and description to ip_interface (#2799) 2018-02-19 11:46:35 +01:00
arvidn a0a63341c7 fix haiku build 2018-02-04 19:10:43 +01:00
arvidn e126d7bce0 move socket_type into aux-namespace 2018-01-29 08:33:45 +01:00
arvidn 89c6f0b4a8 merged RC_1_1 into master 2018-01-21 15:51:22 +01:00
arvidn 0ee6b7d142 build for iOS on travis 2018-01-18 22:37:37 +01:00
arvidn 65fef972a2 apply some c++11 modernization 2018-01-11 04:51:39 -05:00
arvidn 93bb84d94c some random cleanup 2017-09-13 08:28:46 +02:00
arvidn d59d394d5b remove residual mentions of mtu for interfaces 2017-08-20 22:34:20 +02:00
Alden Torres 66734e2e5b using if_indextoname instead of RTM_GETLINK to fill the interface name in enum_net_interfaces (#2253)
using if_indextoname instead of RTM_GETLINK to fill the interface name in enum_net_interfaces. removed IFA_LABEL switch case, removed ip_interface::mtu, master rebase
2017-08-20 10:55:59 +02:00
Alden Torres bde4718e3f typos, auto loop refactor and more std:: 2017-08-16 07:01:50 +02:00
arvidn 6b1037eff5 convert enum values that are just used as constants, to actual constants with the correct type 2017-08-04 15:23:20 +02:00
Alden Torres 285daa21a5 fixed another shorten-64-to-32 warning in netlink code 2017-07-03 13:53:15 -04:00
Alden Torres a78ec94184 fixed compilation warnings in enum_net netlink code 2017-06-29 15:48:28 -04:00
Steven Siloti bbf361336b Use netlink to enumerate network interfaces on linux (#2105)
* move getting a table dump over netlink to a separate function
* use netlink to enumerate network interfaces on linux
2017-06-27 00:34:24 -04:00
Steven Siloti 0a9e2c965d invert logic in read_nl_sock for better clarity and reliability (#2101)
The seq and pid parameter are apparently used as a safety check in case
a stream of netlink messages is not properly terminated. I initially thought
that they represented the expected values of the incoming messages.
Instead seq is set to one-past the expected value and the loop aborts when
seq and pid match the message.

Inverting the logic so that reading continues as long as the seq and pid match
the incoming messages is, to me at least, more intuitive. It is also more
reliable since it does not rely on the next seq being strictly sequential. It
also catches unexpected messages preceding or interleaved with the expected
messages.

There seems to be a lot of confusion all across the internet over the
nlmsg_pid field. The changes here were made based on examination of the
kernel source and iproute2 (a common user of netlink).

The kernel does not read nlmsg_pid at all for routing messages.
Iproute2 sets it to zero unconditionally so I changed this code to do the same.
2017-06-25 10:29:32 -04:00
Steven Siloti 67a530f3ab only listen on preferred IPv6 addresses on Windows
We shouldn't listen on addresses which are duplicates, deprecated,
or tenative unless explicitly requested.

This is only supported on Windows for now because the Linux interface
to get this information is much less convenient for libtorrent to use.
As far as I've been able to determine, Linux only exposes this information
via the RTM_NEWADDR and RTM_GETADDR netlink messages. Currently libtorrent
uses getifaddrs() to enumerate network interfaces on Linux so this will
probably need to be changed to use netlink if available.

MacOS: ???
2017-05-30 07:38:12 -04:00
Arvid Norberg b60b3f164b Merge pull request #2027 from arvidn/RC_1_1
merged RC_1_1 into master
2017-05-24 23:30:24 -04:00
arvidn 432131e493 fix error reporting for enum_net_interfaces 2017-05-23 08:54:09 -04:00
arvidn a985773f4b fix previously faulty fix to enum_routes 2017-05-21 23:21:02 -04:00
arvidn 480bde9333 change formatting of namespace declarations 2017-04-12 14:26:35 -04:00
arvidn b367a0cd50 fix simulator build warnings 2017-04-02 20:48:36 -04:00
Alden Torres 1d1484d689 fixing remaining clang sign warnings (#1825)
fixing remaining clang sign warnings
2017-03-18 08:49:19 -04:00
Alden Torres a8b10a7449 more sign warnings fixes (#1775)
more sign warnings fixes
2017-03-09 07:46:52 -05:00
arvidn 3ffa3f2a08 merged RC_1_1 into master 2017-02-17 00:35:49 -05:00
arvidn 1300204ff1 back-port pavel's fix to ip_interface.name 2017-02-13 08:09:01 -05:00
pavel.pimenov 7e166ae9c4 Fix init ip_interface.name 2017-02-13 08:06:19 -05:00
arvidn 5971818969 merge RC_1_1 into master 2017-02-12 02:24:14 -05:00
arvidn 949d4cd12a fix regression in windows implementation of enum_net causing infinite loop 2017-02-11 19:09:21 -05:00
arvidn 964542e53b back-port ajax16384's fix to enum_net_interfaces on windows 2017-02-08 10:01:40 -05:00
Andrei Kurushin d7917c4382 consolidate address family checking (#1678)
consolidate address family checking, fix no IPV6 windows and netlink builds
2017-02-08 07:52:23 -05:00
arvidn 173951ec7f merged RC_1_1 into master 2017-01-21 02:28:29 -05:00
arvidn 3b9c65daf1 remove unused function, has_interface() 2017-01-16 15:14:47 -05:00
Alden Torres df6cb6a48d fixing sign-conversion warnings, part 4, minor refactor (#1549)
fixing sign-conversion warnings, part 4, minor refactor
2017-01-14 18:53:25 -05:00
Alden Torres c3d9614dfb minor code refactor and cleanup 2017-01-14 06:59:44 -05:00
Andrei Kurushin e10edb5e0b move LoadLibrary logic to new win_util module (#1464)
move LoadLibrary logic to new win_util module. use get_library_procedure as common windows dyn proc load routine
2016-12-28 10:12:20 -08:00
Andrei Kurushin 1ec5c69dcd minor code corrections (#1430)
use compact span cast. extend split_path api with only_first_part flag. use single loadlibrary and getprocaddress for IP helper
2016-12-26 22:45:48 -08:00
Alden Torres eaf99aa42b fixed more warnings of shorten-64-to-32 and sign-compare in android (#1425)
fixed more warnings of -Wshorten-64-to-32 in android. changed file_status to use std::time and disable warnings of NLMSG_OK in clang
2016-12-18 10:59:41 -05:00
Alden Torres f382936d56 headers, end of file, code cleanup 2016-12-12 23:36:45 -05:00
Alden Torres a05f0ba8a4 refactor for more modern struct initialization and use of api 2016-12-12 02:15:27 -05:00
Alden Torres d9f8d4b642 refactor to more use of auto c++11 keyword (#1404)
refactor to more use of auto c++11 keyword
2016-12-11 20:50:30 -05:00
Alden Torres dd7179fb10 added a few consts to arguments and local variables 2016-12-10 18:19:14 -05:00
Alden Torres e73435a77b fixed shorten-64-to-32 warnings for clang 2016-12-10 08:57:08 -05:00
Steven Siloti 07650c8558 set scope id when enumerating IPv6 addresses
This is necessary to be able to correctly match enumerated addresses
with those stored in listen_socket_t::local_endpoint when there is a
non-default zone id.
2016-11-23 01:09:05 -05:00
Arvid Norberg 5f7e2eb928 run undefined sanitier on travis/linux (#1134)
run undefined sanitizer on travis/linux. back-port ed25519 unit test from master
2016-10-08 12:29:46 -04:00
Alden Torres 4f6ea4a70d more session log and source code refactor 2016-09-20 11:24:24 -04:00