mirror of
https://github.com/transmission/transmission
synced 2025-01-31 11:23:40 +00:00
handle IPv6 NAT during LTEP handshake (#5565)
* fix: peer handshake reported wrong ipv6 address https://github.com/transmission/transmission/issues/5542#issuecomment-1556710922
This commit is contained in:
parent
fd583ac878
commit
b8ff35c4ce
1 changed files with 7 additions and 3 deletions
|
@ -958,10 +958,14 @@ void sendLtepHandshake(tr_peerMsgsImpl* msgs)
|
|||
tr_variantInitDict(&val, 8);
|
||||
tr_variantDictAddBool(&val, TR_KEY_e, msgs->session->encryptionMode() != TR_CLEAR_PREFERRED);
|
||||
|
||||
if (auto const addr = msgs->session->publicAddress(TR_AF_INET6); !addr.is_any())
|
||||
// If connecting to global peer, then use global address
|
||||
// Otherwise we are connecting to local peer, use bind address directly
|
||||
if (auto const addr = msgs->io->address().is_global_unicast_address() ? msgs->session->global_address(TR_AF_INET6) :
|
||||
msgs->session->publicAddress(TR_AF_INET6);
|
||||
addr && !addr->is_any())
|
||||
{
|
||||
TR_ASSERT(addr.is_ipv6());
|
||||
tr_variantDictAddRaw(&val, TR_KEY_ipv6, &addr.addr.addr6, sizeof(addr.addr.addr6));
|
||||
TR_ASSERT(addr->is_ipv6());
|
||||
tr_variantDictAddRaw(&val, TR_KEY_ipv6, &addr->addr.addr6, sizeof(addr->addr.addr6));
|
||||
}
|
||||
|
||||
// http://bittorrent.org/beps/bep_0009.html
|
||||
|
|
Loading…
Reference in a new issue