Skip to content

Commit aedd02e

Browse files
committed
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.
1 parent 23ae793 commit aedd02e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/netaddress.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ bool CNetAddr::GetInAddr(struct in_addr* pipv4Addr) const
663663
}
664664

665665
/**
666-
* Try to get our IPv6 address.
666+
* Try to get our IPv6 (or CJDNS) address.
667667
*
668668
* @param[out] pipv6Addr The in6_addr struct to which to copy.
669669
*
@@ -674,7 +674,7 @@ bool CNetAddr::GetInAddr(struct in_addr* pipv4Addr) const
674674
*/
675675
bool CNetAddr::GetIn6Addr(struct in6_addr* pipv6Addr) const
676676
{
677-
if (!IsIPv6()) {
677+
if (!IsIPv6() && !IsCJDNS()) {
678678
return false;
679679
}
680680
assert(sizeof(*pipv6Addr) == m_addr.size());
@@ -993,7 +993,7 @@ bool CService::GetSockAddr(struct sockaddr* paddr, socklen_t *addrlen) const
993993
paddrin->sin_port = htons(port);
994994
return true;
995995
}
996-
if (IsIPv6()) {
996+
if (IsIPv6() || IsCJDNS()) {
997997
if (*addrlen < (socklen_t)sizeof(struct sockaddr_in6))
998998
return false;
999999
*addrlen = sizeof(struct sockaddr_in6);

0 commit comments

Comments
 (0)