-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix UDP can't connect warnings and add IP cache on the way #5329
Conversation
Github correctly show only newly modified files. |
I think it did not work in local because my local |
I guessed this too, that's why I suggested |
@ckerr I think I am dealing with a race condition during By some magic, 58b1b20 -> f5c35c7 "fixed" some failed tests (They are all using I put Could you please let me know how do you decide if a member of
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add locking mechanisms in these places
@ckerr Ready for review again. Addressed all review comments. |
@tearfur what is a good way to summarize 5329 / 5498 / 5510 for the 4.1.0 release notes? |
@ckerr It for sure is hard to boil it down to 1 sentence. 😛 Notes: Added ability to cache IP addresses used in global communications, and use it to fix UDP6 warning log spam. What do you think? I am wondering if I should directly describe the underlying cause of the UDP6 log spam, or if this is fine. |
Fixed #4517, possibly fixes #86 too.
As far as I can tell, the reason this is happening is because
tr_net_hasIPv6()
will only disable UDP6 for Transmission (by not creating a UDP6 socket) when the IPv6 module is not loaded into the kernel (for Linux at least). It does not stop Transmission from trying to connect to IPv6 peers via UDP when the IPv6 module is loaded, but no global IPv6 connectivity is available. However, it needs to stay this way in case a peer is found by LPD.transmission/libtransmission/tr-udp.cc
Lines 177 to 180 in e68c72d
The same can happen for IPv4 if the user only has IPv6 (I think).
So I figured the best way to fix this is to check if the system has a source address that can connect to the public internet in
tr_session::tr_udp_core::sendto()
, which is called for every buffer that needs to be sent over UDP.Thus, this PR ballooned into adding a whole new infrastructural class, which is an IP cache that stores 3 pieces of info for each IP protocol:
tr_session.has_ip_protocol()
tr_session.globalSourceIP()
tr_session.globalIP()
If I did everything right, then:
tr_net_hasIPv6()
can be replaced bytr_session.has_ip_protocol()
(This will be for a future PR)tr_udp_core
knows not to bother sending stuff to global addresses when we have no public internet connectivity (i.e. no source address cached). (Already in this PR)