From c23539b272ef794a563476f0d1f2fe175121dccc Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Fri, 11 Jan 2008 10:18:14 +0000 Subject: [PATCH] made it build on linux. No linux implementation for getting default route yet --- src/enum_net.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/enum_net.cpp b/src/enum_net.cpp index daa15b302..34c981980 100644 --- a/src/enum_net.cpp +++ b/src/enum_net.cpp @@ -45,6 +45,7 @@ POSSIBILITY OF SUCH DAMAGE. #endif #include "libtorrent/enum_net.hpp" +#include "libtorrent/broadcast_socket.hpp" #include namespace libtorrent @@ -69,14 +70,6 @@ namespace libtorrent } return address(); } - - bool verify_sockaddr(sockaddr_in* sin) - { - return (sin->sin_len == sizeof(sockaddr_in) - && sin->sin_family == AF_INET) - || (sin->sin_len == sizeof(sockaddr_in6) - && sin->sin_family == AF_INET6); - } } bool in_subnet(address const& addr, ip_interface const& iface) @@ -226,9 +219,17 @@ namespace libtorrent address get_default_gateway(asio::io_service& ios, address const& interface, asio::error_code& ec) { -#if defined __linux__ || (defined __APPLE__ && __MACH__) || defined __FreeBSD__ || defined __NetBSD__ \ +#if (defined __APPLE__ && __MACH__) || defined __FreeBSD__ || defined __NetBSD__ \ || defined __OpenBSD__ || defined __bsdi__ || defined __DragonFly__ + bool verify_sockaddr(sockaddr_in* sin) + { + return (sin->sin_len == sizeof(sockaddr_in) + && sin->sin_family == AF_INET) + || (sin->sin_len == sizeof(sockaddr_in6) + && sin->sin_family == AF_INET6); + } + struct rt_msg { rt_msghdr m_rtm; @@ -392,9 +393,9 @@ namespace libtorrent return ret; +//#elif defined __linux__ +// No linux implementation yet #else - address interface = guess_local_address(ios); - if (!interface.is_v4()) { ec = asio::error::operation_not_supported;