diff --git a/src/main.cc b/src/main.cc index f5702767..1bff4faf 100644 --- a/src/main.cc +++ b/src/main.cc @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -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)) {