From aedd02ef2750329019d5698b14b17d67c5a563ad Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Thu, 9 Sep 2021 18:19:17 +0200 Subject: net: make it possible to connect to CJDNS addresses Connecting to CJDNS addresses works without a proxy, just like connecting to an IPv6 address. Thus adapt `CService::GetSockAddr()` to retrieve the `struct sockaddr*` even for `CService::IsCJDNS()` objects. --- src/netaddress.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/netaddress.cpp b/src/netaddress.cpp index f9fff5a6d5..c7ec2b8659 100644 --- a/src/netaddress.cpp +++ b/src/netaddress.cpp @@ -663,7 +663,7 @@ bool CNetAddr::GetInAddr(struct in_addr* pipv4Addr) const } /** - * Try to get our IPv6 address. + * Try to get our IPv6 (or CJDNS) address. * * @param[out] pipv6Addr The in6_addr struct to which to copy. * @@ -674,7 +674,7 @@ bool CNetAddr::GetInAddr(struct in_addr* pipv4Addr) const */ bool CNetAddr::GetIn6Addr(struct in6_addr* pipv6Addr) const { - if (!IsIPv6()) { + if (!IsIPv6() && !IsCJDNS()) { return false; } assert(sizeof(*pipv6Addr) == m_addr.size()); @@ -993,7 +993,7 @@ bool CService::GetSockAddr(struct sockaddr* paddr, socklen_t *addrlen) const paddrin->sin_port = htons(port); return true; } - if (IsIPv6()) { + if (IsIPv6() || IsCJDNS()) { if (*addrlen < (socklen_t)sizeof(struct sockaddr_in6)) return false; *addrlen = sizeof(struct sockaddr_in6); -- cgit v1.2.3