mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-05 17:52:29 +00:00
Check if AF_INET6 is supported, or block IPv6 traffic.
This commit is contained in:
+14
@@ -10,6 +10,7 @@
|
||||
#include <torrent/torrent.h>
|
||||
#include <torrent/exceptions.h>
|
||||
#include <torrent/data/chunk_utils.h>
|
||||
#include <torrent/net/fd.h>
|
||||
#include <torrent/utils/chrono.h>
|
||||
#include <torrent/utils/log.h>
|
||||
#include <rak/error_number.h>
|
||||
@@ -445,6 +446,19 @@ main(int argc, char** argv) {
|
||||
// if (rpc::call_command_value("method.use_deprecated") == 1) {
|
||||
// }
|
||||
|
||||
{
|
||||
auto fd = torrent::fd_open_family(torrent::fd_flag_stream, AF_INET6);
|
||||
|
||||
if (fd == -1) {
|
||||
if (errno == EAFNOSUPPORT) {
|
||||
lt_log_print(torrent::LOG_WARN, "disabling ipv6 support, not available on system");
|
||||
rpc::call_command_set_value("network.block.ipv6.set", true);
|
||||
}
|
||||
} else {
|
||||
torrent::fd_close(fd);
|
||||
}
|
||||
}
|
||||
|
||||
int firstArg = parse_options(argc, argv);
|
||||
|
||||
if (OptionParser::has_flag('n', argc, argv)) {
|
||||
|
||||
Reference in New Issue
Block a user