arvidn
1e4083b3fb
rely less on the ability to enumerate the routing table reliably. Any IP address
...
explicitly specified is assumed to represent an externally available IP, unless
marked with the l-flag. If a device name or an unspecified address is used, they
are expanded and only for such expanded entries is there a heuristic to
determine which addresses are externally available and which are local. The
default is to assume it's local only, unless it has a globally routable IP
address or a default route can be found for the device.
2020-03-03 11:43:52 +01:00
arvidn
14f1266199
fix strncpy() warnings and ensure C strings are 0-terminated
2020-02-18 20:36:01 +01:00
arvidn
0a4a06ce74
apparently on VPNs it's common for the gateway for a route to be outside of the netmask of the network it's a router for. fix that in get_gateway
2020-02-08 23:03:10 +01:00
arvidn
208d71ba77
support source-hint from routing table, where supported
2020-01-22 15:50:33 +01:00
arvidn
7529d3e67e
remove now unused, in_local_network() functions
2020-01-20 14:27:16 +01:00
arvidn
f5ebd4e354
simplify natpmp by requiring it to be tied to a specific network, and use get_gateway() and remove unused get_default_route() functions
2020-01-20 01:24:22 +01:00
arvidn
a53d3a8746
factor out get_gateway function and add unit tests. IPv6 gateways are not addressed in the same network, so we can't use match_addr_mask(). Assume all local IPv6 addresses do not have a gateway
2020-01-19 08:27:33 +01:00
arvidn
95df88e7a3
make it a build error if we don't know how to enumerate network interfaces or network routes
2020-01-19 08:27:33 +01:00
arvidn
4ceb2ea467
limit tracker announces and SOCKS5 connection attempts to listen_socket_t that actually can reach the target
2020-01-19 08:27:33 +01:00
arvidn
a0b0f2aec5
fix clearing of netmask if it's not known, on windows
2020-01-18 13:29:54 +01:00
Steven Siloti
e4e967335c
populate ip_interface.netmask on Windows
2020-01-17 00:33:45 +01:00
arvidn
37063afd5c
improve enum_routes and enum_net_interfaces for simulator
2020-01-08 11:05:14 +01:00
arvidn
96695fa714
fix build_netmask to treat the count as a prefix and add tests
2020-01-06 20:23:13 +01:00
arvidn
3569b8885e
fix null termination of description and friendly_name in ip_interface on linux
2020-01-05 18:38:04 +01:00
Arvid Norberg
3caae922aa
simplify and clean up enum_routes() a bit
2020-01-05 09:42:32 +01:00
arvidn
6d441da9e5
fix warning comparing integers of different width
2019-11-14 11:55:14 +01:00
arvidn
1b2832e018
convert some for-loops into std algorithms
2018-11-27 19:43:01 +01:00
arvidn
3f87801142
fix some cppcheck warnings
2018-11-27 13:53:38 +01:00
arvidn
50ae1838e6
wrap inclusion of windows.h with appropriate defines
2018-11-21 10:09:23 +01:00
arvidn
5383854768
make span's and sha1_hash's index and size types signed (instead of unsigned). Specifically std::ptrdiff_t. In line with the direction of gsl span and reduce signed->unsigned casts
2018-11-16 14:06:22 +01:00
Arvid Norberg
b90564d418
remove the IPv6 enable/disable build config
2018-08-19 22:20:54 +02:00
Arvid Norberg
a477a53b80
simplify natpmp gateway and local address discovery
2018-07-29 13:10:36 +02:00
Alden Torres
dfe47aa2a9
fixed sign implicit conversion warnings in new enum_net code ( #3107 )
2018-06-16 15:19:02 +02:00
Steven Siloti
78be52112f
create a natpmp instance for each listen socket
2018-06-07 18:16:08 -07:00
Steven Siloti
496cf46b25
enum_routes fixes on Linux
2018-06-07 18:09:51 -07:00
Steven Siloti
4a578b1450
fix scope_id in enum_routes on Windows
2018-06-07 18:09:51 -07:00
Steven Siloti
72cf4fd9ea
Remove UNC prefixes from device names on Windows
2018-06-07 18:09:51 -07:00
Steven Siloti
603e206f36
fix netmask of routes on Windows
...
The build_netmask function was incorrectly dividing the size of the bytes_type
by 8. Also use b.size() instead of sizeof for consistency.
I'm not 100% certain what the difference between DestinationPrefix.PrefixLength
and SitePrefixLength is. It looks like SitePrefixLength is something specific to
site-local addresses. Emperically I found DestinationPrefix.PrefixLength
contains reasonable values while SitePrefixLength is always zero.
2018-06-07 18:09:51 -07:00
Steven Siloti
9a48ef761e
fix address of point-to-point interfaces ( #3039 )
2018-05-17 00:54:46 +02:00
arvidn
f0227451a6
merged RC_1_1 into master
2018-04-13 01:47:41 +02:00
arvidn
aaf9304a3b
update year in copyright header
2018-04-09 09:04:33 +02:00
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